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

RCBDBBAL.m

Go to the documentation of this file.
  1. RCBDBBAL ;WISC/RFJ-bill balances check ;1 Mar 2001
  1. ;;4.5;Accounts Receivable;**169**;Mar 20, 1995
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. Q
  1. ;
  1. ;
  1. OUTOFBAL(RCBILLDA) ; returns balance if a bill is out of balance
  1. ; returns rclist array of transactions against bill
  1. ; locks to file 430 should be applied before calling this function
  1. ;
  1. N BALANCE,DATA7,OUTOFBAL,STATUS
  1. ; if it is not activated, not out of balance
  1. I '$P($G(^PRCA(430,RCBILLDA,6)),"^",21) Q ""
  1. ;
  1. ; calculate balance and get current balance
  1. S BALANCE=$$GETTRANS^RCDPBTLM(RCBILLDA)
  1. S DATA7=$G(^PRCA(430,RCBILLDA,7))
  1. S STATUS=$P($G(^PRCA(430,RCBILLDA,0)),"^",8)
  1. ;
  1. ; for a write-off bill, the balance should equal all zeros, for
  1. ; these bills, node 7 is the write-off amount, so for the out of
  1. ; balance check to work, node 7 needs to be adjusted to all zeros
  1. I STATUS=23 S DATA7="0^0^0^0^0"
  1. ;
  1. ; test for out of balance
  1. S OUTOFBAL=0
  1. 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
  1. ;
  1. ; for collected/closed (22) and cancellation (39) bills
  1. ; the balance in 430 should equal 0, if not it is out of balance
  1. I STATUS=22!(STATUS)=39 I $TR($P(DATA7,"^",1,5),"^0")'="" S OUTOFBAL=1
  1. ;
  1. Q $S('OUTOFBAL:"",1:BALANCE)