source: WorldVistAEHR/trunk/r/E_CLAIMS_MGMT_ENGINE-BPS/BPSRPT4.m@ 699

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

initial load of WorldVistAEHR

File size: 8.4 KB
Line 
1BPSRPT4 ;BHAM ISC/BEE - ECME REPORTS (CONT) ;14-FEB-05
2 ;;1.0;E CLAIMS MGMT ENGINE;**1,5**;JUN 2004;Build 45
3 ;;Per VHA Directive 2004-038, this routine should not be modified.
4 ;
5 Q
6 ;
7 ; Include Rxs - (R)ELEASED or (N)OT RELEASED or (A)LL
8 ;
9 ; Input Variable -> DFLT = 3 NOT RELEASED
10 ; 2 RELEASED
11 ; 1 ALL
12 ;
13 ; Return Value -> 3 = NOT RELEASED
14 ; 2 = RELEASED
15 ; 1 = ALL
16 ; ^ = Exit
17 ;
18SELRLNRL(DFLT) N DIR,DIRUT,DTOUT,DUOUT,X,Y
19 S DFLT=$S($G(DFLT)=1:"ALL",$G(DFLT)=3:"NOT RELEASED",1:"RELEASED")
20 S DIR(0)="S^R:RELEASED;N:NOT RELEASED;A:ALL"
21 S DIR("A")="Include Rxs - (R)ELEASED or (N)OT RELEASED or (A)LL",DIR("B")=DFLT
22 D ^DIR
23 ;
24 ;Check for "^", timeout, or blank entry
25 I ($G(DUOUT)=1)!($G(DTOUT)=1)!($G(X)="") S Y="^"
26 ;
27 S Y=$S(Y="A":1,Y="R":2,Y="N":3,1:Y)
28 ;
29 Q Y
30 ;
31 ; Select to Include (S)pecific Reject Code or (A)ll
32 ;
33 ; Input Variable -> DFLT = 1 Specific Reject Code
34 ; 0 All Reject Codes
35 ;
36 ; Return Value -> ptr = pointer to BPS NCPDP REJECT CODES (#9002313.93)
37 ; 0 = All Reject Codes
38 ; ^ = Exit
39 ;
40SELREJCD(DFLT) N DIC,DIR,DIRUT,DUOUT,REJ,X,Y
41 ;
42 S DFLT=$S($G(DFLT)=1:"Specific Reject Code",1:"ALL")
43 S DIR(0)="S^S:Specific Reject Code;A:ALL"
44 S DIR("A")="Include (S)pecific Reject Code or (A)LL",DIR("B")=DFLT
45 D ^DIR
46 I ($G(DUOUT)=1)!($G(DTOUT)=1) S Y="^"
47 S REJ=$S(Y="S":1,Y="A":0,1:Y)
48 ;
49 ;Check for "^" or timeout
50 I ($G(DUOUT)=1)!($G(DTOUT)=1) S (REJ,Y)="^"
51 ;
52 ;If Specific Reject Code selected, ask prompt
53 I $G(REJ)=1 D
54 .;
55 .;Prompt for entry
56 .K X S DIC(0)="QEAM",DIC=9002313.93,DIC("A")="Select Reject Code: "
57 .W ! D ^DIC
58 .;
59 .;Check for "^", timeout, or blank entry
60 .I ($G(DUOUT)=1)!($G(DTOUT)=1)!($G(X)="") S (REJ,Y)="^" Q
61 .;
62 .;If valid entry, setup REJ
63 .I +Y>0 S REJ=+Y
64 ;
65 Q REJ
66 ;
67 ; Include Auto(R)eversed or (A)LL
68 ;
69 ; Input Variable -> DFLT = 1 AutoReversed
70 ; 0 ALL
71 ;
72 ; Return Value -> 1 = AutoReversed
73 ; 0 = ALL
74 ; ^ = Exit
75 ;
76SELAUREV(DFLT) N DIR,DIRUT,DTOUT,DUOUT,X,Y
77 ;
78 S DFLT=$S($G(DFLT)=1:"AutoReversed",1:"ALL")
79 S DIR(0)="S^R:AutoReversed;A:ALL"
80 S DIR("A")="Include Auto(R)eversed or (A)LL",DIR("B")=DFLT
81 D ^DIR
82 ;
83 ;Check for "^", timeout, or blank entry
84 I ($G(DUOUT)=1)!($G(DTOUT)=1)!($G(X)="") S Y="^"
85 ;
86 S Y=$S(Y="A":0,Y="R":1,1:Y)
87 ;
88 Q Y
89 ;
90 ; Include A(C)cepted or (R)ejected or (A)LL
91 ;
92 ; Input Variable -> DFLT = 2 Accepted
93 ; 1 Rejected
94 ; 0 ALL
95 ;
96 ; Return Value -> 2 = Accepted
97 ; 1 = Rejected
98 ; 0 = ALL
99 ; ^ = Exit
100 ;
101SELACREJ(DFLT) N DIR,DIRUT,DTOUT,DUOUT,X,Y
102 ;
103 S DFLT=$S($G(DFLT)=2:"Accepted",$G(DFLT)=1:"Rejected",1:"ALL")
104 S DIR(0)="S^C:Accepted;R:Rejected;A:ALL"
105 S DIR("A")="Include A(C)cepted or (R)ejected or (A)LL",DIR("B")=DFLT
106 D ^DIR
107 ;
108 ;Check for "^", timeout, or blank entry
109 I ($G(DUOUT)=1)!($G(DTOUT)=1)!($G(X)="") S Y="^"
110 ;
111 S Y=$S(Y="C":2,Y="R":1,Y="A":0,1:Y)
112 ;
113 Q Y
114 ;
115 ; Select to Include (S)pecific Close Claim Reason or (A)ll
116 ;
117 ; Input Variable -> DFLT = 1 Specific CLAIMS TRACKING NON-BILLABLE REASONS
118 ; 0 All Reasons
119 ;
120 ; Return Value -> ptr = pointer to CLAIMS TRACKING NON-BILLABLE REASONS (#356.8)
121 ; 0 = All Reasons
122 ; ^ = Exit
123 ;
124SELCCRSN(DFLT) N DIC,DIR,DIRUT,DUOUT,RSN,X,Y
125 ;
126 S DFLT=$S($G(DFLT)=1:"Specific Close Claim Reason",1:"ALL")
127 S DIR(0)="S^S:Specific Close Claim Reason;A:ALL"
128 S DIR("A")="Include (S)pecific Close Claim Reason or (A)LL",DIR("B")=DFLT
129 D ^DIR
130 I ($G(DUOUT)=1)!($G(DTOUT)=1) S Y="^"
131 S RSN=$S(Y="S":1,Y="A":0,1:Y)
132 ;
133 ;Check for "^" or timeout
134 I ($G(DUOUT)=1)!($G(DTOUT)=1) S (RSN,Y)="^"
135 ;
136 ;If Specific Reject Code selected, ask prompt
137 I $G(RSN)=1 D
138 .;
139 .;Prompt for entry
140 .K X S DIC(0)="QEAM",DIC=356.8,DIC("A")="Select Close Claim Reason: "
141 .W ! D ^DIC
142 .;
143 .;Check for "^", timeout, or blank entry
144 .I ($G(DUOUT)=1)!($G(DTOUT)=1)!($G(X)="") S (RSN,Y)="^" Q
145 .;
146 .;If valid entry, setup RSN
147 .I +Y>0 S RSN=+Y
148 ;
149 Q RSN
150 ;
151 ;Pull Selected BPS Pharmacies for Display
152 ;
153 ; Input Variables:
154 ; BPPHARM/BPPHARM(ptr) - Set to 0 for all pharmacies, if set to 1 array of internal
155 ; pointers of selected pharmacies
156 ; - BPLEN = The length of the display field
157 ; Returned value -> List of selected BPS Pharmacies (possibly cut short)
158 ;
159GETDIVS(BPLEN,BPPHARM) N BPDIV,BPSTR,BPQUIT
160 I $G(BPPHARM)=0 S BPSTR="ALL"
161 E D
162 .S BPDIV="",BPQUIT=0,BPSTR=""
163 .F S BPDIV=$O(BPPHARM(BPDIV)) Q:+BPDIV=0 D Q:BPQUIT=1
164 .. I $L(BPSTR_$$DIVNAME^BPSSCRDS(BPDIV))>(BPLEN-4) D S BPQUIT=1 Q
165 ... S BPSTR=$$LJ^BPSSCR02(BPSTR_",...",BPLEN)
166 .. S BPSTR=BPSTR_$S(BPSTR]"":", ",1:"")_$$DIVNAME^BPSSCRDS(BPDIV)
167 Q BPSTR
168 ;
169 ;Get the Reject Code
170 ;
171 ; Input variable -> 0 for All Reject Codes or
172 ; lookup to BPS NCPDP REJECT CODES (#9002313.93)
173 ; Returned value -> ALL or the selected Reject Code
174 ;
175GETREJ(REJ) ;
176 I REJ="0" S REJ="ALL"
177 E S REJ=$P($G(^BPSF(9002313.93,+REJ,0)),U,2)
178 Q REJ
179 ;
180 ;Print Header 2 Line 1
181 ;
182 ; Input variable: BPRTYPE -> Report Type (1-7)
183 ;
184HEADLN1(BPRTYPE) ;
185 I (",1,2,3,4,5,7,")[BPRTYPE W !,"PATIENT NAME",?27,"Pt.ID",?35,"RX#",?47,"REF/ECME#"
186 I (BPRTYPE=1)!(BPRTYPE=4) D Q
187 . W ?68,"DATE"
188 . W ?78,$J("$BILLED",10)
189 . W ?97,$J("$INS RESPONSE",13)
190 . W ?122,$J("$COLLECT",10)
191 ;
192 I BPRTYPE=2 D Q
193 . W ?68,"DATE"
194 . W ?78,"RELEASED ON"
195 . W ?91,"RX INFO"
196 ;
197 I BPRTYPE=3 D Q
198 . W ?68,"DATE"
199 . W ?100,$J("$BILLED",10)
200 . W ?119,$J("$INS RESPONSE",13)
201 ;
202 I BPRTYPE=5 D Q
203 . W ?60,"COMPLETED"
204 . W ?78,"TRANS TYPE"
205 . W ?95,"PAYER RESPONSE"
206 ;
207 I BPRTYPE=6 D Q
208 . W !,?33,$J("AMOUNT",17)
209 . W ?51,$J("RETURNED",17)
210 . W ?69,$J("RETURNED",17)
211 . W ?87,$J("AMOUNT",17)
212 ;
213 I BPRTYPE=7 D Q
214 . W ?65,"RX INFO"
215 . W ?87,"DRUG"
216 . W ?121,"NDC"
217 Q
218 ;
219 ;Print Header 2 Line 2
220 ;
221 ; Input variable: BPRTYPE -> Report Type (1-7)
222 ;
223HEADLN2(BPRTYPE) ;
224 I (BPRTYPE=1)!(BPRTYPE=4) D Q
225 . W !,?4,"DRUG"
226 . W ?36,"NDC"
227 . I BPRTYPE=1 W ?47,"RELEASED ON"
228 . W ?68,"RX INFO"
229 . I BPRTYPE=1 W ?122,$J("BILL#",10)
230 ;
231 I BPRTYPE=2 D Q
232 . W !,?3,"CARDHOLD.ID"
233 . W ?31,"GROUP ID"
234 . W ?41,$J("$BILLED",10)
235 . W ?54,"QTY"
236 . W ?61,"NDC#"
237 . W ?82,"DRUG"
238 ;
239 I BPRTYPE=3 D Q
240 . W !,?4,"DRUG"
241 . W ?43,"NDC"
242 . W ?68,"RX INFO"
243 ;
244 I BPRTYPE=5 D Q
245 . W !,?4,"DRUG"
246 . W ?32,"NDC"
247 . W ?47,"RX INFO"
248 . W ?69,"INSURANCE"
249 . W ?112,"ELAP TIME IN SECONDS"
250 ;
251 I BPRTYPE=6 D Q
252 .W !,?1,"DATE"
253 .W ?15,$J("#CLAIMS",17)
254 .W ?33,$J("SUBMITTED",17)
255 .W ?51,$J("REJECTED",17)
256 .W ?69,$J("PAYABLE",17)
257 .W ?87,$J("TO RECEIVE",17)
258 .W ?115,$J("DIFFERENCE",17)
259 ;
260 I BPRTYPE=7 D Q
261 . W !,?3,"CARDHOLD.ID"
262 . W ?31,"GROUP ID"
263 . W ?41,"CLOSE DATE/TIME"
264 . W ?59,"CLOSED BY"
265 . W ?87,"CLOSE REASON"
266 Q
267 ;
268 ;Print Header 2 Line 3
269 ;
270 ; Input variable: BPRTYPE -> Report Type (1-7)
271 ;
272HEADLN3(BPTYP) ;
273 D:BPTYP=4
274 . W !,?6,"RELEASED ON"
275 . W ?22,"REVERSAL METHOD/RETURN STATUS/REASON"
276 Q
277 ;
278SELEXCEL() ; - Returns whether to capture data for Excel report.
279 ; Output: EXCEL = 1 - YES (capture data) / 0 - NO (DO NOT capture data)
280 ;
281 N EXCEL,DIR,DIRUT,DTOUT,DUOUT,DIROUT
282 ;
283 S DIR(0)="Y",DIR("B")="NO",DIR("T")=DTIME W !
284 S DIR("A")="Do you want to capture report data for an Excel document"
285 S DIR("?")="^D HEXC^BPSRPT4"
286 D ^DIR K DIR I $D(DIRUT)!$D(DTOUT)!$D(DUOUT)!$D(DIROUT) Q "^"
287 K DIROUT,DTOUT,DUOUT,DIRUT
288 S EXCEL=0 I Y S EXCEL=1
289 ;
290 ;Display Excel display message
291 I EXCEL=1 D EXMSG
292 ;
293 Q EXCEL
294 ;
295HEXC ; - 'Do you want to capture data...' prompt
296 W !!," Enter: 'Y' - To capture detail report data to transfer"
297 W !," to an Excel document"
298 W !," '<CR>' - To skip this option"
299 W !," '^' - To quit this option"
300 Q
301 ;
302 ;Display the message about capturing to an Excel file format
303 ;
304EXMSG ;
305 W !!?5,"Before continuing, please set up your terminal to capture the"
306 W !?5,"detail report data. On some terminals, this can be done by"
307 W !?5,"clicking on the 'Tools' menu above, then click on 'Capture"
308 W !?5,"Incoming Data' to save to Desktop. This report may take a"
309 W !?5,"while to run."
310 W !!?5,"Note: To avoid undesired wrapping of the data saved to the"
311 W !?5," file, please enter '0;256;999' at the 'DEVICE:' prompt.",!
312 Q
Note: See TracBrowser for help on using the repository browser.