FBUTLMVI ;OAK/ELZ - MPIF API CALLS ;6/21/2016
;;3.5;FEE BASIS;**173**;JAN 30, 1995;Build 1
;;Per VA Directive 6402, this routine should not be modified.
;
;
ACTIVITY(DFN,FBDATE,FBACT) ; - API for MPIF to search for FB related activity
; after the given date relating to the DFN. FBACT should be passed by
; reference and will return an array of activity. The ACTIVITY
; function will return a count of the number of occurrences of activity
; that occurred after the FBDATE for the patient.
;
I '$G(DFN)!('$G(FBDATE)) Q 0
;
K FBACT
N FBC,FBX,FBY,FBZ
S FBC=0
;
; Fee Basis Payment (#162) file
S FBX=0 F S FBX=$O(^FBAAC(DFN,"AB",FBX)) Q:'FBX!((9999999.9999-FBX)<FBDATE) D
. S FBY=0 F S FBY=$O(^FBAAC(DFN,"AB",FBX,FBY)) Q:'FBY D
.. Q:(9999999.9999-FBX\1)'>FBDATE
.. S FBC=FBC+1
.. S FBACT(FBC)=(9999999.9999-FBX\1)_"^FEE BASIS PAYMENT/INITIAL TREATMENT"
S FBX=FBDATE F S FBX=$O(^FBAAC(DFN,3,"AB",FBX)) Q:'FBX!(FBX<FBDATE) D
. S FBY=0 F S FBY=$O(^FBAAC(DFN,3,"AB",FBX,FBY)) Q:'FBY D
.. S FBC=FBC+1
.. S FBACT(FBC)=FBX_"^FEE BASIS PAYMENT/TRAVEL PAYMENT"
;
; Fee Basis Unauthorized Claims (#162.7) file
S FBX=0 F S FBX=$O(^FB583("D",DFN,FBX)) Q:'FBX D
. S FBY=$G(^FB583(FBX,0))
. ; treatment from date
. I $P(FBY,"^",5)>FBDATE D Q
.. S FBC=FBC+1
.. S FBACT(FBC)=$P(FBY,"^",5)_"^FEE BASIS UNAUTHORIZED CLAIMS/FROM DATE"
. ; treatment to date
. I $P(FBY,"^",6)>FBDATE D
.. S FBC=FBC+1
.. S FBACT(FBC)=$P(FBY,"^",6)_"^FEE BASIS UNAUTHORIZED CLAIMS/TO DATE"
;
; Fee Basis Pharmacy Invoice (#162.1) file
S FBX=0 F S FBX=$O(^FBAA(162.1,"AD",DFN,FBX)) Q:'FBX!((9999999-FBX)<FBDATE) D
. S FBY=0 F S FBY=$O(^FBAA(162.1,"AD",DFN,FBX,FBY)) Q:'FBY D
.. S FBZ=0 F S FBZ=$O(^FBAA(162.1,"AD",DFN,FBX,FBY,FBZ)) Q:'FBZ D
... S FBC=FBC+1
... S FBACT(FBC)=9999999-FBX_"^FEE BASIS PHARMACY INVOICE/RX FILL DATE"
;
Q FBC
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFBUTLMVI 1911 printed Nov 22, 2024@17:11:02 Page 2
FBUTLMVI ;OAK/ELZ - MPIF API CALLS ;6/21/2016
+1 ;;3.5;FEE BASIS;**173**;JAN 30, 1995;Build 1
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 ;
ACTIVITY(DFN,FBDATE,FBACT) ; - API for MPIF to search for FB related activity
+1 ; after the given date relating to the DFN. FBACT should be passed by
+2 ; reference and will return an array of activity. The ACTIVITY
+3 ; function will return a count of the number of occurrences of activity
+4 ; that occurred after the FBDATE for the patient.
+5 ;
+6 IF '$GET(DFN)!('$GET(FBDATE))
QUIT 0
+7 ;
+8 KILL FBACT
+9 NEW FBC,FBX,FBY,FBZ
+10 SET FBC=0
+11 ;
+12 ; Fee Basis Payment (#162) file
+13 SET FBX=0
FOR
SET FBX=$ORDER(^FBAAC(DFN,"AB",FBX))
if 'FBX!((9999999.9999-FBX)<FBDATE)
QUIT
Begin DoDot:1
+14 SET FBY=0
FOR
SET FBY=$ORDER(^FBAAC(DFN,"AB",FBX,FBY))
if 'FBY
QUIT
Begin DoDot:2
+15 if (9999999.9999-FBX\1)'>FBDATE
QUIT
+16 SET FBC=FBC+1
+17 SET FBACT(FBC)=(9999999.9999-FBX\1)_"^FEE BASIS PAYMENT/INITIAL TREATMENT"
End DoDot:2
End DoDot:1
+18 SET FBX=FBDATE
FOR
SET FBX=$ORDER(^FBAAC(DFN,3,"AB",FBX))
if 'FBX!(FBX<FBDATE)
QUIT
Begin DoDot:1
+19 SET FBY=0
FOR
SET FBY=$ORDER(^FBAAC(DFN,3,"AB",FBX,FBY))
if 'FBY
QUIT
Begin DoDot:2
+20 SET FBC=FBC+1
+21 SET FBACT(FBC)=FBX_"^FEE BASIS PAYMENT/TRAVEL PAYMENT"
End DoDot:2
End DoDot:1
+22 ;
+23 ; Fee Basis Unauthorized Claims (#162.7) file
+24 SET FBX=0
FOR
SET FBX=$ORDER(^FB583("D",DFN,FBX))
if 'FBX
QUIT
Begin DoDot:1
+25 SET FBY=$GET(^FB583(FBX,0))
+26 ; treatment from date
+27 IF $PIECE(FBY,"^",5)>FBDATE
Begin DoDot:2
+28 SET FBC=FBC+1
+29 SET FBACT(FBC)=$PIECE(FBY,"^",5)_"^FEE BASIS UNAUTHORIZED CLAIMS/FROM DATE"
End DoDot:2
QUIT
+30 ; treatment to date
+31 IF $PIECE(FBY,"^",6)>FBDATE
Begin DoDot:2
+32 SET FBC=FBC+1
+33 SET FBACT(FBC)=$PIECE(FBY,"^",6)_"^FEE BASIS UNAUTHORIZED CLAIMS/TO DATE"
End DoDot:2
End DoDot:1
+34 ;
+35 ; Fee Basis Pharmacy Invoice (#162.1) file
+36 SET FBX=0
FOR
SET FBX=$ORDER(^FBAA(162.1,"AD",DFN,FBX))
if 'FBX!((9999999-FBX)<FBDATE)
QUIT
Begin DoDot:1
+37 SET FBY=0
FOR
SET FBY=$ORDER(^FBAA(162.1,"AD",DFN,FBX,FBY))
if 'FBY
QUIT
Begin DoDot:2
+38 SET FBZ=0
FOR
SET FBZ=$ORDER(^FBAA(162.1,"AD",DFN,FBX,FBY,FBZ))
if 'FBZ
QUIT
Begin DoDot:3
+39 SET FBC=FBC+1
+40 SET FBACT(FBC)=9999999-FBX_"^FEE BASIS PHARMACY INVOICE/RX FILL DATE"
End DoDot:3
End DoDot:2
End DoDot:1
+41 ;
+42 QUIT FBC
+43 ;