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

IBCAPP.m

Go to the documentation of this file.
  1. IBCAPP ;ALB/WCJ - Claims Auto Processing Main Processer;27-AUG-10
  1. ;;2.0;INTEGRATED BILLING;**432,447,568**;21-MAR-94;Build 40
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. G AWAY
  1. AWAY Q
  1. ;
  1. EN(IBIFN,IBORIG,IBPYMT,IBWLF) ;
  1. ; This is called from tag BULL^IBCNSBL2. It is the starting point for the claims auto-processing.
  1. ; Instead of sending a bulletin which started a manual process, the bulletin routine calls this routine
  1. ; which will evaluate the claim and perform one of three actions.
  1. ; 1) auto-process the claim to a subsequent payer.
  1. ; 2) auto-print a claim in case the payer does not want to receive secondary/tertiary claims electronically
  1. ; 3) put the claim on the new COB Management work list.
  1. ;
  1. ; Input: IBIFN -- Pointer to AR (file #430), or Claim (file #399) (same internal number goes to files)
  1. ; IBORIG -- Original amount of the claim
  1. ; IBPYMT -- Total Amount paid on the claim
  1. ; IBWLF -- 1 or 2 if it should go straight to the work list or
  1. ; 0 if it should be evaluated.
  1. ;
  1. N IBREASON,IBX,IBMRANOT,IBERRMSG,IBEOB,IBINS,Z,IB,IBF,IBFT,IBNCN,IBDV,IBREG,IBNCN
  1. S IBMRANOT=1
  1. ;
  1. ; A specific non-human user for all reg 835 EOB filing processes.
  1. ; Change the DUZ to be this user.
  1. ; *** Integration Agreement 4129 - Activated on 30-June-2003 ***
  1. S IBREG=$$IBREG()
  1. I IBREG>0 NEW DUZ D DUZ^XUP(IBREG) ; IA#4129
  1. ;
  1. ; Check if this is being forced to the work list.
  1. ;I $G(IBWLF) S IBREASON="IB813:CHAMPVA Center or TRICARE Fiscal Intermediary or TRICARE Supplemental policy." D PUTONWL(IBIFN,IBREASON) G ENX ;IB*2*432
  1. I $G(IBWLF) D G ENX ;IB*2*568
  1. .I IBWLF=2 S IBREASON="IB815:Balance bill this patient using the appropriate cost-based rate type." D PUTONWL(IBIFN,IBREASON) Q
  1. .I IBWLF=1 S IBREASON="IB813:CHAMPVA Center or TRICARE Fiscal Intermediary or TRICARE Supplemental policy." D PUTONWL(IBIFN,IBREASON) Q
  1. .Q
  1. ;
  1. I IBPYMT'<IBORIG D WLCK^IBCNSBL2(IBIFN) Q ; no reason to continue if nothing else owed
  1. ;
  1. ; Make sure there is another payer
  1. I '$P($G(^DGCR(399,IBIFN,"I"_($$COBN^IBCEF(IBIFN)+1))),U,1) D WLCK^IBCNSBL2(IBIFN) G ENX ;IB*2*432
  1. ;
  1. ; stop if the subsequent claim was already created
  1. I +$P($G(^DGCR(399,IBIFN,"M1")),U,$$COBN^IBCEF(IBIFN)+5) D WLCK^IBCNSBL2(IBIFN) G ENX ;IB*2*432
  1. ;
  1. ; stop if the subsequent payer is Medicare. If there is a non-Medicare tertiary payer, force to worklist
  1. I $$WNRBILL^IBEFUNC(IBIFN,$$COBN^IBCEF(IBIFN)+1) D Q
  1. .I $D(^DGCR(399,IBIFN,"I3")),'$$WNRBILL^IBEFUNC(IBIFN,3) D PUTONWL(IBIFN,"IB814") Q
  1. .D WLCK^IBCNSBL2(IBIFN) Q
  1. ;
  1. ; check the Commercial Auto Processing criteria
  1. S IBX=$$CRIT^IBCAPP1(IBIFN,.IBEOB)
  1. ;
  1. ; If it fails the criteria check, put it on the work list
  1. I '+IBX D PUTONWL(IBIFN,$P(IBX,U,2)) G ENX ;IB*2*432
  1. ;
  1. ; Auto Process this bad boy
  1. ;
  1. ; first check that if it's supposed to be printed locally, the printers are defined.
  1. ; if not, put on the work list
  1. ; if they are, then fall through
  1. S Z=$$COBN^IBCEF(IBIFN)+1
  1. S IBINS=$$POLICY^IBCEF(IBIFN,1,Z)
  1. S IBWLF=0
  1. I $P($G(^DIC(36,IBINS,6)),U,9)=1 D I IBWLF D PUTONWL(IBIFN,IBREASON) G ENX ;IB*2*432
  1. .I $$EOBPRT^IBCAPR()="" S IBWLF=1,IBREASON="IB811:Auto-printer not defined in IB Site Parameters" Q
  1. .I $$MRAPRT^IBCAPR()="" S IBWLF=1,IBREASON="IB811:Auto-printer not defined in IB Site Parameters" Q
  1. .S IB=$$FT^IBCU3(IBIFN) ; form type ien (2 or 3)
  1. .I "^2^3^"'[(U_IB_U) S IBWLF=1,IBREASON="IB810:No Form Type defined" Q
  1. .S IBFT=$$FTN^IBCU3(IB) ; form type name
  1. .S IBF=$P($G(^IBE(353,+IB,2)),U,8)
  1. .S:IBF="" IBF=IB ;Forces the use of the output formatter to print bills
  1. .; get default CMS or UB printer (based on claim form type)
  1. .S IBDV=$S(IB=2:$$CMS1500^IBCAPR1(),1:$$UB4PRT^IBCAPR1())
  1. .I IBDV="" S IBWLF=1,IBREASON="IB811:Auto-printer not defined in IB Site Parameters" Q
  1. I $G(IBREASON)]"" D PUTONWL(IBIFN,IBREASON) G ENX ;IB*2*432
  1. ;
  1. ; create the new claim
  1. S IBNCN="" ; Initialize New Claim Number
  1. D AUTOCOB^IBCEMQA(IBIFN,IBEOB,.IBERRMSG,IBMRANOT,.IBNCN)
  1. ;
  1. ; make sure everything was cool with creating the new claim.
  1. I $G(IBERRMSG)]""!('+$G(IBNCN)) S IBREASON="IB812:Failed AUTOCOB Generation" D PUTONWL(IBIFN,IBREASON) G ENX ;IB*2*432
  1. ;
  1. ; If it's to be auto printed, set force to local print flag on new claim
  1. S IBINS=$$POLICY^IBCEF(IBNCN,1,$$COBN^IBCEF(IBNCN))
  1. ; set field 35 on original claim to indicate subsequent claim was auto-created IB*2.0*447
  1. I $P($G(^DIC(36,IBINS,6)),U,9)=1 D FORCEPRT(IBNCN),AUTOPRC($G(IBIFN),2)
  1. D:$P($G(^DIC(36,IBINS,6)),U,9)'=1 AUTOPRC($G(IBIFN),3)
  1. ;
  1. ; authorize the new claim
  1. D AUTH^IBCEMQA(IBNCN,.IBERRMSG,IBMRANOT)
  1. ;
  1. ; If AUTH error occurred, file the automatic bill generation failure message
  1. I $G(IBERRMSG)]"" D AUTOMSG^IBCESRV3(IBEOB,IBERRMSG) G ENX
  1. ;
  1. ; If local print, then print it
  1. I $P($G(^DIC(36,IBINS,6)),U,9)=1 D STFLP^IBCAPR1(IBNCN)
  1. ;
  1. ENX ;Quit and Cleanup of Main Entry Point, added with IB*2*432
  1. ;
  1. ; DBIA #10111: Allows FM read access of ^XMB(3.8,D0,0) using DIC.
  1. S DIC="^XMB(3.8,",DIC(0)="QM",X="IB DEV TEAM" D ^DIC
  1. ;
  1. Q
  1. ;
  1. PUTONWL(IBIFN,IBREASON) ; Put a claim on the worklist
  1. ; IBIFN - internal claim number
  1. ; IBREASON - reason why this is being put on the worklist (error code:text)
  1. ;
  1. N DA,DIE,DR
  1. S DA=IBIFN
  1. S DIE="^DGCR(399,"
  1. S DR="35///1" ; place on the worklist
  1. S DR=DR_";"_"36///"_$P(IBREASON,":") ; why placed on worklist
  1. D ^DIE
  1. Q
  1. ;
  1. AUTOPRC(IBIFN,IBAP) ; record that a claim was auto-processed IB*2.0*447
  1. ; IBIFN - internal claim number
  1. ; IBAP - 2 = AUTO LOCAL PRINT, 3 = AUTO EDI
  1. ;
  1. N DA,DIE,DR
  1. Q:IBIFN=""
  1. Q:IBAP=""
  1. S DA=IBIFN
  1. S DIE="^DGCR(399,"
  1. S DR="35///"_IBAP ; UPDATE AUTO-PROCESS FIELD
  1. D ^DIE
  1. Q
  1. ;
  1. FORCEPRT(IBIFN) ; set force to local print flag in claim
  1. ; IBIFN - internal claim number
  1. ;
  1. N DA,DIE,DR
  1. S DA=IBIFN
  1. S DIE="^DGCR(399,"
  1. S DR="27///1" ; Force Local Print
  1. D ^DIE
  1. Q
  1. ;
  1. IBREG() ; Returns IEN (Internal Entry Number) from file #200 for
  1. ; the Bill Authorizer of acceptable regular (non MRA) secondary claims,
  1. ; namely, AUTHORIZER,IB REG
  1. ;
  1. ; Output: -1 if record not on file
  1. ; IEN if record is on file
  1. ;
  1. N DIC,X,Y
  1. S DIC(0)="MO",DIC="^VA(200,",X="AUTHORIZER,IB REG"
  1. ; call FM lookup utility
  1. D ^DIC
  1. ; if record is already on file, return IEN
  1. ; else return -1
  1. Q +Y