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

IBPEX.m

Go to the documentation of this file.
  1. IBPEX ;ALB/AAS - PURGE MEDICATION CO-PAY EXEMPTIONS ; 12-NOV-92
  1. ;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;
  1. % I '$D(DT) D DT^DICRW
  1. I '$D(IOF) D HOME^%ZIS
  1. ;
  1. W @IOF,?15,"Purge Medication Copayment Exemptions",!!
  1. ;
  1. S DIR("?")="Enter the date through which you want to purge entries for the BILLING EXEMPTIONS file (354.1)"
  1. S DIR("?",1)="This must be a date at least one year in the past."
  1. S DIR("?",2)="This option will purge inactive exemptions whose exemption date is earlier"
  1. S DIR("?",3)="than this date and active exemptions older than one year before this date."
  1. S DIR(0)="D^2920101:"_(DT-10000)_":EX",DIR("A")="Purge Date"
  1. S Y=DT-10000 D D^DIQ S DIR("B")=Y
  1. D ^DIR K DIR
  1. I $D(DIRUT)!(Y'?7N) G END
  1. S IBPDT=Y
  1. ;
  1. W !!,"There is no output from this routine it just purges.",!
  1. S DIR(0)="Y",DIR("A")="Are you sure you want to purge now",DIR("B")="NO" D ^DIR K DIR
  1. I $D(DIRUT)!(Y'=1) G END
  1. ;
  1. DEV S %ZIS="QM" D ^%ZIS G:POP END
  1. I $D(IO("Q")) S ZTRTN="DQ^IBPEX",ZTSAVE("IB*")="",ZTDESC="IB Purge exemption entries" D ^%ZTLOAD K IO("Q"),ZTSK D HOME^%ZIS G END
  1. U IO
  1. ;
  1. DQ ; -- entry point for later
  1. ; if exemption not active, not current, earlier than ibpdt
  1. ; or
  1. ; if active, not current, earlier that ibpdt-10000
  1. ; then purge
  1. ;
  1. S (IBDT,IBPURG,IBPCNT,IBPAG)=0
  1. D NOW^%DTC S Y=% D D^DIQ S IBPDAT=Y
  1. F S IBDT=$O(^IBA(354.1,"B",IBDT)) Q:'IBDT!(IBDT>IBPDT) S IBDA=0 F S IBDA=$O(^IBA(354.1,"B",IBDT,IBDA)) Q:'IBDA D CHK,PURGE:IBPURG
  1. D HDR,REPORT
  1. G END
  1. ;
  1. END Q:$D(ZTQUEUED)
  1. D ^%ZISC
  1. ;K IBPDT,IBPURG,DIR
  1. Q
  1. ;
  1. CHK ; -- check entries
  1. W:'$D(ZTQUEUED) "."
  1. S IBPURG=0
  1. S X=$G(^IBA(354.1,IBDA,0)) G CHKQ:X=""
  1. S X1=$G(^IBA(354,$P(X,"^",2),0))
  1. ;
  1. ; -- quit if contains ar pass dates
  1. I $P(X,"^",14) G CHKQ
  1. ;
  1. ; -- quit if is current exemption
  1. I +X=$P(X1,"^",3) G CHKQ
  1. ;
  1. ; -- if active, older than purge date - 1 year
  1. I $P(X,"^",10),+X<(IBPDT-10000) S IBPURG=1
  1. ;
  1. ; -- if inactive, older than purge date
  1. I '$P(X,"^",10),+X<IBPDT S IBPURG=1
  1. ;
  1. CHKQ Q
  1. ;
  1. PURGE ; -- blow away the entry
  1. S DA=IBDA,DIK="^IBA(354.1," D ^DIK
  1. K DA,DIK
  1. S IBPCNT=IBPCNT+1
  1. Q
  1. ;
  1. HDR ; -- simple header for 1 line report
  1. I $E(IOST,1,2)="C-"!(IBPAG) W @IOF
  1. S IBPAG=IBPAG+1
  1. W "BILLING EXEMPTION PURGE REPORT",?IOM-30,IBPDAT," PAGE ",IBPAG
  1. W !,$TR($J(" ",IOM)," ","-")
  1. Q
  1. ;
  1. REPORT ; -- simple report
  1. I 'IBPCNT W !,"No exemption found that met purge criteria" G REPORTQ
  1. W !,"There were ",IBPCNT," entries purged from the billing exemption file"
  1. REPORTQ ;
  1. Q