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

FBFHLD3.m

Go to the documentation of this file.
  1. FBFHLD3 ;OIFO/SAB-GET DATA FOR OUT/ANC 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,"DT") = Invoice Date
  1. ; *FBD(0,"FPPS") = FPPS Claim ID
  1. ; *FBD(0,"INV") = Invoice #^Transaction Type^Station #
  1. ;
  1. ; Line Level Data (# is a sequential number)
  1. ; FBD(#,"ADJ") = AdjReason1^AdjGrp1^AdjAmt1^AdjReason2^AdjGrp2^AdjAmt2
  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") = Date of Service
  1. ; FBD(#,"FPPS") = FPPS Line Item
  1. ; FBD(#,"RMK") = Remittance Remark1,Remittance Remark2
  1. ; FBD(#,"SVC") = Service Code^Qualifier^Mod1,Mod2,Mod3,Mod4^Units
  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. S FBC=0 ; line count
  1. ;
  1. ; loop thru lines on invoice
  1. S DA(3)=0
  1. F S DA(3)=$O(^FBAAC("C",FBAAIN,DA(3))) Q:'DA(3) D
  1. .S DA(2)=0
  1. .F S DA(2)=$O(^FBAAC("C",FBAAIN,DA(3),DA(2))) Q:'DA(2) D
  1. ..S DA(1)=0
  1. ..F S DA(1)=$O(^FBAAC("C",FBAAIN,DA(3),DA(2),DA(1))) Q:'DA(1) D
  1. ...S DA=0
  1. ...F S DA=$O(^FBAAC("C",FBAAIN,DA(3),DA(2),DA(1),DA)) Q:'DA D
  1. ....S FBIENS=DA_","_DA(1)_","_DA(2)_","_DA(3)_","
  1. ....F FBI=0,2,3,"FBREJ" S FBY(FBI)=$G(^FBAAC(DA(3),1,DA(2),1,DA(1),1,DA,FBI))
  1. ....Q:'$$CKLNST() ; skip line if status not OK to transmit
  1. ....S FBC=FBC+1
  1. ....; if 1st line then get invoice level data
  1. ....I FBC=1 D INVOICE
  1. ....I FBTTYP="L" D LINE
  1. Q
  1. ;
  1. INVOICE ; determine invoice data from 1st line item
  1. ; FBD(0,"AMT") = Amount Disbursed^Amount Interest
  1. ; FBD(0,"CAN") = Cancel Date^Cancel Reason^Cancel Activity
  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 (L or X)
  1. ;
  1. N FBDT,FBOB,FBX
  1. ; determine Transaction Type (based on CANCELLATION DATE)
  1. S FBTTYP=$S($P(FBY(2),U,4)]"":"X",1:"L")
  1. ;
  1. ; determine station number
  1. S FBSTA=$$STANO^FBFHLU($P(FBY(0),U,8))
  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,4)_U_$$GET1^DIQ(162.03,FBIENS,"37:1")_U_$P(FBY(2),U,6)
  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,6) ; date finalized
  1. I FBDT="" S FBDT=$P(FBY(0),U,14) ; date paid
  1. I FBDT="",$P(FBY(0),U,8) S FBDT=$P(^FBAA(161.7,$P(FBY(0),U,8),0),U,6) ; date supv closed batch (for 0.00 invoices)
  1. S FBD(0,"DT")=FBDT
  1. ;
  1. Q
  1. ;
  1. LINE ; FBC
  1. ; FBD(#,"ADJ") = AdjReason1^AdjGrp1^AdjAmt1^AdjReason2^AdjGrp2^AdjAmt2
  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") = Date of Service
  1. ; FBD(#,"FPPS") = FPPS Line Item
  1. ; FBD(#,"RMK") = Remittance Remark1^Remittance Remark2
  1. ; FBD(#,"SVC") = Service Code^Qualifier^Mod1,Mod2,Mod3,Mod4^Units
  1. ;
  1. N FBAARCE,FBADJ,FBMODLE
  1. ; compare invoice transaction type (L,X) with line cancel status
  1. I ((FBTTYP="X")&($P(FBY(2),U,4)=""))!((FBTTYP="L")&($P(FBY(2),U,4)]"")) D POST^FBFHLU(FBAAIN,"E","ALL LINES DO NOT HAVE SAME CANCEL STATUS") Q
  1. ;
  1. ; SVC
  1. S FBAARCE=$$GET1^DIQ(162.03,FBIENS,48)
  1. I FBAARCE]"" S FBD(FBC,"SVC")=FBAARCE_U_"NU"
  1. E D
  1. . S FBD(FBC,"SVC")=$$GET1^DIQ(162.03,FBIENS,.01)_U_"HC"
  1. . S FBMODLE=$$MODL^FBAAUTL4("^FBAAC("_DA(3)_",1,"_DA(2)_",1,"_DA(1)_",1,"_DA_",""M"")","E")
  1. . I $L(FBMODLE,",")>4 S FBMODLE=$P(FBMODLE,",",1,4)
  1. . S $P(FBD(FBC,"SVC"),U,3)=FBMODLE
  1. S $P(FBD(FBC,"SVC"),U,4)=$P(FBY(2),U,14) ; units paid
  1. ;
  1. ;FPPS
  1. S FBD(FBC,"FPPS")=$P(FBY(3),U,2)
  1. ;
  1. ;DT
  1. S FBD(FBC,"DT")=$P($G(^FBAAC(DA(3),1,DA(2),1,DA(1),0)),U)
  1. ;
  1. ;AMT
  1. S FBD(FBC,"AMT")=$P(FBY(0),U,2)_U_$P(FBY(0),U,3)
  1. ;
  1. ;ADJ
  1. D LOADADJ^FBAAFA(FBIENS,.FBADJ)
  1. I $D(FBADJ) S FBD(FBC,"ADJ")=$$ADJL^FBUTL2(.FBADJ)
  1. ;
  1. ;RMK
  1. S FBD(FBC,"RMK")=$$RRL^FBAAFR(FBIENS)
  1. ;
  1. ;CK
  1. S FBD(FBC,"CK")=$P(FBY(2),U,3)_U_$P(FBY(0),U,14)_U_$$PAYMETH^FBFHLU($P(FBY(2),U,3))
  1. ;
  1. ;835 FB*3.5*122
  1. I $P(FBY(2),U,17),$P(FBY(2),U,18),$P(FBY(2),U,19)'="" S FBD(FBC,"835")=$P(FBY(2),U,17)_U_$P(FBY(2),U,18)_U_$P(FBY(2),U,19)
  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. ;FBFHLD3