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

IBARXEU1.m

Go to the documentation of this file.
  1. IBARXEU1 ;ALB/AAS - RX EXEMPTION UTILITY ROUTINE (CONT.);3/27/07 3:10pm ; 31 Jan 2019 3:51 PM
  1. ;;2.0;INTEGRATED BILLING;**26,112,74,275,367,449,385,627,700**;21-MAR-94;Build 81
  1. ;;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. STATUS(DFN,IBDT) ; -- Determine medication copayment exemption status
  1. ; -- requests data from MAS
  1. ;
  1. ; returns : = exemption reason (pointer to 354.2) ^ date
  1. ;
  1. N X,Y
  1. I $G(IBDT)="" S IBDT=DT
  1. S X=$$AUTOST(DFN,IBDT)
  1. I X'="" G STATUSQ
  1. S X=$$INCST(DFN,IBDT)
  1. STATUSQ Q X
  1. ;
  1. AUTOST(DFN,IBDT) ; -- Determine automatically exempt patients.
  1. ; input : dfn = patient file pointer
  1. ; ibdt = internal form of effective date
  1. ;
  1. ; returns : = exemption reason (pointer to 354.2) ^ date
  1. ; null if no autostatus
  1. ;
  1. N IBEXREA,IBEXMT,I
  1. S (IBEXREA,IBEXMT)=""
  1. I $G(IBDT)="" S IBDT=DT
  1. ;
  1. ; -- ask mas if in receipt of pension/a&a/hb, etc.
  1. ; the automatic determinations
  1. ; returns:
  1. ; sc>50%^rec a&a^rec hb^rec pen^n/a^non-vet^^POW^Unempl.^cd^moh
  1. ; 1 1 1 1 1 1 1 1 1
  1. ; pieces =1 if true
  1. S IBEXMT=$$AUTOINFO^DGMTCOU1(DFN) I IBEXMT="" G AUTOSTQ
  1. I IBEXMT[1 F I=1,2,3,4,6,8,9,10,11 I $P(IBEXMT,"^",I)=1 S IBEXREA=I*10 Q ;lookup code is piece position time 10
  1. ;
  1. ; -- need to move CD patinet's to 70 which is ignored by IB, used to
  1. ; keep other stuff working, auto-exempt stuff relies on a 2 digit
  1. ; code to work properly
  1. ; -- added moh code to move to 50 to keep at 2 digit
  1. I IBEXREA=100 S IBEXREA=70 ;not used above
  1. I IBEXREA=110 S IBEXREA=50 ;not used above
  1. ;
  1. AUTOSTQ I IBEXREA="" Q IBEXREA
  1. Q $O(^IBE(354.2,"ACODE",+IBEXREA,0))_"^"_IBDT
  1. ;
  1. ;
  1. INCST(DFN,IBDT) ; -- return medication copayment exemption reason/date
  1. ; -- ask mas for income data
  1. ;
  1. ; returns : = exemption reason (pointer to 354.2) ^ date
  1. ;
  1. N IBDATA,X,DGMT,CLN,CONV
  1. S IBDATA=$G(^DGMT(408.31,+$$LST^DGMTCOU1(DFN,IBDT,3),0)) ;get any test
  1. ;
  1. ; -- is the mt too old even under VFA rules - no data
  1. I $$PLUS^IBARXEU0(+IBDATA)<IBDT,'$$VFAOK^IBARXEU($$LST^IBARXEU0(DFN,+IBDATA)) S X=$O(^IBE(354.2,"ACODE",210,0))_"^"_IBDT G INCSTQ
  1. ;
  1. I $P(IBDATA,U,23)=2 D G:CONV INCSTQ ;skip Edb conv. tests
  1. .;Loop through the MT comments, Check for EDB converted test
  1. .;No comments to check
  1. .S (CLN,CONV)=0,DGMT=$$LST^DGMTCOU1(DFN,IBDT,3)
  1. .F S CLN=$O(^DGMT(408.31,+DGMT,"C",CLN)) Q:'CLN!(CONV) D
  1. ..;If most recent test is a converted test use current info from IBA(354
  1. ..I $G(^DGMT(408.31,+DGMT,"C",CLN,0))["Z06 MT via Edb" S CONV=1,X=$P($G(^IBA(354,DFN,0)),"^",5)_"^"_$P($G(^IBA(354,DFN,0)),"^",3)
  1. ;
  1. I $$NETW S X=$$MTCOMP^IBARXEU5($$INCDT(IBDATA),IBDATA)
  1. I '$$NETW S X=$$INCDT(IBDATA),X=$P(X,"^",3)_"^"_$P(X,"^",2)
  1. INCSTQ Q X
  1. ;
  1. INCDT(IBDATA) ; -- calcualtes copay exemption status based on income
  1. ; and net worth
  1. ; input := zeroth node from 408.31
  1. ; output := 1 = exempt ^date of test^ exemption reason
  1. ; 2 = non-exempt^...
  1. ; 3 = pending adjudication (if active)^...
  1. ;
  1. N X,IBDT,IBINCOM,IBEXREA,IBDEPEN,IBNETW,IBTABLE,IBLEVEL,IBTHRES
  1. I '$D(DFN) N DFN S DFN=$P(IBDATA,"^",2)
  1. S IBEXREA=""
  1. ;
  1. ; -- if test incomplete, no longer required, no longer applicable, or
  1. ; required set to no income data
  1. ; autoexempt test should be done first before getting to here
  1. S X=$P(IBDATA,"^",3) I X=1!(X=3)!(X=10)!(X=9)!($P(IBDATA,"^",14)) S IBEXREA=$S($P(IBDATA,"^",14):110,1:210) G NO
  1. ;
  1. S IBDT=+IBDATA
  1. S IBINCOM=$P(IBDATA,"^",4)-$P(IBDATA,"^",15) I IBINCOM<0 S IBINCOM=0
  1. S IBDEPEN=$P(IBDATA,"^",18),IBNETW=$P(IBDATA,"^",5)
  1. ;
  1. ; -- get A&A income level
  1. ;S IBLEVEL=$$THRES(IBDT,2,IBDEPEN)
  1. S IBLEVEL=$$THRES(IBDT,$S($E(IBDT,1,5)'<29612:1,1:2),IBDEPEN)
  1. I $P(IBLEVEL,"^",3) S IBPRIOR=$P(IBLEVEL,"^",3)
  1. ;
  1. S IBEXREA=120 ; low income
  1. I IBINCOM>+IBLEVEL S IBEXREA=110 G NO ;high income not exempt
  1. ;
  1. I '$$NETW G NO
  1. ;
  1. ; -- get networth threshold amount
  1. S IBTHRES=+$$THRES(IBDT,4,0)
  1. ; -- low income check for net worth
  1. S IBEXREA=$S((IBINCOM+IBNETW)>IBTHRES:130,1:120)
  1. ;
  1. NO ; -- not enough information
  1. I IBEXREA="" S IBEXREA=210
  1. ;
  1. I $$NETW S Y=$S(IBEXREA=110:2,IBEXREA=120:1,IBEXREA=130:3,1:2)
  1. I '$$NETW S Y=$S(IBEXREA=120:1,1:2)
  1. ;
  1. INCDTQ Q Y_"^"_+IBDATA_"^"_$O(^IBE(354.2,"ACODE",+IBEXREA,0))
  1. ;
  1. THRES(DATE,TYPE,DEPEND) ; -- return threshold amount
  1. ;
  1. ; -- if date is less than 12/1/92 will use 12/1 92 rates
  1. ; date =: fileman format of effective date
  1. ; type =: 2= pension plus A&A 1992 thru 1995
  1. ; type =: 1= basic pension 1996 to present
  1. ; depend =: number of dependents
  1. ;
  1. ; -- returns rate^effective date^prior year
  1. ;
  1. I DATE<2921201 S DATE=2921201 ; use threshold rates from 12/1/92
  1. N IBTABLE,IBLEVEL,IBPRIOR
  1. S (IBLEVEL,IBPRIOR)=""
  1. ; -- get entry to determine income amounts
  1. S IBTABLE=$G(^IBE(354.3,+$O(^(+$O(^IBE(354.3,"AIVDT",TYPE,-(DATE+.000001))),0)),0))
  1. G:IBTABLE="" THRESQ
  1. I TYPE=4 S DEPEND=0
  1. ;
  1. ; --see if rate is for prior year
  1. I $$PLUS^IBARXEU0(+IBTABLE)<DATE S IBPRIOR=+IBTABLE
  1. ;
  1. ; -- rates begin in piece 3 for veteran alone, piece 4 for 1 dependent..
  1. S IBLEVEL=$S(DEPEND<9:$P(IBTABLE,"^",DEPEND+3),1:"")
  1. I IBLEVEL="" S IBLEVEL=$P(IBTABLE,"^",4)+((DEPEND-1)*$P(IBTABLE,"^",12))
  1. THRESQ Q IBLEVEL_"^"_+IBTABLE_"^"_IBPRIOR
  1. ;
  1. NETW() ; -- use networth in determining copay exemptions - specs keep changing
  1. ; returns 1 if should use networth in exemption determination
  1. ; returns 0 if should not use networth in exemption
  1. Q 0