[613] | 1 | RCXFMSC1 ;WISC/RFJ-fms cash receipt (cr) build lines ;1 Oct 97
|
---|
| 2 | ;;4.5;Accounts Receivable;**90,96,106,113,135,98,173,220**;Mar 20, 1995
|
---|
| 3 | ;;Per VHA Directive 10-93-142, this routine should not be modified.
|
---|
| 4 | Q
|
---|
| 5 | ;
|
---|
| 6 | ;
|
---|
| 7 | FMSLINES(RECEIPDA,RCTR) ; receipda is the ien for the receipt in file 344
|
---|
| 8 | ; return total(fund,revsrce,vendorid,fmstrantype) = dollar amount
|
---|
| 9 | ; RCTR = 1 if extracting for a TR document, null or 0 if for CR
|
---|
| 10 | ;
|
---|
| 11 | N %,ACCRUAL,AMOUNT,BILLDA,CATEGORY,FMSTYPE,FUND,RECEIPT,REVSRCE
|
---|
| 12 | N TRAN0,TRAN3,TRANDA,VENDORID,RECEFT,RCEDILB,Z
|
---|
| 13 | ;
|
---|
| 14 | S RCEDILB=$$EDILB^RCDPEU(RECEIPDA),RCTR=$G(RCTR)
|
---|
| 15 | S RECEFT=$S(RCEDILB=1:1,1:"") ; EFT deposit CR doc
|
---|
| 16 | S RECEIPT=$P($G(^RCY(344,RECEIPDA,0)),"^")
|
---|
| 17 | I RECEIPT="" Q
|
---|
| 18 | ;
|
---|
| 19 | S TRANDA=0 F S TRANDA=$O(^PRCA(433,"AF",RECEIPT,TRANDA)) Q:'TRANDA D
|
---|
| 20 | . S TRAN0=$G(^PRCA(433,TRANDA,0)),TRAN3=$G(^PRCA(433,TRANDA,3))
|
---|
| 21 | . S CATEGORY=$P($G(^PRCA(430,+$P(TRAN0,"^",2),0)),"^",2)
|
---|
| 22 | . S BILLDA=+$P(TRAN0,"^",2)
|
---|
| 23 | . ;
|
---|
| 24 | . ; do not send champva
|
---|
| 25 | . I CATEGORY=29 S FUND="0160a1" D SETTMP Q
|
---|
| 26 | . ;
|
---|
| 27 | . S ACCRUAL=$$ACCK^PRCAACC(BILLDA)
|
---|
| 28 | . ;
|
---|
| 29 | . ; if its not an accrual, send a detail document
|
---|
| 30 | . I 'ACCRUAL D Q
|
---|
| 31 | . . S FMSTYPE=$$GETTYPE(BILLDA,RCTR)
|
---|
| 32 | . . I FMSTYPE="" S FMSTYPE="XX" ; make it reject if missing
|
---|
| 33 | . . ; send a detail document only if there is principal
|
---|
| 34 | . . I $P(TRAN3,"^") S DETAIL(FMSTYPE,BILLDA)=$G(DETAIL(FMSTYPE,BILLDA))+$P(TRAN3,"^")
|
---|
| 35 | . . ; set tmp global which is used by the 215 report
|
---|
| 36 | . . S FUND=$$GETFUNDB^RCXFMSUF(BILLDA,,RECEFT) D SETTMP
|
---|
| 37 | . . ;
|
---|
| 38 | . . ; look for interest and admin charges
|
---|
| 39 | . . ; use vendorid x for totals
|
---|
| 40 | . . S VENDORID="MISCN"
|
---|
| 41 | . . ; get the revenue source code for the bill
|
---|
| 42 | . . S REVSRCE=$$CALCRSC^RCXFMSUR(BILLDA,RECEFT)
|
---|
| 43 | . . D INTADMIN
|
---|
| 44 | . ;
|
---|
| 45 | . ; get the fund for the bill
|
---|
| 46 | . S FUND=$$GETFUNDB^RCXFMSUF(BILLDA,,RECEFT)
|
---|
| 47 | . ;
|
---|
| 48 | . ; get the vendor id $p(2) for the bill
|
---|
| 49 | . S VENDORID=$S(FUND=528709:"EXCFVALUE",FUND=4032:"EXCFVALUE",1:"MCCFVALUE")
|
---|
| 50 | . ;
|
---|
| 51 | . ; get the revenue source code for the bill
|
---|
| 52 | . S REVSRCE=$$CALCRSC^RCXFMSUR(BILLDA,RECEFT)
|
---|
| 53 | . ;
|
---|
| 54 | . ; get the principle collected, $p(tran3,"^"), if prepayment
|
---|
| 55 | . ; set it to 1;5 with no interest, admin, etc.
|
---|
| 56 | . I CATEGORY=26 S TRAN3=$P($G(^PRCA(433,TRANDA,1)),"^",5)
|
---|
| 57 | . ;
|
---|
| 58 | . ; total principal
|
---|
| 59 | . D TOTAL($P(TRAN3,"^"))
|
---|
| 60 | . ;
|
---|
| 61 | . ; set tmp for detail
|
---|
| 62 | . D SETTMP
|
---|
| 63 | . ;
|
---|
| 64 | . ; check for interest collected
|
---|
| 65 | . D INTADMIN
|
---|
| 66 | Q
|
---|
| 67 | ;
|
---|
| 68 | ;
|
---|
| 69 | INTADMIN ; check for interest and admin charges
|
---|
| 70 | S AMOUNT=$P(TRAN3,"^",2)
|
---|
| 71 | I AMOUNT S FUND=$$GETFUNDO^RCXFMSUF("I") D TOTAL(AMOUNT)
|
---|
| 72 | ; check for admin collected
|
---|
| 73 | S AMOUNT=$P(TRAN3,"^",3)
|
---|
| 74 | I AMOUNT S FUND=$$GETFUNDO^RCXFMSUF("A") D TOTAL(AMOUNT)
|
---|
| 75 | ; check for marshall fee collected
|
---|
| 76 | S AMOUNT=$P(TRAN3,"^",4)
|
---|
| 77 | I AMOUNT S FUND=$$GETFUNDO^RCXFMSUF("M") D TOTAL(AMOUNT)
|
---|
| 78 | ; check for court cost collected
|
---|
| 79 | S AMOUNT=$P(TRAN3,"^",5)
|
---|
| 80 | I AMOUNT S FUND=$$GETFUNDO^RCXFMSUF("C") D TOTAL(AMOUNT)
|
---|
| 81 | Q
|
---|
| 82 | ;
|
---|
| 83 | ;
|
---|
| 84 | TOTAL(AMOUNT) ; accumulate totals for summary document
|
---|
| 85 | I 'AMOUNT Q
|
---|
| 86 | ; check key elements and if null set to X's to reject
|
---|
| 87 | I FUND="" S FUND="XXXXXX"
|
---|
| 88 | I REVSRCE="" S REVSRCE="XXXX"
|
---|
| 89 | I VENDORID="" S VENDORID="XXXXX"
|
---|
| 90 | ;
|
---|
| 91 | S TOTAL(FUND,REVSRCE,VENDORID)=$G(TOTAL(FUND,REVSRCE,VENDORID))+AMOUNT
|
---|
| 92 | Q
|
---|
| 93 | ;
|
---|
| 94 | ;
|
---|
| 95 | SETTMP ; set the tmp global for detailed data by bill
|
---|
| 96 | ; the tmp global is used by the 215 report (rcy215a)
|
---|
| 97 | I FUND="" S FUND="XXXXXX"
|
---|
| 98 | ;
|
---|
| 99 | S %=$G(^TMP($J,"RCFMSCR",FUND,BILLDA))
|
---|
| 100 | S $P(%,"^",1)=$P(%,"^",1)+$P(TRAN3,"^",1) ; principal
|
---|
| 101 | S $P(%,"^",2)=$P(%,"^",2)+$P(TRAN3,"^",2) ; interest
|
---|
| 102 | S $P(%,"^",3)=$P(%,"^",3)+$P(TRAN3,"^",3) ; admin
|
---|
| 103 | S $P(%,"^",4)=$P(%,"^",4)+$P(TRAN3,"^",4) ; marshal fee
|
---|
| 104 | S $P(%,"^",5)=$P(%,"^",5)+$P(TRAN3,"^",5) ; court cost
|
---|
| 105 | S ^TMP($J,"RCFMSCR",FUND,BILLDA)=%
|
---|
| 106 | Q
|
---|
| 107 | ;
|
---|
| 108 | ;
|
---|
| 109 | GETTYPE(BILLDA,RCTR) ; return a bills fms transaction type (which goes on the CRA code
|
---|
| 110 | ; sheet) from the field 259 refund/reimbursement in file 430.
|
---|
| 111 | ; If RCTR = 1, return TR code, otherwise return CR code
|
---|
| 112 | N REFUND
|
---|
| 113 | S RCTR=$S($G(RCTR):7,1:3) ; CR code is in piece 3 of data, TR is in pc 7
|
---|
| 114 | S REFUND=$$RECTYP^PRCAFUT(BILLDA)
|
---|
| 115 | I REFUND<0 S REFUND=""
|
---|
| 116 | I $L(REFUND)=1 S REFUND="0"_REFUND
|
---|
| 117 | ; this call gets the transaction type from file 347.4
|
---|
| 118 | S REFUND=$$DTYPE^PRCAFBD1(REFUND)
|
---|
| 119 | I REFUND<0 S REFUND=""
|
---|
| 120 | Q $S($P(REFUND,"^",RCTR)'="":$P(REFUND,"^",RCTR),1:REFUND)
|
---|
| 121 | ;
|
---|
| 122 | ;
|
---|
| 123 | LINE(BILLDA) ;
|
---|
| 124 | ;returns FMS line number
|
---|
| 125 | N X
|
---|
| 126 | S X=$P($G(^PRCA(430,BILLDA,11)),"^",4)
|
---|
| 127 | I X="" S X="001"
|
---|
| 128 | Q X
|
---|