Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: FBFHLD9

FBFHLD9.m

Go to the documentation of this file.
  1. FBFHLD9 ;OIFO/SAB-GET DATA FOR INPATIENT INVOICE ;9/9/2003
  1. ;;3.5;FEE BASIS;**61,122**;JUNE 6, 2011;Build 8
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. Q
  1. ;
  1. EN ;
  1. ; input
  1. ; FBAAIN - invoice number
  1. ; output
  1. ; If transaction type = "X" then only * items are output
  1. ; Claim Level Data
  1. ; FBD(0,"AMT") = Amount Disbursed^Amount Interest
  1. ; *FBD(0,"CAN") = Cancel Date^Cancel Reason^Cancel Activity
  1. ; FBD(0,"DAYS) = Covered Days
  1. ; FBD(0,"DRG") = DRG^DRG Weight
  1. ; FBD(0,"DT") = Invoice Date
  1. ; *FBD(0,"FPPS") = FPPS Claim ID
  1. ; *FBD(0,"INV") = Invoice #^Transaction Type^Station #
  1. ;
  1. ; Line Level Data
  1. ; FBD(1,"ADJ") = AdjReason1^AdjGrp1^AdjAmt1
  1. ; FBD(1,"AMT") = Amount Claimed^Amount Paid
  1. ; FBD(1,"CK") = Check Number^Check Date^Payment Method
  1. ; FBD(1,"835") = Routing Number^Financial Institution^^Account Number ; FB*3.5*122
  1. ; FBD(1,"DT") = Start Date^End Date
  1. ; FBD(1,"FPPS") = FPPS Line Item
  1. ; FBD(1,"RMK") = Remittance Remark1,Remittance Remark2
  1. ;
  1. ; If exceptions for invoice
  1. ; ^TMP($J,"FBE",FBAAIN,seq number)=message
  1. ; If warnings for invoice
  1. ; ^TMP($J,"FBW",FBAAIN,seq number)=message
  1. ;
  1. ; initialize variables
  1. N DA,FBC,FBI,FBIENS,FBSTA,FBTTYP,FBY
  1. K FBD
  1. ;
  1. S DA=FBAAIN
  1. S FBIENS=DA_","
  1. F FBI=0,2,3,"FBREJ" S FBY(FBI)=$G(^FBAAI(DA,FBI))
  1. Q:'$$CKLNST() ; skip line if status not OK to transmit
  1. S FBC=1
  1. D INVOICE
  1. I FBTTYP="C" D LINE
  1. Q
  1. ;
  1. INVOICE ; determine invoice data
  1. ; FBD(0,"AMT") = Amount Disbursed^Amount Interest
  1. ; FBD(0,"CAN") = Cancel Date^Cancel Reason^Cancel Activity
  1. ; FBD(0,"DAYS")
  1. ; FBD(0,"DRG")
  1. ; FBD(0,"DT") = Invoice Date
  1. ; FBD(0,"FPPS") = FPPS Claim ID
  1. ; FBD(0,"INV") = Invoice #^Transaction Type^Station #
  1. ; FBSTA = station number
  1. ; FBTTYP = transaction type (C or X)
  1. ;
  1. N FBDT,FBOB,FBX
  1. ; determine Transaction Type (based on CANCELLATION DATE)
  1. S FBTTYP=$S($P(FBY(2),U,5)]"":"X",1:"C")
  1. ;
  1. ; determine station number
  1. S FBSTA=$$STANO^FBFHLU($P(FBY(0),U,17))
  1. ;
  1. ;INV
  1. S FBD(0,"INV")=FBAAIN_U_FBTTYP_U_FBSTA
  1. ;
  1. ;FPPS
  1. S FBD(0,"FPPS")=$P(FBY(3),U)
  1. ;
  1. ;CAN
  1. ; if cancel then get cancel data
  1. I FBTTYP="X" D Q
  1. . S FBD(0,"CAN")=$P(FBY(2),U,5)_U_$$GET1^DIQ(162.5,FBIENS,"50:1")_U_$P(FBY(2),U,7)
  1. ;
  1. ;AMT
  1. S FBD(0,"AMT")="0^0" ; initialize sums
  1. ;
  1. ;DT
  1. ; determine invoice date
  1. ; (date finalized or date paid or date supervisor closed batch)
  1. S FBDT=$P(FBY(0),U,16) ; date finalized
  1. I FBDT="" S FBDT=$P(FBY(2),U) ; date paid
  1. I FBDT="",$P(FBY(0),U,17) S FBDT=$P(^FBAA(161.7,$P(FBY(0),U,17),0),U,6) ; date supv closed
  1. S FBD(0,"DT")=FBDT
  1. ;
  1. ;DAYS
  1. S FBD(0,"DAYS")=+$P(FBY(2),U,10)
  1. ;
  1. ;DRG
  1. S FBX=$$GET1^DIQ(162.5,FBIENS,24)
  1. I $E(FBX,1,3)="DRG" S FBX=$E(FBX,4,999)
  1. S FBD(0,"DRG")=FBX_U_$P(FBY(2),U,12)
  1. ;
  1. Q
  1. ;
  1. LINE ; FBC
  1. ; FBD(#,"ADJ") = AdjReason1^AdjGrp1^AdjAmt1
  1. ; FBD(#,"AMT") = Amount Claimed^Amount Paid
  1. ; FBD(#,"CK") = Check Number^Check Date^Payment Method
  1. ; FBD(#,"835") = Routing Number^Financial Institution^^Account Number ; FB*3.5*122
  1. ; FBD(#,"DT") = Start Date^End Date
  1. ; FBD(#,"FPPS") = FPPS Line Item
  1. ; FBD(#,"RMK") = Remittance Remark1^Remittance Remark2
  1. ;
  1. N FBADJ
  1. ;
  1. ;FPPS
  1. S FBD(FBC,"FPPS")=$P(FBY(3),U,2)
  1. ;
  1. ;DT
  1. S FBD(FBC,"DT")=$P(FBY(0),U,6)_U_$P(FBY(0),U,7)
  1. ;
  1. ;AMT
  1. S FBD(FBC,"AMT")=$P(FBY(0),U,8)_U_$P(FBY(0),U,9)
  1. ;
  1. ;ADJ
  1. D LOADADJ^FBCHFA(FBIENS,.FBADJ)
  1. I $D(FBADJ) S FBD(FBC,"ADJ")=$$ADJL^FBUTL2(.FBADJ)
  1. ;
  1. ;RMK
  1. S FBD(FBC,"RMK")=$$RRL^FBCHFR(FBIENS)
  1. ;
  1. ;CK
  1. S FBD(FBC,"CK")=$P(FBY(2),U,4)_U_$P(FBY(2),U)_U_$$PAYMETH^FBFHLU($P(FBY(2),U,4))
  1. ;
  1. ;835 FB*3.5*122
  1. I $P(FBY(2),U,13),$P(FBY(2),U,14),$P(FBY(2),U,15)'="" S FBD(FBC,"835")=$P(FBY(2),U,13)_U_$P(FBY(2),U,14)_U_$P(FBY(2),U,15)
  1. ;
  1. ;CAMT ; add disbursed and interest amounts to claim (0) level
  1. ; note - disbursed amount on file includes the interest
  1. ; since FPPS wants it w/o interest - interest is subtracted
  1. S $P(FBD(0,"AMT"),U)=$P(FBD(0,"AMT"),U)+($P(FBY(2),U,8)-$P(FBY(2),U,9))
  1. S $P(FBD(0,"AMT"),U,2)=$P(FBD(0,"AMT"),U,2)+$P(FBY(2),U,9)
  1. Q
  1. ;
  1. CKLNST() ; check line status extrinsic function
  1. ; result (0 or 1)
  1. ; 0 when line should not be sent to FPPS
  1. ; 1 when line should be sent to FPPS
  1. N FBRET
  1. S FBRET=1
  1. ;
  1. ; check if rejected line
  1. I $P(FBY("FBREJ"),U)]"" S FBRET=0
  1. ;
  1. Q FBRET
  1. ;
  1. ;FBFHLD9