FBLTCAR ;WOIFO/SS - LTC AUTHORIZATIONS REPORTS ;5/16/2014
;;3.5;FEE BASIS;**49,154**;JAN 30, 1995;Build 12
;;Per VA Directive 6402, this routine should not be modified.
;
Q
;LTC Ending and Active Authorization Reports
;
;
EXPO ;entry point for LTC Outpatient Ending Authorization Report
N FBLTCRT,FBLTCPR
S FBLTCPR="OUTPATIENT"
S FBLTCRT=1 ;Ending Expiration report
D EN^FBLTCAR2
Q
;
EXPC ;entry point for LTC CHN Ending Authorization Report
N FBLTCRT,FBLTCPR
S FBLTCPR="CONTRACT NURSING HOME"
S FBLTCRT=1 ;Ending Expiration report
D EN^FBLTCAR2
Q
;
ACTO ;entry point for LTC Outpatient Active Authorization Report
N FBLTCRT,FBLTCPR
S FBLTCPR="OUTPATIENT"
S FBLTCRT=2 ;Active authorizations report
D EN^FBLTCAR2
Q
ACTC ;entry point for LTC CHN Active Authorization Report
N FBLTCRT,FBLTCPR
S FBLTCPR="CONTRACT NURSING HOME"
S FBLTCRT=2 ;Active authorizations report
D EN^FBLTCAR2
Q
;
;/*
;check if exclude/include the aithorization in report
;INPUT:
;FBAUTHFR - authorization date FROM
;FBAUTHTO - authorization date TO
;FBRPTFR - report for date FROM
;FBRPTTO - report for date TO
;FBRPTYPE - type of report:
; 1-authorization Ending report
; 2-Active authorization report
;OUTPUT:
;1 - exclude
;0 - include
LTCRPT(FBAUTHFR,FBAUTHTO,FBRPTFR,FBRPTTO,FBRPTYPE) ;
Q:FBRPTYPE=0 0
;authorization Ending report
I FBRPTYPE=1 Q:((FBAUTHTO'<FBRPTFR)&(FBAUTHTO'>FBRPTTO)) 0 Q 1
;Active authorization report
I FBRPTYPE=2 Q:((FBAUTHTO<FBRPTFR)!(FBAUTHFR>FBRPTTO)) 1 Q 0
Q 0
;
;
;FBPTDFN - patient ien in file #2
;FB161P - pointer to multiple in file #161 under the DFN
;FBVEND - vendor
;FBDTB - begin date of the user specified date range
;FBDTE - end date of the user specified date range
;FBAUBEG - begin date of authorization
;FBAUEND - end date of authorization
;
;OUTPUT:
; string to print
;
PRNVIS(FBPTDFN,FB161P,FBVEND,FBDTB,FBDTE,FBAUBEG,FBAUEND) ;
N FBRET1,FBRETAR,FBVNDR
S FBRETAR=""
S FBRET1=$$GETVIS(FBPTDFN,FB161P,FBDTB,$S(FBAUEND>FBDTE:FBDTE,1:FBAUEND),FBAUBEG,.FBRETAR)
I FBVEND="not specified" D ;if vendor was not specified in (#161)
. ;loop thru vendors (#162) under this authorization
. S FBVNDR="" F S FBVNDR=$O(FBRETAR(FBVNDR)) Q:FBVNDR="" D
. . W !,?6,"Vendor: "_$S(FBVNDR>0:$P($G(^FBAAV(FBVNDR,0)),U),1:"not specified")
. . W !,?6,"Visits: "_$G(FBRETAR(FBVNDR,1)),?19,"Paid Amt: $"_$G(FBRETAR(FBVNDR,2)),?39,"Cum Visits: "_$G(FBRETAR(FBVNDR,3)),?56,"Cum Paid Amt: $"_$G(FBRETAR(FBVNDR,4))
. W !,?6,"---"
W !,?6,"Visits: "_$P(FBRET1,U,1),?19,"Paid Amt: $"_$P(FBRET1,U,2),?39,"Cum Visits: "_$P(FBRET1,U,3),?56,"Cum Paid Amt: $"_$P(FBRET1,U,4)
Q
;
;INPUT:
;FBPATDFN - patient ien in file #2
;FB161 - pointer to multiple in file #161 under the DFN
;FBBEG - begin date of the user specified date range
;FBEND - end date of the user specified date range
;FBAUTB - begin date of authorization
;
;OUTPUT:
; returns number_of_visits^total amount^cumulative_number_of_visits^cumulative_total amount
; FBRET - array with results
GETVIS(FBPATDFN,FB161,FBBEG,FBEND,FBAUTB,FBRET) ;
N FBVND,FBINDT,FBINITDT,FBCPT,FBAMT,FBCNT,FBCMAMT,FBCMCNT,FBDTCPT,FBBB,FBCPTN,FBAMT1
; auth,patient,vendor
S (FBCNT,FBAMT,FBCMCNT,FBCMAMT)=0
S FBVND=0 F S FBVND=$O(^FBAAC("AFN",FB161,FBPATDFN,FBVND)) Q:+FBVND=0 D
. F FBBB=1:1:4 S FBRET(FBVND,FBBB)=0
. ;auth,patient,vendor,date
. S FBINDT=0 F S FBINDT=$O(^FBAAC("AFN",FB161,FBPATDFN,FBVND,FBINDT)) Q:+FBINDT=0 D
. . ;determine a date value
. . S FBINITDT=+$G(^FBAAC(FBPATDFN,1,FBVND,1,FBINDT,0))
. . Q:FBINITDT=0
. . I FBINITDT>FBEND Q ;out of date range
. . ;auth,patient,vendor,date,service
. . S FBCPT=0 F S FBCPT=$O(^FBAAC("AFN",FB161,FBPATDFN,FBVND,FBINDT,FBCPT)) Q:+FBCPT=0 D
. . . S FBCPTN=+$G(^FBAAC(FBPATDFN,1,FBVND,1,FBINDT,1,FBCPT,0))
. . . S FBAMT1=+$P($G(^FBAAC(FBPATDFN,1,FBVND,1,FBINDT,1,FBCPT,0)),"^",3)
. . . ; cumulative (from the begining of authorization till the end of user's date range)
. . . I FBINITDT'<FBAUTB S FBCMAMT=FBCMAMT+FBAMT1,FBRET(FBVND,4)=FBRET(FBVND,4)+FBAMT1 S:'$D(FBDTCPT(FBINITDT,FBCPTN)) FBCMCNT=FBCMCNT+1,FBRET(FBVND,3)=FBRET(FBVND,3)+1
. . . ; for user specified date range
. . . I FBINITDT'<FBBEG S FBAMT=FBAMT+FBAMT1,FBRET(FBVND,2)=FBRET(FBVND,2)+FBAMT1 S:'$D(FBDTCPT(FBINITDT,FBCPTN)) FBCNT=FBCNT+1,FBRET(FBVND,1)=FBRET(FBVND,1)+1
. . . S:'$D(FBDTCPT(FBINITDT,FBCPTN)) FBDTCPT(FBINITDT,FBCPTN)=""
S FBRET=FBCNT_"^"_FBAMT_"^"_FBCMCNT_"^"_FBCMAMT
Q FBRET
;
;
;FBLTCAR
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFBLTCAR 4586 printed Dec 13, 2024@01:58:35 Page 2
FBLTCAR ;WOIFO/SS - LTC AUTHORIZATIONS REPORTS ;5/16/2014
+1 ;;3.5;FEE BASIS;**49,154**;JAN 30, 1995;Build 12
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 QUIT
+5 ;LTC Ending and Active Authorization Reports
+6 ;
+7 ;
EXPO ;entry point for LTC Outpatient Ending Authorization Report
+1 NEW FBLTCRT,FBLTCPR
+2 SET FBLTCPR="OUTPATIENT"
+3 ;Ending Expiration report
SET FBLTCRT=1
+4 DO EN^FBLTCAR2
+5 QUIT
+6 ;
EXPC ;entry point for LTC CHN Ending Authorization Report
+1 NEW FBLTCRT,FBLTCPR
+2 SET FBLTCPR="CONTRACT NURSING HOME"
+3 ;Ending Expiration report
SET FBLTCRT=1
+4 DO EN^FBLTCAR2
+5 QUIT
+6 ;
ACTO ;entry point for LTC Outpatient Active Authorization Report
+1 NEW FBLTCRT,FBLTCPR
+2 SET FBLTCPR="OUTPATIENT"
+3 ;Active authorizations report
SET FBLTCRT=2
+4 DO EN^FBLTCAR2
+5 QUIT
ACTC ;entry point for LTC CHN Active Authorization Report
+1 NEW FBLTCRT,FBLTCPR
+2 SET FBLTCPR="CONTRACT NURSING HOME"
+3 ;Active authorizations report
SET FBLTCRT=2
+4 DO EN^FBLTCAR2
+5 QUIT
+6 ;
+7 ;/*
+8 ;check if exclude/include the aithorization in report
+9 ;INPUT:
+10 ;FBAUTHFR - authorization date FROM
+11 ;FBAUTHTO - authorization date TO
+12 ;FBRPTFR - report for date FROM
+13 ;FBRPTTO - report for date TO
+14 ;FBRPTYPE - type of report:
+15 ; 1-authorization Ending report
+16 ; 2-Active authorization report
+17 ;OUTPUT:
+18 ;1 - exclude
+19 ;0 - include
LTCRPT(FBAUTHFR,FBAUTHTO,FBRPTFR,FBRPTTO,FBRPTYPE) ;
+1 if FBRPTYPE=0
QUIT 0
+2 ;authorization Ending report
+3 IF FBRPTYPE=1
if ((FBAUTHTO'<FBRPTFR)&(FBAUTHTO'>FBRPTTO))
QUIT 0
QUIT 1
+4 ;Active authorization report
+5 IF FBRPTYPE=2
if ((FBAUTHTO<FBRPTFR)!(FBAUTHFR>FBRPTTO))
QUIT 1
QUIT 0
+6 QUIT 0
+7 ;
+8 ;
+9 ;FBPTDFN - patient ien in file #2
+10 ;FB161P - pointer to multiple in file #161 under the DFN
+11 ;FBVEND - vendor
+12 ;FBDTB - begin date of the user specified date range
+13 ;FBDTE - end date of the user specified date range
+14 ;FBAUBEG - begin date of authorization
+15 ;FBAUEND - end date of authorization
+16 ;
+17 ;OUTPUT:
+18 ; string to print
+19 ;
PRNVIS(FBPTDFN,FB161P,FBVEND,FBDTB,FBDTE,FBAUBEG,FBAUEND) ;
+1 NEW FBRET1,FBRETAR,FBVNDR
+2 SET FBRETAR=""
+3 SET FBRET1=$$GETVIS(FBPTDFN,FB161P,FBDTB,$SELECT(FBAUEND>FBDTE:FBDTE,1:FBAUEND),FBAUBEG,.FBRETAR)
+4 ;if vendor was not specified in (#161)
IF FBVEND="not specified"
Begin DoDot:1
+5 ;loop thru vendors (#162) under this authorization
+6 SET FBVNDR=""
FOR
SET FBVNDR=$ORDER(FBRETAR(FBVNDR))
if FBVNDR=""
QUIT
Begin DoDot:2
+7 WRITE !,?6,"Vendor: "_$SELECT(FBVNDR>0:$PIECE($GET(^FBAAV(FBVNDR,0)),U),1:"not specified")
+8 WRITE !,?6,"Visits: "_$GET(FBRETAR(FBVNDR,1)),?19,"Paid Amt: $"_$GET(FBRETAR(FBVNDR,2)),?39,"Cum Visits: "_$GET(FBRETAR(FBVNDR,3)),?56,"Cum Paid Amt: $"_$GET(FBRETAR(FBVNDR,4))
End DoDot:2
+9 WRITE !,?6,"---"
End DoDot:1
+10 WRITE !,?6,"Visits: "_$PIECE(FBRET1,U,1),?19,"Paid Amt: $"_$PIECE(FBRET1,U,2),?39,"Cum Visits: "_$PIECE(FBRET1,U,3),?56,"Cum Paid Amt: $"_$PIECE(FBRET1,U,4)
+11 QUIT
+12 ;
+13 ;INPUT:
+14 ;FBPATDFN - patient ien in file #2
+15 ;FB161 - pointer to multiple in file #161 under the DFN
+16 ;FBBEG - begin date of the user specified date range
+17 ;FBEND - end date of the user specified date range
+18 ;FBAUTB - begin date of authorization
+19 ;
+20 ;OUTPUT:
+21 ; returns number_of_visits^total amount^cumulative_number_of_visits^cumulative_total amount
+22 ; FBRET - array with results
GETVIS(FBPATDFN,FB161,FBBEG,FBEND,FBAUTB,FBRET) ;
+1 NEW FBVND,FBINDT,FBINITDT,FBCPT,FBAMT,FBCNT,FBCMAMT,FBCMCNT,FBDTCPT,FBBB,FBCPTN,FBAMT1
+2 ; auth,patient,vendor
+3 SET (FBCNT,FBAMT,FBCMCNT,FBCMAMT)=0
+4 SET FBVND=0
FOR
SET FBVND=$ORDER(^FBAAC("AFN",FB161,FBPATDFN,FBVND))
if +FBVND=0
QUIT
Begin DoDot:1
+5 FOR FBBB=1:1:4
SET FBRET(FBVND,FBBB)=0
+6 ;auth,patient,vendor,date
+7 SET FBINDT=0
FOR
SET FBINDT=$ORDER(^FBAAC("AFN",FB161,FBPATDFN,FBVND,FBINDT))
if +FBINDT=0
QUIT
Begin DoDot:2
+8 ;determine a date value
+9 SET FBINITDT=+$GET(^FBAAC(FBPATDFN,1,FBVND,1,FBINDT,0))
+10 if FBINITDT=0
QUIT
+11 ;out of date range
IF FBINITDT>FBEND
QUIT
+12 ;auth,patient,vendor,date,service
+13 SET FBCPT=0
FOR
SET FBCPT=$ORDER(^FBAAC("AFN",FB161,FBPATDFN,FBVND,FBINDT,FBCPT))
if +FBCPT=0
QUIT
Begin DoDot:3
+14 SET FBCPTN=+$GET(^FBAAC(FBPATDFN,1,FBVND,1,FBINDT,1,FBCPT,0))
+15 SET FBAMT1=+$PIECE($GET(^FBAAC(FBPATDFN,1,FBVND,1,FBINDT,1,FBCPT,0)),"^",3)
+16 ; cumulative (from the begining of authorization till the end of user's date range)
+17 IF FBINITDT'<FBAUTB
SET FBCMAMT=FBCMAMT+FBAMT1
SET FBRET(FBVND,4)=FBRET(FBVND,4)+FBAMT1
if '$DATA(FBDTCPT(FBINITDT,FBCPTN))
SET FBCMCNT=FBCMCNT+1
SET FBRET(FBVND,3)=FBRET(FBVND,3)+1
+18 ; for user specified date range
+19 IF FBINITDT'<FBBEG
SET FBAMT=FBAMT+FBAMT1
SET FBRET(FBVND,2)=FBRET(FBVND,2)+FBAMT1
if '$DATA(FBDTCPT(FBINITDT,FBCPTN))
SET FBCNT=FBCNT+1
SET FBRET(FBVND,1)=FBRET(FBVND,1)+1
+20 if '$DATA(FBDTCPT(FBINITDT,FBCPTN))
SET FBDTCPT(FBINITDT,FBCPTN)=""
End DoDot:3
End DoDot:2
End DoDot:1
+21 SET FBRET=FBCNT_"^"_FBAMT_"^"_FBCMCNT_"^"_FBCMAMT
+22 QUIT FBRET
+23 ;
+24 ;
+25 ;FBLTCAR