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

BARBLCLC.m

Go to the documentation of this file.
  1. BARBLCLC ;IHS/SD/LSL - A/R BILL CALCULATIONS ; 03/04/2010
  1. ;;1.8;IHS ACCOUNTS RECEIVABLE;**17;OCT 22,2008
  1. ;;
  1. ; IHS/ASDS/LSL - 03/04/10 V1.8 Patch 17 - PKD
  1. ; New Routine for Calculated Fields in ^BARBL
  1. ;
  1. CALC(D0) ; Calculated Amount field PAYMENT - CO-PAY - DEDUCTIBLE
  1. ; Already have bill ^BARBL(DUZ(2),D0,0) where D0 = Bill Number
  1. ; ^BARBL(DUZ(2),"AC",D0,DATE.TIME)="" points to-> $P(^BARTR(DUZ(2),DATE.TIME,0),"^")
  1. ; I $P(^BARTR(DUZ(2),DATE.TIME,0),"^")=40 - PAYMENT
  1. N ALWAMT,TRIEN,TCODE,TTCODE,TCR,TDB,T S ALWAMT=""
  1. S TRIEN="" F S TRIEN=$O(^BARTR(DUZ(2),"AC",D0,TRIEN)) Q:'TRIEN D
  1. . S TCODE=$G(^BARTR(DUZ(2),TRIEN,1))
  1. . Q:(+TCODE'=40)&(+TCODE'=43) ; count PAYMENTS & ADJUSTMENTS ONLY
  1. . S T=$G(^BARTR(DUZ(2),TRIEN,0))
  1. . S TCR=$P(T,"^",2),TDB=$P(T,"^",3)
  1. . I +TCODE=43 S TTCODE=$P(TCODE,"^",2) Q:(TTCODE'=13)&(TTCODE'=14)
  1. . S ALWAMT=ALWAMT+TCR-TDB ; Add credits / deduct debits for adjustments
  1. Q ALWAMT
  1. ;