source: WorldVistAEHR/trunk/r/ACCOUNTS_RECEIVABLE-PRCA-PRY-RC/RCBECHGU.m@ 1005

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

initial load of WorldVistAEHR

File size: 4.8 KB
Line 
1RCBECHGU ;WISC/RFJ-process the charges to bill (called by rcbechgs) ;1 Jun 00
2 ;;4.5;Accounts Receivable;**153**;Mar 20, 1995
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 Q
5 ;
6 ;
7ADDCHARG ; this is called by rcbechgs and is a continuation of that routine
8 ; variables passed to this entry point:
9 ; rcupdate = the fm date that charges are being added
10 ; rcdata0 = debtor file entry 0th node
11 ;
12 N COMMENT,DR,RCBILLDA,RCDATA,RCDATE,RCLINE,RCTRANDA,RCTRDATE,VALUE,X
13 ;
14 ; for first party charges, the 433 transaction date must be 3 days
15 ; prior to the statement date so the charges will appear on the
16 ; patient statement (statement date is the variable rcupdate)
17 S RCTRDATE=RCUPDATE
18 I $P(RCDATA0,"^")["DPT(" S RCTRDATE=$$FMADD^XLFDT(RCUPDATE,-3)
19 ;
20 S RCBILLDA=0 F S RCBILLDA=$O(^TMP("RCBECHGS",$J,"ADDCHG",RCBILLDA)) Q:'RCBILLDA D
21 . S RCDATA=^TMP("RCBECHGS",$J,"ADDCHG",RCBILLDA)
22 . ; pass the value = interest ^ admin ^ penalty
23 . S VALUE=+$P(RCDATA,"^",1)_"^"_$P(RCDATA,"^",2)_"^"_$P(RCDATA,"^",3)
24 . ; no value for interest or admin
25 . I '$P(VALUE,"^"),'$P(VALUE,"^",2),'$P(VALUE,"^",3) Q
26 . ; pass the comments, admin comment (p4) and penalty comment (p5)
27 . S COMMENT="",RCLINE=1
28 . I $P(RCDATA,"^",4)'="" S COMMENT(RCLINE)="Admin Reason: "_$P(RCDATA,"^",4),RCLINE=2
29 . I $P(RCDATA,"^",5)'="" S COMMENT(RCLINE)="Penalty Reason: "_$P(RCDATA,"^",5)
30 . ; lock the bill, this lock cannot fail
31 . L +^PRCA(430,RCBILLDA)
32 . ;
33 . ; add the int/admin transaction
34 . S RCTRANDA=$$INTADM^RCBEUTR1(RCBILLDA,VALUE,.COMMENT,RCTRDATE)
35 . I 'RCTRANDA L -^PRCA(430,RCBILLDA) Q
36 . ;
37 . ; set key fields in file 430
38 . S DR=""
39 . ; interest last updated
40 . I $P(RCDATA,"^",1) S DR=DR_".11////"_RCUPDATE_";"
41 . ; admin last updated
42 . I $P(RCDATA,"^",2) S DR=DR_".12////"_RCUPDATE_";"
43 . ; penalty last updated
44 . I $P(RCDATA,"^",3) S DR=DR_".13////"_RCUPDATE_";"
45 . S X=$$EDIT430^RCBEUBIL(RCBILLDA,DR)
46 . ;
47 . ; set date admin applied to account in file 340
48 . S DR=".12////"_RCUPDATE_";"
49 . S X=$$EDIT340^RCBEUDEB(+$P(^PRCA(430,RCBILLDA,0),"^",9),DR)
50 . ; clear the lock on the bill
51 . L -^PRCA(430,RCBILLDA)
52 . ;
53 . ; set tmp for mailman message, sort by date prepared
54 . S RCDATE=+$P(^PRCA(430,RCBILLDA,0),"^",10)
55 . S ^TMP("RCBECHGS REPORT",$J,RCDATE,RCBILLDA)=$P(RCDATA,"^")_"^"_$P(RCDATA,"^",2)_"^"_$P(RCDATA,"^",3)_"^"_RCTRANDA
56 Q
57 ;
58 ;
59REPORT ; build report in mailman
60 N MMDATA,RCBILLDA,RCDATA,RCDATE,RCLINE,RCSPACE,RCTOTAL,RCUPDATE,X,XMDUN,XMY
61 K ^TMP($J,"RCRJRCORMM")
62 S RCSPACE=$J("",79)
63 S RCTOTAL=""
64 S RCLINE=2
65 S RCDATE="" F S RCDATE=$O(^TMP("RCBECHGS REPORT",$J,RCDATE)) Q:RCDATE="" D
66 . S RCBILLDA=0 F S RCBILLDA=$O(^TMP("RCBECHGS REPORT",$J,RCDATE,RCBILLDA)) Q:'RCBILLDA D
67 . . S RCDATA=^TMP("RCBECHGS REPORT",$J,RCDATE,RCBILLDA)
68 . . ; bill number
69 . . S MMDATA=$E($P($P($G(^PRCA(430,RCBILLDA,0)),"^"),"-",2)_RCSPACE,1,10)
70 . . ; date bill prepared
71 . . S MMDATA=MMDATA_$E($$FORMATDT^RCBECHGA(RCDATE)_RCSPACE,1,10)
72 . . ; transaction with charges added
73 . . S MMDATA=MMDATA_$E($P(RCDATA,"^",4)_RCSPACE,1,10)
74 . . ; date of update (transaction date)
75 . . S RCUPDATE=$P($G(^PRCA(433,+$P(RCDATA,"^",4),1)),"^")
76 . . S MMDATA=MMDATA_$E($$FORMATDT^RCBECHGA(RCUPDATE)_RCSPACE,1,10)
77 . . ; justify dollar amount 10 places with 2 decimal places,
78 . . ; if no interest, admin, penalty, then set to null
79 . . ; total dollars for end of report
80 . . F X=1:1:3 D
81 . . . S $P(RCTOTAL,"^",X)=$P(RCTOTAL,"^",X)+$P(RCDATA,"^",X)
82 . . . S $P(RCDATA,"^",X)=$S('$P(RCDATA,"^",X):$J("",12),1:$J($P(RCDATA,"^",X),12,2))
83 . . ; interest charge
84 . . S MMDATA=MMDATA_$P(RCDATA,"^",1)
85 . . ; admin charge
86 . . S MMDATA=MMDATA_$P(RCDATA,"^",2)
87 . . ; penalty charge
88 . . S MMDATA=MMDATA_$P(RCDATA,"^",3)
89 . . S RCLINE=RCLINE+1
90 . . S ^TMP($J,"RCRJRCORMM",RCLINE,0)=MMDATA
91 ;
92 I RCLINE=2 S ^TMP($J,"RCRJRCORMM",1,0)="No interest, administrative, or penalty charges added on "_$$FMTE^XLFDT($$NOW^XLFDT)_"."
93 ; if charges added, build header
94 I RCLINE'=2 D
95 . S ^TMP($J,"RCRJRCORMM",1,0)="BILL DATEPREP 433TRANS TRANDATE "_$J("INTEREST",12)_$J("ADMIN",12)_$J("PENALTY",12)
96 . S ^TMP($J,"RCRJRCORMM",2,0)="------ -------- -------- -------- "_$J("--------",12)_$J("-----",12)_$J("-------",12)
97 . ; build totals
98 . S RCLINE=RCLINE+1
99 . S ^TMP($J,"RCRJRCORMM",RCLINE,0)=$E(RCSPACE,1,42)_"---------- ---------- ----------"
100 . S RCLINE=RCLINE+1
101 . S ^TMP($J,"RCRJRCORMM",RCLINE,0)=$E(RCSPACE,1,30)_"TOTALS "_$J($P(RCTOTAL,"^"),12,2)_$J($P(RCTOTAL,"^",2),12,2)_$J($P(RCTOTAL,"^",3),12,2)
102 ;
103 ; send report
104 S XMY("G.PRCA ADJUSTMENT TRANS")=""
105 S X=$$SENDMSG^RCRJRCOR("AR Nightly Interest/Admin/Penalty Charges Added",.XMY)
106 K ^TMP($J,"RCRJRCORMM")
107 Q
Note: See TracBrowser for help on using the repository browser.