Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: RCBECHGP

RCBECHGP.m

Go to the documentation of this file.
  1. RCBECHGP ;WISC/RFJ-add penalty charges to bills (called by rcbechgs) ;1 Jun 00
  1. ;;4.5;Accounts Receivable;**153**;Mar 20, 1995
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. Q
  1. ;
  1. ;
  1. PENALTY ; this is called by rcbechgs and is a continuation of that routine
  1. ; variables passed to this entry point:
  1. ; rcupdate = the fm date that charges are being added
  1. ; the rcupdate variable is the statement date for non-benefit
  1. ; debts or (statement date minus 3 days) for benefit (first
  1. ; party debts)
  1. ;
  1. ; penalty charges are not applied to first party bills, check to make
  1. ; sure the account does not contain DPT( before calling.
  1. ;
  1. N DAYSPEN,FROMDATE,RCBILLDA,RCDATA6,RCDATE,RCFPEN,RCLASTDT,RCLET120,REPAYDAT,X
  1. ;
  1. ; penalty charges are assessed on each bill, not just the account
  1. ; loop all bills for the account
  1. S RCDATE=0 F S RCDATE=$O(^TMP("RCBECHGS",$J,"LIST",RCDATE)) Q:'RCDATE D
  1. . S RCBILLDA=0 F S RCBILLDA=$O(^TMP("RCBECHGS",$J,"LIST",RCDATE,RCBILLDA)) Q:'RCBILLDA D
  1. . . ; bill category set up to not charge penalty, get next bill
  1. . . I '$P($G(^PRCA(430.2,+$P(^PRCA(430,RCBILLDA,0),"^",2),0)),"^",12) Q
  1. . . S RCDATA6=$G(^PRCA(430,RCBILLDA,6))
  1. . . ; get the last date penalty was charged to this bill
  1. . . ; if the last date is not set in field .13, use field 67
  1. . . S RCLASTDT=$P($G(^PRCA(430,RCBILLDA,.1)),"^",3) I 'RCLASTDT S RCLASTDT=$P(RCDATA6,"^",7)
  1. . . ; take the current statement date in variable rcupdate
  1. . . ; (this is actually 3 days before the statement date for
  1. . . ; benefit first party debts and is when penalty charges
  1. . . ; get added) and subtract 1 month (this date will be the
  1. . . ; last statement date). If the last penalty charge date
  1. . . ; is greater than the last statement date, do not add
  1. . . ; penalty a second time for the same month.
  1. . . I RCLASTDT>$$FPS^RCAMFN01(RCUPDATE,-1) Q
  1. . . ;
  1. . . ; calculate 4 months from initial notification. this
  1. . . ; date is 120 days from letter1 date.
  1. . . I '$P(RCDATA6,"^") Q
  1. . . S RCLET120=$$FPS^RCAMFN01($P(RCDATA6,"^",1),4)
  1. . . ;
  1. . . ; if the current update date is greater than (the letter1
  1. . . ; date + 4 months), it has not been 120 days from the
  1. . . ; initial notification, do not add penalty charges
  1. . . I RCUPDATE<RCLET120 Q
  1. . . ;
  1. . . ; get the repayment plan date
  1. . . S REPAYDAT=$P($G(^PRCA(430,RCBILLDA,4)),"^")
  1. . . ; check to see if it was established within 120 days of
  1. . . ; initial notification. if not charge penalty on bill
  1. . . I REPAYDAT>RCLET120 S REPAYDAT=0
  1. . . ;
  1. . . ; if no repayment plan date, penalty charge from initial
  1. . . ; delinquency date (31st day).
  1. . . ; calculate the number of days of penalty from the last
  1. . . ; penalty charge date to the date the account is being
  1. . . ; updated (rcupdate). rcupdate is usually the current
  1. . . ; statement day. if the last penalty charge is not defined,
  1. . . ; use the letter1 date. if not letter1 date, quit
  1. . . I 'REPAYDAT D Q
  1. . . . S FROMDATE=RCLASTDT I 'FROMDATE S FROMDATE=$P(RCDATA6,"^") I 'FROMDATE Q
  1. . . . S DAYSPEN=$$FMDIFF^XLFDT(RCUPDATE,$P(FROMDATE,"."))
  1. . . . I DAYSPEN<1 Q
  1. . . . ; calculate the penalty
  1. . . . S X=$$CALCPEN(RCBILLDA,DAYSPEN) I 'X Q
  1. . . . S $P(^TMP("RCBECHGS",$J,"ADDCHG",RCBILLDA),"^",3)=X
  1. . . . S $P(^TMP("RCBECHGS",$J,"ADDCHG",RCBILLDA),"^",5)="Full payment or repayment plan not established in 120 days from initial notification."
  1. . . ;
  1. . . ; check to see if the account defaulted on the repayment
  1. . . ; plan up to the date the penalty is being charged, if so
  1. . . ; charge penalty on the bill
  1. . . S RCFPEN=$$REPAYDEF^RCBECHGA(RCBILLDA,RCUPDATE) I 'RCFPEN Q
  1. . . ;
  1. . . ; account defaulted on repayment, charge penalty
  1. . . ; charge penalty after the 121st day from the date of default
  1. . . I $$FMADD^XLFDT($P(RCFPEN,"^",2),121)>RCUPDATE Q
  1. . . ; charge penalty from the last penalty charge date or
  1. . . ; back to the date of default on the repayment plan
  1. . . S FROMDATE=RCLASTDT I 'FROMDATE S FROMDATE=$P(RCFPEN,"^",2)
  1. . . S DAYSPEN=$$FMDIFF^XLFDT(RCUPDATE,FROMDATE)
  1. . . I DAYSPEN<1 Q
  1. . . ; calculate the penalty
  1. . . S X=$$CALCPEN(RCBILLDA,DAYSPEN) I 'X Q
  1. . . S $P(^TMP("RCBECHGS",$J,"ADDCHG",RCBILLDA),"^",3)=X
  1. . . S $P(^TMP("RCBECHGS",$J,"ADDCHG",RCBILLDA),"^",5)=$P(RCFPEN,"^",3)
  1. Q
  1. ;
  1. ;
  1. CALCPEN(RCBILLDA,DAYSPEN) ; calc the penalty for a number of days (dayspen)
  1. N DATEPREP,PENALTY,PRINCPAL
  1. ; get the date the bill was prepared
  1. S DATEPREP=$P($G(^PRCA(430,RCBILLDA,0)),"^",10) I 'DATEPREP Q 0
  1. ; get the principal balance
  1. S PRINCPAL=$P($G(^PRCA(430,RCBILLDA,7)),"^") I 'PRINCPAL Q 0
  1. ; the penalty based on the date the bill is prepared (rcdate)
  1. ; divided by 360 days in the year equals the current daily rate.
  1. ; multiply by the number of days to charge penalty and by the
  1. ; principal balance
  1. S PENALTY=+$J(+$$PEN^RCMSFN01(DATEPREP)/360*DAYSPEN*PRINCPAL,0,2)
  1. Q PENALTY