source: WorldVistAEHR/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBCICMS.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: 9.4 KB
Line 
1IBCICMS ;DSI/ESG - IBCI CLAIMSMANAGER STATUS REPORT ;2-APR-2001
2 ;;2.0;INTEGRATED BILLING;**161**;21-MAR-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 NEW STOP,IBCIRTN,DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT,POP,RPTSPECS
6 ;
7 S STOP=0
8 S IBCIRTN="IBCICMS"
9 W @IOF
10 W !?10,"ClaimsManager Status Report",!
11A10 D DATE I STOP G EXIT
12A20 D DTRANGE I STOP G:$$STOP EXIT G A10
13A30 D STATUS I STOP G:$$STOP EXIT G A20
14A40 D TYPE I STOP G:$$STOP EXIT G A30
15A50 D SELASN I STOP G:$$STOP EXIT G A40
16A60 D ASSIGN I STOP G:$$STOP EXIT G A50
17A70 D SORTBY I STOP G:$$STOP EXIT G A60
18A75 D COMMENTS I STOP G:$$STOP EXIT G A70
19A80 D DEVICE(IBCIRTN) I STOP G:$$STOP EXIT G:RPTSPECS("TYPE")="S" A40 G A75
20 ;
21EXIT ;
22 QUIT ; quit from routine
23 ;
24COMPILE ; This entry point is called from EN^XUTMDEVQ in either
25 ; direct mode or queued mode.
26 NEW IBCISCNT
27 D BUILD ; compile report
28 I '$G(ZTSTOP) D EN^IBCICMSP ; print report
29 D ^%ZISC ; close the device
30 KILL ^TMP($J,IBCIRTN) ; kill scratch global
31 I $D(ZTQUEUED) S ZTREQ="@" ; purge the task record
32COMPX ;
33 QUIT ; quit from routine
34 ;
35 ;
36STOP() ; See if the user wants to exit out of the whole option
37 W !
38 S DIR(0)="Y"
39 S DIR("A")="Do you want to exit out of this option entirely"
40 S DIR("B")="YES"
41 S DIR("?",1)=" Enter YES to immediately exit out of this option."
42 S DIR("?")=" Enter NO to return to the previous question."
43 D ^DIR K DIR
44 I $D(DIRUT) S (STOP,Y)=1 G STOPX
45 I 'Y S STOP=0
46STOPX ;
47 Q Y
48 ;
49DATE ;
50 W !
51 S DIR(0)="SO^1:Event Date (Date of Service);2:Entered Date (Date of Entry into VistA)"
52 S DIR("A")="Select Date Range by"
53 S DIR("B")="Event Date"
54 S DIR("?",1)=" Please enter the type of date on which you would like to report."
55 S DIR("?",2)=" The Event Date is the date on which the services were performed."
56 S DIR("?")=" The Entered Date is the date on which the bill was Entered into VistA."
57 D ^DIR K DIR
58 I $D(DIRUT) S STOP=1 G DATEX
59 S RPTSPECS("DATYP")=Y
60 S RPTSPECS("DATYP1")=$S(Y=1:"Event",1:"Entered")
61DATEX ;
62 Q
63 ;
64DTRANGE ;
65 NEW X,Y,%DT
66 W !
67 S %DT="AEX"
68 S %DT("A")="Enter the beginning "_RPTSPECS("DATYP1")_" Date: "
69 S %DT(0)="-NOW"
70 D ^%DT
71 I Y=-1!$D(DTOUT) S STOP=1 G DTRNGX
72 S RPTSPECS("BEGDATE")=Y
73 W !
74 S %DT="AEX"
75 S %DT("A")=" Enter the ending "_RPTSPECS("DATYP1")_" Date: "
76 S %DT(0)=RPTSPECS("BEGDATE")
77 D ^%DT
78 I Y=-1!$D(DTOUT) S STOP=1 G DTRNGX
79 S RPTSPECS("ENDDATE")=Y
80DTRNGX ;
81 Q
82 ;
83 ;
84STATUS ;
85 NEW CH,IEN,TXT
86 W !
87 S CH="1:All ClaimsManager Statuses;"
88 S CH=CH_"2:One Specific ClaimsManager Status;"
89 S CH=CH_"3:Any ClaimsManager Status (Bill is still Editable)"
90 S DIR(0)="SO^"_CH
91 S DIR("A")="Select the ClaimsManager Status Option"
92 S DIR("B")=3
93 S DIR("?",1)=" Option 1 - All ClaimsManager Statuses - indicates that all bills"
94 S DIR("?",2)=" will be included on the report regardless of ClaimsManager"
95 S DIR("?",3)=" status."
96 S DIR("?",4)=" "
97 S DIR("?",5)=" Option 2 - One Specific ClaimsManager Status - will allow you to"
98 S DIR("?",6)=" choose a ClaimsManager status and only bills with this specific"
99 S DIR("?",7)=" status will be included on the report."
100 S DIR("?",8)=" "
101 S DIR("?",9)=" Option 3 - Any ClaimsManager Status (Bill is still Editable) -"
102 S DIR("?",10)=" will only select those bills that are still open for editing in"
103 S DIR("?")=" the IB Enter/Edit Billing Information option."
104 D ^DIR K DIR
105 I $D(DIRUT) S STOP=1 G STATX
106 S RPTSPECS("STATYP")=Y,RPTSPECS("IBCISTAT")=""
107 I RPTSPECS("STATYP")'=2 G STATX
108 ;
109 ; Ask the user which status they want to report on
110 W !
111 S IEN=0,CH=""
112 F S IEN=$O(^IBA(351.91,IEN)) Q:'IEN D
113 . S TXT=$P($G(^IBA(351.91,IEN,0)),U,2)
114 . I CH="" S CH=IEN_":"_TXT
115 . E S CH=CH_";"_IEN_":"_TXT
116 . Q
117 S DIR(0)="SO^"_CH
118 S DIR("A")="Please choose a ClaimsManager Status"
119 D ^DIR K DIR
120 I $D(DIRUT) S STOP=1 G STATX
121 S RPTSPECS("IBCISTAT")=Y
122STATX ;
123 Q
124 ;
125 ;
126COMMENTS ;
127 S RPTSPECS("IBCICOMM")=1 ; default
128 I RPTSPECS("TYPE")="S" G COMMX ; don't ask if summary
129 W !
130 S DIR(0)="Y"
131 S DIR("A")="Do you want to see ClaimsManager comments associated with these bills"
132 S DIR("B")="YES"
133 S DIR("?",1)=" Enter YES if you would like to see the comments which are stored in the"
134 S DIR("?",2)=" ClaimsManager file (#351.9) for each bill on this report."
135 S DIR("?",3)=""
136 S DIR("?")=" Enter NO if you do not want to see these comments."
137 D ^DIR K DIR
138 I $D(DIRUT) S STOP=1 G COMMX
139 S RPTSPECS("IBCICOMM")=+Y
140COMMX ;
141 Q
142 ;
143 ;
144SELASN ;
145 W !
146 S DIR(0)="F^1:1"
147 S DIR("A",1)="Do you want to include one specific Assigned to person or All?"
148 S DIR("A")="Please enter 1 or A"
149 S DIR("B")="A"
150 S DIR("?",1)=" Enter '1' to indicate that you only want to include one specific"
151 S DIR("?",2)=" Assigned to person on this report. You will then be asked"
152 S DIR("?",3)=" to select this person."
153 S DIR("?",4)=""
154 S DIR("?",5)=" Enter 'A' to indicate that you want to include all Assigned to"
155 S DIR("?",6)=" people on this report. You will then be asked if you want"
156 S DIR("?")=" to sort by the Assigned to person."
157 D ^DIR K DIR
158 I $D(DIRUT) S STOP=1 G SELASNX
159 I '$F(".1.A.","."_Y_".") W *7," Invalid response ... Please enter '1' or 'A'" G SELASN
160 S RPTSPECS("SELASN")=Y
161SELASNX ;
162 Q
163 ;
164 ;
165ASSIGN ;
166 NEW DIC,X,Y
167 W !
168 S RPTSPECS("ASNSORT")=0
169 S RPTSPECS("ASNDUZ")=0
170 I RPTSPECS("SELASN")="A" D G ASSIGNX
171 . I RPTSPECS("TYPE")="S" Q ; don't ask this if summary
172 . S DIR(0)="Y"
173 . S DIR("A")="Do you want the primary sort by the Assigned To person"
174 . S DIR("B")="YES"
175 . S DIR("?",1)=" Enter YES if you would like the bills on this report primarily"
176 . S DIR("?",2)=" sorted by the Assigned To person. If a bill is not assigned"
177 . S DIR("?",3)=" to anyone, then the word ""UNASSIGNED"" will be used."
178 . S DIR("?",4)=""
179 . S DIR("?")=" Enter NO if you would like to choose a different primary sort."
180 . D ^DIR K DIR
181 . I $D(DIRUT) S STOP=1 Q
182 . S RPTSPECS("ASNSORT")=+Y
183 . Q
184 ;
185 ; At this point, we know that the user wants to include only one
186 ; assigned to person. We need to select this person here.
187 ;
188 S DIC="^VA(200,"
189 S DIC(0)="AEMQO"
190 S DIC("A")="Enter the Assigned to person to include: "
191 S DIC("S")="I $D(^IBA(351.9,""ASN"",+Y))"
192 I $D(^IBA(351.9,"ASN",DUZ)) S DIC("B")=DUZ
193 D ^DIC
194 I Y<0 S STOP=1 G ASSIGNX
195 S RPTSPECS("ASNDUZ")=+Y
196ASSIGNX ;
197 Q
198 ;
199 ;
200SORTBY ;
201 S RPTSPECS("SORTBY")=3 ; default
202 I RPTSPECS("TYPE")="S" G SORTBYX ; don't ask if summary
203 NEW CH,PS
204 W !
205 S CH="1:Terminal Digit;"
206 S CH=CH_"2:Insurance Company Name;"
207 S CH=CH_"3:Patient Last Name;"
208 S CH=CH_"4:Total Charges;"
209 S CH=CH_"5:Bill Number"
210 S DIR(0)="SO^"_CH
211 S PS=$S(RPTSPECS("ASNSORT"):"secondary",1:"primary")
212 S DIR("A")="Please enter the "_PS_" sort criteria"
213 S DIR("B")="Patient Last Name"
214 D ^DIR K DIR
215 I $D(DIRUT) S STOP=1 G SORTBYX
216 S RPTSPECS("SORTBY")=Y
217SORTBYX ;
218 Q
219 ;
220TYPE ;
221 W !
222 S DIR(0)="S^D:Detailed;S:Summary"
223 S DIR("A")="Please enter the report type"
224 S DIR("B")="Detailed"
225 S DIR("?",1)=" The Detailed report will show the breakout of bills &"
226 S DIR("?",2)=" a summary based on the criteria that you selected."
227 S DIR("?",3)=""
228 S DIR("?",4)=" The Summary report will show the total amount of bills"
229 S DIR("?")=" based on the criteria that you selected."
230 D ^DIR K DIR
231 I $D(DIRUT) S STOP=1 G TYPEX
232 S RPTSPECS("TYPE")=Y
233TYPEX ;
234 Q
235 ;
236DEVICE(IBCIRTN) ; Device Handler and possible TaskManager calls
237 NEW ZTRTN,ZTDESC,ZTSAVE,POP
238 W !!!,"*** This report is 132 characters wide ***",!
239 S ZTRTN="COMPILE^"_IBCIRTN
240 S ZTDESC="IBCI ClaimsManager Status Report"
241 I IBCIRTN="IBCICME" S ZTDESC="IBCI ClaimsManager Error Report"
242 S ZTSAVE("RPTSPECS(")=""
243 S ZTSAVE("IBCIRTN")=""
244 D EN^XUTMDEVQ(ZTRTN,ZTDESC,.ZTSAVE)
245 I POP S STOP=1
246DEVICEX ;
247 Q
248 ;
249 ;
250BUILD ; Build the scratch global based on the selection and sort criteria
251 ;
252 NEW SUBSCRPT,RDT,IBIFN,CMDATA,IBDATA,CMSTATUS,BILLID,PATDATA
253 NEW NAME,SSN,BILLER,CODER,OIFLG,ASSIGNED,CHARGES,ERR,ERRCODES
254 NEW SORT1,SORT2,SORT3,SORT4,SORT5,RPTDATA,COUNT,ASNSUB,NAMESUB
255 NEW INSNAME
256 ;
257 KILL ^TMP($J,IBCIRTN)
258 ;
259 S SUBSCRPT="D" ; for event date looping
260 I RPTSPECS("DATYP")=2 S SUBSCRPT="APD" ; for entry date looping
261 ;
262 ; Get the starting date for looping purposes
263 S RDT=$O(^DGCR(399,SUBSCRPT,RPTSPECS("BEGDATE")),-1)
264 ;
265 S COUNT=0
266 ; Main loop....stop when we get to a date after the report end date
267 F S RDT=$O(^DGCR(399,SUBSCRPT,RDT)) Q:'RDT!($P(RDT,".",1)>RPTSPECS("ENDDATE"))!$G(ZTSTOP) D
268 . S IBIFN=0
269 . F S IBIFN=$O(^DGCR(399,SUBSCRPT,RDT,IBIFN)) Q:'IBIFN!$G(ZTSTOP) D
270 .. S COUNT=COUNT+1
271 .. I $D(ZTQUEUED),COUNT#100=0,$$S^%ZTLOAD() S ZTSTOP=1 Q
272 .. S CMDATA=$G(^IBA(351.9,IBIFN,0))
273 .. I CMDATA="" Q
274 .. S IBDATA=$G(^DGCR(399,IBIFN,0))
275 .. I IBDATA="" Q
276 .. ;
277 .. ; If the user chose a specific ClaimsManager status to report
278 .. ; on, then make sure this bill has the status they want.
279 .. S CMSTATUS=$P(CMDATA,U,2)
280 .. I RPTSPECS("STATYP")=2,CMSTATUS'=RPTSPECS("IBCISTAT") Q
281 .. ;
282 .. ; If the user wants to see bills that are still open for editing
283 .. I RPTSPECS("STATYP")=3,'$F(".1.","."_$P(IBDATA,U,13)_".") Q ;DSI/DJW 3/21/02
284 .. ;
285 .. ; If the user wants to include a specific assigned to person,
286 .. ; then make sure the assigned to person is the one they want.
287 .. I RPTSPECS("ASNDUZ"),RPTSPECS("ASNDUZ")'=$P(CMDATA,U,12) Q
288 .. ;
289 .. ; At this point, we know we want to include this bill.
290 .. D GETDATA^IBCICME1
291 .. S ^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4,SORT5,NAME,IBIFN)=RPTDATA
292 .. Q
293 . Q
294 ;
295BUILDX ;
296 Q
297 ;
298 ;
Note: See TracBrowser for help on using the repository browser.