- RCDPLPL4 ;ALB/SAB - Multiple Bill Link Payments ;17 Mar 16
- ;;4.5;Accounts Receivable;**304,301,321,326,332**;Mar 20, 1995;Build 40
- ;;Per VA Directive 6402, this routine should not be modified.
- ;
- Q
- ;
- MULTIPLE(RCRECTDA,RCTRANDA,RCGECSCR,RCSTATUS) ; Process multiple bills for the same receipt transaction.
- ;
- N RCAMT,RCCT,RCAMTRM,RCEXIT,RCMSG,RCNWTRAN,RCTACCT,RCTAMT,RCTDATA,RCACT,RCARRAY,RCEXT,RCRSP,RCSPRSS
- N RCDACNO,I,RCNM,RCBLIEN,RCDACNOI,RCUNAPN,RCQTSP,RCANS,RCDACT,RCDATA,RCPIEN,RCTACCTT
- N RCTAMT,RCTCMT,RCTDNM,RCUNRCN,RCDCHKSW,HRCDCKSW
- ;
- S (RCSPRSS,RCEXIT,RCCT)=0
- S RCTDATA=$G(^RCY(344,RCRECTDA,1,RCTRANDA,0))
- I RCTDATA="" D Q
- . S RCMSG="The initial receipt transaction data is missing. Unable to link a claim to this transaction."
- . D WRITE^RCDPRPLU(RCMSG)
- ;
- ; Retrieve payment amount on the transaction
- S (RCAMT,RCAMTRM)=+$P(RCTDATA,U,4)
- ;
- I RCAMT=0 D Q
- . S RCMSG="The transaction balance is 0. Unable to link a claim to this transaction."
- . D WRITE^RCDPRPLU(RCMSG)
- ;
- ;Retrieve list of Bills to link to payment
- F D Q:RCAMTRM=0 Q:RCEXIT
- . ;
- . ;Re-init the suspense quit flag
- . S RCQTSP=0
- . ;
- . ;Ask the user for the account
- . S RCDCHKSW=1,HRCDCKSW=0,RCACCT=$$GETACCT(RCRECTDA) I RCDCHKSW=0 W ! Q ;prca*4.5*301
- . I RCACCT=-1 D Q
- . . S RCRSP=$$CONQUIT()
- . . S:RCRSP=1 RCEXIT=1
- . ;
- . I RCACCT=0 D Q
- . . W !,?6,"Invalid Bill Number, Please try again...."
- . S:RCACCT="SUSPENSE" RCACCT="" ;Payment needs to remain in suspense.
- . ;
- . ;Ask the user for the amount
- . S RCAMT=$$GETAMT(RCACCT,RCAMTRM)
- . Q:RCAMT=-1
- . ;
- . ;Ask the user for Comment if no account is entered.
- . S RCCMT=""
- . I RCACCT="" S RCCMT=$$GETCMT()
- . ;timed out or ^ - exit.
- . I (RCCMT=-1)!(RCCMT="^") Q
- . ;
- . ;Update the array and amount remaining.
- . S RCCT=RCCT+1
- . S RCARRAY(RCCT)=RCACCT_U_RCAMT_U_RCCMT_U_$$GETACTNM(RCACCT)
- . S RCAMTRM=RCAMTRM-RCAMT
- . ;
- . ;Check to see if user wishes to continue
- . I RCAMTRM>0 D
- . . ;
- . . ;ask if user wishes to continue
- . . S RCRSP=$$CONTINUE(RCAMTRM)
- . . ;
- . . ;User wishes to continue
- . . Q:RCRSP=1
- . . ;
- . . ;if no, ask if user is sure and that all selected payments will not be linked.
- . . S RCRSP=$$CONQUIT()
- . . I RCRSP=1 S RCEXIT=1
- ;
- ; If the user is exiting before completion, quit.
- Q:RCEXIT
- ;
- ;State all money is disbursed and display all accounts for confirmation
- W !!,"*** RECEIPT HAS BEEN FULLY DISBURSED ***",!
- ;
- ; Ask if user wishes to review the list again
- S RCANS=$$GETANS(1)
- ;
- ;Spacing line
- W !
- ;
- ; Review the list if necessary
- I RCANS=1 D
- . S I=0
- . W !,?5,"PATIENT NAME",?36,"ACCOUNT",?50,"PAYMENT TO APPLY",!
- . F I=1:1:RCCT D
- . . S (RCNM,RCDACNO,RCDACNOI)=""
- . . S RCDATA=$G(RCARRAY(I))
- . . S RCDACT=$P(RCDATA,U)
- . . S:RCDACT="" RCNM="SUSPENSE"
- . . I RCDACT[";DPT" D
- . . . S RCNM=$P($G(^DPT($P(RCDACT,";"),0)),U)
- . . . S RCDACNO=""
- . . I RCDACT[";PRCA" D
- . . . S RCDACNOI=$P(RCDACT,";")
- . . . S RCDACNO=$P($G(^PRCA(430,$P(RCDACNOI,U),0)),U)
- . . . S RCPIEN=$P($G(^DGCR(399,RCDACNOI,0)),U,2)
- . . . I RCPIEN="" S RCNM="PATIENT NAME NOT FOUND" Q
- . . . S RCNM=$P($G(^DPT(RCPIEN,0)),U)
- . . . I RCNM="" S RCNM="PATIENT NAME NOT FOUND"
- . . W ?5,RCNM,?36,RCDACNO,?50,"$",$J($FN($P(RCDATA,U,2),",",2),15),!
- ;
- ; Ask the user if they wish to update. Quit if they time out, "^" out, or say No to updating.
- S RCANS=$$GETANS(2)
- Q:RCANS'=1
- ;
- ;Initialize error flag
- S RCERROR=0
- ;
- ;Surpress PNORBILL^RCDPURED output
- S RCSPRSS=1
- ;
- ;create line spacing
- W !!
- ;
- ;Link the payments
- F RCACT=1:1:RCCT D Q:RCERROR
- . ;
- . ;Extract data to update
- . S RCTAMT=$P(RCARRAY(RCACT),U,2) ;Payment Amount
- . S RCTACCT=$P(RCARRAY(RCACT),U,1) ;Account to link to.
- . S RCTCMT=$P(RCARRAY(RCACT),U,3)
- . S RCTDNM=$P(RCARRAY(RCACT),U,4)
- . S RCTACCTT=$S(RCTACCT="":"the Suspense Item",1:RCTACCT)
- . ;
- . ;If not the first transaction, create a new one
- . I RCACT'=1 D Q
- . . ;
- . . ; Create new transaction
- . . S RCNWTRAN=$$COPYTRAN(RCRECTDA,RCTDATA,RCTAMT,RCGECSCR)
- . . ;
- . . ; Link the Payment using the display name
- . . D LINKPAY(RCRECTDA,RCNWTRAN,RCTDNM)
- . . ;
- . . ; build unapplied deposit number
- . . S RCUNRCN=$P($G(^RCY(344,RCRECTDA,0)),U)
- . . S RCUNAPN=$S($L(RCUNRCN)>9:$E(RCUNRCN,$L(RCUNRCN-9),$L(RCUNRCN)),1:RCUNRCN)
- . . S RCUNAPN=RCUNAPN_$E("0000",1,4-$L(RCNWTRAN))_RCNWTRAN
- . . D SETUNAPP^RCDPURET(RCRECTDA,RCNWTRAN,RCUNAPN) ; add new unapplied deposit #
- . . ;
- . . ; If creating a new suspense item, update the comment field and audit logs
- . . I RCTCMT'="" D
- . . . ;
- . . . D UPDCMT(RCRECTDA,RCNWTRAN,RCTCMT) ; add comment
- . . . I $G(RCGECSCR)'="" D
- . . . . D AUDIT^RCBEPAY(RCRECTDA,RCNWTRAN,"I")
- . . . . D SUSPDIS^RCBEPAY(RCRECTDA,RCNWTRAN,"P")
- . . . W !,"***** PAYMENT AMOUNT LEFT IN SUSPENSE = $",$J(RCTAMT,"",2)," ... done."
- . . ;
- . . ; If linking an account, process the linking
- . . I RCTCMT="" D
- . . . ;
- . . . ; If the receipt has been processed, process the payment
- . . . I $G(RCGECSCR)'="" D Q
- . . . . W !,RCTDNM," - Updating the Linked Account with PMT = $",$J(RCTAMT,"",2)," ... done."
- . . . . D REMCMT(RCRECTDA,RCNWTRAN) ; Remove the supense comment. No longer needed.
- . . . . D PROCESS(RCRECTDA,RCNWTRAN,RCTDNM)
- . . . ;
- . . . ; The receipt has not been processed
- . . . W !,RCTDNM," - Receipt has not been processed. Account linked but not"
- . . . W !,?6,"updated for the PMT = $",$J(RCTAMT,"",2)
- . ;
- . ;If this is the first transaction, adjust the payment amount to be the amount not split out.
- . I RCACT=1 D
- . . ;
- . . ; Modify the original payment amount
- . . D ADJTRAMT(RCRECTDA,RCTRANDA,RCTAMT,RCGECSCR,.RCARRAY) ; Added RCARRAY - PRCA*4.5*326
- . . ;
- . . ; Adjusting the amount in suspense, update the comment field and audit logs
- . . I RCTCMT'="" D Q
- . . . D UPDCMT(RCRECTDA,RCTRANDA,RCTCMT) ; add comment
- . . . I $G(RCGECSCR)'="" D
- . . . . D AUDIT^RCBEPAY(RCRECTDA,RCTRANDA,"I")
- . . . . D SUSPDIS^RCBEPAY(RCRECTDA,RCTRANDA,"P")
- . . . W !,"***** PAYMENT AMOUNT LEFT IN SUSPENSE = $",$J(RCTAMT,"",2)," ... done."
- . . ;
- . . ; Link the Payment, send account if PRCA, Patient name in Patient
- . . D LINKPAY(RCRECTDA,RCTRANDA,RCTDNM)
- . . ;
- . . ;Remove the comment, item is no longer in suspense
- . . D REMCMT(RCRECTDA,RCTRANDA)
- . . ;
- . . ; If the receipt has been processed, process the payment
- . . I $G(RCGECSCR)'="" D Q
- . . . W !,RCTDNM," - Updating the Linked Account with PMT = $",$J(RCTAMT,"",2)," ... done."
- . . . D PROCESS(RCRECTDA,RCTRANDA,RCTDNM)
- . . ;
- . . ; The receipt has not been processed
- . . W !,RCTDNM," - Receipt has not been processed. Account linked but not"
- . . W !,?6,"updated for the PMT = $",$J(RCTAMT,"",2)
- ;
- ; PRCA*4.5*332 - If all money was split off the original EEOB remove it.
- D CHKEOB^RCDPEU2(RCRECTDA,RCTRANDA,.RCARRAY)
- ;
- W !!
- ;
- D ENDMSG(RCSTATUS)
- ;
- D WRITE^RCDPRPLU(" ")
- ;
- Q
- ;
- GETACCT(RCRECTDA) ; Ask the user for the account
- ;
- N X,Y,DTOUT,DUOUT,DIR,DIROUT,DIRUT,DA,RCSUSFLG,RCSTAT
- ;
- S RCSUSFLG=0
- S DIR("A")="BILL NUMBER: ",DIR(0)="FAO"
- S DIR("PRE")="I X=""SUSPENSE"" S X=""^"",RCSUSFLG=1"
- D ^DIR
- Q:RCSUSFLG "SUSPENSE"
- I $D(DTOUT)!$D(DUOUT)!(Y="") Q -1
- ;
- ;Force to all caps
- S Y=$$UP^XLFSTR(Y)
- ;
- ; Check for valid bill number
- I '$O(^PRCA(430,"D",Y,"")) S Y="" ; Not a valid bill number
- ;
- Q:Y="" 0 ; quit if invalid bill number or lookup number
- ;
- S X=Y
- S DA(1)=RCRECTDA
- D PNORBILL^RCDPURED
- ;
- ;if this is an account, is it active? If not, request a new account.
- I $G(X)[";PRCA" D Q:RCSTAT'="ACTIVE" 0
- . S RCSTAT=$$GET1^DIQ(430,$P($G(X),";")_",",8,"E")
- . I RCSTAT'="ACTIVE",$P($G(^RCD(340,+$P(^PRCA(430,$P($G(X),";"),0),"^",9),0)),"^")[";DPT(" W !,"This bill's status is currently ",RCSTAT,".",!,"Please select a different account."
- ;
- ;Something went wrong. Try again.
- I '$D(X) Q 0
- ;
- ; Account found, return it
- Q X
- ;
- GETAMT(RCACCT,RCAMT) ; Ask the user for the amount
- ;
- N X,Y,DTOUT,DUOUT,DIR,DIROUT,DIRUT,DA,RCFLG,AMTFLG
- ;
- ;
- S RCFLG=0
- F D Q:RCFLG
- . S AMTFLG=1 ; Set amount flag check to 1 in case the account is a SUSPENSE account
- . S DIR("A")="Amount to apply to Account",DIR(0)="N^0.01:"_$J(RCAMT,"",2)_":2"
- . D ^DIR
- . I $D(DTOUT)!$D(DUOUT)!(Y="") S Y=-1,RCFLG=1 Q
- . ;If not a SUSPENSE account, check the balance.
- . I RCACCT'="" S AMTFLG=$$PAYCHK(RCACCT,Y)
- . ;amount applied is greater than the amount owed. Try again
- . Q:'AMTFLG
- . I +Y>0 S RCFLG=1 Q
- . S Y=0,RCFLG=1
- Q Y
- ;
- GETCMT() ; Ask the user for a comment
- ;
- N X,Y,DTOUT,DUOUT,DIR,DIROUT,DIRUT
- F D Q:Y'=""
- . S Y=$$COM^RCDPECH ; PRCA*4.5*321
- . ;strip all leading and trailing spaces
- . S Y=$$TRIM^XLFSTR(Y)
- . I Y="" W !,"A comment is required when changing the status of an item in Suspense. Please",!,"try again." Q
- . I $D(DTOUT) S Y=-1
- Q Y
- ;
- CONTINUE(RCAMTRM) ; Ask the user to see if they wish to continue
- ;
- N X,Y,DTOUT,DUOUT,DIR,DIROUT,DIRUT
- S DIR("A")="Receipt has $"_$J(RCAMTRM,10,2)_" left to link. Do you wish to link another? ",DIR(0)="YA"
- D ^DIR
- I $D(DTOUT)!$D(DUOUT)!(Y="") Q -1
- Q Y
- ;
- ; Confirm with the user that the wish to stop before completing the linking of payments
- CONQUIT() ;
- ;
- N X,Y,DTOUT,DUOUT,DIR,DIROUT,DIRUT
- S DIR("A",1)="Exiting now will prevent the linking of any previously selected claims to this"
- S DIR("A")="receipt. Are you sure? ",DIR(0)="YA"
- D ^DIR
- I $D(DTOUT)!$D(DUOUT)!(Y="") Q 1
- Q Y
- ;
- ;Create a new transaction using an existing transaction as the foundation.
- COPYTRAN(RCRECTDA,RCTDATA,RCAMT,RCGECSCR) ;
- ; Input
- ; RCRECTDA - IEN of Receipt file #344
- ; RCPAYDA - IEN of Receipt Transaction file #344.01
- ; RCAMT - Amount
- ; RCGECSCR - null = receipt not processed
- ; Output
- ; Update Receipt file #344 and Audit log #344,71
- ;
- N RCNWTRAN,DR,DA,DTOUT,DIE,X,Y,RCTDATA3
- ;
- S RCTDATA3=$G(^RCY(344,RCRECTDA,1,RCTRANDA,3))
- ;Create a new transaction
- S RCNWTRAN=$$ADDTRAN^RCDPURET(RCRECTDA)
- S RCCMT="Multi-Trans Split"
- ;
- ;Update Transaction
- S DR=".02////"_$P(RCTDATA,U,2) ;Original Confirmation #
- S DR=DR_";.04///"_RCAMT ;Amount
- S DR=DR_";.06////"_$P(RCTDATA,U,6) ;Original date of payment
- S DR=DR_";.07////"_$P(RCTDATA,U,7) ;Original Check #
- S DR=DR_";.08////"_$P(RCTDATA,U,8) ;Original Check routing #
- S DR=DR_";.1////"_$P(RCTDATA,U,10) ;Original date on the check
- S DR=DR_";.11////"_$P(RCTDATA,U,11) ;Original CC number
- S DR=DR_";.12////"_$P(RCTDATA,U,12) ;Original user who entered the check
- S DR=DR_";.13////"_$P(RCTDATA,U,13) ;Original check account #
- S DR=DR_";.14///"_DUZ ;User Linking the payment
- S DR=DR_";1.02////"_RCCMT ;Initial Comment
- S DR=DR_";3.02////"_$P(RCTDATA3,U,2) ;Date Trans. originally suspense
- S DR=DR_";3.03////"_$P(RCTDATA3,U,3) ;User who originally suspended Trans.
- S DIE="^RCY(344,"_RCRECTDA_",1,"
- S DA=RCNWTRAN,DA(1)=RCRECTDA
- D ^DIE
- S $P(^RCY(344,RCRECTDA,1,RCNWTRAN,0),"^",19)=$G(RCDPTYPE)
- ;
- ;Update the Audit Log
- I $G(RCGECSCR)'="" D AUDIT^RCBEPAY(RCRECTDA,RCNWTRAN,"I")
- ;
- Q RCNWTRAN
- ;
- ;Adjust the original transaction's payment amount to match to the actual, split amount.
- ADJTRAMT(RCRECTDA,RCTRANDA,RCAMT,RCGECSCR,RCARRAY) ; Added RCARRAY - PRCA*4.5*326
- ; Input
- ; RCRECTDA - IEN of Receipt file #344
- ; RCPAYDA - IEN of Receipt Transaction file #344.01
- ; RCAMT - Amount
- ; RCGECSCR - null = receipt not processed
- ; RCARRAY - Array of Multi-Trans split information (OPTIONAL)
- ; Output
- ; Update Receipt file #344 and Audit log #344,71
- ;
- N RCCMT,DR,DIE,DA,DTOUT
- S RCCMT="Multi-Trans Split"
- ;
- S DR=".04///"_RCAMT_";1.02///"_RCCMT
- S DIE="^RCY(344,"_RCRECTDA_",1,"
- S DA=RCTRANDA,DA(1)=RCRECTDA
- D ^DIE
- D LASTEDIT^RCDPUREC(RCRECTDA)
- ;
- ;Update the Audit Log
- I $G(RCGECSCR)'="" D AUDIT^RCBEPAY(RCRECTDA,RCTRANDA,"I",.RCARRAY) ; Added RCARRAY - PRCA*4.5*326
- ;Update comment history - PRCA*4.5*321
- D AUDIT^RCDPECH(RCRECTDA,RCTRANDA,"","")
- Q
- ;
- ;Link the Transaction to an existing account
- LINKPAY(RCRECTDA,RCTRANDA,RCACCT) ;
- ;
- N DR,DIE,DA,DTOUT
- S DR=".09///"_RCACCT
- S DIE="^RCY(344,"_RCRECTDA_",1,"
- S DA=RCTRANDA,DA(1)=RCRECTDA
- D ^DIE
- D LASTEDIT^RCDPUREC(RCRECTDA)
- Q
- ;
- ;Remove the suspense comment, item no longer in suspense
- REMCMT(RCRECTDA,RCTRANDA) ;
- ;
- N DR,DIE,DA,DTOUT
- S DR="1.02///@"
- S DIE="^RCY(344,"_RCRECTDA_",1,"
- S DA=RCTRANDA,DA(1)=RCRECTDA
- D ^DIE
- D LASTEDIT^RCDPUREC(RCRECTDA)
- Q
- ;
- GETACTNM(RCACCT) ;
- N RCACCTL,RCIEN,RCFILE
- S RCACCTL=""
- Q:RCACCT="" RCACCTL
- S RCFILE=$S(RCACCT[";PRCA(430":430,1:2)
- S RCIEN=$P(RCACCT,";")
- S RCACCTL=$$GET1^DIQ(RCFILE,RCIEN_",",".01","E")
- S:$L(RCACCTL,"-")>1 RCACCTL=$P(RCACCTL,"-",2)
- Q RCACCTL
- ;
- ;Update the suspense comment
- UPDCMT(RCRECTDA,RCTRANDA,RCCMT) ;
- ;
- N DR,DIE,DA,DTOUT
- S DR="1.02///"_RCCMT_";" S DIE="^RCY(344,"_RCRECTDA_",1,"
- S DA=RCTRANDA,DA(1)=RCRECTDA
- D ^DIE
- ;Update comment history - PRCA*4.5*321
- D AUDIT^RCDPECH(RCRECTDA,RCTRANDA,"","")
- Q
- ;
- ;Process and update the payment amounts
- ;Note: some of the code and logic below is also in tag PROCESS^RCDPLPL3.
- ; If changes in logic are made below, please review this tag as well.
- PROCESS(RCRECTDA,RCTRANDA,RCTDNM) ;
- ;
- N RCERROR
- S RCERROR=$$PROCESS^RCBEPAY(RCRECTDA,RCTRANDA)
- ; an error occurred during processing a payment
- I RCERROR D Q
- . W !
- . W !,"+------------------------------------------------------------------------------+"
- . W !,"| An ERROR has occurred when processing payment ",RCTRANDA," on receipt ",$P(^RCY(344,RCRECTDA,0),"^"),".",?79,"|"
- . W !,"| The error message returned during processing is:",?79,"|"
- . W !,"|",?79,"|"
- . W !,"| ",$P(RCERROR,"^",2),?79,"|"
- . W !,"|",?79,"|"
- . W !,"| You will need to correct the error before you can link the payment.",?79,"|"
- . W !,"+------------------------------------------------------------------------------+"
- . W !
- . D DELEACCT^RCDPURET(RCRECTDA,RCTRANDA)
- . W !,"Account "_RCTDNM_" was deleted and not linked."
- ;
- ;File entry in Audit Log
- D AUDIT^RCBEPAY(RCRECTDA,RCTRANDA,"P")
- ;
- ; Update Suspense Status
- D SUSPDIS^RCBEPAY(RCRECTDA,RCTRANDA,"PD")
- ;
- I $E(RCSTATUS)="A" D
- . ; send mail message to the RCDP PAYMENTS mail group
- . D MAILMSG^RCDPLPSR(RCRECTDA,RCTRANDA)
- . ; place an x in the fms doc field so it will show on the
- . ; suspense report
- . D EDITFMS^RCDPURET(RCRECTDA,RCTRANDA,"x")
- Q
- ;
- ;Display end of processing message.
- ENDMSG(RCSTATUS) ;
- ;
- I $E(RCSTATUS)="A" D
- . W !,"Since the FMS cash receipt document is Accepted in FMS, you need to go"
- . W !,"online in FMS and transfer the amount paid out of the station's suspense"
- . W !,"account.",!
- . W !,"Mail message(s) sent to RCDP PAYMENTS mail group.",!
- I $E(RCSTATUS)'="A" D
- . W !,"Since the FMS cash receipt document is NOT Accepted in FMS, you can use"
- . W !,"the option Process Receipt located under the Receipt Processing Menu"
- . W !,"to regenerate the cash receipt document to FMS.",!
- Q
- ;
- ;Get users answers to questions for reports.
- GETANS(RCIDX) ;
- N DA,DIR,DTOUT,DUOUT,X,Y,DIRUT,DIROUT
- ;
- ; Ask the user what kind of report
- I RCIDX=1 D
- . S DIR("?")="Select to Y to review the payments, N to skip the review."
- . S DIR("A")="Do you want to review the payment list before updating accounts (Y/N)? "
- ;
- ; Ask the user for the payer to start the reporting on (Range Option)
- I RCIDX=2 D
- . S DIR("?")="Enter Y to update the accounts, N to return to the LP menu"
- . S DIR("A")="Do you want to update accounts with these payments (Y/N)? "
- ;
- S DIR(0)="YA"
- D ^DIR
- K DIR
- I $G(DTOUT)!$G(DUOUT) Q -1
- Q Y
- ;
- ;Retrieve the review response question from the user
- GETANS1() ;
- ;
- N FLG,X,Y
- S FLG=0,Y=0
- F D Q:FLG=1
- . R !,"Do you want to review the payment list before updating accounts (Y/N)? ",X:DTIME
- . ;I $G(DTOUT) S FLG=1 Q ;If it times out, treat it like a No and go to the next prompt.
- . I X="" W !,"Enter Y or N to continue." Q
- . I X["?" W !,"Select to Y to review the payments, N to skip the review." Q
- . S X=$$UP^XLFSTR(X)
- . I X="Y" S Y=1,FLG=1 Q
- . I X="N" S Y=0,FLG=1 Q
- . W !,"Select to Y to review the payments, N to skip the review."
- Q Y
- ;
- ;Is the amount entered < the amount owed. (AR ACCOUNTS ONLY, NO DEBTORS)
- PAYCHK(RCACCT,RCAMT) ;
- ;
- N OWED,FLG
- ;
- S FLG=0
- ; account is the debtor account. No need to check...
- Q:RCACCT'["PRCA" 1
- ; calculate amount owed for a bill
- S OWED=$G(^PRCA(430,+RCACCT,7))
- S OWED=$P(OWED,"^")+$P(OWED,"^",2)+$P(OWED,"^",3)+$P(OWED,"^",4)+$P(OWED,"^",5)
- I RCAMT>OWED W !,"The requested payment is greater than then amount owed please try again.",! Q FLG
- S FLG=1
- Q FLG
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRCDPLPL4 16959 printed Mar 13, 2025@20:50:45 Page 2
- RCDPLPL4 ;ALB/SAB - Multiple Bill Link Payments ;17 Mar 16
- +1 ;;4.5;Accounts Receivable;**304,301,321,326,332**;Mar 20, 1995;Build 40
- +2 ;;Per VA Directive 6402, this routine should not be modified.
- +3 ;
- +4 QUIT
- +5 ;
- MULTIPLE(RCRECTDA,RCTRANDA,RCGECSCR,RCSTATUS) ; Process multiple bills for the same receipt transaction.
- +1 ;
- +2 NEW RCAMT,RCCT,RCAMTRM,RCEXIT,RCMSG,RCNWTRAN,RCTACCT,RCTAMT,RCTDATA,RCACT,RCARRAY,RCEXT,RCRSP,RCSPRSS
- +3 NEW RCDACNO,I,RCNM,RCBLIEN,RCDACNOI,RCUNAPN,RCQTSP,RCANS,RCDACT,RCDATA,RCPIEN,RCTACCTT
- +4 NEW RCTAMT,RCTCMT,RCTDNM,RCUNRCN,RCDCHKSW,HRCDCKSW
- +5 ;
- +6 SET (RCSPRSS,RCEXIT,RCCT)=0
- +7 SET RCTDATA=$GET(^RCY(344,RCRECTDA,1,RCTRANDA,0))
- +8 IF RCTDATA=""
- Begin DoDot:1
- +9 SET RCMSG="The initial receipt transaction data is missing. Unable to link a claim to this transaction."
- +10 DO WRITE^RCDPRPLU(RCMSG)
- End DoDot:1
- QUIT
- +11 ;
- +12 ; Retrieve payment amount on the transaction
- +13 SET (RCAMT,RCAMTRM)=+$PIECE(RCTDATA,U,4)
- +14 ;
- +15 IF RCAMT=0
- Begin DoDot:1
- +16 SET RCMSG="The transaction balance is 0. Unable to link a claim to this transaction."
- +17 DO WRITE^RCDPRPLU(RCMSG)
- End DoDot:1
- QUIT
- +18 ;
- +19 ;Retrieve list of Bills to link to payment
- +20 FOR
- Begin DoDot:1
- +21 ;
- +22 ;Re-init the suspense quit flag
- +23 SET RCQTSP=0
- +24 ;
- +25 ;Ask the user for the account
- +26 ;prca*4.5*301
- SET RCDCHKSW=1
- SET HRCDCKSW=0
- SET RCACCT=$$GETACCT(RCRECTDA)
- IF RCDCHKSW=0
- WRITE !
- QUIT
- +27 IF RCACCT=-1
- Begin DoDot:2
- +28 SET RCRSP=$$CONQUIT()
- +29 if RCRSP=1
- SET RCEXIT=1
- End DoDot:2
- QUIT
- +30 ;
- +31 IF RCACCT=0
- Begin DoDot:2
- +32 WRITE !,?6,"Invalid Bill Number, Please try again...."
- End DoDot:2
- QUIT
- +33 ;Payment needs to remain in suspense.
- if RCACCT="SUSPENSE"
- SET RCACCT=""
- +34 ;
- +35 ;Ask the user for the amount
- +36 SET RCAMT=$$GETAMT(RCACCT,RCAMTRM)
- +37 if RCAMT=-1
- QUIT
- +38 ;
- +39 ;Ask the user for Comment if no account is entered.
- +40 SET RCCMT=""
- +41 IF RCACCT=""
- SET RCCMT=$$GETCMT()
- +42 ;timed out or ^ - exit.
- +43 IF (RCCMT=-1)!(RCCMT="^")
- QUIT
- +44 ;
- +45 ;Update the array and amount remaining.
- +46 SET RCCT=RCCT+1
- +47 SET RCARRAY(RCCT)=RCACCT_U_RCAMT_U_RCCMT_U_$$GETACTNM(RCACCT)
- +48 SET RCAMTRM=RCAMTRM-RCAMT
- +49 ;
- +50 ;Check to see if user wishes to continue
- +51 IF RCAMTRM>0
- Begin DoDot:2
- +52 ;
- +53 ;ask if user wishes to continue
- +54 SET RCRSP=$$CONTINUE(RCAMTRM)
- +55 ;
- +56 ;User wishes to continue
- +57 if RCRSP=1
- QUIT
- +58 ;
- +59 ;if no, ask if user is sure and that all selected payments will not be linked.
- +60 SET RCRSP=$$CONQUIT()
- +61 IF RCRSP=1
- SET RCEXIT=1
- End DoDot:2
- End DoDot:1
- if RCAMTRM=0
- QUIT
- if RCEXIT
- QUIT
- +62 ;
- +63 ; If the user is exiting before completion, quit.
- +64 if RCEXIT
- QUIT
- +65 ;
- +66 ;State all money is disbursed and display all accounts for confirmation
- +67 WRITE !!,"*** RECEIPT HAS BEEN FULLY DISBURSED ***",!
- +68 ;
- +69 ; Ask if user wishes to review the list again
- +70 SET RCANS=$$GETANS(1)
- +71 ;
- +72 ;Spacing line
- +73 WRITE !
- +74 ;
- +75 ; Review the list if necessary
- +76 IF RCANS=1
- Begin DoDot:1
- +77 SET I=0
- +78 WRITE !,?5,"PATIENT NAME",?36,"ACCOUNT",?50,"PAYMENT TO APPLY",!
- +79 FOR I=1:1:RCCT
- Begin DoDot:2
- +80 SET (RCNM,RCDACNO,RCDACNOI)=""
- +81 SET RCDATA=$GET(RCARRAY(I))
- +82 SET RCDACT=$PIECE(RCDATA,U)
- +83 if RCDACT=""
- SET RCNM="SUSPENSE"
- +84 IF RCDACT[";DPT"
- Begin DoDot:3
- +85 SET RCNM=$PIECE($GET(^DPT($PIECE(RCDACT,";"),0)),U)
- +86 SET RCDACNO=""
- End DoDot:3
- +87 IF RCDACT[";PRCA"
- Begin DoDot:3
- +88 SET RCDACNOI=$PIECE(RCDACT,";")
- +89 SET RCDACNO=$PIECE($GET(^PRCA(430,$PIECE(RCDACNOI,U),0)),U)
- +90 SET RCPIEN=$PIECE($GET(^DGCR(399,RCDACNOI,0)),U,2)
- +91 IF RCPIEN=""
- SET RCNM="PATIENT NAME NOT FOUND"
- QUIT
- +92 SET RCNM=$PIECE($GET(^DPT(RCPIEN,0)),U)
- +93 IF RCNM=""
- SET RCNM="PATIENT NAME NOT FOUND"
- End DoDot:3
- +94 WRITE ?5,RCNM,?36,RCDACNO,?50,"$",$JUSTIFY($FNUMBER($PIECE(RCDATA,U,2),",",2),15),!
- End DoDot:2
- End DoDot:1
- +95 ;
- +96 ; Ask the user if they wish to update. Quit if they time out, "^" out, or say No to updating.
- +97 SET RCANS=$$GETANS(2)
- +98 if RCANS'=1
- QUIT
- +99 ;
- +100 ;Initialize error flag
- +101 SET RCERROR=0
- +102 ;
- +103 ;Surpress PNORBILL^RCDPURED output
- +104 SET RCSPRSS=1
- +105 ;
- +106 ;create line spacing
- +107 WRITE !!
- +108 ;
- +109 ;Link the payments
- +110 FOR RCACT=1:1:RCCT
- Begin DoDot:1
- +111 ;
- +112 ;Extract data to update
- +113 ;Payment Amount
- SET RCTAMT=$PIECE(RCARRAY(RCACT),U,2)
- +114 ;Account to link to.
- SET RCTACCT=$PIECE(RCARRAY(RCACT),U,1)
- +115 SET RCTCMT=$PIECE(RCARRAY(RCACT),U,3)
- +116 SET RCTDNM=$PIECE(RCARRAY(RCACT),U,4)
- +117 SET RCTACCTT=$SELECT(RCTACCT="":"the Suspense Item",1:RCTACCT)
- +118 ;
- +119 ;If not the first transaction, create a new one
- +120 IF RCACT'=1
- Begin DoDot:2
- +121 ;
- +122 ; Create new transaction
- +123 SET RCNWTRAN=$$COPYTRAN(RCRECTDA,RCTDATA,RCTAMT,RCGECSCR)
- +124 ;
- +125 ; Link the Payment using the display name
- +126 DO LINKPAY(RCRECTDA,RCNWTRAN,RCTDNM)
- +127 ;
- +128 ; build unapplied deposit number
- +129 SET RCUNRCN=$PIECE($GET(^RCY(344,RCRECTDA,0)),U)
- +130 SET RCUNAPN=$SELECT($LENGTH(RCUNRCN)>9:$EXTRACT(RCUNRCN,$LENGTH(RCUNRCN-9),$LENGTH(RCUNRCN)),1:RCUNRCN)
- +131 SET RCUNAPN=RCUNAPN_$EXTRACT("0000",1,4-$LENGTH(RCNWTRAN))_RCNWTRAN
- +132 ; add new unapplied deposit #
- DO SETUNAPP^RCDPURET(RCRECTDA,RCNWTRAN,RCUNAPN)
- +133 ;
- +134 ; If creating a new suspense item, update the comment field and audit logs
- +135 IF RCTCMT'=""
- Begin DoDot:3
- +136 ;
- +137 ; add comment
- DO UPDCMT(RCRECTDA,RCNWTRAN,RCTCMT)
- +138 IF $GET(RCGECSCR)'=""
- Begin DoDot:4
- +139 DO AUDIT^RCBEPAY(RCRECTDA,RCNWTRAN,"I")
- +140 DO SUSPDIS^RCBEPAY(RCRECTDA,RCNWTRAN,"P")
- End DoDot:4
- +141 WRITE !,"***** PAYMENT AMOUNT LEFT IN SUSPENSE = $",$JUSTIFY(RCTAMT,"",2)," ... done."
- End DoDot:3
- +142 ;
- +143 ; If linking an account, process the linking
- +144 IF RCTCMT=""
- Begin DoDot:3
- +145 ;
- +146 ; If the receipt has been processed, process the payment
- +147 IF $GET(RCGECSCR)'=""
- Begin DoDot:4
- +148 WRITE !,RCTDNM," - Updating the Linked Account with PMT = $",$JUSTIFY(RCTAMT,"",2)," ... done."
- +149 ; Remove the supense comment. No longer needed.
- DO REMCMT(RCRECTDA,RCNWTRAN)
- +150 DO PROCESS(RCRECTDA,RCNWTRAN,RCTDNM)
- End DoDot:4
- QUIT
- +151 ;
- +152 ; The receipt has not been processed
- +153 WRITE !,RCTDNM," - Receipt has not been processed. Account linked but not"
- +154 WRITE !,?6,"updated for the PMT = $",$JUSTIFY(RCTAMT,"",2)
- End DoDot:3
- End DoDot:2
- QUIT
- +155 ;
- +156 ;If this is the first transaction, adjust the payment amount to be the amount not split out.
- +157 IF RCACT=1
- Begin DoDot:2
- +158 ;
- +159 ; Modify the original payment amount
- +160 ; Added RCARRAY - PRCA*4.5*326
- DO ADJTRAMT(RCRECTDA,RCTRANDA,RCTAMT,RCGECSCR,.RCARRAY)
- +161 ;
- +162 ; Adjusting the amount in suspense, update the comment field and audit logs
- +163 IF RCTCMT'=""
- Begin DoDot:3
- +164 ; add comment
- DO UPDCMT(RCRECTDA,RCTRANDA,RCTCMT)
- +165 IF $GET(RCGECSCR)'=""
- Begin DoDot:4
- +166 DO AUDIT^RCBEPAY(RCRECTDA,RCTRANDA,"I")
- +167 DO SUSPDIS^RCBEPAY(RCRECTDA,RCTRANDA,"P")
- End DoDot:4
- +168 WRITE !,"***** PAYMENT AMOUNT LEFT IN SUSPENSE = $",$JUSTIFY(RCTAMT,"",2)," ... done."
- End DoDot:3
- QUIT
- +169 ;
- +170 ; Link the Payment, send account if PRCA, Patient name in Patient
- +171 DO LINKPAY(RCRECTDA,RCTRANDA,RCTDNM)
- +172 ;
- +173 ;Remove the comment, item is no longer in suspense
- +174 DO REMCMT(RCRECTDA,RCTRANDA)
- +175 ;
- +176 ; If the receipt has been processed, process the payment
- +177 IF $GET(RCGECSCR)'=""
- Begin DoDot:3
- +178 WRITE !,RCTDNM," - Updating the Linked Account with PMT = $",$JUSTIFY(RCTAMT,"",2)," ... done."
- +179 DO PROCESS(RCRECTDA,RCTRANDA,RCTDNM)
- End DoDot:3
- QUIT
- +180 ;
- +181 ; The receipt has not been processed
- +182 WRITE !,RCTDNM," - Receipt has not been processed. Account linked but not"
- +183 WRITE !,?6,"updated for the PMT = $",$JUSTIFY(RCTAMT,"",2)
- End DoDot:2
- End DoDot:1
- if RCERROR
- QUIT
- +184 ;
- +185 ; PRCA*4.5*332 - If all money was split off the original EEOB remove it.
- +186 DO CHKEOB^RCDPEU2(RCRECTDA,RCTRANDA,.RCARRAY)
- +187 ;
- +188 WRITE !!
- +189 ;
- +190 DO ENDMSG(RCSTATUS)
- +191 ;
- +192 DO WRITE^RCDPRPLU(" ")
- +193 ;
- +194 QUIT
- +195 ;
- GETACCT(RCRECTDA) ; Ask the user for the account
- +1 ;
- +2 NEW X,Y,DTOUT,DUOUT,DIR,DIROUT,DIRUT,DA,RCSUSFLG,RCSTAT
- +3 ;
- +4 SET RCSUSFLG=0
- +5 SET DIR("A")="BILL NUMBER: "
- SET DIR(0)="FAO"
- +6 SET DIR("PRE")="I X=""SUSPENSE"" S X=""^"",RCSUSFLG=1"
- +7 DO ^DIR
- +8 if RCSUSFLG
- QUIT "SUSPENSE"
- +9 IF $DATA(DTOUT)!$DATA(DUOUT)!(Y="")
- QUIT -1
- +10 ;
- +11 ;Force to all caps
- +12 SET Y=$$UP^XLFSTR(Y)
- +13 ;
- +14 ; Check for valid bill number
- +15 ; Not a valid bill number
- IF '$ORDER(^PRCA(430,"D",Y,""))
- SET Y=""
- +16 ;
- +17 ; quit if invalid bill number or lookup number
- if Y=""
- QUIT 0
- +18 ;
- +19 SET X=Y
- +20 SET DA(1)=RCRECTDA
- +21 DO PNORBILL^RCDPURED
- +22 ;
- +23 ;if this is an account, is it active? If not, request a new account.
- +24 IF $GET(X)[";PRCA"
- Begin DoDot:1
- +25 SET RCSTAT=$$GET1^DIQ(430,$PIECE($GET(X),";")_",",8,"E")
- +26 IF RCSTAT'="ACTIVE"
- IF $PIECE($GET(^RCD(340,+$PIECE(^PRCA(430,$PIECE($GET(X),";"),0),"^",9),0)),"^")[";DPT("
- WRITE !,"This bill's status is currently ",RCSTAT,".",!,"Please select a different account."
- End DoDot:1
- if RCSTAT'="ACTIVE"
- QUIT 0
- +27 ;
- +28 ;Something went wrong. Try again.
- +29 IF '$DATA(X)
- QUIT 0
- +30 ;
- +31 ; Account found, return it
- +32 QUIT X
- +33 ;
- GETAMT(RCACCT,RCAMT) ; Ask the user for the amount
- +1 ;
- +2 NEW X,Y,DTOUT,DUOUT,DIR,DIROUT,DIRUT,DA,RCFLG,AMTFLG
- +3 ;
- +4 ;
- +5 SET RCFLG=0
- +6 FOR
- Begin DoDot:1
- +7 ; Set amount flag check to 1 in case the account is a SUSPENSE account
- SET AMTFLG=1
- +8 SET DIR("A")="Amount to apply to Account"
- SET DIR(0)="N^0.01:"_$JUSTIFY(RCAMT,"",2)_":2"
- +9 DO ^DIR
- +10 IF $DATA(DTOUT)!$DATA(DUOUT)!(Y="")
- SET Y=-1
- SET RCFLG=1
- QUIT
- +11 ;If not a SUSPENSE account, check the balance.
- +12 IF RCACCT'=""
- SET AMTFLG=$$PAYCHK(RCACCT,Y)
- +13 ;amount applied is greater than the amount owed. Try again
- +14 if 'AMTFLG
- QUIT
- +15 IF +Y>0
- SET RCFLG=1
- QUIT
- +16 SET Y=0
- SET RCFLG=1
- End DoDot:1
- if RCFLG
- QUIT
- +17 QUIT Y
- +18 ;
- GETCMT() ; Ask the user for a comment
- +1 ;
- +2 NEW X,Y,DTOUT,DUOUT,DIR,DIROUT,DIRUT
- +3 FOR
- Begin DoDot:1
- +4 ; PRCA*4.5*321
- SET Y=$$COM^RCDPECH
- +5 ;strip all leading and trailing spaces
- +6 SET Y=$$TRIM^XLFSTR(Y)
- +7 IF Y=""
- WRITE !,"A comment is required when changing the status of an item in Suspense. Please",!,"try again."
- QUIT
- +8 IF $DATA(DTOUT)
- SET Y=-1
- End DoDot:1
- if Y'=""
- QUIT
- +9 QUIT Y
- +10 ;
- CONTINUE(RCAMTRM) ; Ask the user to see if they wish to continue
- +1 ;
- +2 NEW X,Y,DTOUT,DUOUT,DIR,DIROUT,DIRUT
- +3 SET DIR("A")="Receipt has $"_$JUSTIFY(RCAMTRM,10,2)_" left to link. Do you wish to link another? "
- SET DIR(0)="YA"
- +4 DO ^DIR
- +5 IF $DATA(DTOUT)!$DATA(DUOUT)!(Y="")
- QUIT -1
- +6 QUIT Y
- +7 ;
- +8 ; Confirm with the user that the wish to stop before completing the linking of payments
- CONQUIT() ;
- +1 ;
- +2 NEW X,Y,DTOUT,DUOUT,DIR,DIROUT,DIRUT
- +3 SET DIR("A",1)="Exiting now will prevent the linking of any previously selected claims to this"
- +4 SET DIR("A")="receipt. Are you sure? "
- SET DIR(0)="YA"
- +5 DO ^DIR
- +6 IF $DATA(DTOUT)!$DATA(DUOUT)!(Y="")
- QUIT 1
- +7 QUIT Y
- +8 ;
- +9 ;Create a new transaction using an existing transaction as the foundation.
- COPYTRAN(RCRECTDA,RCTDATA,RCAMT,RCGECSCR) ;
- +1 ; Input
- +2 ; RCRECTDA - IEN of Receipt file #344
- +3 ; RCPAYDA - IEN of Receipt Transaction file #344.01
- +4 ; RCAMT - Amount
- +5 ; RCGECSCR - null = receipt not processed
- +6 ; Output
- +7 ; Update Receipt file #344 and Audit log #344,71
- +8 ;
- +9 NEW RCNWTRAN,DR,DA,DTOUT,DIE,X,Y,RCTDATA3
- +10 ;
- +11 SET RCTDATA3=$GET(^RCY(344,RCRECTDA,1,RCTRANDA,3))
- +12 ;Create a new transaction
- +13 SET RCNWTRAN=$$ADDTRAN^RCDPURET(RCRECTDA)
- +14 SET RCCMT="Multi-Trans Split"
- +15 ;
- +16 ;Update Transaction
- +17 ;Original Confirmation #
- SET DR=".02////"_$PIECE(RCTDATA,U,2)
- +18 ;Amount
- SET DR=DR_";.04///"_RCAMT
- +19 ;Original date of payment
- SET DR=DR_";.06////"_$PIECE(RCTDATA,U,6)
- +20 ;Original Check #
- SET DR=DR_";.07////"_$PIECE(RCTDATA,U,7)
- +21 ;Original Check routing #
- SET DR=DR_";.08////"_$PIECE(RCTDATA,U,8)
- +22 ;Original date on the check
- SET DR=DR_";.1////"_$PIECE(RCTDATA,U,10)
- +23 ;Original CC number
- SET DR=DR_";.11////"_$PIECE(RCTDATA,U,11)
- +24 ;Original user who entered the check
- SET DR=DR_";.12////"_$PIECE(RCTDATA,U,12)
- +25 ;Original check account #
- SET DR=DR_";.13////"_$PIECE(RCTDATA,U,13)
- +26 ;User Linking the payment
- SET DR=DR_";.14///"_DUZ
- +27 ;Initial Comment
- SET DR=DR_";1.02////"_RCCMT
- +28 ;Date Trans. originally suspense
- SET DR=DR_";3.02////"_$PIECE(RCTDATA3,U,2)
- +29 ;User who originally suspended Trans.
- SET DR=DR_";3.03////"_$PIECE(RCTDATA3,U,3)
- +30 SET DIE="^RCY(344,"_RCRECTDA_",1,"
- +31 SET DA=RCNWTRAN
- SET DA(1)=RCRECTDA
- +32 DO ^DIE
- +33 SET $PIECE(^RCY(344,RCRECTDA,1,RCNWTRAN,0),"^",19)=$GET(RCDPTYPE)
- +34 ;
- +35 ;Update the Audit Log
- +36 IF $GET(RCGECSCR)'=""
- DO AUDIT^RCBEPAY(RCRECTDA,RCNWTRAN,"I")
- +37 ;
- +38 QUIT RCNWTRAN
- +39 ;
- +40 ;Adjust the original transaction's payment amount to match to the actual, split amount.
- ADJTRAMT(RCRECTDA,RCTRANDA,RCAMT,RCGECSCR,RCARRAY) ; Added RCARRAY - PRCA*4.5*326
- +1 ; Input
- +2 ; RCRECTDA - IEN of Receipt file #344
- +3 ; RCPAYDA - IEN of Receipt Transaction file #344.01
- +4 ; RCAMT - Amount
- +5 ; RCGECSCR - null = receipt not processed
- +6 ; RCARRAY - Array of Multi-Trans split information (OPTIONAL)
- +7 ; Output
- +8 ; Update Receipt file #344 and Audit log #344,71
- +9 ;
- +10 NEW RCCMT,DR,DIE,DA,DTOUT
- +11 SET RCCMT="Multi-Trans Split"
- +12 ;
- +13 SET DR=".04///"_RCAMT_";1.02///"_RCCMT
- +14 SET DIE="^RCY(344,"_RCRECTDA_",1,"
- +15 SET DA=RCTRANDA
- SET DA(1)=RCRECTDA
- +16 DO ^DIE
- +17 DO LASTEDIT^RCDPUREC(RCRECTDA)
- +18 ;
- +19 ;Update the Audit Log
- +20 ; Added RCARRAY - PRCA*4.5*326
- IF $GET(RCGECSCR)'=""
- DO AUDIT^RCBEPAY(RCRECTDA,RCTRANDA,"I",.RCARRAY)
- +21 ;Update comment history - PRCA*4.5*321
- +22 DO AUDIT^RCDPECH(RCRECTDA,RCTRANDA,"","")
- +23 QUIT
- +24 ;
- +25 ;Link the Transaction to an existing account
- LINKPAY(RCRECTDA,RCTRANDA,RCACCT) ;
- +1 ;
- +2 NEW DR,DIE,DA,DTOUT
- +3 SET DR=".09///"_RCACCT
- +4 SET DIE="^RCY(344,"_RCRECTDA_",1,"
- +5 SET DA=RCTRANDA
- SET DA(1)=RCRECTDA
- +6 DO ^DIE
- +7 DO LASTEDIT^RCDPUREC(RCRECTDA)
- +8 QUIT
- +9 ;
- +10 ;Remove the suspense comment, item no longer in suspense
- REMCMT(RCRECTDA,RCTRANDA) ;
- +1 ;
- +2 NEW DR,DIE,DA,DTOUT
- +3 SET DR="1.02///@"
- +4 SET DIE="^RCY(344,"_RCRECTDA_",1,"
- +5 SET DA=RCTRANDA
- SET DA(1)=RCRECTDA
- +6 DO ^DIE
- +7 DO LASTEDIT^RCDPUREC(RCRECTDA)
- +8 QUIT
- +9 ;
- GETACTNM(RCACCT) ;
- +1 NEW RCACCTL,RCIEN,RCFILE
- +2 SET RCACCTL=""
- +3 if RCACCT=""
- QUIT RCACCTL
- +4 SET RCFILE=$SELECT(RCACCT[";PRCA(430":430,1:2)
- +5 SET RCIEN=$PIECE(RCACCT,";")
- +6 SET RCACCTL=$$GET1^DIQ(RCFILE,RCIEN_",",".01","E")
- +7 if $LENGTH(RCACCTL,"-")>1
- SET RCACCTL=$PIECE(RCACCTL,"-",2)
- +8 QUIT RCACCTL
- +9 ;
- +10 ;Update the suspense comment
- UPDCMT(RCRECTDA,RCTRANDA,RCCMT) ;
- +1 ;
- +2 NEW DR,DIE,DA,DTOUT
- +3 SET DR="1.02///"_RCCMT_";"
- SET DIE="^RCY(344,"_RCRECTDA_",1,"
- +4 SET DA=RCTRANDA
- SET DA(1)=RCRECTDA
- +5 DO ^DIE
- +6 ;Update comment history - PRCA*4.5*321
- +7 DO AUDIT^RCDPECH(RCRECTDA,RCTRANDA,"","")
- +8 QUIT
- +9 ;
- +10 ;Process and update the payment amounts
- +11 ;Note: some of the code and logic below is also in tag PROCESS^RCDPLPL3.
- +12 ; If changes in logic are made below, please review this tag as well.
- PROCESS(RCRECTDA,RCTRANDA,RCTDNM) ;
- +1 ;
- +2 NEW RCERROR
- +3 SET RCERROR=$$PROCESS^RCBEPAY(RCRECTDA,RCTRANDA)
- +4 ; an error occurred during processing a payment
- +5 IF RCERROR
- Begin DoDot:1
- +6 WRITE !
- +7 WRITE !,"+------------------------------------------------------------------------------+"
- +8 WRITE !,"| An ERROR has occurred when processing payment ",RCTRANDA," on receipt ",$PIECE(^RCY(344,RCRECTDA,0),"^"),".",?79,"|"
- +9 WRITE !,"| The error message returned during processing is:",?79,"|"
- +10 WRITE !,"|",?79,"|"
- +11 WRITE !,"| ",$PIECE(RCERROR,"^",2),?79,"|"
- +12 WRITE !,"|",?79,"|"
- +13 WRITE !,"| You will need to correct the error before you can link the payment.",?79,"|"
- +14 WRITE !,"+------------------------------------------------------------------------------+"
- +15 WRITE !
- +16 DO DELEACCT^RCDPURET(RCRECTDA,RCTRANDA)
- +17 WRITE !,"Account "_RCTDNM_" was deleted and not linked."
- End DoDot:1
- QUIT
- +18 ;
- +19 ;File entry in Audit Log
- +20 DO AUDIT^RCBEPAY(RCRECTDA,RCTRANDA,"P")
- +21 ;
- +22 ; Update Suspense Status
- +23 DO SUSPDIS^RCBEPAY(RCRECTDA,RCTRANDA,"PD")
- +24 ;
- +25 IF $EXTRACT(RCSTATUS)="A"
- Begin DoDot:1
- +26 ; send mail message to the RCDP PAYMENTS mail group
- +27 DO MAILMSG^RCDPLPSR(RCRECTDA,RCTRANDA)
- +28 ; place an x in the fms doc field so it will show on the
- +29 ; suspense report
- +30 DO EDITFMS^RCDPURET(RCRECTDA,RCTRANDA,"x")
- End DoDot:1
- +31 QUIT
- +32 ;
- +33 ;Display end of processing message.
- ENDMSG(RCSTATUS) ;
- +1 ;
- +2 IF $EXTRACT(RCSTATUS)="A"
- Begin DoDot:1
- +3 WRITE !,"Since the FMS cash receipt document is Accepted in FMS, you need to go"
- +4 WRITE !,"online in FMS and transfer the amount paid out of the station's suspense"
- +5 WRITE !,"account.",!
- +6 WRITE !,"Mail message(s) sent to RCDP PAYMENTS mail group.",!
- End DoDot:1
- +7 IF $EXTRACT(RCSTATUS)'="A"
- Begin DoDot:1
- +8 WRITE !,"Since the FMS cash receipt document is NOT Accepted in FMS, you can use"
- +9 WRITE !,"the option Process Receipt located under the Receipt Processing Menu"
- +10 WRITE !,"to regenerate the cash receipt document to FMS.",!
- End DoDot:1
- +11 QUIT
- +12 ;
- +13 ;Get users answers to questions for reports.
- GETANS(RCIDX) ;
- +1 NEW DA,DIR,DTOUT,DUOUT,X,Y,DIRUT,DIROUT
- +2 ;
- +3 ; Ask the user what kind of report
- +4 IF RCIDX=1
- Begin DoDot:1
- +5 SET DIR("?")="Select to Y to review the payments, N to skip the review."
- +6 SET DIR("A")="Do you want to review the payment list before updating accounts (Y/N)? "
- End DoDot:1
- +7 ;
- +8 ; Ask the user for the payer to start the reporting on (Range Option)
- +9 IF RCIDX=2
- Begin DoDot:1
- +10 SET DIR("?")="Enter Y to update the accounts, N to return to the LP menu"
- +11 SET DIR("A")="Do you want to update accounts with these payments (Y/N)? "
- End DoDot:1
- +12 ;
- +13 SET DIR(0)="YA"
- +14 DO ^DIR
- +15 KILL DIR
- +16 IF $GET(DTOUT)!$GET(DUOUT)
- QUIT -1
- +17 QUIT Y
- +18 ;
- +19 ;Retrieve the review response question from the user
- GETANS1() ;
- +1 ;
- +2 NEW FLG,X,Y
- +3 SET FLG=0
- SET Y=0
- +4 FOR
- Begin DoDot:1
- +5 READ !,"Do you want to review the payment list before updating accounts (Y/N)? ",X:DTIME
- +6 ;I $G(DTOUT) S FLG=1 Q ;If it times out, treat it like a No and go to the next prompt.
- +7 IF X=""
- WRITE !,"Enter Y or N to continue."
- QUIT
- +8 IF X["?"
- WRITE !,"Select to Y to review the payments, N to skip the review."
- QUIT
- +9 SET X=$$UP^XLFSTR(X)
- +10 IF X="Y"
- SET Y=1
- SET FLG=1
- QUIT
- +11 IF X="N"
- SET Y=0
- SET FLG=1
- QUIT
- +12 WRITE !,"Select to Y to review the payments, N to skip the review."
- End DoDot:1
- if FLG=1
- QUIT
- +13 QUIT Y
- +14 ;
- +15 ;Is the amount entered < the amount owed. (AR ACCOUNTS ONLY, NO DEBTORS)
- PAYCHK(RCACCT,RCAMT) ;
- +1 ;
- +2 NEW OWED,FLG
- +3 ;
- +4 SET FLG=0
- +5 ; account is the debtor account. No need to check...
- +6 if RCACCT'["PRCA"
- QUIT 1
- +7 ; calculate amount owed for a bill
- +8 SET OWED=$GET(^PRCA(430,+RCACCT,7))
- +9 SET OWED=$PIECE(OWED,"^")+$PIECE(OWED,"^",2)+$PIECE(OWED,"^",3)+$PIECE(OWED,"^",4)+$PIECE(OWED,"^",5)
- +10 IF RCAMT>OWED
- WRITE !,"The requested payment is greater than then amount owed please try again.",!
- QUIT FLG
- +11 SET FLG=1
- +12 QUIT FLG