| 1 | FBLTCAR ;WOIFO/SS-LTC AUTHORIZATIONS REPORTS ;11/20/02 | 
|---|
| 2 | ;;3.5;FEE BASIS;**49**;JAN 30, 1995 | 
|---|
| 3 | ; | 
|---|
| 4 | Q | 
|---|
| 5 | ;LTC Ending and Active Authorization Reports | 
|---|
| 6 | ; | 
|---|
| 7 | ; | 
|---|
| 8 | EXPO ;entry point for LTC Outpatient Ending Authorization Report | 
|---|
| 9 | N FBLTCRT,FBLTCPR | 
|---|
| 10 | S FBLTCPR="OUTPATIENT" | 
|---|
| 11 | S FBLTCRT=1 ;Ending Expiration report | 
|---|
| 12 | D EN^FBLTCAR2 | 
|---|
| 13 | Q | 
|---|
| 14 | ; | 
|---|
| 15 | EXPC ;entry point for LTC CHN Ending Authorization Report | 
|---|
| 16 | N FBLTCRT,FBLTCPR | 
|---|
| 17 | S FBLTCPR="CONTRACT NURSING HOME" | 
|---|
| 18 | S FBLTCRT=1 ;Ending Expiration report | 
|---|
| 19 | D EN^FBLTCAR2 | 
|---|
| 20 | Q | 
|---|
| 21 | ; | 
|---|
| 22 | ACTO ;entry point for LTC Outpatient Active Authorization Report | 
|---|
| 23 | N FBLTCRT,FBLTCPR | 
|---|
| 24 | S FBLTCPR="OUTPATIENT" | 
|---|
| 25 | S FBLTCRT=2 ;Active authorizations report | 
|---|
| 26 | D EN^FBLTCAR2 | 
|---|
| 27 | Q | 
|---|
| 28 | ACTC ;entry point for LTC CHN Active Authorization Report | 
|---|
| 29 | N FBLTCRT,FBLTCPR | 
|---|
| 30 | S FBLTCPR="CONTRACT NURSING HOME" | 
|---|
| 31 | S FBLTCRT=2 ;Active authorizations report | 
|---|
| 32 | D EN^FBLTCAR2 | 
|---|
| 33 | Q | 
|---|
| 34 | ; | 
|---|
| 35 | ;/* | 
|---|
| 36 | ;check if exclude/include the aithorization in report | 
|---|
| 37 | ;INPUT: | 
|---|
| 38 | ;FBAUTHFR - authorization date FROM | 
|---|
| 39 | ;FBAUTHTO - authorization date TO | 
|---|
| 40 | ;FBRPTFR  - report for date FROM | 
|---|
| 41 | ;FBRPTTO  - report for date TO | 
|---|
| 42 | ;FBRPTYPE - type of report: | 
|---|
| 43 | ;  1-authorization Ending report | 
|---|
| 44 | ;  2-Active authorization report | 
|---|
| 45 | ;OUTPUT: | 
|---|
| 46 | ;1 - exclude | 
|---|
| 47 | ;0 - include | 
|---|
| 48 | LTCRPT(FBAUTHFR,FBAUTHTO,FBRPTFR,FBRPTTO,FBRPTYPE) ; | 
|---|
| 49 | Q:FBRPTYPE=0 0 | 
|---|
| 50 | ;authorization Ending report | 
|---|
| 51 | I FBRPTYPE=1 Q:((FBAUTHTO'<FBRPTFR)&(FBAUTHTO'>FBRPTTO)) 0  Q 1 | 
|---|
| 52 | ;Active authorization report | 
|---|
| 53 | I FBRPTYPE=2 Q:((FBAUTHTO<FBRPTFR)!(FBAUTHFR>FBRPTTO)) 1  Q 0 | 
|---|
| 54 | Q 0 | 
|---|
| 55 | ; | 
|---|
| 56 | ; | 
|---|
| 57 | ;FBPTDFN - patient ien in file #2 | 
|---|
| 58 | ;FB161P - pointer to multiple in file #161 under the DFN | 
|---|
| 59 | ;FBVEND - vendor | 
|---|
| 60 | ;FBDTB - begin date of the user specified date range | 
|---|
| 61 | ;FBDTE - end date of the user specified date range | 
|---|
| 62 | ;FBAUBEG - begin date of authorization | 
|---|
| 63 | ;FBAUEND - end date of authorization | 
|---|
| 64 | ; | 
|---|
| 65 | ;OUTPUT: | 
|---|
| 66 | ; string to print | 
|---|
| 67 | ; | 
|---|
| 68 | PRNVIS(FBPTDFN,FB161P,FBVEND,FBDTB,FBDTE,FBAUBEG,FBAUEND) ; | 
|---|
| 69 | N FBRET1,FBRETAR,FBVNDR | 
|---|
| 70 | S FBRETAR="" | 
|---|
| 71 | S FBRET1=$$GETVIS(FBPTDFN,FB161P,FBDTB,$S(FBAUEND>FBDTE:FBDTE,1:FBAUEND),FBAUBEG,.FBRETAR) | 
|---|
| 72 | I FBVEND="not specified" D  ;if vendor was not specified in (#161) | 
|---|
| 73 | . ;loop thru vendors (#162) under this authorization | 
|---|
| 74 | . S FBVNDR="" F  S FBVNDR=$O(FBRETAR(FBVNDR)) Q:FBVNDR=""  D | 
|---|
| 75 | . . W !,?6,"Vendor: "_$S(FBVNDR>0:$P($G(^FBAAV(FBVNDR,0)),U),1:"not specified") | 
|---|
| 76 | . . 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)) | 
|---|
| 77 | . W !,?6,"---" | 
|---|
| 78 | 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) | 
|---|
| 79 | Q | 
|---|
| 80 | ; | 
|---|
| 81 | ;INPUT: | 
|---|
| 82 | ;FBPATDFN - patient ien in file #2 | 
|---|
| 83 | ;FB161 - pointer to multiple in file #161 under the DFN | 
|---|
| 84 | ;FBBEG - begin date of the user specified date range | 
|---|
| 85 | ;FBEND - end date of the user specified date range | 
|---|
| 86 | ;FBAUTB - begin date of authorization | 
|---|
| 87 | ; | 
|---|
| 88 | ;OUTPUT: | 
|---|
| 89 | ; returns number_of_visits^total amount^cumulative_number_of_visits^cumulative_total amount | 
|---|
| 90 | ; FBRET - array with results | 
|---|
| 91 | GETVIS(FBPATDFN,FB161,FBBEG,FBEND,FBAUTB,FBRET) ; | 
|---|
| 92 | N FBVND,FBINDT,FBINITDT,FBCPT,FBAMT,FBCNT,FBCMAMT,FBCMCNT,FBDTCPT,FBBB,FBCPTN,FBAMT1 | 
|---|
| 93 | ; auth,patient,vendor | 
|---|
| 94 | S (FBCNT,FBAMT,FBCMCNT,FBCMAMT)=0 | 
|---|
| 95 | S FBVND=0 F  S FBVND=$O(^FBAAC("AF",FB161,FBPATDFN,FBVND)) Q:+FBVND=0  D | 
|---|
| 96 | . F FBBB=1:1:4 S FBRET(FBVND,FBBB)=0 | 
|---|
| 97 | . ;auth,patient,vendor,date node | 
|---|
| 98 | . S FBINDT=0 F  S FBINDT=$O(^FBAAC("AF",FB161,FBPATDFN,FBVND,FBINDT)) Q:+FBINDT=0  D | 
|---|
| 99 | . . ;determine a date value | 
|---|
| 100 | . . S FBINITDT=+$G(^FBAAC(FBPATDFN,1,FBVND,1,FBINDT,0)) | 
|---|
| 101 | . . Q:FBINITDT=0 | 
|---|
| 102 | . . I FBINITDT>FBEND Q  ;out of date range | 
|---|
| 103 | . . ;patient,vendor,date,CPT code | 
|---|
| 104 | . . S FBCPT=0 F  S FBCPT=$O(^FBAAC(FBPATDFN,1,FBVND,1,FBINDT,1,FBCPT)) Q:+FBCPT=0  D | 
|---|
| 105 | . . . S FBCPTN=+$G(^FBAAC(FBPATDFN,1,FBVND,1,FBINDT,1,FBCPT,0)) | 
|---|
| 106 | . . . S FBAMT1=+$P($G(^FBAAC(FBPATDFN,1,FBVND,1,FBINDT,1,FBCPT,0)),"^",3) | 
|---|
| 107 | . . . ; cumulative (from the begining of authorization till the end of user's date range) | 
|---|
| 108 | . . . 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 | 
|---|
| 109 | . . . ; for user specified date range | 
|---|
| 110 | . . . 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 | 
|---|
| 111 | . . . S:'$D(FBDTCPT(FBINITDT,FBCPTN)) FBDTCPT(FBINITDT,FBCPTN)="" | 
|---|
| 112 | S FBRET=FBCNT_"^"_FBAMT_"^"_FBCMCNT_"^"_FBCMAMT | 
|---|
| 113 | Q FBRET | 
|---|
| 114 | ; | 
|---|
| 115 | ; | 
|---|
| 116 | ;FBLTCAR | 
|---|