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

IBARXEPV.m

Go to the documentation of this file.
  1. IBARXEPV ;ALB/AAS - RX COPAY EXEMPTION VERIFY STATUS ; 02/12/2004
  1. ;;2.0;INTEGRATED BILLING;**262**; 21-MAR-94
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;
  1. % ; -- print/verify patients whose current exemption does not match
  1. ; what is currently computed.
  1. I '$D(DT) D DT^DICRW
  1. S IBQUIT=0
  1. I '$D(IOF) D HOME^%ZIS
  1. W @IOF,"Verify Medication Copayment Exemption Status"
  1. W !! D DATE^IBOUTL
  1. I 'IBBDT!('IBEDT)!(IBEDT<IBBDT) G END
  1. ;
  1. ; -- update patient status
  1. W !
  1. S DIR("?")="Answer 'YES' if you want to automatically update patient status to the computed status, or 'NO' to print a report of discrepancies."
  1. S DIR(0)="Y",DIR("A")="Update Patient Status",DIR("B")="NO" D ^DIR K DIR S IBUP=+Y
  1. I $D(DIRUT) G END
  1. W !
  1. ;
  1. DEV W !!,"You will need a 132 column printer for this report!",!
  1. S %ZIS="QM" D ^%ZIS G:POP END
  1. I $D(IO("Q")) S ZTRTN="DQ^IBARXEPV",ZTSAVE("IB*")="",ZTDESC="IB Verify Medication Copayment exemption" D ^%ZTLOAD K ZTSK,IO("Q") D HOME^%ZIS G END
  1. I '$D(ZTQUEUED) W !,"HMMMM, LET ME THINK ABOUT THIS FOR A MINUTE"
  1. U IO
  1. ;
  1. DQ ; -- entry point from task man to start comparison
  1. S (IBPCNT,IBPAG)=0,IBOK=1 D NOW^%DTC S Y=% D D^DIQ S IBPDAT=$P(Y,"@")_" "_$E($P(Y,"@",2),1,5)
  1. K ^TMP($J,"IBUNVER")
  1. ;
  1. ; -- look through inverse date x-ref
  1. S IBDT=IBBDT-.00001
  1. F S IBDT=$O(^IBA(354.1,"B",IBDT)) Q:'IBDT!(IBDT>(IBEDT+.9)) S IBDA=0 F S IBDA=$O(^IBA(354.1,"B",IBDT,IBDA)) Q:'IBDA D CHK I 'IBOK D UP:IBUP,SET
  1. D REPORT,PAUSE^IBOUTL:'IBQUIT
  1. G END
  1. ;
  1. END K ^TMP($J,"IBUNVER")
  1. I $D(ZTQUEUED) S ZTREQ="@" Q
  1. D ^%ZISC
  1. K DFN,DIR,DIRUT,DIC,DIE,DA,DR,X,Y
  1. K IBBDT,IBDA,IBDATA,IBDEPEN,IBDFN,IBDT,IBEDT,IBER,IBERR,IBEXREA,IBEXREAN,IBEXREAO,IBJ,IBMESS,IBNAM,IBOK,IBP,IBPAG,IBPCNT,IBPDAT,IBQUIT,IBUP
  1. Q
  1. ;
  1. REPORT ; -- print report
  1. D HDR S IBDCNT=0
  1. I '$D(^TMP($J,"IBUNVER")) W !,"No discrepancies found in ",IBPCNT," exemptions checked." G REPORTQ
  1. ;
  1. S IBNAM=""
  1. F S IBNAM=$O(^TMP($J,"IBUNVER",IBNAM)) Q:IBNAM=""!(IBQUIT) S IBDFN="" F S IBDFN=$O(^TMP($J,"IBUNVER",IBNAM,IBDFN)) Q:IBDFN=""!(IBQUIT) S IBER=^(IBDFN) D LINE
  1. ;
  1. W !!,"There were ",IBDCNT," discrepancies found in ",IBPCNT," exemptions checked."
  1. ;
  1. REPORTQ Q
  1. ;
  1. LINE ; -- write each line
  1. S DFN=+IBDFN,IBDCNT=IBDCNT+1
  1. I $Y>(IOSL-5) D PAUSE^IBOUTL Q:IBQUIT D HDR
  1. W !,$E(IBNAM,1,20),?22,$P(IBER,"^",8)
  1. S X=$P(IBER,"^",5) W ?39,$S(X=3:"Exemption incorrect",X=1!(X=2)!(X=5):"Not Current Status",X=4:"Name Missing",1:"Hmmmm")
  1. W ?61,$$DAT1^IBOUTL($P(IBER,"^",2))_" "_$E($P($G(^IBE(354.2,+IBER,0)),"^"),1,15)
  1. W ?88,$$DAT1^IBOUTL($P(IBER,"^",4))_" "_$E($P($G(^IBE(354.2,+$P(IBER,"^",3),0)),"^"),1,15)
  1. W ?115,$P(IBER,"^",6)
  1. Q
  1. ;
  1. CHK ; -- check if current status = computed status
  1. S IBOK=1,IBMESS="Nothing Updated",IBERR=""
  1. S X=$G(^IBA(354.1,+IBDA,0)) G CHKQ:'$P(X,"^",10) ;not active skip
  1. S DFN=$P(X,"^",2)
  1. S Y=$G(^IBA(354,DFN,0)) I +X<$P(Y,"^",3) G CHKQ ;not current exemption
  1. ;
  1. N DGMT,CONV,CLN S (CLN,CONV)=0,DGMT=$$LST^DGMTU(DFN,+X,1)
  1. I $P(DGMT,U,5)=2 D G:CONV CHKQ ; skip Edb conv. tests
  1. .; Loop through the MT comments, Check for EDB converted test
  1. .; No comments to check
  1. .Q:'$D(^DGMT(408.31,+DGMT,"C",1,0))
  1. .F S CLN=$O(^DGMT(408.31,+DGMT,"C",CLN)) Q:'CLN!(CONV) D
  1. ..I ^DGMT(408.31,+DGMT,"C",CLN,0)["Z06 MT via Edb" S CONV=1
  1. ;
  1. S IBPCNT=IBPCNT+1
  1. I '+Y S IBOK=0,IBERR=4
  1. S IBEXREAO=$P(X,"^",5)_"^"_+X ;current exemption
  1. I $P($G(^IBE(354.2,+IBEXREAO,0)),"^",5)=2010 G CHKQ ; hardships don't report
  1. I +X>$P(Y,"^",3) S IBOK=0,IBERR=1 ;most current exemption not in 354
  1. I $P(X,"^",5)'=$P(Y,"^",5) S IBOK=0,IBERR=2 ;Current exemption not in 354
  1. I $P(X,"^",4)'=$P(Y,"^",4) S IBOK=0,IBERR=5 ;current status in exemption not in 354
  1. S IBEXREAN=$$STATUS^IBARXEU1(DFN,DT)
  1. I +IBEXREAO'=+IBEXREAN S IBOK=0,IBERR=3
  1. CHKQ Q
  1. ;
  1. UP ; -- update current exemption status
  1. Q:IBOK
  1. S IBJOB=15,IBWHER=16
  1. I IBERR=4 D G UPQ
  1. .S DIE="^IBA(354,",DA=DFN,DR=".01////"_DFN D ^DIE
  1. .K DIE,DA,DR,DIC
  1. .S IBMESS="Name Corrected"
  1. UP1 N IBOLDAUT S IBOLDAUT=""
  1. ;
  1. ; -- if currently not auto exempt make sure not more recent autoexempt
  1. I $L($P($G(^IBE(354.2,+IBEXREAN,0)),"^",5))>2 D OLDAUT^IBARXEX1(IBEXREAN)
  1. S IBFORCE=$P(IBEXREAN,"^",2)
  1. D MOSTR^IBARXEU5($P(IBEXREAN,"^",2),+IBEXREAN)
  1. D ADDEX^IBAUTL6(+IBEXREAN,$P(IBEXREAN,"^",2),1,1,IBOLDAUT)
  1. S IBMESS="Updated"
  1. UPQ K IBFORCE Q
  1. ;
  1. SET ; -- set ^tmp node if not okay
  1. Q:IBOK
  1. S IBP=$$PT^IBEFUNC(DFN)
  1. S IBDFN=DFN
  1. I $D(^TMP($J,"IBUNVER",$P(IBP,"^"),DFN)) S IBDFN=DFN_"-"_IBPCNT
  1. S ^TMP($J,"IBUNVER",$P(IBP,"^"),IBDFN)=IBEXREAO_"^"_IBEXREAN_"^"_IBERR_"^"_IBMESS_"^"_IBP
  1. Q
  1. ;
  1. HDR ; -- print header
  1. I IBPAG!($E(IOST,1,2)="C-") W @IOF
  1. S IBPAG=IBPAG+1
  1. W !,"Medication Copayment Exemption Problem Report",?(IOM-31),IBPDAT," Page ",IBPAG
  1. W !,"Patient",?22,"PT. ID",?39,"Error",?61,"Current Exemption",?88,"Computed Exemption",?115,"Action"
  1. W !,$TR($J(" ",IOM)," ","-")
  1. Q