source: WorldVistAEHR/trunk/r/BENEFICIARY_TRAVEL-DGBT/DGBTOA6.m@ 1800

Last change on this file since 1800 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.6 KB
RevLine 
[613]1DGBTOA6 ;ALB/SCK - DGBT BENE TRAVEL PAYABLE CLAIMS REPORT ; 6/29/93 7/16/93
2 ;;1.0;Beneficiary Travel;;September 25, 2001
3ACCTS ;
4 U IO
5 N Y
6 K ^TMP("BT",$J)
7 F ACTCDE=4,5 D
8 . S Y=$$GETACT(ACTCDE)
9 D KVAR^VADPT
10 D REPORT
11 K DGBTBEG,DGBTBG,DGBTEND,CDATE,CURACT,ACTCDE,DIV,ERR,^TMP("BT",$J)
12ACCTSQ Q
13 ;
14GETACT(ACTNUM) ;
15 N Y S Y=1
16 S CDATE=DGBTBG F S CDATE=$O(^DGBT(392,"ACTP",ACTNUM,CDATE)) Q:'CDATE!(CDATE>DGBTEND) D
17 . N BTCLAIM
18 . Q:'$D(^DGBT(392,CDATE,0))
19 . S BTCLAIM=^DGBT(392,CDATE,0)
20 . S BTCLAIM("M")=$G(^DGBT(392,CDATE,"M")) ; reference node "M" of bene travel claim file (#392)
21 . S BTCLAIM("R")=$G(^DGBT(392,CDATE,"R")) ; reference node "R" of bene travel claim file ( #392)
22 . S DIV=$P($G(BTCLAIM),U,11)
23 . S DFN=$P($G(BTCLAIM),U,2)
24 . D PID^VADPT6 Q:VAERR
25 . S ^TMP("BT",$J,ACTNUM,DIV,$P($G(^DPT(DFN,0)),U),VA("PID"),CDATE)=$P(BTCLAIM("M"),U,3)_"^"_$P(BTCLAIM,U,9)_"^"_$P(BTCLAIM,U,10)_"^"_$P(BTCLAIM("R"),U)
26 Q (Y)
27 ;
28REPORT ;
29 N BTFIN,PDIV,NDIV
30 I '$D(^TMP("BT",$J)) D NOREP Q
31 S ERR=$$SETVAR()
32 S CURACT="",CURACT=$O(^TMP("BT",$J,CURACT)),PRVACT=CURACT
33 Q:$$HEADR()
34 S CURACT="" F S CURACT=$O(^TMP("BT",$J,CURACT)) Q:CURACT="" D Q:BTFIN
35 . I CURACT'=PRVACT D SUBS S BTFIN=$$HEADR,PRVACT=CURACT I PDIV]"" S ERR=$$DIVSN(NDIV)
36 . S NDIV="" F S NDIV=$O(^TMP("BT",$J,CURACT,NDIV)) Q:NDIV']"" S:PDIV'=NDIV PDIV=$$DIVSN(NDIV) D Q:BTFIN
37 .. S CURNAME="" F S CURNAME=$O(^TMP("BT",$J,CURACT,NDIV,CURNAME)) Q:CURNAME="" D Q:BTFIN
38 ... S CURID="" F S CURID=$O(^TMP("BT",$J,CURACT,NDIV,CURNAME,CURID)) Q:CURID="" D Q:BTFIN
39 .... S CDATE="" F S CDATE=$O(^TMP("BT",$J,CURACT,NDIV,CURNAME,CURID,CDATE)) Q:CDATE="" S BTFIN=$$PRTOUT() Q:BTFIN
40 D TOTL
41 Q
42 ;
43PRTOUT() ;
44 N Y
45 S BTCLAIM=^TMP("BT",$J,CURACT,NDIV,CURNAME,CURID,CDATE)
46 I $Y+5>IOSL S Y=$$HEADR() G:Y PRTOUTQ
47 W !,$E(CURNAME,1,21),?23,CURID,?37,$$EXDATE(CDATE),?61,$FN($P(BTCLAIM,U,1),"",2),?70,$FN($P(BTCLAIM,U,2),"",2),?78,$FN($P(BTCLAIM,U,3),"",2),?86,$E($P(BTCLAIM,U,4),1,50)
48 S COUNT=COUNT+1,MILES=MILES+$P(BTCLAIM,U,1),DEDCT=DEDCT+$P(BTCLAIM,U,2),PAY=PAY+$P(BTCLAIM,U,3)
49PRTOUTQ Q (Y)
50 ;
51EXDATE(CDOUT) ;
52 S Y=CDOUT D DD^%DT
53 Q (Y)
54 ;
55DIVSN(NDIV) ;
56 I $G(NDIV)]"" D
57 . W !!,"Division: ",$P($G(^DG(40.8,NDIV,0)),"^")
58 . W !,"========="
59 Q (NDIV)
60 ;
61NOREP ;
62 S CURACT=4,PAGE=0
63 I $$HEADR() G NOREPQ
64 W !!,"No data found for accounts 'ALL OTHER' or 'C&P'"
65NOREPQ Q
66 ;
67HEADR() ;
68 N QFLAG S QFLAG=0
69 I $E(IOST,1,2)="C-" K DIR S DIR(0)="E" D ^DIR S QFLAG='Y G:QFLAG HEADRQ W @IOF
70 S PAGE=PAGE+1
71 I $E(IOST,1,2)'="C-" W @IOF
72 W !,"Payable Claims Report"
73 W ?(IOM-40),"Report Date: ",$P($$NOW^VALM1,"@"),?(IOM-10),"Page: ",PAGE
74 W !,"Inclusion Dates: ",$P($$FMTE^XLFDT(DGBTBEG,1),"@")," to ",$P($$FMTE^XLFDT(DGBTEND,1),"@")
75 W !,"For ACCOUNT TYPE: ",$S(CURACT=4:"ALL OTHER",CURACT=5:"C&P EXAMINATIONS")
76 W !!?61,"Mileage",?70,"Amount",?78,"Amount"
77 W !,"Patient Name",?23,"Patient ID",?37,"Claim DATE/TME",?61,"Amount",?70,"Deduct",?78,"Payable",?86,"Remarks"
78 W !,"----------------",?23,"------------",?37,"------------------",?61,"------",?70,"------",?78,"-------",?86,"-----------------"
79HEADRQ Q (QFLAG)
80 ;
81TOTL ;
82 D SUBS
83 W !!?61,"------",?70,"------",?78,"-------"
84 W !,"TOTALS",?61,$FN(TMILES,"",2),?70,$FN(TDEDCT,"",2),?78,$FN(TPAY,"",2)
85 W !,"TOTAL CLAIMS: ",TCOUNT
86 Q
87 ;
88SUBS ;
89 N Y
90 W !!?61,"------",?70,"------",?78,"-------"
91 W !,"Subtotals",?61,$FN(MILES,"",2),?70,$FN(DEDCT,"",2),?78,$FN(PAY,"",2)
92 W !,"Subtotal Count of Claims: ",COUNT
93 S TCOUNT=TCOUNT+COUNT,TMILES=TMILES+MILES,TDEDCT=TDEDCT+DEDCT,TPAY=TPAY+PAY
94 S (MILES,DEDCT,PAY,COUNT)=0
95 Q
96 ;
97SETVAR() ;
98 N Y S Y=0
99 S (PAGE,COUNT,MILES,DEDCT,PAY,TCOUNT,TPAY,TDEDCT,TMILES,BTFIN)=0
100 S PDIV=""
101 ;
102 Q (Y)
Note: See TracBrowser for help on using the repository browser.