source: WorldVistAEHR/trunk/r/ACCOUNTS_RECEIVABLE-PRCA-PRY-RC/RCDMCR2A.m@ 702

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

initial load of WorldVistAEHR

File size: 9.5 KB
Line 
1RCDMCR2A ;HEC/SBW - DMC Debt Validity Management Report ;9/Oct/2007
2 ;;4.5;Accounts Receivable;**253**;Mar 20, 1995;Build 9
3 ;;Per VHA Directive 2004-038, this routine should not be modified.
4 ;
5 ;This routine is being implemented for the Hold Debt to DMC Project.
6 ;It will do the following:
7 ; A new management report option will be added in AR to assist
8 ; managers in reviewing the processing of the bills related to
9 ; the Debt Validity Report. This report will include bills
10 ; for veterans who are SC 50% to 100% or in receipt of VA Pension
11 ; benefits and have bills for episodes of care within the previous
12 ; 365 days (or older selected date). The user will have the option to
13 ; select if the report will be for bills where the DMC Debt Valid
14 ; field is "null", "PENDING", "YES", "NO" or All Values. The report
15 ; will list only bills with Current Status of "ACTIVE", "OPEN",
16 ; "SUSPENDED", "CANCELLATION", "REFUND REVIEW" and "REFUNDED".
17 ;
18MAIN ; Initial Interactive Processing
19 N STOPIT,RCSCR,GETBEGDT,BEGDT,RCTYPE,RCDMCVAL
20 W !!,"*** Print the DMC Debt Validity Management Report ***"
21 W !!,"This report may take a while to process. It is recommended that"
22 W !,"you Queue this report to a device that is 132 characters wide."
23 ;
24 S STOPIT=0 ; quit flag
25 ; Prompts to the user:
26 ;
27 ;Prompt user for Date from which to include bills for episodes of care
28 ;on report
29 S GETBEGDT=$$GETBEGDT^RCDMCUT2("Report To Include Bills For Episodes of Care Beginning With User Selected Date."," Entered Date Must be "_$$FMTE^XLFDT($$FMADD^XLFDT(DT,-365,0,0,0),"1D")_" or older!")
30 Q:+GETBEGDT'>0
31 S BEGDT=$P(GETBEGDT,U,2)
32 ;
33 S RCTYPE=$$GETTYPE^RCDMCUT2(.STOPIT)
34 Q:STOPIT>0!(RCTYPE']"")
35 S RCDMCVAL=$$GETDMC^RCDMCUT2(.STOPIT)
36 Q:STOPIT>0!(RCDMCVAL']"")
37 D:RCTYPE="D"
38 . W !?5,"It is recommended that you Queue this report to a"
39 . W !?5,"device that is 132 characters wide.",!
40 D:RCTYPE="S"
41 . W !?5,"It is recommended that you Queue this report to run.",!
42 D:RCTYPE="E" EXMSG^RCDMCUT2
43 ;
44 D DEVICE^RCDMCUT2("RUN^RCDMCR2A","DMC Debt Validity Management Report Process",.STOPIT,.RCSCR,BEGDT,"",RCTYPE,RCDMCVAL)
45 Q:STOPIT>0!($D(ZTQUEUED))
46 D RUN^RCDMCR2A
47 I STOPIT'=2 D PAUSE2^RCDMCUT2
48 Q
49 ;
50QUERPT ; Initial Taskman Scheduled Queued processing
51 N STOPIT,RCSCR,RCTYPE,RCDMCVAL,BEGDT
52 ;Queued Report option allows print the Detailed report
53 ;for all DMC Debt Values
54 S STOPIT=0,RCSCR="",RCTYPE="D",RCDMCVAL="A"
55 ;
56 ;Get the "NUMBER OF DAYS FOR DMC REPORTS" site parameter in the AR Site
57 ;Parameter (#342) file.
58 S BEGDT=$$GETRDAY^RCMSITE
59 ;If parameter value not greater than 364 day set default to 365 days
60 S:BEGDT'>364 BEGDT=365
61 ;Set report begin date to past date using Number of Days for DMC reports
62 S BEGDT=$$FMADD^XLFDT(DT,0-BEGDT,0,0,0)
63 ;
64 D RUN^RCDMCR2A
65 Q
66 ;
67RUN ;Get data and Print it out
68 ;If queued ensure you delete it from the TASKS file
69 I $D(ZTQUEUED) S ZTREQ="@"
70 N RCPAGE
71 ;If not passed date, default to get data 365 old
72 I $G(BEGDT)'>0 S BEGDT=$$FMADD^XLFDT(DT,-365,0,0,0)
73 K ^TMP($J,"RCDMCR2")
74 S RCPAGE=0
75 I RCDMCVAL="A" S RCDMCVAL("BLANK/NULL")="",RCDMCVAL("PENDING")="",RCDMCVAL("YES")="",RCDMCVAL("NO")=""
76 I RCDMCVAL'="A" S RCDMCVAL($$EXTDMC^RCDMCUT2(RCDMCVAL))=""
77 ; Collect the data in ^TMP
78 D COLLECT^RCDMCR2B(.STOPIT,BEGDT,.RCDMCVAL)
79 Q:$G(STOPIT)>0
80 U IO
81 ; Print Report using data in ^TMP
82 D REPORT
83 I 'RCSCR W !,@IOF
84 D ^%ZISC
85 K ^TMP($J,"RCDMCR2")
86 K RCTYPE,RCDMCVAL,RCSCR,TESTDATE
87 Q
88 ;
89REPORT ;Print report
90 N RUNDATE,FULLHDR,STATUS,VALID,NAME,SSN,NAMEPRT,BILLNO
91 N NODE,CNUM,CLOC,PRINAMT,STATUS,EDITBY,EDITDT
92 S FULLHDR=1
93 S RUNDATE=$$FMTE^XLFDT($$NOW^XLFDT,"9D")
94 ;No report data. Print header and Message. Then quit
95 I +$D(^TMP($J,"RCDMCR2"))'>0 S FULLHDR=0 D HDR W !,"No data meets the criteria." Q
96 ;Summary Type report for single DMC Debt Valid value.
97 ;Print summary data and then quit.
98 I RCTYPE="S" D SUMRPT Q
99 I RCTYPE="E" S FULLHDR=1 D HDR
100 S VALID=""
101 F S VALID=$O(^TMP($J,"RCDMCR2","DETAIL",VALID)) Q:VALID']"" D Q:STOPIT
102 . ;Detailed Report - Print header with field headers when DMC Debt
103 . ;Valid value changes
104 . I RCTYPE="D" S FULLHDR=1 D HDR
105 . S NAME=""
106 . F S NAME=$O(^TMP($J,"RCDMCR2","DETAIL",VALID,NAME)) Q:NAME']"" D Q:STOPIT
107 . . S SSN=""
108 . . F S SSN=$O(^TMP($J,"RCDMCR2","DETAIL",VALID,NAME,SSN)) Q:SSN']"" D Q:STOPIT
109 . . . ;NAMEPRT - Use to only print Name & SSN once for multiple bills
110 . . . S NAMEPRT=1
111 . . . S BILLNO=""
112 . . . F S BILLNO=$O(^TMP($J,"RCDMCR2","DETAIL",VALID,NAME,SSN,BILLNO)) Q:BILLNO']"" D Q:STOPIT
113 . . . . S NODE=$G(^TMP($J,"RCDMCR2","DETAIL",VALID,NAME,SSN,BILLNO))
114 . . . . S CNUM=$P(NODE,U,1),CLOC=$P(NODE,U,2),PRINAMT=$P(NODE,U,3)
115 . . . . S STATUS=$P(NODE,U,4),EDITBY=$P(NODE,U,5),EDITDT=$P(NODE,U,6)
116 . . . . I RCTYPE="D" S FULLHDR=1 D WRLINE Q
117 . . . . I RCTYPE="E" S FULLHDR=0 D WRLINE2 Q
118 . ;Print Summary for DMC Debt Valid if printing all DMC Debt Valid
119 . ;values on Detailed report
120 . I RCTYPE="D",RCDMCVAL="A" D
121 . . D VALSUM
122 . . ;Pause Prompt when print to Screen and more Patient Data
123 . . I RCSCR,$O(^TMP($J,"RCDMCR2","DETAIL",VALID))]"" D PAUSE^RCDMCUT2
124 S FULLHDR=0
125 D TOTSUM
126 Q
127 ;
128 ;
129WRLINE ; Write the data formated report line
130 D CHKP() Q:STOPIT
131 ;If Multiple Bills for Vet only print Name & SSN for 1st record on page
132 W !
133 I NAMEPRT>0 D
134 . W $E(NAME,1,20)
135 . W ?22,SSN
136 . W ?30,CNUM
137 . W ?42,CLOC
138 . S NAMEPRT=0
139 W ?50,BILLNO
140 W ?63,$J("$"_$FN($P(PRINAMT,".",1),",P"),12)
141 W ?77,$E(STATUS,1,13)
142 W ?93,$E(EDITBY,1,20)
143 W ?115,$$FMTE^XLFDT(EDITDT,"9D")
144 Q
145 ;
146WRLINE2 ; Write the Excel report line
147 W !
148 W NAME_U
149 W SSN_U
150 W CNUM_U
151 W CLOC_U
152 W BILLNO_U
153 W PRINAMT_U
154 W VALID_U
155 W STATUS_U
156 W EDITBY_U
157 W $$FMTE^XLFDT(EDITDT,"9D")
158 Q
159 ;
160CHKP(FOOTER) ;Check for End of Page
161 ;Input
162 ; FOOTER - Footer value. Optional. Default to 4 if nothing passed
163 I $G(FOOTER)'>0 S FOOTER=4
164 I $Y>(IOSL-FOOTER) D:RCSCR PAUSE^RCDMCUT2 Q:STOPIT D HDR
165 Q
166 ;
167HDR ;Print Report Header
168 ;NAMEPRT - Use to only print Name & SSN once for multiple bills
169 S NAMEPRT=1
170 S RCPAGE=RCPAGE+1
171 ;Header for Detailed and Excel Delimited format (132 Chars wide)
172 D:RCTYPE="D"!(RCTYPE="E")
173 . W @IOF,"DMC Debt Validity Management ",$$EXTTYPE^RCDMCUT2(RCTYPE)," Report"
174 . W ?53,"Run Date: ",RUNDATE
175 . W ?78,"Episode of Care Data from ",$$FMTE^XLFDT(BEGDT,"9D")
176 . W ?120,"Page: "_RCPAGE
177 ;Header for Summary Format (80 chars wide
178 D:RCTYPE="S"
179 . W @IOF,"DMC Debt Validity Management ",$$EXTTYPE^RCDMCUT2(RCTYPE)," Report"
180 . W ?70,"Page: "_RCPAGE
181 . W !,"Run Date: ",RUNDATE
182 . W ?30,"Episode of Care Data from ",$$FMTE^XLFDT(BEGDT,"9D")
183 ;
184 W !?5,"DMC Debt Valid Field Values = ",$$EXTDMC^RCDMCUT2(RCDMCVAL)
185 ;Print Underline for Summary Report header and Summary Data Header
186 I RCTYPE="S"!((RCTYPE="D")&(FULLHDR'>0)) D
187 . D ULINE^RCDMCUT2("=",$G(IOM))
188 ;Quit if printing summary data. Don't need field headers
189 Q:FULLHDR'>0
190 ;Print Detail Report header
191 I RCTYPE="D" D
192 . W !?30,"Claim",?42,"Claim",?50,"Bill",?65,"Receivable",?93,"DMC Debt Valid",?115,"DMC Debt Valid"
193 . W !,"Veteran Name",?22,"SSN",?30,"Number",?42,"Loc.",?50,"Number",?65,"Amount",?77,"Status",?93,"Edit By",?115,"Edit Date"
194 . D ULINE^RCDMCUT2("=",$G(IOM))
195 . I RCDMCVAL="A" W !,"*** Following data is for DMC Debt Valid Field Values of ",VALID," ***"
196 ;Print Excel Delimited format header
197 I RCTYPE="E" D
198 . W !,"Veteran Name",U,"SSN",U,"Claim #",U,"Claim Loc",U,"Bill #",U,"DMC Debt Valid",U,"Amount",U,"STATUS",U,"DMC Debt Valid Edit By",U,"DMC Debt Valid Edit Date"
199 Q
200 ;
201SUMRPT ;Print Summary report (No detailed data)
202 S FULLHDR=0
203 D HDR
204 ;If not all DMC Debt Values then just print Total Summary and quit
205 I RCDMCVAL'="A" D TOTSUM Q
206 ;If DMC Debt Valid Report is for all values then print summary by DMC
207 ;Debt Valid value and then the Total Summary for all DMC Debt Valid
208 ;values.
209 S VALID=""
210 F S VALID=$O(^TMP($J,"RCDMCR2","DETAIL",VALID)) Q:VALID']"" D Q:STOPIT
211 . D VALSUM
212 D TOTSUM
213 Q
214 ;
215TOTSUM ;Print Total Summary
216 N STAT
217 ;Don't print summary if user ^ out
218 Q:STOPIT
219 ;Don't print field headers
220 S FULLHDR=0
221 D CHKP() Q:STOPIT
222 W !
223 ;At bottom of page need to get 3 lines of Summary Total display
224 D CHKP(7) Q:STOPIT
225 W !,"SUMMARY TOTAL - ",$$EXTDMC^RCDMCUT2(RCDMCVAL)
226 D ULINE^RCDMCUT2("-",65)
227 W !,"Total Number of Bills:",?53,$J($FN($G(^TMP($J,"RCDMCR2","TOT","BILL")),",P"),13)
228 D CHKP() Q:STOPIT
229 W !,"Total Number of unique veterans:",?53,$J($FN($G(^TMP($J,"RCDMCR2","TOT","VET")),",P"),13)
230 D CHKP() Q:STOPIT
231 W !,"Total Account Receivable Dollars:",?53,$J("$"_$FN($P($G(^TMP($J,"RCDMCR2","TOT","$")),".",1),",P"),13)
232 ;Get summary data for each Status
233 S STAT=""
234 F S STAT=$O(^TMP($J,"RCDMCR2","TOT-STAT",STAT)) Q:STAT']"" D Q:STOPIT
235 . D CHKP() Q:STOPIT
236 . W !,"Total Number of unique ",STAT," Bill Status:",?53,$J($FN($G(^TMP($J,"RCDMCR2","TOT-STAT",STAT)),",P"),13)
237 Q
238 ;
239VALSUM ;Print Summary Total by DMC Debt Valid value
240 ;Don't print summary if user ^ out
241 Q:STOPIT
242 D CHKP() Q:STOPIT
243 W !
244 ;At bottom of page need to get 3 lines of Summary Total display
245 D CHKP(7) Q:STOPIT
246 W !,"SUMMARY TOTAL FOR DMC Debt Valid = ",VALID
247 D ULINE^RCDMCUT2("-",75)
248 W !,"Total Number of Bills (",VALID,"):",?63,$J($FN($G(^TMP($J,"RCDMCR2","SUM",VALID,"BILL")),",P"),13)
249 D CHKP() Q:STOPIT
250 W !,"Total Number of unique veterans (",VALID,"):",?63,$J($FN($G(^TMP($J,"RCDMCR2","SUM",VALID,"VET")),",P"),13)
251 D CHKP() Q:STOPIT
252 W !,"Total Account Receivable Dollars (",VALID,"):",?63,$J("$"_$FN($P($G(^TMP($J,"RCDMCR2","SUM",VALID,"$")),".",1),",P"),13)
253 ;Get summary data for each Current Status
254 S STAT=""
255 F S STAT=$O(^TMP($J,"RCDMCR2","SUM-STAT",VALID,STAT)) Q:STAT']"" D Q:STOPIT
256 . D CHKP() Q:STOPIT
257 . W !,"Total Number of unique ",STAT," Bill Status (",VALID,"):",?63,$J($FN($G(^TMP($J,"RCDMCR2","SUM-STAT",VALID,STAT)),",P"),13)
258 Q
Note: See TracBrowser for help on using the repository browser.