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

IBCECOB2.m

Go to the documentation of this file.
  1. IBCECOB2 ;ALB/CXW - IB COB MANAGEMENT SCREEN ;16-JUN-1999
  1. ;;2.0;INTEGRATED BILLING;**137,155,433,432,447,488,516,592,641,727**;21-MAR-1994;Build 34
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. EDI ;history detail display
  1. N IBIFN,IBDA
  1. D SEL(.IBDA,1)
  1. S IBDA=+$O(IBDA(0)),IBIFN=+$G(IBDA(IBDA))
  1. D EDI1(IBIFN)
  1. S VALMBCK="R"
  1. Q
  1. ;
  1. EDI1(IBIFN) ;
  1. N DFN
  1. Q:'IBIFN
  1. S DFN=$P($G(^DGCR(399,IBIFN,0)),U,2)
  1. D EN^VALM("IBJT EDI STATUS")
  1. K:$D(IBFASTXT) IBFASTXT
  1. Q
  1. ;
  1. EDI2(IBIFN) ;
  1. N DFN
  1. Q:'IBIFN
  1. S DFN=$P($G(^DGCR(399,IBIFN,0)),U,2)
  1. D EN^VALM("IBJT EDI STATUS ALONE")
  1. K:$D(IBFASTXT) IBFASTXT
  1. Q
  1. ;
  1. CSA ;claims status awaiting resolution
  1. N IBDAX
  1. D EN^IBCECSA
  1. I $D(IBFASTXT) K IBFASTXT
  1. S VALMBCK="R"
  1. Q
  1. ;
  1. RVEOB ;Review EOB
  1. D FULL^VALM1 W !
  1. N IBDA,IBIFN,IBCMT,IBSEL
  1. D SEL(.IBDA,1)
  1. S IBSEL=+$O(IBDA(0))
  1. S IBDA=$G(IBDA(IBSEL))
  1. S IBIFN=$P(IBDA,U),IBDA=$P(IBDA,U,3)
  1. I 'IBIFN G VEOBQ
  1. S IBCMT=$G(^TMP("IBCECOB1",$J,IBSEL))
  1. I IBCMT'="" D EN^VALM("IBCEM MRA REVIEW")
  1. VEOBQ K ^TMP("IBCECOC",$J)
  1. S VALMBCK="R"
  1. Q
  1. ;
  1. TPJI ;Third Party joint Inquiry
  1. N IBDA,IBIFN
  1. D SEL(.IBDA,1)
  1. S IBDA=+$O(IBDA(0)),IBIFN=+$G(IBDA(IBDA))
  1. I IBDA="" G TPJIQ
  1. D TPJI1(IBIFN)
  1. TPJIQ S VALMBCK="R"
  1. Q
  1. ;
  1. TPJI1(IBIFN) ;
  1. N DFN,IBNOTPJI
  1. Q:'IBIFN
  1. S DFN=$P($G(^DGCR(399,IBIFN,0)),U,2),IBNOTPJI=1
  1. D EN^VALM("IBJT CLAIM INFO")
  1. K:$D(IBFASTXT) IBFASTXT
  1. Q
  1. ;
  1. PBILL ;Print bill
  1. N IBIFN,IBDA,IBRESUB
  1. D SEL(.IBDA,1)
  1. S IBDA=$O(IBDA(0)),IBIFN=+$G(IBDA(+IBDA))
  1. I IBDA="" G PBOUT
  1. S IBRESUB=$$RESUB^IBCECSA4(IBIFN,1,"P")
  1. I IBRESUB'>0 W !,*7,"This is not a transmittable bill or review not needed" D PAUSE^VALM1 G PBOUT
  1. I IBRESUB=2 D G PBOUT
  1. . N IB364
  1. . S IB364=+$P($G(IBDA(IBDA)),U,2)
  1. . D PRINT1^IBCEM03(IBIFN,.IBDA,IB364)
  1. D PBILL1(IBIFN,.IBRESULT) ;WCJ;US3380MODIFIED THIS LINE BUT WHY???
  1. PBOUT S VALMBCK="R"
  1. Q
  1. ;
  1. PMRA ;Print MRA
  1. N IBIFN,IBDA,IBDAX
  1. D SEL(.IBDA,1)
  1. ;IB*2.0*592 JRA Fix <UNDEFINED> error occurring when IBDA(+IBDA) does not exist. Also, ensure that IBDAX'=""
  1. ; since it's used as a subscript to ^IBM.
  1. ;S IBDA=$O(IBDA(0)),IBIFN=+$G(IBDA(+IBDA)),IBDAX=$P(IBDA(+IBDA),U,3) ;IB*2.0*592 JRA ';'
  1. S IBDA=$O(IBDA(0)),IBIFN=+$G(IBDA(+IBDA)),IBDAX=+$P($G(IBDA(+IBDA)),U,3) ;IB*2.0*592 JRA Add $G to SET of IBDAX and +$P
  1. G:'IBIFN PRMQ
  1. I '$G(IBMRANOT),$D(^IBM(361.1,IBDAX,"ERR")),'$$WARNMSE G PRMQ ; Claim contains Message Storage Errors
  1. D MRA^IBCEMRAA(.IBIFN)
  1. PRMQ S VALMBCK="R"
  1. Q
  1. PBILL1(IBIFN,IBRESULT) ;WCJ;IB641;US3380;added IBRESULT parameter
  1. N IBAC1,IBAC,DFN
  1. S IBRESULT=0 ;WCJ;IB641;US3380;default IBRESULT to 0 (not yet successful)
  1. Q:'IBIFN
  1. S DFN=$P($G(^DGCR(399,IBIFN,0)),U,2)
  1. S IBAC=4,IBAC1=1
  1. ;D 4^IBCB1
  1. D ALT4^IBCB1(.IBRESULT) ; WCJ;IB641;US3380;added parameter to show whether it actually got printed
  1. D FULL^VALM1,PAUSE^VALM1
  1. Q
  1. ;
  1. CANCEL ;Cancel bill
  1. ; IBDA(IBDA)=IBIFN^IB364^ien of 361.1^user selection seq^user name~duz#
  1. ;
  1. N IBIFN,IBDA,IB364,IBEOBIFN,X,IBDENCT
  1. ;
  1. ; Check for security key
  1. I '$$KCHK^XUSRB("IB AUTHORIZE") D G CANCELQ
  1. . D FULL^VALM1 S VALMBCK="R"
  1. . W !!?5,"You don't hold the proper security key to access this function."
  1. . W !?5,"The necessary key is IB AUTHORIZE. Please see your manager."
  1. . D PAUSE^VALM1
  1. . Q
  1. ;
  1. D SEL(.IBDA,1)
  1. S IBDA=$O(IBDA(0)),IBIFN=+$G(IBDA(+IBDA)),IB364=$P($G(IBDA(+IBDA)),U,2)
  1. S IBEOBIFN=$P($G(IBDA(+IBDA)),U,3)
  1. ;
  1. ; IB*2.0*432 - if not mra, only allow cancel of denied claims. If no EOB, check AR status instead
  1. I 'IBEOBIFN,$G(IBMRANOT)=1,$P($$ARSTATA^IBJTU4(IBIFN),U)="COLLECTED/CLOSED" D G CANCELQ
  1. . D FULL^VALM1 S VALMBCK="R"
  1. . W !!,*7,"You can only cancel denied claims. This claim is in a COLLECTED/CLOSED status"
  1. . W !,"Use Remove Action to remove claim from this worklist."
  1. . D PAUSE^VALM1
  1. . Q
  1. ;
  1. ; IB*2.0*432 - if not mra, only allow cancel of claims with multiple EOBS if none have processed.
  1. I $G(IBMRANOT)=1,'$$DENCHK(IBIFN,.IBDENCT),$G(IBDENCT)>1 D G CANCELQ
  1. . D FULL^VALM1 S VALMBCK="R"
  1. . W !!,*7,"Multiple EOBs exist for this claim and at least one has EOB status of PROCESSED."
  1. . W !,"Use Remove Action to remove claim from this worklist."
  1. . D PAUSE^VALM1
  1. . Q
  1. ;
  1. ; IB*2.0*432 - if not mra, only allow cancel of denied claims
  1. I IBEOBIFN,$G(IBMRANOT)=1,$P($G(^IBM(361.1,IBEOBIFN,0)),U,13)'=2 D G CANCELQ
  1. . D FULL^VALM1 S VALMBCK="R"
  1. . W !!?5,*7,"You can only cancel denied claims."
  1. . D PAUSE^VALM1
  1. . Q
  1. ;
  1. ;WCJ;IB727;check to see if all lines are covered in the MRA
  1. N IBRETSPLT
  1. I '$G(IBMRANOT),$$SPLIT^IBCEMU1(IBEOBIFN),$$SPLIT2^IBCEMU1(IBEOBIFN)=0!($$SPLIT2^IBCEMU1(IBEOBIFN)=-1&($$SPLTMRA^IBCEMU1(IBIFN,.IBRETSPLT)<2)) D G CANCELQ
  1. . D FULL^VALM1 S VALMBCK="R"
  1. . W !!?5,"All claim lines must be adjudicated before cancelling a split claim."
  1. . D PAUSE^VALM1
  1. ;
  1. I IBDA D
  1. . I '$$LOCK^IBCEU0(361.1,IBEOBIFN) Q
  1. . D CANCEL^IBCEM3(.IBDA,IBIFN,IB364)
  1. . D UNLOCK^IBCEU0(361.1,IBEOBIFN)
  1. S VALMBCK="R"
  1. ;
  1. ; for non-MRA claims cancelled from worklist, set field 38
  1. I $G(IBMRANOT)=1,$P($G(^DGCR(399,IBIFN,0)),U,13)=7 S X=$$WLRMVF^IBCECOB1($S($G(IBIFN)'="":IBIFN,1:+$G(IBDA(IBDA))),"CA")
  1. I $G(IBDA)'="" D BLD^IBCECOB1
  1. CANCELQ Q
  1. ;
  1. CRD ; Correct Rejected/Denied claim protocol action
  1. N IBCNCRD
  1. S IBCNCRD=1
  1. CLONE ; 'Copy/cancel bill' protocol action
  1. ;N IBDA,IBQ,IBEOBIFN,IBKEY,X,IBDENCT
  1. N IBDA,IBQ,IBEOBIFN,IBKEY,X,IBDENCT,IBIFN ;WCJ;IB727
  1. ;
  1. ; Check for security key
  1. ;IB*2.0*516/TAZ - Remove check for IB CLON
  1. ;I '$$KCHK^XUSRB("IB AUTHORIZE") D G CLONEQ
  1. ;S IBKEY=$S($G(IBCNCRD)=1:"IB AUTHORIZE",1:"IB CLON")
  1. S IBKEY="IB AUTHORIZE"
  1. I '$$KCHK^XUSRB(IBKEY) D G CLONEQ
  1. . D FULL^VALM1 S VALMBCK="R"
  1. . ;W !!?5,"You don't hold the proper security key to access this function."
  1. . ;W !?5,"The necessary key is IB AUTHORIZE. Please see your manager."
  1. . W !!?5,"You must hold the "_IBKEY_" security key to access this function."
  1. . W !?5,"Please see your manager."
  1. . D PAUSE^VALM1
  1. . Q
  1. ;
  1. D SEL(.IBDA,1)
  1. ;S IBDA=$O(IBDA(""))
  1. S IBDA=$O(IBDA(0)),IBIFN=+$G(IBDA(+IBDA)) ; IB727
  1. I IBDA="" G CLONEQ
  1. ;
  1. ; IB*2.0*432 - if not mra, only allow cancel of claims with multiple EOBS if none have processed.
  1. I $G(IBMRANOT)=1,'$$DENCHK(+IBDA(IBDA),.IBDENCT),$G(IBDENCT)>1 D G CANCELQ
  1. . D FULL^VALM1 S VALMBCK="R"
  1. . W !!,*7,"Multiple EOBs exist for this claim and at least one has EOB status of PROCESSED."
  1. . W !,"Use Remove Action to remove claim from this worklist."
  1. . D PAUSE^VALM1
  1. . Q
  1. ;
  1. ;WCJ;IB727;check to see if all lines are covered in the MRA
  1. N IBEOBIFN,IBRETSPLT
  1. S IBEOBIFN=$P($G(IBDA(+IBDA)),U,3)
  1. I '$G(IBMRANOT),$$SPLIT^IBCEMU1(IBEOBIFN),$$SPLIT2^IBCEMU1(IBEOBIFN)=0!($$SPLIT2^IBCEMU1(IBEOBIFN)=-1&($$SPLTMRA^IBCEMU1(IBIFN,.IBRETSPLT)<2)) D G CLONEQ
  1. . D FULL^VALM1 S VALMBCK="R"
  1. . W !!?5,"All claim lines must be adjudicated before "_$S($G(IBCNCRD):"crd'ing",1:" cloning")_" a split claim."
  1. . D PAUSE^VALM1
  1. ;
  1. S IBEOBIFN=$P($G(IBDA(+IBDA)),U,3)
  1. I '$$LOCK^IBCEU0(361.1,IBEOBIFN) G CLONEQ
  1. D COPYCLON(+$G(IBDA(IBDA)),$P($G(IBDA(+IBDA)),U,2),.IBQ)
  1. D UNLOCK^IBCEU0(361.1,IBEOBIFN)
  1. ;
  1. ; for non-MRA claims cloned or corrected from worklist, set field 38
  1. I $G(IBMRANOT)=1,$G(IBQ)'="" S X=$$WLRMVF^IBCECOB1(+$G(IBDA(IBDA)),$S($G(IBCNCRD)=1:"CR",1:"CL"))
  1. ;
  1. CLONEQ ;
  1. S VALMBCK="R"
  1. D:$G(IBQ)'="" BLD^IBCECOB1
  1. Q
  1. ;
  1. COPYCLON(IBIFN,IB364,IBQ) ; Generic entry point for clone a bill from EDI processing
  1. ; IBIFN = original bill ien
  1. ; IB364 = the ien of the transmission bill entry in file 364
  1. ; IBQ = If bill is not cancelled, this is returned as null
  1. ; - pass by reference -
  1. ;
  1. N IBQUIT,IBCCCC,IBHV,Y,IBCAN,IBCE,IBDA,IBCNCOPY
  1. ;I '$$CANCKS^IBCEM3("CC",IBIFN) S IBQ="" G CCQ
  1. I $G(IBCNCRD)'=1,'$$CANCKS^IBCEM3("CC",IBIFN) S IBQ="" G CCQ
  1. ;
  1. ;S IBCAN=2,IBCE("EDI")=1,Y=IBIFN,IBCCCC=0,IBHV("IBIFN")=IBIFN,IBHV("IBIFN1")="",IBCNCOPY=1
  1. S IBCAN=2,IBCE("EDI")=1,Y=IBIFN,IBCCCC=0,IBHV("IBIFN")=IBIFN,IBHV("IBIFN1")=""
  1. I $G(IBCNCRD)'=1 S IBCNCOPY=1 D ^IBCCC
  1. I $G(IBCNCRD)=1 D CRD^IBCCC
  1. ;D ^IBCCC
  1. S IBIFN=IBHV("IBIFN")
  1. K IBCE("EDI") S IBQ=1
  1. I $P($G(^DGCR(399,IBIFN,0)),U,13)'=7 S IBQ=""
  1. I IBHV("IBIFN1") D
  1. . N IBU
  1. . S IBU="R"
  1. . S IBNIEN=+IBHV("IBIFN1")
  1. . I "23"'[$P($G(^DGCR(399,+IBHV("IBIFN1"),0)),U,13) D
  1. .. W:'$G(IBCEAUTO) !,*7,"Please note: the new bill was not AUTHORIZED.",!,"It can only be accessed now via the normal, non-EDI functions.",!,"Status of new bill is ",$$EXPAND^IBTRE(399,.13,$P(^DGCR(399,IBHV("IBIFN1"),0),U,13)) S IBU="C"
  1. . D UPDEDI^IBCEM(IB364,IBU)
  1. ;
  1. I '$G(IBCEAUTO) D PAUSE^VALM1
  1. CCQ Q
  1. ;
  1. PRO ; Copy for secondary/tertiary bill
  1. N VALMY,IBDA,Z,IBIFN,IBIFNH,IB364,IBCE,IBNCN
  1. ;I '$P($G(^IBE(350.9,1,8)),U,12) D G PROQ
  1. I '$P($G(^IBE(350.9,1,8)),U,12),$G(IBMRANOT)'=1 D G PROQ
  1. . D FULL^VALM1
  1. . W !!?5,"MRA's may not be processed at this time."
  1. . W !?5,"The IB site parameter ""Allow MRA Processing?"" is set to NO."
  1. . D PAUSE^VALM1
  1. . Q
  1. D SEL(.IBDA,1)
  1. S Z=$O(IBDA(0)),Z=$G(IBDA(+Z)) G:'Z PROQ
  1. S IBIFN=$P(Z,U),IB364=$P(Z,U,2),IBDA=$P(Z,U,3),IBIFNH=IBIFN
  1. N IBEOBIFN ;WCJ;IB727 v17
  1. S IBEOBIFN=IBDA ;WCJ;IB727 v17
  1. I 'IBIFN G PROQ
  1. I '$G(IBMRANOT),$D(^IBM(361.1,IBDA,"ERR")),'$$WARNMSE G PROQ ; Claim contains Message Storage Errors
  1. ;
  1. ;I $G(IBMRANOT),($$GET1^DIQ(399,IBIFN_",",36,"","","")="IB803"),'$$WARNIBMRANOT G PROQ ;TPF;EBILL-2436;IB*2.0*727
  1. I $G(IBMRANOT),$$FILERR^IBCAPP2(IBIFN),'$$WARNIBMRANOT G PROQ ;TPF;EBILL-3061;IB*2.0*727 v15
  1. ;
  1. ;WCJ;IB727;check to see if all lines are covered in the MRA
  1. N IBRETSPLT ;N IBEOBIFN,IBRETSPLT ;WCJ;IB727 v17
  1. ;S IBEOBIFN=$P($G(IBDA(+IBDA)),U,3) ;WCJ;IB727 v17
  1. I '$G(IBMRANOT),$$SPLIT^IBCEMU1(IBEOBIFN),$$SPLIT2^IBCEMU1(IBEOBIFN)=0!($$SPLIT2^IBCEMU1(IBEOBIFN)=-1&($$SPLTMRA^IBCEMU1(IBIFN,.IBRETSPLT)<2)) D G PROQ
  1. . D FULL^VALM1 S VALMBCK="R"
  1. . W !!?5,"All claim lines must be adjudicated before processing a split claim to subsequent payer."
  1. . D PAUSE^VALM1
  1. ;
  1. I '$$LOCK^IBCEU0(361.1,IBDA) G PROQ
  1. D COBCOPY(IBIFN,IB364,2,IBDA,"BLD^IBCECOB1",.IBNCN)
  1. D UNLOCK^IBCEU0(361.1,IBDA)
  1. ;
  1. ; for non-MRA claims copied from work list, set field 38
  1. I $G(IBMRANOT)=1,$G(IBNCN)'="",($G(IBNCN)'=$G(IBIFN)) D
  1. .S X=$$WLRMVF^IBCECOB1($G(IBIFN),"PC")
  1. .;I $P($G(^DGCR(399,+IBNCN,"S")),U,9)'=1 D
  1. .;.W:'$G(IBCEAUTO) !,*7,"Please note: the new bill was not AUTHORIZED.",!,"It can only be accessed now via the normal, non-EDI functions.",!,"Status of new bill is ",$$EXPAND^IBTRE(399,.13,$P(^DGCR(399,IBNCN,0),U,13))
  1. .;.D PAUSE^VALM1
  1. .D:$G(IBMRANOT)=1 BLD^IBCECOB1
  1. .Q
  1. ;
  1. PROQ S VALMBCK="R"
  1. Q
  1. ;
  1. COBCOPY(IBIFN,IB364,IBFROM,IBIEN,IBBLD,IBNCN) ; Generic entry point for EDI COB copy
  1. ; IBIFN = original bill ien
  1. ; IB364 = the ien of the transmission bill entry in file 364
  1. ; IBFROM = 1 if called from CSA, 2 if called from COB/EOB processing
  1. ; IBIEN = entry in 361 (IBFROM=1) or 361.1 (IBFROM=2) being processed
  1. ; IBBLD = the name of the entrypoint that will rebuild the display
  1. ; IBNCN = by reference, returns the new claim ien if user completed the Copy process
  1. ;
  1. N IBCBASK,IBCBCOPY,IBCAN,IBIFNH,IBNSTAT,IBOSTAT,IBPRCOB,IBSECHK,IBLMVAR,IBAC,IBMRAIEN,IBDA,IBAUTO
  1. N IBCOB,IBCOBIL,IBCOBN,IBINS,IBINSN,IBINSOLD,IBMRAIO,IBMRAO,IBNMOLD,IBQUIT
  1. S (IBCBASK,IBCBCOPY,IBCAN,IBAUTO)=1,(IBPRCOB,IBSECHK)=0,(IBMRAIEN,IBDA)=IBIEN
  1. I $G(IBMRANOT)'=1,'IB364!'IBIFN W !,"Transmission record is missing for this bill" D PAUSE^VALM1 G COBCOPX
  1. ;
  1. S IBIFNH=IBIFN
  1. I IBFROM=2 S IBPRCOB=1
  1. ; IB*2.0*447 Check PR to include excess and percentages where applicable
  1. ;I $S($G(IBMRANOT)=1:$$TOT(IBIFN)'>0,1:$$PREOBTOT^IBCEU0(IBIFN,$G(IBMRANOT))'>0) D G COBCOPX
  1. I $$TOT(IBIFN,$G(IBMRANOT))'>0 D G COBCOPX
  1. . D FULL^VALM1
  1. . W !!?5,"There is no "_$S($G(IBMRANOT)=1:"balance remaining",1:"patient responsibility and/or excess charges")_" for this claim."
  1. . W !?5,"This claim may not be processed."
  1. . D PAUSE^VALM1
  1. . Q
  1. ;
  1. I $G(IBDA)'="",$P($G(^IBM(361.1,IBDA,0)),U,16)="1.5" D G COBCOPX
  1. . W !!,"This claim has already been processed as a sec/tert claim."
  1. . W !,"You will need to complete the authorization process for this claim."
  1. . D PAUSE^VALM1
  1. . D AUTH
  1. . Q
  1. ;
  1. ; If multiple EOBs and one is processed, make sure collected closed.
  1. I $G(IBMRANOT),$$CCCHK(IBIFN)<0 D G COBCOPX
  1. . W !,"Multiple EOBs exist for this claim and at least one has EOB status of PROCESSED."
  1. . W !,"Claim cannot be sent to next payer until AR status is Collected/Closed."
  1. . D PAUSE^VALM1
  1. . Q
  1. ;
  1. ; Get out if no next payer
  1. I '$P($G(^DGCR(399,IBIFN,"I"_($$COBN^IBCEF(IBIFN)+1))),U,1) D G COBCOPX
  1. . W !,"There is no next payer for this bill"
  1. . D PAUSE^VALM1
  1. . Q
  1. ;
  1. D DSPRB^IBCCCB0(IBIFN) ; display related bills
  1. S IBCE("EDI")=1
  1. D CHKB^IBCCCB ; process COB, create secondary bill
  1. S IBNCN=$G(IBCE("EDI","NEW")) ; get new claim ien
  1. S IBIFN=IBIFNH
  1. I IBSECHK G COBCOPX
  1. ;
  1. ; if user came from CBW, no need to view and authorize a 2nd time (already happens in IBCCCB)
  1. Q:$G(IBMRANOT)=1
  1. S IBV=1 D VIEW^IBCB2 ; display billing screens
  1. D AUTH ; authorize bill
  1. COBCOPX ;
  1. Q
  1. ;
  1. AUTH ; procedure to authorize the claim and refresh the screen
  1. K ^UTILITY($J) S IBAC=1,IBQUIT=0 D 3^IBCB1
  1. I '$D(IOUON)!'$D(IORVON) D ENS^%ZISS
  1. I $P($G(^IBM(361.1,IBMRAIEN,0)),U,16)=3 D UPDEDI^IBCEM(IB364,"Z")
  1. I $G(IBBLD)'="" D @IBBLD
  1. D PAUSE^VALM1
  1. AUTHX ;
  1. Q
  1. ;
  1. RES ;Resubmit bill by print
  1. N IBDA,IBIFN,IB364
  1. D SEL(.IBDA,1)
  1. S IBDA=+$O(IBDA(0)),IBIFN=+$G(IBDA(+IBDA)),IB364=+$P($G(IBDA(IBDA)),U,2)
  1. I 'IBIFN G RESQ
  1. D PRINT1^IBCEM03(IBIFN,.IBDA,IB364)
  1. D PAUSE^VALM1
  1. I $G(IBDA)'="" D BLD^IBCECOB1
  1. RESQ S VALMBCK="R"
  1. Q
  1. ;
  1. EBI ;View an unauthorized transmitted bill
  1. N IBFLG,IBDA,IBIFN,IB364,DFN
  1. K ^TMP($J,"IBBILL")
  1. D FULL^VALM1
  1. ;
  1. D SEL(.IBDA,1)
  1. S IBDA=+$O(IBDA(""))
  1. S IBIFN=+$G(IBDA(IBDA)),IB364=+$P($G(IBDA(IBDA)),U,2),DFN=$P($G(^DGCR(399,IBIFN,0)),U,2)
  1. G:'IBIFN EDITQ
  1. S IBV=1 D VIEW^IBCB2
  1. I '$D(IOUON)!'$D(IORVON) D ENS^%ZISS
  1. D BLD^IBCECOB1
  1. EDITQ S VALMBCK="R"
  1. Q
  1. ;
  1. SEL(IBDA,ONE) ; Select entry(s) from list
  1. ; IBDA = array returned if selections made
  1. ; IBDA(n)=ien of bill selected (file 399)
  1. ; ONE = if set to 1, only one selection can be made at a time
  1. N IB
  1. K IBDA
  1. D FULL^VALM1
  1. D EN^VALM2($G(XQORNOD(0)),$S('$G(ONE):"",1:"S"))
  1. S IBDA=0 F S IBDA=$O(VALMY(IBDA)) Q:'IBDA S IBDA(IBDA)=$P($G(^TMP("IBCECOB",$J,+IBDA)),U,2,6)
  1. Q
  1. ;
  1. EXIT ; Exit out of COB
  1. D FASTEXIT^IBCEFG4
  1. I $G(IBFASTXT)=1 S IBFASTXT=5
  1. Q
  1. ;
  1. TOT(IBIFN,IBMRANOT) ; calculate if any balance remaining on non-MRA claim
  1. ; IBIFN = claim ien
  1. ; IBMRANOT = MRW/CBW flag (1=user came from CBW) added with IB*2.0*447
  1. N IBPRTOT,IBBLD,IBCBN,IBU2
  1. I $G(IBMRANOT)'=1 Q $S($$MSEDT^IBCEMU4(IBIFN)'="":$$MSPRE^IBCEMU4(IBIFN),1:$$PREOBTOT^IBCEU0(IBIFN))
  1. ; total up the payer paid amounts, if this is a 2ndary claim, be sure to account for what the primary paid also
  1. S IBU2=$G(^DGCR(399,IBIFN,"U2")),IBCBN=$$COBN^IBCEF(IBIFN),IBPRTOT=$$EOBTOT^IBCEU1(IBIFN,IBCBN)
  1. S:IBPRTOT<0 IBPRTOT=0 ; don't allow negative prior payment or offset
  1. S:IBCBN=2 IBPRTOT=IBPRTOT+$P(IBU2,U,4)
  1. S:IBCBN=3 IBPRTOT=IBPRTOT+$P(IBU2,U,4)+$P(IBU2,U,5)
  1. S:IBPRTOT<0 IBPRTOT=0 ; don't allow negative prior payment or offset
  1. ; Subtract payer paid amount from Total Charges from BILLS/CLAIMS (#399) file, don't allow neg
  1. S IBBLD=$P($G(^DGCR(399,IBIFN,"U1")),U,1)-IBPRTOT
  1. S:IBBLD<0 IBBLD=0
  1. Q IBBLD
  1. ;
  1. CCCHK(IBIFN) ; If there are multiple EOBS on file for this claim, then one of them must be processed and AR status must be collected closed to process.
  1. ; returns 1 if true
  1. ; 0 if there are not multiple EOBs or mulitple EOBs and none are processed (all denials)
  1. ; -1 if false
  1. N IBDA,IBCT,IBPROC,IBARSTAT,IBEOBNDX,IBEOB
  1. S IBCT=0,IBPROC=0
  1. F IBEOBNDX="B","C" D
  1. .S IBDA=0 F S IBDA=$O(^IBM(361.1,IBEOBNDX,IBIFN,IBDA)) Q:'+IBDA D
  1. ..Q:$D(IBEOB(IBDA))
  1. ..Q:$P($G(^IBM(361.1,IBDA,0)),U,4)=1 ; only count EOBs
  1. ..S IBEOB(IBDA)="",IBCT=IBCT+1
  1. ..I $P($G(^IBM(361.1,IBDA,0)),U,13)=1 S IBPROC=1
  1. I IBCT<2 Q 0 ; less than 2 EOBs
  1. I 'IBPROC Q 0 ; no EOBs with status processed
  1. S IBARSTAT=$$ARSTATA^IBJTU4(IBIFN) ; get status of AR
  1. I $P(IBARSTAT,U)="COLLECTED/CLOSED" Q 1
  1. Q -1
  1. ;
  1. DENCHK(IBIFN,IBCT) ; Make sure all EOBs from this claim are denied.
  1. ; Input: IBIFN - IEN to 399
  1. ; IBCT - by reference. Return count of EOBs.
  1. ; Output: returns 1 if there is at least one EOB and that none of the EOBS are processed.
  1. ; otherwise 0
  1. ;
  1. N IBDA,IBPROC,IBEOBNDX,IBEOB
  1. S IBCT=0,IBPROC=0
  1. F IBEOBNDX="B","C" D
  1. .S IBDA=0 F S IBDA=$O(^IBM(361.1,IBEOBNDX,IBIFN,IBDA)) Q:'+IBDA D
  1. ..Q:$D(IBEOB(IBDA))
  1. ..Q:$P($G(^IBM(361.1,IBDA,0)),U,4)=1 ; only count EOBs
  1. ..S IBEOB(IBDA)="",IBCT=IBCT+1
  1. ..I $P($G(^IBM(361.1,IBDA,0)),U,13)=1 S IBPROC=1
  1. I IBCT,'IBPROC Q 1 ; there is at least one EOB and none of the EOBS are processed.
  1. Q 0 ;
  1. ;
  1. WARNMSE() ; Display MSE Warning and check if we should continue.
  1. D FULL^VALM1
  1. N DIR,X,Y
  1. S DIR("A",1)="WARNING : The MRA for this claim caused a Data Mismatch/Message Storage Error."
  1. S DIR("A",2)="If you continue, the secondary claim may not contain the correct data."
  1. S DIR("A")="Do you wish to continue? ",DIR("B")="NO",DIR(0)="YA" D ^DIR
  1. I Y>0 Q 1 ; Okay to continue.
  1. Q 0 ;
  1. ;
  1. WARNIBMRANOT() ;TPF;EBILL-2436;IB*2.0*727;WCJ-lessened to warning
  1. D FULL^VALM1
  1. N DIR,X,Y
  1. S DIR("A",1)="WARNING: An EOB/MRA for this claim caused a Data Mismatch/Message Storage Error."
  1. S DIR("A",2)="If you continue, the subsequent claim may not contain the correct data."
  1. S DIR("A")="Do you wish to continue? ",DIR("B")="NO",DIR(0)="YA" D ^DIR
  1. I Y>0 Q 1 ; Okay to continue.
  1. Q 0 ;
  1. ;
  1. D FULL^VALM1
  1. W !!,"WARNING: An EOB for this Claim has an MSE error and cannot be processed."
  1. N DIR
  1. S DIR(0)="E"
  1. D ^DIR
  1. Q 0