source: WorldVistAEHR/trunk/r/E_CLAIMS_MGMT_ENGINE-BPS/BPSRPT7.m@ 1154

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

initial load of WorldVistAEHR

File size: 8.6 KB
Line 
1BPSRPT7 ;BHAM ISC/BEE - ECME REPORTS ;14-FEB-05
2 ;;1.0;E CLAIMS MGMT ENGINE;**1,3,5**;JUN 2004;Build 45
3 ;;Per VHA Directive 2004-038, this routine should not be modified.
4 ;
5 Q
6 ;
7 ;Routine to Display the Reports (Continued)
8 ;
9 ; Input Variables -> BPCLM = Array of report data by date
10 ; BPDIV,BPSUMDET,GTOT
11 ; Returned Value -> Cumulative Grand Totals
12 ;
13PTBDT(BPDIV,BPSUMDET,BPCLM,GTOT) N DIFF,I,NP,RDT,TOT,X
14 ;
15 ;Loop through compiled array and display
16 S TOT=""
17 S RDT="" F S RDT=$O(BPCLM(RDT)) Q:RDT="" D Q:BPQ
18 .S NP=$$CHKP^BPSRPT5(1) Q:BPQ
19 .S X=$G(BPCLM(RDT))
20 .;
21 .;Print Details - Report
22 .I BPSUMDET=0,'BPEXCEL D
23 ..W !,$$DATTIM^BPSRPT1(RDT) ;Date
24 ..W ?15,$J(+$P(X,U),17) ;#Claims
25 ..W ?33,$J(+$P(X,U,2),17,2) ;Amount Submitted
26 ..W ?51,$J(+$P(X,U,3),17,2) ;Returned Rejected
27 ..W ?69,$J(+$P(X,U,4),17,2) ;Returned Payable
28 ..W ?87,$J(+$P(X,U,5),17,2) ;Amount to Receive
29 ..;
30 ..;Difference
31 ..S DIFF=+$P(X,U,4)-$P(X,U,5)
32 ..I DIFF<0 S DIFF="<"_$TR($J(-DIFF,15,2)," ")_">" W ?117,$J(DIFF,15)
33 ..E W ?116,$J(DIFF,15,2)
34 ..;
35 ..;Print Details - Excel
36 .I BPSUMDET=0,BPEXCEL D
37 ..;
38 ..;Division
39 ..W !,$S(BPDIV=0:"BLANK",$$DIVNAME^BPSSCRDS(BPDIV)]"":$$DIVNAME^BPSSCRDS(BPDIV),1:BPDIV),U
40 ..W $$DATTIM^BPSRPT1(RDT),U ;Date
41 ..W +$P(X,U),U ;#Claims
42 ..W $TR($J(+$P(X,U,2),17,2)," "),U ;Amount Submitted
43 ..W $TR($J(+$P(X,U,3),17,2)," "),U ;Returned Rejected
44 ..W $TR($J(+$P(X,U,4),17,2)," "),U ;Returned Payable
45 ..W $TR($J(+$P(X,U,5),17,2)," "),U ;Amount to Receive
46 ..;
47 ..;Difference
48 ..S DIFF=+$P(X,U,4)-$P(X,U,5)
49 ..W $TR($J(DIFF,15,2)," ")
50 .;
51 .;Save Totals
52 .F I=1:1:5 S $P(TOT,U,I)=$P(TOT,U,I)+$P(X,U,I),$P(GTOT,U,I)=$P($G(GTOT),U,I)+$P(X,U,I)
53 ;
54 ;Print Totals
55 Q:BPEXCEL
56 Q:BPQ S NP=$$CHKP^BPSRPT5(2) Q:BPQ
57 D ULINE^BPSRPT5("-")
58 W !,"TOTALS"
59 W ?15,$J(+$P(TOT,U),17)
60 W ?33,$J(+$P(TOT,U,2),17,2)
61 W ?51,$J(+$P(TOT,U,3),17,2)
62 W ?69,$J(+$P(TOT,U,4),17,2)
63 W ?87,$J(+$P(TOT,U,5),17,2)
64 S X=$S((+$P(TOT,U,4))=0:0,1:(+$P(TOT,U,5))/(+$P(TOT,U,4)))
65 S DIFF=+$P(TOT,U,4)-$P(TOT,U,5)
66 I DIFF<0 S DIFF="<"_$TR($J(-DIFF,15,2)," ")_">" W ?117,$J(DIFF,15)
67 E W ?116,$J(DIFF,15,2)
68 Q
69 ;
70 ;Print Grand Totals - Report 6
71 ;
72PGTOT6(GTOT) N DIFF,NP,X
73 Q:BPQ S NP=$$CHKP^BPSRPT5(2) Q:BPQ
74 D ULINE^BPSRPT5("-")
75 W !,"GRAND TOTALS"
76 W ?15,$J(+$P(GTOT,U),17)
77 W ?33,$J(+$P(GTOT,U,2),17,2)
78 W ?51,$J(+$P(GTOT,U,3),17,2)
79 W ?69,$J(+$P(GTOT,U,4),17,2)
80 W ?87,$J(+$P(GTOT,U,5),17,2)
81 S X=$S((+$P(GTOT,U,4))=0:0,1:(+$P(GTOT,U,5))/(+$P(GTOT,U,4)))
82 S DIFF=+$P(GTOT,U,4)-$P(GTOT,U,5)
83 I DIFF<0 S DIFF="<"_$TR($J(-DIFF,15,2)," ")_">" W ?117,$J(DIFF,15)
84 E W ?116,$J(DIFF,15,2)
85 Q
86 ;
87 ;Print Grand Totals - Reports 1,2,3,4,5,7
88 ;
89PGTOT(BPRTYPE,BPGBIL,BPGINS,BPGCOLL,BPGCNT,BPGELTM) ;
90 I (BPRTYPE=1)!(BPRTYPE=4) D Q
91 .W !!,?78,"----------",?100,"----------",?122,"----------"
92 .W !,"GRAND TOTALS",?78,$J(BPGBIL,10,2),?100,$J(BPGINS,10,2),?122,$J(BPGCOLL,10,2)
93 .W !,"COUNT",?78,$J(BPGCNT,10),?100,$J(BPGCNT,10),?122,$J(BPGCNT,10)
94 .W:BPGCNT !,"MEAN",?78,$J(BPGBIL/BPGCNT,10,2),?100,$J(BPGINS/BPGCNT,10,2),?122,$J(BPGCOLL/BPGCNT,10,2)
95 I BPRTYPE=3 D Q
96 .W !!,?100,"----------",?122,"----------"
97 .W !,"GRAND TOTALS",?100,$J(BPGBIL,10,2),?122,$J(BPGINS,10,2)
98 .W !,"COUNT",?100,$J(BPGCNT,10),?122,$J(BPGCNT,10)
99 .W:BPGCNT !,"MEAN",?100,$J(BPGBIL/BPGCNT,10,2),?122,$J(BPGINS/BPGCNT,10,2)
100 I BPRTYPE=2 D Q
101 .W !!,?41,"----------"
102 .W !,"GRAND TOTALS",?41,$J(BPGBIL,10,2)
103 .W !,"COUNT",?41,$J(BPGCNT,10)
104 .W:BPGCNT !,"MEAN",?41,$J(BPGBIL/BPGCNT,10,2)
105 I (BPRTYPE=5) D Q
106 .W !!,"GRAND TOTALS (ALL DIVISIONS)",?65,"---------------"
107 .W !,"TOTAL CLAIMS",?65,$J(BPGCNT,15)
108 .W !,"AVERAGE ELAPSED TIME PER CLAIM",?65,$J($S(BPGCNT=0:"0",1:(BPGELTM\BPGCNT)),15)
109 I (BPRTYPE=7) D Q
110 .W !!,"GRAND TOTALS (ALL DIVISIONS) BY BILLER"
111 .N BPBILR,BPDIV S BPDIV="ALL DIVISIONS"
112 .S BPBILR="" F S BPBILR=$O(BPGCNT(BPBILR)) Q:BPBILR="" D Q:BPQ
113 ..S NP=$$CHKP^BPSRPT5(1) Q:BPQ
114 ..W !,?3,BPBILR,?65,$J($G(BPGCNT(BPBILR)),5)
115 .Q:$G(BPQ)
116 .W !,?65,"-----"
117 .W !,"CLOSED CLAIMS GRAND TOTAL",?65,$J(BPGCNT,5)
118 ;
119 Q
120 ;
121 ;Get Close Reason
122 ;
123 ; Input Variable -> BP59 = ptr to BPS TRANSACTIONS
124 ; Returned Value -> Claim Close Reason
125 ;
126CLRSN(BP59) N BP02,CIEN,CL
127 S CL=""
128 S BP02=+$P($G(^BPST(BP59,0)),U,4)
129 S CIEN=+$P($G(^BPSC(BP02,900)),U,4)
130 I CIEN'=0 S CL=$$GETCLR^BPSRPT6(CIEN)
131 Q CIEN_"^"_CL
132 ;
133 ;Get Reversal Reason
134 ;
135 ; Input Variable -> BP59 = ptr to BPS TRANSACTIONS
136 ; Returned Value -> Claim Reversal Reason
137 ;
138RVSRSN(BP59) Q $P($G(^BPST(BP59,4)),U,4)
139 ;
140 ;Return the Billed Amount
141 ;
142BILLED(BP59) ;
143 Q +$P($G(^BPST(BP59,5)),U,5)
144 ;
145 ;Return the Transaction Type - SUBMIT or REVERSAL
146 ;
147TTYPE(BPRX,BPREF) N BPSTATUS,TTYPE
148 S TTYPE="SUBMIT"
149 S BPSTATUS=$$STATUS^BPSRPT6(BPRX,BPREF)
150 I BPSTATUS["REVERSAL" S TTYPE="REVERSAL"
151 Q TTYPE
152 ;
153 ;Return the payer response
154 ;
155RESPONSE(BPRX,BPREF) Q $P($$STATUS^BPSRPT6(BPRX,BPREF),U)
156 ;
157 ;Print Report Subtotals
158 ;
159TOTALS(BPRTYPE,BPDIV,BPTBIL,BPTINS,BPTCOLL,BPCNT,BPELTM) ;
160 I (BPRTYPE=1)!(BPRTYPE=4) D Q
161 .W !!,?78,"----------",?100,"----------",?122,"----------"
162 .W !,"SUBTOTALS for DIV:",$E($$BPDIV(BPDIV),1,52),?78,$J(BPTBIL,10,2),?100,$J(BPTINS,10,2),?122,$J(BPTCOLL,10,2)
163 .W !,"COUNT",?78,$J(BPCNT,10),?100,$J(BPCNT,10),?122,$J(BPCNT,10)
164 .W:BPCNT !,"MEAN",?78,$J(BPTBIL/BPCNT,10,2),?100,$J(BPTINS/BPCNT,10,2),?122,$J(BPTCOLL/BPCNT,10,2)
165 I BPRTYPE=3 D Q
166 .W !!,?100,"----------",?122,"----------"
167 .W !,"SUBTOTALS for DIV:",$E($$BPDIV(BPDIV),1,52),?100,$J(BPTBIL,10,2),?122,$J(BPTINS,10,2)
168 .W !,"COUNT",?100,$J(BPCNT,10),?122,$J(BPCNT,10)
169 .W:BPCNT !,"MEAN",?100,$J(BPTBIL/BPCNT,10,2),?122,$J(BPTINS/BPCNT,10,2)
170 I BPRTYPE=2 D Q
171 .W !!,?41,"----------"
172 .W !,"SUBTOTALS for DIV:",$E($$BPDIV(BPDIV),1,22),?41,$J(BPTBIL,10,2)
173 .W !,"COUNT",?41,$J(BPCNT,10)
174 .W:BPCNT !,"MEAN",?41,$J(BPTBIL/BPCNT,10,2)
175 I (BPRTYPE=5) D Q
176 .W !!,"SUBTOTALS for DIV: ",$E($$BPDIV(BPDIV),1,43),?65,"---------------"
177 .W !,"TOTAL CLAIMS",?65,$J(BPCNT,15)
178 .W !,"AVERAGE ELAPSED TIME PER CLAIM",?65,$J($S(BPCNT=0:"0",1:(BPELTM\BPCNT)),15)
179 I (BPRTYPE=7) D Q
180 .W !!,"SUBTOTALS for DIV:",$E($$BPDIV(BPDIV),1,43)
181 .N BPBILR
182 .S BPBILR="" F S BPBILR=$O(BPCNT(BPBILR)) Q:BPBILR="" D Q:BPQ
183 ..S NP=$$CHKP^BPSRPT5(1) Q:BPQ
184 ..W !,?3,BPBILR,?65,$J($G(BPCNT(BPBILR)),5)
185 .Q:$G(BPQ)
186 .W !,?65,"-----"
187 .W !,"CLOSED CLAIMS SUBTOTAL",?65,$J(BPCNT,5)
188 ;
189 Q
190 ;
191 ;Print Report Header
192 ; Input variables (defined in BPSRPT0) - BPPHARM,BPSUMDET,BPNOW,BPMWC,BPRTBCK,BPINSINF
193 ; BPREJCD,BPCCRSN,BPAUTREV,BPACREJ,BPQSTDRG
194 ; BPDRUG,BPDRGCL,BPRLNRL,BPSORT,BPBEGDT,BPENDDT
195 ; Output variable - BPSDATA -> Reset to 0 to show no actual data has been printed
196 ; on the screen
197 ; BPPAGE -> First set in BPSRPT0
198 ; BPBLINE -> Controls whether to print a blank line
199 ;
200HDR(BPRTYPE,BPRPTNAM,BPPAGE) ;
201 ;Display Excel Header
202 I BPEXCEL D HDR^BPSRPT8(BPRTYPE) Q
203 ;
204 ; Define BPPDATA - Tells whether data has been displayed for a screen
205 S BPSDATA=0
206 S BPBLINE=""
207 S BPPAGE=$G(BPPAGE)+1
208 W @IOF
209 W "ECME "_BPRPTNAM_" "_$S(BPSUMDET=1:"SUMMARY",1:"DETAIL")_" REPORT"
210 W ?89,"Print Date: "_$G(BPNOW)_" Page:",$J(BPPAGE,3)
211 W !,"DIVISION(S): ",$$GETDIVS^BPSRPT4(75,.BPPHARM)
212 W ?93,"Fill Locations: "_$S(BPMWC="A":"C,M,W",1:BPMWC)
213 W ?116,"Fill type: "_$S(BPRTBCK=2:"RT",BPRTBCK=3:"BB",1:"RT,BB")
214 W !,"Insurance: "_$E($S(BPINSINF=0:"ALL",1:BPINSINF),1,30)
215 I (",2,")[BPRTYPE W ?44,"Reject Code: ",$E($$GETREJ^BPSRPT4(BPREJCD),1,28)
216 I (",7,")[BPRTYPE W ?44,"Close Reason: ",$E($$GETCLR^BPSRPT6(BPCCRSN),1,26)
217 I (",4,")[BPRTYPE W ?44,$J($S(BPAUTREV=0:"ALL",1:"AUTO"),4)," Reversals"
218 I (",4,")[BPRTYPE W ?60,$J($S(BPACREJ=1:"REJECTED",BPACREJ=2:"ACCEPTED",1:"ALL"),8)," Returned Status"
219 W ?87,"Drugs/Classes: "_$S(BPQSTDRG=2:$$DRGNAM^BPSRPT6(BPDRUG,30),BPQSTDRG=3:$E(BPDRGCL,1,30),1:"ALL")
220 W !,$S(BPRTYPE=5:"PRESCRIPTIONS",BPRLNRL=2:"RELEASED PRESCRIPTIONS",BPRLNRL=3:"PRESCRIPTIONS (NOT RELEASED)",1:"ALL PRESCRIPTIONS")
221 W " BY "_$S(BPRTYPE=7:"CLOSE",1:"TRANSACTION")_" DATE: "
222 W "From "_$$DATTIM^BPSRPT1(BPBEGDT)_" through "_$$DATTIM^BPSRPT1($P(BPENDDT,"."))
223 ;
224 D ULINE^BPSRPT5("=") Q:$G(BPQ)
225 D HEADLN1^BPSRPT4(BPRTYPE)
226 D HEADLN2^BPSRPT4(BPRTYPE)
227 D HEADLN3^BPSRPT4(BPRTYPE)
228 D ULINE^BPSRPT5("=")
229 ;
230 ;Print Division
231 I $G(BPDIV)]"" D
232 .W !,"DIVISION: ",$S(BPDIV=0:"BLANK",BPDIV="ALL DIVISIONS":"ALL DIVISIONS",$$DIVNAME^BPSSCRDS(BPDIV)]"":$$DIVNAME^BPSSCRDS(BPDIV),1:BPDIV)
233 .I BPRTYPE=5!(BPRTYPE=6)!(BPSUMDET=1)!(BPGRPLAN="") D ULINE^BPSRPT5("-")
234 ;
235 ;Print Insurance If Defined
236 I BPSUMDET=0,$G(BPGRPLAN)]"",$G(BPGRPLAN)'=0,$G(BPGRPLAN)'="~" D WRPLAN^BPSRPT5(BPGRPLAN)
237 Q
238 ;
239 ;Special Division Handling
240 ;
241BPDIV(BPDIV) Q $S(BPDIV=0:"BLANK",$$DIVNAME^BPSSCRDS(BPDIV)]"":$$DIVNAME^BPSSCRDS(BPDIV),1:BPDIV)
Note: See TracBrowser for help on using the repository browser.