source: WorldVistAEHR/trunk/r/ACCOUNTS_RECEIVABLE-PRCA-PRY-RC/RCBECHGP.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: 5.1 KB
Line 
1RCBECHGP ;WISC/RFJ-add penalty charges to bills (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 ;
7PENALTY ; 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 ; the rcupdate variable is the statement date for non-benefit
11 ; debts or (statement date minus 3 days) for benefit (first
12 ; party debts)
13 ;
14 ; penalty charges are not applied to first party bills, check to make
15 ; sure the account does not contain DPT( before calling.
16 ;
17 N DAYSPEN,FROMDATE,RCBILLDA,RCDATA6,RCDATE,RCFPEN,RCLASTDT,RCLET120,REPAYDAT,X
18 ;
19 ; penalty charges are assessed on each bill, not just the account
20 ; loop all bills for the account
21 S RCDATE=0 F S RCDATE=$O(^TMP("RCBECHGS",$J,"LIST",RCDATE)) Q:'RCDATE D
22 . S RCBILLDA=0 F S RCBILLDA=$O(^TMP("RCBECHGS",$J,"LIST",RCDATE,RCBILLDA)) Q:'RCBILLDA D
23 . . ; bill category set up to not charge penalty, get next bill
24 . . I '$P($G(^PRCA(430.2,+$P(^PRCA(430,RCBILLDA,0),"^",2),0)),"^",12) Q
25 . . S RCDATA6=$G(^PRCA(430,RCBILLDA,6))
26 . . ; get the last date penalty was charged to this bill
27 . . ; if the last date is not set in field .13, use field 67
28 . . S RCLASTDT=$P($G(^PRCA(430,RCBILLDA,.1)),"^",3) I 'RCLASTDT S RCLASTDT=$P(RCDATA6,"^",7)
29 . . ; take the current statement date in variable rcupdate
30 . . ; (this is actually 3 days before the statement date for
31 . . ; benefit first party debts and is when penalty charges
32 . . ; get added) and subtract 1 month (this date will be the
33 . . ; last statement date). If the last penalty charge date
34 . . ; is greater than the last statement date, do not add
35 . . ; penalty a second time for the same month.
36 . . I RCLASTDT>$$FPS^RCAMFN01(RCUPDATE,-1) Q
37 . . ;
38 . . ; calculate 4 months from initial notification. this
39 . . ; date is 120 days from letter1 date.
40 . . I '$P(RCDATA6,"^") Q
41 . . S RCLET120=$$FPS^RCAMFN01($P(RCDATA6,"^",1),4)
42 . . ;
43 . . ; if the current update date is greater than (the letter1
44 . . ; date + 4 months), it has not been 120 days from the
45 . . ; initial notification, do not add penalty charges
46 . . I RCUPDATE<RCLET120 Q
47 . . ;
48 . . ; get the repayment plan date
49 . . S REPAYDAT=$P($G(^PRCA(430,RCBILLDA,4)),"^")
50 . . ; check to see if it was established within 120 days of
51 . . ; initial notification. if not charge penalty on bill
52 . . I REPAYDAT>RCLET120 S REPAYDAT=0
53 . . ;
54 . . ; if no repayment plan date, penalty charge from initial
55 . . ; delinquency date (31st day).
56 . . ; calculate the number of days of penalty from the last
57 . . ; penalty charge date to the date the account is being
58 . . ; updated (rcupdate). rcupdate is usually the current
59 . . ; statement day. if the last penalty charge is not defined,
60 . . ; use the letter1 date. if not letter1 date, quit
61 . . I 'REPAYDAT D Q
62 . . . S FROMDATE=RCLASTDT I 'FROMDATE S FROMDATE=$P(RCDATA6,"^") I 'FROMDATE Q
63 . . . S DAYSPEN=$$FMDIFF^XLFDT(RCUPDATE,$P(FROMDATE,"."))
64 . . . I DAYSPEN<1 Q
65 . . . ; calculate the penalty
66 . . . S X=$$CALCPEN(RCBILLDA,DAYSPEN) I 'X Q
67 . . . S $P(^TMP("RCBECHGS",$J,"ADDCHG",RCBILLDA),"^",3)=X
68 . . . S $P(^TMP("RCBECHGS",$J,"ADDCHG",RCBILLDA),"^",5)="Full payment or repayment plan not established in 120 days from initial notification."
69 . . ;
70 . . ; check to see if the account defaulted on the repayment
71 . . ; plan up to the date the penalty is being charged, if so
72 . . ; charge penalty on the bill
73 . . S RCFPEN=$$REPAYDEF^RCBECHGA(RCBILLDA,RCUPDATE) I 'RCFPEN Q
74 . . ;
75 . . ; account defaulted on repayment, charge penalty
76 . . ; charge penalty after the 121st day from the date of default
77 . . I $$FMADD^XLFDT($P(RCFPEN,"^",2),121)>RCUPDATE Q
78 . . ; charge penalty from the last penalty charge date or
79 . . ; back to the date of default on the repayment plan
80 . . S FROMDATE=RCLASTDT I 'FROMDATE S FROMDATE=$P(RCFPEN,"^",2)
81 . . S DAYSPEN=$$FMDIFF^XLFDT(RCUPDATE,FROMDATE)
82 . . I DAYSPEN<1 Q
83 . . ; calculate the penalty
84 . . S X=$$CALCPEN(RCBILLDA,DAYSPEN) I 'X Q
85 . . S $P(^TMP("RCBECHGS",$J,"ADDCHG",RCBILLDA),"^",3)=X
86 . . S $P(^TMP("RCBECHGS",$J,"ADDCHG",RCBILLDA),"^",5)=$P(RCFPEN,"^",3)
87 Q
88 ;
89 ;
90CALCPEN(RCBILLDA,DAYSPEN) ; calc the penalty for a number of days (dayspen)
91 N DATEPREP,PENALTY,PRINCPAL
92 ; get the date the bill was prepared
93 S DATEPREP=$P($G(^PRCA(430,RCBILLDA,0)),"^",10) I 'DATEPREP Q 0
94 ; get the principal balance
95 S PRINCPAL=$P($G(^PRCA(430,RCBILLDA,7)),"^") I 'PRINCPAL Q 0
96 ; the penalty based on the date the bill is prepared (rcdate)
97 ; divided by 360 days in the year equals the current daily rate.
98 ; multiply by the number of days to charge penalty and by the
99 ; principal balance
100 S PENALTY=+$J(+$$PEN^RCMSFN01(DATEPREP)/360*DAYSPEN*PRINCPAL,0,2)
101 Q PENALTY
Note: See TracBrowser for help on using the repository browser.