RCBEPAY2 ;WISC/RFJ-create a payment transaction cont ;1 Jun 00 ;;4.5;Accounts Receivable;**153,162**;Mar 20, 1995 ;;Per VHA Directive 10-93-142, this routine should not be modified. Q ; ; SET ; set the transactions and balances (continuation of rcbepay1) N COMMENT,DR,RCDATA3,RCLINE,RCREPAMT,RCREPDA,RCTOTAL,RCTYPE,X ; ; no payment amount S RCTOTAL=$G(RCPAY("PRIN"))+$G(RCPAY("INT"))+$G(RCPAY("ADM"))+$G(RCPAY("MF"))+$G(RCPAY("CC")) I 'RCTOTAL S RCTRANDA="0^Bill has no balance, no payment made" Q ; ; create 433 transaction for bill, transaction type = payment (2) ; the transaction will be locked S RCTRANDA=$$ADD433^RCBEUTRA(RCBILLDA,2) I 'RCTRANDA S RCTRANDA="0^Unable to add a payment transaction to file 433" Q ; 433 transaction added and lock applied ; ; edit/setup fields for 433 transaction. 11=payment date ; 13=receipt number; 15=trasaction amount; 7=rcdoj code ; 5.02=brief comment = deposit / receipt / payment # S DR="11////"_RCPAYDAT_";" S DR=DR_"15////"_RCTOTAL_";" ; if receipt is passed, set fields for receipt ; note: a receipt is not passed if posting from a prepayment S X=$G(^RCY(344,+RCRECTDA,0)) I X'="" D . S DR=DR_"13////"_$P(X,"^")_";" . S DR=DR_"5.02////"_$P($G(^RCY(344.1,+$P(X,"^",6),0)),"^")_" / "_$P(X,"^")_" / "_RCPAYDA_";" ; ; determine if DOJ, RC, TOP, or IRS payment S RCTYPE=$P($G(^RC(341.1,+$P($G(^RCY(344,+RCRECTDA,0)),"^",4),0)),"^",2) S RCTYPE=$S(RCTYPE=5:"DOJ",RCTYPE=3:"RC",RCTYPE=13:"TOP",RCTYPE=11:"IRS",1:"") I RCTYPE="" S RCTYPE=$P($G(^PRCA(430,RCBILLDA,6)),"^",5) I RCTYPE'="" S:RCTYPE="DC" RCTYPE="RC" S DR=DR_"7////"_RCTYPE_";" S X=$$EDIT433^RCBEUTRA(RCTRANDA,DR) I 'X S RCTRANDA="0^Unable to set fields for transaction "_RCTRANDA L -^PRCA(433,RCTRANDA) Q ; ; if TOP, decrement current top debt amount (field 4.03 in file 340) I RCTYPE="TOP" D TOPAMT^RCBEUDEB(RCBILLDA,-RCTOTAL) ; ; if there is a repayment plan, set as being paid in file 430 ; loop thru all repayment plans and keep paying them off till ; you run out of money. this code is for double payments. S RCREPAMT=$P($G(^PRCA(430,RCBILLDA,4)),"^",3) ; is there a repayment amount and is the total amt equal to ; or greater than the expected repayment amount? I RCREPAMT,RCTOTAL'