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

IBJTLB1.m

Go to the documentation of this file.
IBJTLB1 ;ALB/ARH - TPI INACTIVE LIST BUILD ;2/14/95
 ;;2.0;INTEGRATED BILLING;**39,80,61,137,276,451,516,530,568,592**;21-MAR-94;Build 58
 ;;Per VA Directive 6402, this routine should not be modified.
 ;
BLDA ; build active list for third party joint inquiry active list, DFN must be defined
 ; first search starts at dt and works backwards for 6 months of bills or IBMAXCNT bills, whichever is greater
 ; all bills for a single day are included in the same search so even IBMAXCNT may be exceeded
 ; if IBEND is defined on entry it is used as the end dt of the search, otherwise DT is used
 ; IBBEG is left defined on exit, if it has a value then it is used by the Change Dates action to define the next
 ; end date of the search, this results in each CD action default working backwards through the date range until
 ; no bills are found and IBBEG is null then search restarts at DT, IBEND is defined so can tell if range changed
 N IBIFN,IBCNT,IBBDT,IBEDT,IBFIRST,IBLAST,IBDT1,IBDT2,IBMAXCNT K IBHMSG
 S IBEDT=$S(+$G(IBEND):IBEND,1:DT),IBBDT=$$FMADD^XLFDT(IBEDT,-180),IBMAXCNT=52
 ;
 S (VALMCNT,IBCNT)=0,IBDT1=$S(IBEDT'="":-(IBEDT+.01),1:""),IBDT2=-IBBDT
 S IBFIRST=IBBDT,IBLAST=-$O(^DGCR(399,"APDS",DFN,""))
 ;
 F  S IBDT1=$O(^DGCR(399,"APDS",DFN,IBDT1)) Q:'IBDT1!(IBDT1>IBDT2&(IBCNT'<IBMAXCNT))  S IBFIRST=-IBDT1 D
 . S IBIFN=0 F  S IBIFN=$O(^DGCR(399,"APDS",DFN,IBDT1,IBIFN)) Q:'IBIFN  I '$$ACTIVE^IBJTU4(IBIFN) D SCRN W "."
 ;
 S IBBEG=$S('IBDT1:"",IBBDT>IBFIRST:IBFIRST,1:IBBDT),IBBDT=$S(+IBBEG:$$DATE(IBBEG),1:"BEGIN")
 S IBEND=$S(IBEDT=""!(IBLAST'>IBEDT):"",1:IBEDT),IBEDT=$S(+IBEND:$$DATE(IBEND),1:"END")
 ;
 I 'IBBEG,'IBEND S IBHMSG="** All Inactive Bills **"
 I $G(IBHMSG)="" S IBHMSG=IBBDT_" - "_IBEDT
 S IBHMSG=IBHMSG_"   ("_VALMCNT_")"
 ;
 I VALMCNT=0 D SET(" ",0),SET("No Inactive Bills for this Patient",0)
 ;
 Q
 ;
SCRN ; add bill to screen list (IBIFN,DFN must be defined)
 N X,IBY,IBD0,IBDU,IBDM,TYPE,REJFLAG,INDFLG S X=""
 S IBCNT=IBCNT+1,IBD0=$G(^DGCR(399,+IBIFN,0)),IBDU=$G(^DGCR(399,+IBIFN,"U")),IBDM=$G(^DGCR(399,+IBIFN,"M"))
 S IBY=IBCNT,X=$$SETFLD^VALM1(IBY,X,"NUMBER")
 ; IB*2.0*451 - get EEOB indicator for bill # when applicable
 S IBPFLAG=$$EEOB^IBJTLA1(+IBIFN)
 S REJFLAG=+$$BILLREJ^IBJTU6($P(IBD0,U)) ;IB*2.0*530 Add indicator for rejects
 S INDFLG=$S($G(IBPFLAG)'="":"%",1:"")_$S(REJFLAG:"c",1:"") S:INDFLG="" INDFLG=" "
 S IBY=$P(IBD0,U,1)_$$ECME^IBTRE(IBIFN),X=$$SETFLD^VALM1(IBY,X,"BILL")
 S IBY=INDFLG_IBY,X=$$SETFLD^VALM1(IBY,X,"BILL")
 S IBY=$S($$REF^IBJTU31(+IBIFN):"r",1:""),X=$$SETFLD^VALM1(IBY,X,"REFER")
 S IBY=$S($$IB^IBRUTL(+IBIFN,0):"*",1:""),X=$$SETFLD^VALM1(IBY,X,"HD")
 S IBY=$$DATE($P(IBDU,U,1)),X=$$SETFLD^VALM1(IBY,X,"STFROM")
 S IBY=$$DATE($P(IBDU,U,2)),X=$$SETFLD^VALM1(IBY,X,"STTO")
 ;
 ;S IBY=$$TYPE($P(IBD0,U,5))_$$TF($P(IBD0,U,6)),X=$$SETFLD^VALM1(IBY,X,"TYPE")
 S TYPE=$$TYPE($P(IBD0,U,5)) I $E(TYPE,2)="P" S TYPE=$E(TYPE)  ; 516 - baa
 ;S IBY=TYPE_"/"_$S($P(IBD0,U,27)=1:"I",$P(IBD0,U,27)=2:"P",1:""),X=$$SETFLD^VALM1(IBY,X,"TYPE")  ; 516 - baa
 ;IB*2.0*592; If the claim is a Dental Claim, set the 2nd piece of the TYPE to "D" for Dental
 ;IA# 10116
 S IBY=TYPE_"/"_$S($$FT^IBCEF(IBIFN)=7:"D",$P(IBD0,U,27)=1:"I",$P(IBD0,U,27)=2:"P",1:""),X=$$SETFLD^VALM1(IBY,X,"TYPE")  ; 592 (vd-US14)
 S IBTYP=$$TYP^IBRFN(IBIFN)
 S IBTYP=$S(IBTYP="":-1,IBTYP="PR":"P",IBTYP="PH":"R",1:IBTYP)
 S IBY=IBY_"/"_IBTYP,X=$$SETFLD^VALM1(IBY,X,"TYPE")
 S IBY=" "_$P($$ARSTATA^IBJTU4(IBIFN),U,2),X=$$SETFLD^VALM1(IBY,X,"ARST")
 ;
 S IBY=$P($G(^DGCR(399.3,+$P(IBD0,U,7),0)),U,4),X=$$SETFLD^VALM1(IBY,X,"RATE")
 S IBY=$S($$MINS^IBJTU31(IBIFN):"+",1:""),X=$$SETFLD^VALM1(IBY,X,"CB")
 S IBY=+$G(^DGCR(399,+IBIFN,"MP"))
 I 'IBY,$$MCRWNR^IBEFUNC(+$$CURR^IBCEF2(IBIFN)) S IBY=+$$CURR^IBCEF2(IBIFN)
 S IBY=$P($G(^DIC(36,+IBY,0)),U,1),X=$$SETFLD^VALM1(IBY,X,"INSUR")
 S IBY=$$BILL^RCJIBFN2(IBIFN)
 S X=$$SETFLD^VALM1($J(+$P(IBY,U,1),8,2),X,"OAMT")
 S X=$$SETFLD^VALM1($J(+$P(IBY,U,3),8,2),X,"CAMT")
 D SET(X,IBCNT)
 Q
 ;
DATE(X) ; date in external format
 Q $E(X,4,5)_"/"_$E(X,6,7)_"/"_$E(X,2,3)
 ;
TYPE(X) ; return abbreviated form of Bill Classification (399,.05)
 ; modified for 516 - baa
 Q $S(X=1:"IP",X=2:"IH",X=3:"OP",X=4:"OH",1:"")   ;(vd-US14)-IB*2*592 - after detecting as a bug, made this
 ;Q $S(X=1:"I",X=2:"IH",X=3:"O",X=4:"OH",1:"")    ;change so the code would be consistent with TYPE^IBTJLA1.
 ;
TF(X) ; return abbreviated form of Timeframe of Bill (399,.06)
 Q $S(X=2:"-F",X=3:"-C",X=4:"-L",X'=1:"-O",1:"")
 ;
SET(X,CNT) ; set up list manager screen array
 S VALMCNT=VALMCNT+1
 S ^TMP("IBJTLB",$J,VALMCNT,0)=X Q:'CNT
 S ^TMP("IBJTLB",$J,"IDX",VALMCNT,+CNT)=""
 S ^TMP("IBJTLBX",$J,CNT)=VALMCNT_U_IBIFN
 Q