source: WorldVistAEHR/trunk/r/E_CLAIMS_MGMT_ENGINE-BPS/BPSRCRI.m@ 1306

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

initial load of WorldVistAEHR

File size: 5.6 KB
RevLine 
[613]1BPSRCRI ;BHAM ISC/NSS - ECME REPORTS ;08-FEB-07
2 ;;1.0;E CLAIMS MGMT ENGINE;**5**;JUN 2004;Build 45
3 ;;Per VHA Directive 2004-038, this routine should not be modified.
4 ;
5 Q
6 ;
7 ;ECME Claims Response Inquiry Report
8 ;
9 ;User input prompts
10EN ; Routine entry point
11 N BPCFILE,BP02,BP03,BPSCR,BPQ,BPX,BPVAX,ZTQUEUED
12 S BPCFILE=9002313.02
13 I $D(IOF) W @IOF
14 W !,"ECME Claims-Response Inquiry Report",!
15 ;
16 ;User selects VA CLAIM ID
17 S BP02=$$BPIEN(BPCFILE)
18 I BP02=-1 G EXIT
19 S BPVAX=$P(BP02,U,2),BP02=+BP02
20 ;
21 ;Select device
22 I $$DEVICE=-1 G EXIT
23 ;
24 ;Run the reports
25 D RUNRPT
26 ;
27 ;Prompt user to retrieve Claim IEN
28 ;Input
29 ; BPCFILE (9002313.02) user inputs VA ID#
30 ;Output
31 ; -1 (not found) or File IEN
32BPIEN(BPCFILE) ; User is prompted for input, cross-ref "B" lookup
33 N DIC,Y,DUOUT,DTOUT,DIROUT
34 S DIC=$$ROOT^DILFD(BPCFILE)
35 S DIC("A")="Select VA Claim ID: "
36 S DIC(0)="ABEQ"
37 D ^DIC
38 I (Y=-1)!$D(DIROUT)!$D(DUOUT)!$D(DTOUT) Q -1
39 Q Y
40 ;
41 ;Select the output Device
42DEVICE() ;
43 N %ZIS,ZTSK,ZTRTN,ZTIO,ZTSAVE,ZTDESC,POP,BPQ
44 S BPQ=0
45 S %ZIS="QM"
46 W !!,"Note: This report contains three separate sections - transaction data, claims"
47 W !," data, and response data. There will be a page break/form feed after"
48 W !," each section regardless of the page length specified in the device input.",!
49 D ^%ZIS
50 I POP Q -1
51 S BPSCR=$S($E($G(IOST),1,2)="C-":1,1:0)
52 I $D(IO("Q")) D S BPQ=-1
53 . S ZTRTN="RUNRPT^BPSRCRI"
54 . S ZTIO=ION
55 . S ZTSAVE("*")=""
56 . S ZTDESC="ECME CLAIMS RESPONSE INQUIRY REPORT"
57 . D ^%ZTLOAD
58 . W !,$S($D(ZTSK):"REQUEST QUEUED TASK="_ZTSK,1:"REQUEST CANCELLED")
59 . D HOME^%ZIS
60 U IO
61 Q BPQ
62 ;
63 ; Print or display the report
64RUNRPT ;
65 N BPLARR,BP57,BP59,BPQ
66 D BPFLDS ; BPS TRANSACTIONS/LOG OF TRANSACTIONS
67 D PRNTRPT
68 Q
69 ;
70 ;Collect data from Transactions file #59 or Transactions Log file #57
71BPFLDS ; Build BPLARR array of data
72 N BPL0,BPL1,BP902
73 S BP03=0,BPX=""
74 ;Determine if claim is reversal or not
75 I $D(^BPST("AE",BP02))!($D(^BPSTL("AE",BP02))) D
76 . S BPX="AE" ;Not a reversal
77 . S BPLARR(9)=" CLAIM IEN (c): "
78 . S BPLARR(10)="RESPONSE IEN (c): "
79 I BPX="",($D(^BPST("AER",BP02))!($D(^BPSTL("AER",BP02)))) D
80 . S BPX="AER" ;Reversal
81 . S BPLARR(10)="REVERSAL RESPONSE IEN (c): "
82 . S BPLARR(9)=" REVERSAL CLAIM IEN (c): "
83 I BPX="" Q
84 S (BP57,BP59)=0
85 S BP59=$O(^BPST(BPX,BP02,""),-1)
86 I BP59="" S BP59=0
87 ;
88 I BP59'=0 D ;Find claim in BPS Transactions file
89 . S BPL0=$G(^BPST(BP59,0)),BPL1=$G(^BPST(BP59,1))
90 . I BPX="AE" S BP03=$P($G(^BPST(BP59,0)),U,5)
91 . I BPX="AER" S BP03=$P($G(^BPST(BP59,4)),U,2)
92 . S BPLARR(4)="PRESCRIPTION #: "_+$$GET1^DIQ(9002313.59,BP59,1.11)
93 . D GETS^DIQ(9002313.59902,1_","_BP59,"902;902.24;902.27","E","BP902","ERROR")
94 . S BPLARR(7)=" PLAN NAME: "_$G(BP902(9002313.59902,"1,"_BP59_",",902.24,"E"))
95 . S BPLARR(8)="PHARMACY PLAN ID: "_$G(BP902(9002313.59902,"1,"_BP59_",",902.27,"E"))
96 ;
97 I BP59=0 D ;;Find claim in BPS Log of Transactions file
98 . S BP57=$O(^BPSTL(BPX,BP02,""),-1)
99 . I BP57="" S BP57=0 Q
100 . S BPL0=$G(^BPSTL(BP57,0)),BPL1=$G(^BPSTL(BP57,1)),BP59=$P($G(BPL0),U)
101 . I BPX="AE" S BP03=$P($G(^BPSTL(BP57,0)),U,5)
102 . I BPX="AER" S BP03=$P($G(^BPSTL(BP57,4)),U,2)
103 . S BPLARR(4)="PRESCRIPTION #: "_+$$GET1^DIQ(9002313.57,BP57,1.11)
104 . D GETS^DIQ(9002313.57902,1_","_BP57,"902;902.24;902.27","E","BP902","ERROR")
105 . S BPLARR(7)=" PLAN NAME: "_$G(BP902(9002313.59902,"1,"_BP57_",",902.24,"E"))
106 . S BPLARR(8)="PHARMACY PLAN ID: "_$G(BP902(9002313.59902,"1,"_BP57_",",902.27,"E"))
107 ;
108 I BP59=0,BP57=0 Q
109 ;Build rest of array components
110 S BPLARR(1)="ENTRY#: "_BP59
111 S BPLARR(2)="STATUS: "_+$P($G(BPL0),U,2)
112 S BPX=$P($G(BPL1),U,7)
113 S BPLARR(3)=" PHARMACY: "_$P($G(^BPS(9002313.56,+BPX,0)),"^")
114 S BPLARR(5)=" RXI-INTERNAL (c): "_$P($G(BPL1),U,11)
115 S BPLARR(9)=BPLARR(9)_BP02
116 S BPLARR(10)=BPLARR(10)_BP03
117 Q
118 ;
119PRNTRPT ; Output the reports
120 N BPQ,ZTREQ
121 S BPQ=0
122 W @IOF
123 D CHKP(1) I BPQ Q
124 W "ECME Claims-Response Inquiry Report"
125 W ?48,"Print Date: "_$E(DT,4,5)_"/"_$E(DT,6,7)_"/"_$E(DT,2,3)
126 W !,"VA CLAIM ID: "_BPVAX,!
127 D PRTTRANS ; BPS Transaction (or Transaction log) file fields
128 I 'BPSCR W !,@IOF
129 E I 'BPQ D PAUSE
130 Q:BPQ
131 D PRT02 ; BPS CLAIMS FILE
132 I 'BPSCR W !,@IOF
133 E I 'BPQ D PAUSE
134 Q:BPQ
135 D PRT03 ; BPS RESPONSE FILE
136 Q:BPQ
137 I 'BPSCR W !,@IOF
138 E I 'BPQ D PAUSE2
139 I $D(ZTQUEUED) S ZTREQ="@" Q
140 D ^%ZISC
141 Q
142 ;
143 ; Display transaction log fields
144PRTTRANS ; Print transaction file report
145 W !,"BPS TRANSACTION/BPS LOG OF TRANSACTION DATA: ",!
146 I BPX="" W !,"NO TRANSACTION MATCHES FOUND",!! Q
147 ;
148 ;Loop through the array
149 N BPX
150 S BPX=0 F S BPX=$O(BPLARR(BPX)) Q:'BPX D I BPQ Q
151 . D CHKP(1) I BPQ Q
152 . I BPX=1 W !,BPLARR(BPX) Q
153 . I BPX#2=0 W ?40,BPLARR(BPX) Q
154 . W !,BPLARR(BPX)
155 Q
156 ;
157 ;Run claim file data report #9002313.02
158PRT02 ; Claims file output
159 W !,"BPS CLAIMS FILE DATA: "
160 N DIC,DR,DA,DIQ,DTOUT,DIRUT
161 S DIC=$$ROOT^DILFD(BPCFILE),DA=BP02
162 I $D(IOF) W @IOF
163 D EN^DIQ
164 I ($G(DUOUT)=1)!($G(DTOUT)=1) S BPQ=1
165 Q
166 ;
167 ;Run response file data report #9002313.03
168PRT03 ; Response file output
169 W !!,"BPS RESPONSE FILE DATA: ",!
170 I BP03=0!(BP03="") W !,"NO RESPONSE FILE DATA FOUND",!! Q
171 N DIC,DR,DA,DIQ,DTOUT,DIRUT
172 S DIC=$$ROOT^DILFD(9002313.03),DA=BP03
173 D EN^DIQ
174 I ($G(DUOUT)=1)!($G(DTOUT)=1) S BPQ=1
175 Q
176 ;
177 ;Check for End of Page
178 ; Input variable -> BPLINES - Number of lines from bottom
179 ; CONT - 0 = New Entry, 1 = Continue Entry
180CHKP(BPLINES) ;
181 S BPLINES=BPLINES+1
182 I $G(BPSCR) S BPLINES=BPLINES+1
183 I $Y>(IOSL-BPLINES) D:$G(BPSCR) PAUSE Q:$G(BPQ) 0 Q 1
184 Q 0
185 ;
186PAUSE ;
187 N X
188 U IO(0)
189 R !!,"Press RETURN to continue, '^' to exit: ",X:DTIME
190 I '$T S X="^"
191 I X["^" S BPQ=1
192 U IO
193 Q
194 ;
195PAUSE2 ;
196 N X
197 U IO(0)
198 R !,"Press RETURN to continue: ",X:DTIME
199 U IO
200 Q
201 ;
202 ;EXIT
203EXIT ;
204 Q
205 ;
Note: See TracBrowser for help on using the repository browser.