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

RCBEUTR1.m

Go to the documentation of this file.
  1. RCBEUTR1 ;WISC/RFJ-add int,admin chg or increase,decrease principal ;1 Jun 00
  1. ;;4.5;Accounts Receivable;**153,169,192,226,270,276,301,315,377**;Mar 20, 1995;Build 45
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. Q
  1. ;
  1. ;
  1. INTADM(RCBILLDA,RCVALUE,RCCOMMNT,RCDATE) ; add an intererst/admin charge (transaction type=13)
  1. ; for a bill. rcvalue = interest ^ admin ^ penalty ^ marshal fee ^ court cost
  1. ; for the transaction. rcdate = process date (optional)
  1. ; returns transaction number if successful
  1. ;
  1. N RCDRSTRG,RCTRANDA,Y
  1. ; add the transaction (if added to 433, transaction is locked)
  1. S RCTRANDA=$$ADD433^RCBEUTRA(RCBILLDA,13) I 'RCTRANDA Q 0
  1. ;
  1. ; build dr string
  1. ; transaction date (strip off time)
  1. S RCDRSTRG="11////"_$S($G(RCDATE):$P(RCDATE,"."),1:DT)_";"
  1. ;
  1. ; transaction values
  1. S RCDRSTRG=RCDRSTRG_"15////"_($P(RCVALUE,"^")+$P(RCVALUE,"^",2)+$P(RCVALUE,"^",3)+$P(RCVALUE,"^",4)+$P(RCVALUE,"^",5))_";"
  1. I $P(RCVALUE,"^",4) S RCDRSTRG=RCDRSTRG_"25////"_$P(RCVALUE,"^",4)_";" ;marshal fee
  1. I $P(RCVALUE,"^",5) S RCDRSTRG=RCDRSTRG_"26////"_$P(RCVALUE,"^",5)_";" ;court cost
  1. I $P(RCVALUE,"^",1) S RCDRSTRG=RCDRSTRG_"27////"_$P(RCVALUE,"^",1)_";" ;interest
  1. I $P(RCVALUE,"^",2) S RCDRSTRG=RCDRSTRG_"28////"_$P(RCVALUE,"^",2)_";" ;admin
  1. I $P(RCVALUE,"^",3) S RCDRSTRG=RCDRSTRG_"29////"_$P(RCVALUE,"^",3)_";" ;penalty
  1. I $G(RCDATE) S RCDRSTRG=RCDRSTRG_"19////"_RCDATE_";" ;date entered
  1. ;
  1. ; input the fields for the transaction
  1. S Y=$$EDIT433^RCBEUTRA(RCTRANDA,RCDRSTRG) I 'Y L -^PRCA(433,RCTRANDA) Q 0
  1. ;
  1. ; set the comment
  1. I $D(RCCOMMNT(1)) D ADDCOMM^RCBEUTRA(RCTRANDA,.RCCOMMNT)
  1. ;
  1. ; move over 433 from 430 (no principal, just move it)
  1. D FY433^RCBEUTRA(RCTRANDA)
  1. ;
  1. ; mark transaction as processed
  1. D PROCESS^RCBEUTRA(RCTRANDA)
  1. ;
  1. ; update the bill file with the balance of the transaction
  1. D SETBAL^RCBEUBIL(RCTRANDA)
  1. ;
  1. ;PRCA*4.5*377
  1. ; Update Repayment Plan if one is attached to the bill
  1. D UPDBAL^RCRPU1(RCBILLDA,RCTRANDA)
  1. ;
  1. ; if the bill has no balance, close or cancel it
  1. D CLOSEIT(RCBILLDA)
  1. ;
  1. ; clear the lock and return the transaction added
  1. L -^PRCA(433,RCTRANDA)
  1. Q RCTRANDA
  1. ;
  1. ; PRCA*4.5*270 add CRD flag so FMS knows this is a corrected record
  1. ; INCDEC(RCBILLDA,RCVALUE,RCCOMMNT,RCDATE,RCPREPAY,RCONTADJ) ; automatically
  1. INCDEC(RCBILLDA,RCVALUE,RCCOMMNT,RCDATE,RCPREPAY,RCONTADJ,RCCRD) ;
  1. ; automatically create an increase or decrease adjustment for a bill
  1. ; pass variables:
  1. ; rcvalue = principal value for the transaction.
  1. ; if rcvalue is less than zero, it will create a
  1. ; decrease adjustment. if rcvalue is greater than
  1. ; zero, it will create an increase adjustment.
  1. ; rccommnt = the comments for the word processing field.
  1. ; rcdate = optional processing date and time. if not
  1. ; passed, the current date and time will be used
  1. ; rcprepay = optional prepayment transaction. this is the
  1. ; payment transaction applied to the bill to
  1. ; create the decrease adjustment. this gets
  1. ; stored in field 20 (file 433).
  1. ; rcontadj = optional contract adjustment. if 1 then this
  1. ; gets stored in field 88 (file 433).
  1. ; rccrd = optional corrected flag. If 1, then FMS must 1st cancel or delete the
  1. ; original billing document before creating the new one.
  1. ;
  1. ; returns transaction number added to 433 if successful.
  1. ;
  1. N ADJNUMB,RCDRSTRG,RCTRANDA,X,Y,RCNEG,TRNTYP
  1. ;
  1. ; determine transaction type
  1. I RCVALUE>0 S TRNTYP=1 I $D(^PRCA(430,"TCSP",RCBILLDA)) S TRNTYP=73 ;PRCA*4.5*315/DRF
  1. I RCVALUE<0 S TRNTYP=35
  1. ;
  1. ; add the transaction (if added to 433, transaction is locked)
  1. S RCTRANDA=$$ADD433^RCBEUTRA(RCBILLDA,TRNTYP) I 'RCTRANDA Q 0
  1. ;
  1. ; build dr string
  1. ; 11=transaction date (strip off time)
  1. S RCDRSTRG="11////"_$S($G(RCDATE):$P(RCDATE,"."),1:DT)_";"
  1. ; transaction value (make sure it is not negative)
  1. I RCVALUE<0 S RCVALUE=-RCVALUE
  1. S RCDRSTRG=RCDRSTRG_"15////"_RCVALUE_";"
  1. S RCDRSTRG=RCDRSTRG_"81////"_RCVALUE_";"
  1. I $G(RCBETYPE)="DECREASE" S RCDRSTRG=RCDRSTRG_"31////"_RCVALUE_";" ;PRCA*4.5*301
  1. ;
  1. ; get the next adjustment number if increase(1) or decrease(35)
  1. ; start with the last transaction and work backwards
  1. S X=999999999999,ADJNUMB=1
  1. F S X=$O(^PRCA(433,"C",RCBILLDA,X),-1) Q:'X I $P($G(^PRCA(433,X,1)),"^",4) I $P(^(1),"^",2)=1!($P(^(1),"^",2)=35) S ADJNUMB=$P(^(1),"^",4)+1 Q
  1. S RCDRSTRG=RCDRSTRG_"14////"_ADJNUMB_";"
  1. ;
  1. ; date entered
  1. I $G(RCDATE) S RCDRSTRG=RCDRSTRG_"19////"_RCDATE_";"
  1. ;
  1. ; store the prepayment transaction
  1. I $G(RCPREPAY) D
  1. . S RCDRSTRG=RCDRSTRG_"20////"_RCPREPAY_";"
  1. . ; for prepayments, set the incomplete transaction flag
  1. . ; this will no longer be used after patch 146 and can
  1. . ; be removed
  1. . S RCDRSTRG=RCDRSTRG_"10////1;"
  1. ;
  1. ; contract adjustment
  1. I $G(RCONTADJ) S RCDRSTRG=RCDRSTRG_"88///1;"
  1. ;
  1. ; input the fields for the transaction
  1. S Y=$$EDIT433^RCBEUTRA(RCTRANDA,RCDRSTRG) I 'Y L -^PRCA(433,RCTRANDA) Q 0
  1. ;
  1. ; set the comment
  1. I $D(RCCOMMNT(1)) D ADDCOMM^RCBEUTRA(RCTRANDA,.RCCOMMNT)
  1. ;
  1. ; mark the transaction processed
  1. D PROCESS^RCBEUTRA(RCTRANDA)
  1. ;
  1. ; update the fiscal year multiple (must be done after marked as
  1. ; processed so the value is defined)
  1. D FYMULT^RCBEUTRA(RCTRANDA)
  1. ;
  1. ; update the bill file with the balance of the transaction
  1. ; PRCA276 - add exception condition - needs to quit receipt processing when negative claim balance could result
  1. S RCNEG=0 D SETBAL^RCBEUBIL(RCTRANDA,.RCNEG) I RCNEG D DEL433^RCBEUTRA(RCTRANDA,"CANCELLED WORKLIST DEC ADJ TO PREVENT NEG PRIN BAL",1) L -^PRCA(433,RCTRANDA) Q "0^1"
  1. ;
  1. ; if the bill has no balance, close or cancel it
  1. D CLOSEIT(RCBILLDA)
  1. ;
  1. ;PRCA*4.5*377 - add hook for repayment plan updates
  1. ; if the bill is in a repayment plan, update the plan with the increase or decrease
  1. D UPDBAL^RCRPU1(RCBILLDA,RCTRANDA)
  1. ;
  1. ; send FMS document if non-accrued (redo this later on)
  1. I '$$ACCK^PRCAACC(RCBILLDA) D
  1. . N D0,DA,DI,DIC,DIE,DIQ2,DQ,DR,ENT,FMSNUM,GECSDATA
  1. . N CATEG,DATA1,ERR
  1. . S CATEG=$P($G(^PRCA(430,RCBILLDA,0)),"^",2)
  1. . ;
  1. . ; category=29 champva, do not send to fms, quit
  1. . I CATEG=29 Q
  1. . ;
  1. . ; category=30 tricare or 32 tricare third party, and contract adj
  1. . I (CATEG=30!(CATEG=32)),$P($G(^PRCA(433,RCTRANDA,8)),"^",8) D Q
  1. . . S DATA1=$G(^PRCA(433,RCTRANDA,1))
  1. . . D EN^PRCAFWO(RCBILLDA,$P(DATA1,"^",1),$P(DATA1,"^",5),$$SITE^RCMSITE,RCTRANDA)
  1. . ;
  1. . ; all other categories
  1. . ; pass trans amount(1;5),trans type(1;2),trans date(1;1)
  1. . S DATA1=$G(^PRCA(433,RCTRANDA,1))
  1. . ;
  1. . ; PRCA*4.5*270 - pass CRD flag to FMS
  1. . D EN^PRCAFBDM(RCBILLDA,$P(DATA1,"^",5),$P(DATA1,"^",2),$P(DATA1,"^",1),RCTRANDA,.ERR,$G(RCCRD))
  1. ;
  1. ; clear the lock and return the transaction added
  1. L -^PRCA(433,RCTRANDA)
  1. Q RCTRANDA
  1. ;
  1. ;
  1. CLOSEIT(RCBILLDA) ; check to cancel or close bill with no balance
  1. N AMTPAID,BILLBAL,DATA7,TRANDA
  1. ; if the bill has no balance, close or cancel it
  1. S DATA7=$G(^PRCA(430,RCBILLDA,7))
  1. S BILLBAL=$P(DATA7,"^")+$P(DATA7,"^",2)+$P(DATA7,"^",3)+$P(DATA7,"^",4)+$P(DATA7,"^",5)
  1. I 'BILLBAL D
  1. . ; get payments recorded against the bill. if payments have been
  1. . ; made, then the status of the bill should be collected/closed.
  1. . S AMTPAID=$P(DATA7,"^",7)+$P(DATA7,"^",8)+$P(DATA7,"^",9)+$P(DATA7,"^",10)+$P(DATA7,"^",11)
  1. . I AMTPAID D CHGSTAT^RCBEUBIL(RCBILLDA,22) Q
  1. . ; if the last transaction was a decrease contract adjustment,
  1. . ; then the status will be collected/closed
  1. . S TRANDA=+$O(^PRCA(433,"C",RCBILLDA,999999999999),-1)
  1. . I $P($G(^PRCA(433,TRANDA,8)),"^",8) D CHGSTAT^RCBEUBIL(RCBILLDA,22) Q
  1. . ; otherwise it should be cancellation
  1. . D CHGSTAT^RCBEUBIL(RCBILLDA,39)
  1. Q