source: WorldVistAEHR/trunk/r/ACCOUNTS_RECEIVABLE-PRCA-PRY-RC/RCBDBBAL.m@ 841

Last change on this file since 841 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 1.4 KB
Line 
1RCBDBBAL ;WISC/RFJ-bill balances check ;1 Mar 2001
2 ;;4.5;Accounts Receivable;**169**;Mar 20, 1995
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 Q
5 ;
6 ;
7OUTOFBAL(RCBILLDA) ; returns balance if a bill is out of balance
8 ; returns rclist array of transactions against bill
9 ; locks to file 430 should be applied before calling this function
10 ;
11 N BALANCE,DATA7,OUTOFBAL,STATUS
12 ; if it is not activated, not out of balance
13 I '$P($G(^PRCA(430,RCBILLDA,6)),"^",21) Q ""
14 ;
15 ; calculate balance and get current balance
16 S BALANCE=$$GETTRANS^RCDPBTLM(RCBILLDA)
17 S DATA7=$G(^PRCA(430,RCBILLDA,7))
18 S STATUS=$P($G(^PRCA(430,RCBILLDA,0)),"^",8)
19 ;
20 ; for a write-off bill, the balance should equal all zeros, for
21 ; these bills, node 7 is the write-off amount, so for the out of
22 ; balance check to work, node 7 needs to be adjusted to all zeros
23 I STATUS=23 S DATA7="0^0^0^0^0"
24 ;
25 ; test for out of balance
26 S OUTOFBAL=0
27 I +$P(DATA7,"^")'=+$P(BALANCE,"^")!(+$P(DATA7,"^",2)'=+$P(BALANCE,"^",2))!(+$P(DATA7,"^",3)'=+$P(BALANCE,"^",3))!(+$P(DATA7,"^",4)'=+$P(BALANCE,"^",4))!(+$P(DATA7,"^",5)'=+$P(BALANCE,"^",5)) S OUTOFBAL=1
28 ;
29 ; for collected/closed (22) and cancellation (39) bills
30 ; the balance in 430 should equal 0, if not it is out of balance
31 I STATUS=22!(STATUS)=39 I $TR($P(DATA7,"^",1,5),"^0")'="" S OUTOFBAL=1
32 ;
33 Q $S('OUTOFBAL:"",1:BALANCE)
Note: See TracBrowser for help on using the repository browser.