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

IBEMTO.m

Go to the documentation of this file.
  1. IBEMTO ;ALB/CPM - BILL MT CHARGES AWAITING NEW COPAY RATE ; 02-AUG-93
  1. ;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;
  1. ; Bill MT OPT charges on hold awaiting the new copay rate.
  1. ;
  1. ENO ; Standalone option entry point
  1. S IBOPT=1
  1. ;
  1. ENR ; Enter/edit billing rates entry point
  1. ;
  1. ; - quit if job has been fired up from enter/edit rates already
  1. I $G(IBRUN) G ENQ
  1. ;
  1. ; - quit if there are no charges on hold awaiting the new rate
  1. I '$D(^IB("AC",20)) W:$G(IBOPT) !!,"There are no charges on hold awaiting the entry of the new copay rate." G ENQ
  1. ;
  1. ; - quit if current rate is still too old
  1. S IBDT=DT,IBX="O" D TYPE^IBAUTL2
  1. I $$OLDRATE^IBAMTS1(IBRTED,DT) D:$G(IBOPT) G ENQ
  1. .W !!,"The current copay rate (effective ",$$DAT1^IBOUTL(IBRTED),") is still too old to use. Please be"
  1. .W !,"sure that you have entered the most current rate in your Billing Rates table."
  1. ;
  1. ; - if x-ref is locked, the job must be currently running
  1. L +^IB("AC",20):5 E D:$G(IBOPT) G ENQ
  1. .W !!,"The list of held charges cannot be accessed -- the job to bill these held"
  1. .W !,"charges may currently be running."
  1. ;
  1. ; - queue the job to bill the held charges?
  1. I '$G(IBOPT) D
  1. .W !!?28,*7,*7,"*** PLEASE NOTE ***"
  1. .W !?8,"The Means Test Outpatient Copayment rate has just been updated,"
  1. .W !?8,"and there are charges 'on hold' awaiting the entry of this new rate!",!
  1. ;
  1. I $G(IBOPT) D
  1. .S IBN=0 F IBJ=0:1:21 S IBN=$O(^IB("AC",20,IBN)) Q:'IBN
  1. .W !!,"There ",$S(IBJ=1:"is 1",1:"are "_$S(IBJ>20:"at least ",1:"")_IBJ)," charge",$E("s",IBJ>1)," on hold, awaiting the new copay rate."
  1. S DIR(0)="Y",DIR("A")="Do you want to queue a job to automatically bill these held charges",DIR("?")="^D HQ^IBEMTO"
  1. D ^DIR K DIR I 'Y!($D(DIRUT))!($D(DUOUT)) G ENQ
  1. ;
  1. ; - queue up job to bill held charges
  1. S:'$G(IBOPT) ZTDTH=$H
  1. S ZTRTN="DQ^IBEMTO",ZTIO="",ZTDESC="BILLING OF MT OPT CHARGES AWAITING NEW COPAY RATE"
  1. S IBRUN=1 D ^%ZTLOAD W !!,$S($D(ZTSK):"This job has been queued. The task number is "_ZTSK_".",1:"Unable to queue this job!")
  1. ;
  1. ENQ L -^IB("AC",20)
  1. K:$G(IBOPT) IBRUN
  1. K IBN,IBDT,IBATYP,IBDESC,IBJ,IBOPT,IBRTED,IBCHG,IBX,ZTSK
  1. Q
  1. ;
  1. HQ ; Help for prompt
  1. W !!,"If you wish to queue off a job to bill the Means Test Outpatient"
  1. W !,"copayment charges that are on hold awaiting entry of the updated"
  1. W !,"billing rate, please enter 'Y' or 'YES'. The job will be tasked"
  1. W !,"immediately. Otherwise, enter 'N' or 'NO' or '^' to quit."
  1. Q
  1. ;
  1. ;
  1. DQ ; Tasked job to bill all charges awaiting the new copay rate.
  1. S IBJOB=8,IBDUZ=DUZ,IBSEQNO=1,IBCNT=0
  1. ;
  1. ; - record start time
  1. D NOW^%DTC S IBSTART=$$DAT2^IBOUTL(%)
  1. ;
  1. ; - if can't lock x-ref, job must currently be running
  1. L +^IB("AC",20):5
  1. ;
  1. ; - loop through all charges awaiting the new rate
  1. I S IBREF=0 F S IBREF=$O(^IB("AC",20,IBREF)) Q:'IBREF D CHG
  1. ;
  1. ; - unlock x-ref, record end time, and post bulletin
  1. L -^IB("AC",20)
  1. D NOW^%DTC S IBEND=$$DAT2^IBOUTL(%)
  1. D BULL^IBEMTO1
  1. K IBT,IBSTART,IBEND,IBREF,IBND,IBDT,IBX,IBCHG,IBSEQNO,IBNOS,IBCNT,XMTEXT,XMSUB,XMZ,XMY,XMDUZ
  1. Q
  1. ;
  1. CHG ; Pass a single charge to Accounts Receivable.
  1. S IBND=$G(^IB(IBREF,0)) I 'IBND K ^IB("AC",20,IBREF) G CHGQ
  1. S IBDT=DT,IBX="O" D TYPE^IBAUTL2
  1. I $$OLDRATE^IBAMTS1(IBRTED,$P(IBND,"^",14)) G CHGQ ; rate still old
  1. S $P(^IB(IBREF,0),"^",7)=IBCHG,IBSEQNO=1,DFN=+$P(IBND,"^",2)
  1. S IBNOS=IBREF D ^IBR S:Y>0 IBCNT=IBCNT+1
  1. CHGQ Q