source: WorldVistAEHR/trunk/r/ACCOUNTS_RECEIVABLE-PRCA-PRY-RC/RCDMBWL1.m@ 738

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

initial load of WorldVistAEHR

File size: 8.3 KB
Line 
1RCDMBWL1 ;WISC/RFJ-diagnostic measures workload report (to clerk) ;1 Jan 01
2 ;;4.5;Accounts Receivable;**167**;Mar 20, 1995
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 Q
5 ;
6 ;
7REPORT ; called by RCDMBWLR to generate the report
8 N %,DATA,RCASSIGN,RCBALANC,RCBILLDA,RCCLERK,RCCOUNT,RCDATA,RCDATA0,RCDATE,RCDEBTDA,RCDESC,RCLINE,RCNAME,RCPREFIX,RCTMPDAT,RCTODAY,X,XMDUN,XMY,XMZ,Y
9 D NOW^%DTC S Y=X D DD^%DT S RCTODAY=Y,RCTODAY=$$DOW^XLFDT(X)_" "_RCTODAY
10 ;
11 K ^TMP("RCDMBWL1",$J) ;used for supervisor report
12 ;
13 ; generate mailmessage with assignments for user
14 S RCCLERK=0 F S RCCLERK=$O(^TMP("RCDMBWLR",$J,RCCLERK)) Q:'RCCLERK D
15 . ; initialize counts for summary of all assignments for each clerk
16 . S RCCOUNT("clbills")=0
17 . S RCCOUNT("clbillstotal")=0
18 . S RCCOUNT("death")=0
19 . S RCCOUNT("deathtotal")=0
20 . S RCCOUNT("dmc")=0
21 . S RCCOUNT("dmctotal")=0
22 . S RCCOUNT("top")=0
23 . S RCCOUNT("toptotal")=0
24 . S RCCOUNT("repay")=0
25 . S RCCOUNT("repaytotal")=0
26 . S RCCOUNT("default")=0
27 . S RCCOUNT("defaulttotal")=0
28 . ; show heading at top of mailman message
29 . K ^TMP($J,"RCRJRCORMM")
30 . S RCLINE=0
31 . D BUILDMM("The following mailman message is your Accounts Receivable assignment list.")
32 . D BUILDMM(" "_RCTODAY_".")
33 . D BUILDMM(" ")
34 . ;
35 . S RCASSIGN=0 F S RCASSIGN=$O(^TMP("RCDMBWLR",$J,RCCLERK,RCASSIGN)) Q:'RCASSIGN D
36 . . D BUILDMM(" ")
37 . . ; show the assignment number
38 . . D BUILDMM("ASSIGNMENT #: "_$E(RCASSIGN_" ",1,5))
39 . . ; show the condition of the assignment
40 . . S RCDATA=" CONDITION: IF "
41 . . ; print conditions [condition 1][condition 2][...]
42 . . S RCDESC=$G(^TMP("RCDMBWLR",$J,RCCLERK,RCASSIGN,"DESC"))
43 . . F %=2:1 D I DATA="" Q
44 . . . S DATA=$P($P(RCDESC,"[",%),"]")
45 . . . I DATA="" Q
46 . . . D BUILDMM($S(RCDATA'="":RCDATA,1:" and ")_DATA)
47 . . . ; do not show "condition: if" more than once
48 . . . S RCDATA=""
49 . . ;
50 . . ; show header for bills
51 . . D BUILDMM("ACCOUNT BILL# CATEGORY ACTIVATE "_$J("BALANCE",10))
52 . . D BUILDMM("------------------------------------------------------------------------------")
53 . . ;
54 . . ; show the bills under the assignment
55 . . ; loop the debtor first
56 . . S RCCOUNT("bills")=0
57 . . S RCCOUNT("billstotal")=0
58 . . S RCNAME="" F S RCNAME=$O(^TMP("RCDMBWLR",$J,RCCLERK,RCASSIGN,"IF",RCNAME)) Q:RCNAME="" D
59 . . . S RCDEBTDA="" F S RCDEBTDA=$O(^TMP("RCDMBWLR",$J,RCCLERK,RCASSIGN,"IF",RCNAME,RCDEBTDA)) Q:'RCDEBTDA D
60 . . . . ; start looping bills under the assignment
61 . . . . S RCBILLDA=0 F S RCBILLDA=$O(^TMP("RCDMBWLR",$J,RCCLERK,RCASSIGN,"IF",RCNAME,RCDEBTDA,RCBILLDA)) Q:'RCBILLDA D
62 . . . . . ; get the data in tmp global
63 . . . . . ; = ssn ^ 1 for death ^ bill balance
64 . . . . . S RCTMPDAT=^TMP("RCDMBWLR",$J,RCCLERK,RCASSIGN,"IF",RCNAME,RCDEBTDA,RCBILLDA)
65 . . . . . ;
66 . . . . . ; generate prefix codes
67 . . . . . S RCPREFIX=""
68 . . . . . ; test for account death
69 . . . . . I $P(RCTMPDAT,"^",2) S RCPREFIX="*"
70 . . . . . ;
71 . . . . . ; test for bill sent to DMC
72 . . . . . I $G(^PRCA(430,RCBILLDA,12)) S RCPREFIX=RCPREFIX_"d"
73 . . . . . ;
74 . . . . . ; test for bill sent to TOP
75 . . . . . I $G(^PRCA(430,RCBILLDA,14)) S RCPREFIX=RCPREFIX_"t"
76 . . . . . ;
77 . . . . . ; test bill for repayment plan
78 . . . . . I $G(^PRCA(430,RCBILLDA,4)) S RCPREFIX=RCPREFIX_"r"
79 . . . . . ; test for bill in default
80 . . . . . I RCPREFIX["r",$$REPAYDEF^RCBECHGA(RCBILLDA,DT) S RCPREFIX=$TR(RCPREFIX,"r","R")
81 . . . . . ;
82 . . . . . ; start building line for mailman message
83 . . . . . S RCDATA0=$G(^PRCA(430,RCBILLDA,0))
84 . . . . . ; prefix and account name
85 . . . . . S RCDATA=$E(RCPREFIX_$S(RCPREFIX'="":" ",1:"")_$S($P(RCTMPDAT,"^",4)'="":$E(RCNAME,1,8)_"/"_$E($P(RCTMPDAT,"^",4),1,7),1:RCNAME)_" ",1,16)_" "
86 . . . . . ; account ssn (if applicable)
87 . . . . . S RCDATA=RCDATA_$P(RCTMPDAT,"^")_" "
88 . . . . . ; bill number
89 . . . . . S RCDATA=RCDATA_$E($P($P(RCDATA0,"^"),"-",2)_" ",1,7)_" "
90 . . . . . ; category
91 . . . . . S RCDATA=RCDATA_$E($P($G(^PRCA(430.2,+$P(RCDATA0,"^",2),0)),"^")_" ",1,15)_" "
92 . . . . . ; date bill activated
93 . . . . . S RCDATE=$P($G(^PRCA(430,RCBILLDA,6)),"^",21) I RCDATE="" S RCDATE=" "
94 . . . . . S RCDATA=RCDATA_$E(RCDATE,4,5)_"/"_$E(RCDATE,6,7)_"/"_$E(RCDATE,2,3)_" "
95 . . . . . ; bill balance
96 . . . . . S RCBALANC=$P(RCTMPDAT,"^",3)
97 . . . . . D BUILDMM(RCDATA_$J(RCBALANC,18,2))
98 . . . . . ;
99 . . . . . ; calculate bill count totals for assignment
100 . . . . . S RCCOUNT("bills")=RCCOUNT("bills")+1
101 . . . . . S RCCOUNT("billstotal")=RCCOUNT("billstotal")+RCBALANC
102 . . . . . ;
103 . . . . . ; death
104 . . . . . I RCPREFIX["*" D
105 . . . . . . S RCCOUNT("death")=RCCOUNT("death")+1
106 . . . . . . S RCCOUNT("deathtotal")=RCCOUNT("deathtotal")+RCBALANC
107 . . . . . ;
108 . . . . . ; dmc
109 . . . . . I RCPREFIX["d" D
110 . . . . . . S RCCOUNT("dmc")=RCCOUNT("dmc")+1
111 . . . . . . S RCCOUNT("dmctotal")=RCCOUNT("dmctotal")+RCBALANC
112 . . . . . ;
113 . . . . . ; top
114 . . . . . I RCPREFIX["t" D
115 . . . . . . S RCCOUNT("top")=RCCOUNT("top")+1
116 . . . . . . S RCCOUNT("toptotal")=RCCOUNT("toptotal")+RCBALANC
117 . . . . . ;
118 . . . . . ; repayment plans
119 . . . . . I RCPREFIX["r" D
120 . . . . . . S RCCOUNT("repay")=RCCOUNT("repay")+1
121 . . . . . . S RCCOUNT("repaytotal")=RCCOUNT("repaytotal")+RCBALANC
122 . . . . . ;
123 . . . . . ; default repayment plan
124 . . . . . I RCPREFIX["R" D
125 . . . . . . S RCCOUNT("default")=RCCOUNT("default")+1
126 . . . . . . S RCCOUNT("defaulttotal")=RCCOUNT("defaulttotal")+RCBALANC
127 . . ;
128 . . ; show bill count
129 . . D BUILDMM(" TOTAL BILL COUNT FOR ASSIGNMENT: "_$E(RCCOUNT("bills")_" ",1,10)_$J(RCCOUNT("billstotal"),31,2))
130 . . S RCCOUNT("clbills")=RCCOUNT("clbills")+RCCOUNT("bills")
131 . . S RCCOUNT("clbillstotal")=RCCOUNT("clbillstotal")+RCCOUNT("billstotal")
132 . . ;
133 . . ; build list for supervisor
134 . . S RCCLERK("name")=$E($P($G(^VA(200,RCCLERK,0)),"^"),1,30) I RCCLERK("name")="" S RCCLERK("name")="[Not Specified]"
135 . . S ^TMP("RCDMBWL1",$J,RCCLERK("name"),RCCLERK,RCASSIGN,"SUMM")=RCCOUNT("bills")_"^"_RCCOUNT("billstotal")
136 . . S ^TMP("RCDMBWL1",$J,RCCLERK("name"),RCCLERK,RCASSIGN,"DESC")=RCDESC
137 . ;
138 . ; summarize assignment list
139 . D BUILDMM(" ")
140 . D BUILDMM("SUMMARY OF ALL ASSIGNMENTS")
141 . D BUILDMM("--------------------------")
142 . D BUILDMM("ALL BILLS FOR ALL ASSIGNMENTS COUNT: "_$J(RCCOUNT("clbills"),6)_" TOTAL: "_$J(RCCOUNT("clbillstotal"),10,2))
143 . I RCCOUNT("death") D BUILDMM("* indicates patient has expired COUNT: "_$J(RCCOUNT("death"),6)_" TOTAL: "_$J(RCCOUNT("deathtotal"),10,2))
144 . I RCCOUNT("dmc") D BUILDMM("d indicates bill has been forwarded to DMC COUNT: "_$J(RCCOUNT("dmc"),6)_" TOTAL: "_$J(RCCOUNT("dmctotal"),10,2))
145 . I RCCOUNT("top") D BUILDMM("t indicates bill has been forwarded to TOP COUNT: "_$J(RCCOUNT("top"),6)_" TOTAL: "_$J(RCCOUNT("toptotal"),10,2))
146 . I RCCOUNT("repay") D BUILDMM("r indicates bill is under a repayment plan COUNT: "_$J(RCCOUNT("repay"),6)_" TOTAL: "_$J(RCCOUNT("repaytotal"),10,2))
147 . I RCCOUNT("default") D BUILDMM("R indicates bill in default of repay plan COUNT: "_$J(RCCOUNT("default"),6)_" TOTAL: "_$J(RCCOUNT("defaulttotal"),10,2))
148 . ;
149 . ; send mail message
150 . S XMY(RCCLERK)=""
151 . S XMZ=$$SENDMSG^RCRJRCOR("AR Assignment List for "_$E(DT,4,5)_"/"_$E(DT,6,7)_"/"_$E(DT,2,3),.XMY)
152 . K ^TMP($J,"RCRJRCORMM")
153 ;
154 D REPORT^RCDMBWL2
155 ;
156 K ^TMP("RCDMBWL1",$J)
157 Q
158 ;
159 ;
160BUILDMM(DATA) ; build mailman message
161 S RCLINE=RCLINE+1
162 S ^TMP($J,"RCRJRCORMM",RCLINE)=DATA
163 Q
Note: See TracBrowser for help on using the repository browser.