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

IBAUTL8.m

Go to the documentation of this file.
  1. IBAUTL8 ;ALB/MGD - DUPLICATE COPAY TRANSACTION UTILITIES; Sep 30, 2020@15:16:44
  1. ;;2.0;INTEGRATED BILLING;**630**;21-MAR-94;Build 39
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ; ****************************************************************************
  1. ; This routine is designed to implement a series of final checks immediately *
  1. ; prior to IB releasing a charge over to Accounts Receivable (AR). *
  1. ; IBAUTL9 handles the storing of associated information related to any *
  1. ; duplicate copays found by IBAUTL8. *
  1. ; These updates are part being released in IB*2.0*630. *
  1. ; ****************************************************************************
  1. ;
  1. COPAYCHK(IBDFN,IBN,IBINTACT) ;
  1. ; Determine if the Copay charge currently being reviewed should be passed over to Accounts Receivable (AR)
  1. ; Input:
  1. ; IBDFN = Pointer to the Patient in file #2
  1. ; IBN = Pointer to the charge in file #350
  1. ; IBINTACT = Optional - Flag to indicate when the call is being made from an interactive option.
  1. ; 1:Interactive
  1. ; For Interactive call, the IEN of the existing copay charge will be passed
  1. ; back and this info will be used to display an error message for the
  1. ; Release Charges 'On Hold' [IB MT RELEASE CHARGES] option and the Pass a Charge
  1. ; action on the Cancel/Edit/Add Patient Charges [IB CANCEL/EDIT/ADD CHARGES] option.
  1. ; 0:Non-Interactive
  1. ; For Non-Interactive calls, duplicate copay transaction information
  1. ; will be stored in ^XTMP("IB TRANS").
  1. ; At the end of the IB nightly background job, any duplicate copay info in
  1. ; ^XTMP("IB TRANS") will be sent via MailMan to the IB DUPLICATE TRANSACTIONS mail group.
  1. ;
  1. ; Output: IBACTION = Flag to indicate whether the copay charge being reviewed should be passed to AR.
  1. ; Flag # - The IEN of the existing Copay charge for the Patient/Date of interest.
  1. ; The charge being reviewed should NOT be passed over to AR.
  1. ; 0 - There is no existing Copay charge for this Patient/Date.
  1. ; The charge being reviewed should be passed over to AR.
  1. ;
  1. ; The checks that occur in the software below are prioritized based on the existing VA rules.
  1. ;
  1. N IBACTION,IBAT,IBDATA0,IBEVDT
  1. ; Initialize return value.
  1. ; Defaulting to 0 will cause the charge currently being reviewed to be passed over to AR.
  1. ; Currently, there is no existing check to prevent passing duplicates over to AR so setting
  1. ; IBACTION = 0 mimics the way the software currently works. Our new checks will set
  1. ; IBACTION = IEN of existing copay charge to prevent the duplicates charges from occurring.
  1. S IBACTION=0
  1. ; Quit if DFN or IBN not defined
  1. I '+IBDFN!('+IBN) Q IBACTION
  1. ; If IBINTACT was not passed in, default it to 0:Non-Interactive
  1. S IBINTACT=$S(IBINTACT'="":IBINTACT,1:0)
  1. ; Quit if DFN not valid
  1. I '$D(^DPT(IBDFN)) Q IBACTION
  1. ; Load the 0 node from File #350 for this record. QUIT if no 0 node
  1. S IBDATA0=$G(^IB(IBN,0))
  1. I IBDATA0="" Q IBACTION
  1. ; Load EVENT DATE (#.17)
  1. S IBEVDT=$P(IBDATA0,U,17)
  1. ; If the EVENT DATE is not defined, default to DATE BILLED FROM (#.14)
  1. I IBEVDT'?7N S IBEVDT=$P(IBDATA0,U,14)
  1. ; Quit if no valid EVENT DATE or DATE BILLED FROM
  1. I IBEVDT'?7N Q IBACTION
  1. ; Load the ACTION TYPE (#.03) for the charge being reviewed
  1. S IBAT=$P(IBDATA0,U,3)
  1. ; Quit if Action Type not defined
  1. I +IBAT<=0 Q IBACTION
  1. ;
  1. ; Perform checks for Outpatient Copays.
  1. ; Action Types = 51 - DG OPT COPAY NEW 74 - DG OBSERVATION COPAY NEW
  1. ; 136 - CC (OPT) NEW 203 - CC URGENT CARE (OPT) NEW
  1. I "^51^74^136^203^"[("^"_IBAT_"^") D OCPYNEW(IBN,IBEVDT,.IBACTION,IBINTACT) Q IBACTION
  1. ;
  1. ; Perform checks for Inpatient Per Diem. It is legal to have both an Inpatient Per Diem AND an
  1. ; Inpatient Copay on the same day provided they are a correct pairing.
  1. ; Correct pairings are checked during the Inpatient checks.
  1. ; Action Types = 45 - DG INPT PER DIEM NEW 48 - DG NHCU PER DIEM NEW
  1. ; 133 - CC (PER DIEM) NEW
  1. I "^45^48^133^"[("^"_IBAT_"^") D IPDNEW^IBAUTL8A(IBN,IBEVDT,.IBACTION,IBINTACT) Q IBACTION
  1. ;
  1. ; Perform checks for Inpatient Copay. It is legal to have both an Inpatient Per Diem AND an
  1. ; Inpatient Copay on the same day provided they are the correct pairings.
  1. ; Correct pairings are checked in ICPYNEW.
  1. ; Tricare: GEN MED INPT COPAY (#15) - can have more than one per day. Bill all of
  1. ; these charges. There is no need to check for them.
  1. ; Action Types = 130 - CC (INPT) NEW 16 - DG INPT COPAY (SUR) NEW
  1. ; 17 - DG INPT COPAY (SPI) NEW 18 - DG INPT COPAY (PSY) NEW
  1. ; 19 - DG INPT COPAY (INT) NEW 20 - DG INPT COPAY (REH) NEW
  1. ; 21 - DG INPT COPAY (BLI) NEW 22 - DG INPT COPAY (NEU) NEW
  1. ; 23 - DG INPT COPAY (ALC) NEW 24 - DG NHCU COPAY NEW
  1. ;
  1. I "^130^16^17^18^19^20^21^22^23^24^"[("^"_IBAT_"^") D ICPYNEW^IBAUTL8C(IBN,IBEVDT,.IBACTION,IBINTACT) Q IBACTION
  1. ;
  1. ; Perform checks for Long Term Care (LTC) Copay.
  1. ; Action Types = 89 - DG LTC OPT ADHC NEW 92 - DG LTC OPT GEM NEW
  1. ; 95 - DG LTC OPT RESPITE NEW 105 - DG LTC FEE OPT ADHC NEW
  1. ; 108 - DG LTC FEE OPT RESPITE NEW
  1. I "^89^92^95^105^108^"[("^"_IBAT_"^") D LTCNEW^IBAUTL8B(IBN,IBEVDT,.IBACTION,IBINTACT) Q IBACTION
  1. Q IBACTION
  1. ;
  1. OCPYNEW(IBN,IBEVDT,IBACTION,IBINTACT) ;
  1. ; Perform checks for a new Outpatient Copay charge to determine if this charge should be passed over to AR.
  1. ; Input:
  1. ; IBN = Pointer to Outpatient Copay charge currently being reviewed in the INTEGRATED BILLING ACTION (#350) file
  1. ; IBEVDT = Event Date for the charge currently being reviewed in the INTEGRATED BILLING ACTION (#350) file
  1. ; IBACTION = Passed by reference. Passed in as 0:Pass to AR
  1. ; IBINTACT = Optional - Flag to indicate when the call is being made from an interactive option.
  1. ; 1:Interactive
  1. ; 0:Non-Interactive
  1. ; For more info see COPAYCHK above
  1. ;
  1. ; Output: IBACTION = 0 if the current charge being reviewed should be passed over to AR
  1. ; # The IEN of the existing Copay charge for the Patient/Date of interest.
  1. ; The charge being reviewed should NOT be passed over to AR.
  1. ;
  1. ; Verify incoming value of IBACTION and default to 0 if not defined
  1. S IBACTION=$S(IBACTION'="":IBACTION,1:0)
  1. ; Quit if necessary data was not passed in
  1. I +IBN<=0!(+IBEVDT'?7N) Q
  1. ; If IBINTACT was not passed in, default it to 0:Non-Interactive
  1. S IBINTACT=$S(IBINTACT'="":IBINTACT,1:0)
  1. N IBBFI,IBBFO,IBBOB,IBBPD,IBDFN,IBIEN,IBLTC,IBRSN
  1. ; Load Patient IEN from IBN passed in
  1. S IBDFN=+$P($G(^IB(IBN,0)),U,2)
  1. ; Quit if no IEN in record
  1. I IBDFN<1 Q
  1. ; Determine if the Patient has an Inpatient Copay for the Event Date
  1. S IBBFI=$$BFI^IBAUTL8C(IBDFN,IBEVDT,IBN)
  1. ; Determine if the Patient has an Per Diem Copay for the Event Date
  1. S IBBPD=$$BFPD^IBAUTL8A(IBDFN,IBEVDT,IBN)
  1. ; Determine if the Patient has an Observation Copay for the Event Date
  1. S IBBOB=$$BFOB^IBAUTL8A(IBDFN,IBEVDT,IBN)
  1. ; If the Patient has already been charged an Inpatient Copay charge OR an Inpatient Per Diem charge OR
  1. ; an Outpatient Observation Copay charge for the Event Date, Don't pass Outpatient Copay to AR
  1. I IBBFI!IBBPD!IBBOB D Q
  1. . ; Set return value to NOT pass the charge over to AR
  1. . S IBACTION=$S(IBBFI:IBBFI,IBBPD:IBBPD,IBBOB:IBBOB,1:0)
  1. . ; Quit if interactive
  1. . Q:IBINTACT
  1. . ; Cancel the Outpatient Copay charge being reviewed with CANCELLATION REASON = 42 - BILLED AT HIGHER TIER RATE
  1. . ; ### Uncomment for Phase 2 D CNCLCHRG^IBAUTL8A(IBN,42)
  1. . ; Determine which Cancellation Reason to include in MailMan message
  1. . I IBBFI>0 S IBIEN=IBBFI,IBRSN="EXISTING INPATIENT COPAY CHARGE WHICH HAS HIGHER PRECEDENCE"
  1. . I IBBPD>0 S IBIEN=IBBPD,IBRSN="EXISTING INPATIENT PER DIEM CHARGE WHICH HAS HIGHER PRECEDENCE"
  1. . I IBBOB>0 S IBIEN=IBBOB,IBRSN="EXISTING OBSERVATION COPAY CHARGE WHICH HAS HIGHER PRECEDENCE"
  1. . ; Record related info into ^XTMP for MailMan message
  1. . I 'IBINTACT D STORE1^IBAUTL9(IBN,IBIEN,IBRSN)
  1. . Q
  1. ;
  1. ; Determine if the Patient has an Outpatient Copay for the Event Date
  1. S IBBFO=$$BFO^IBAUTL8A(IBDFN,IBEVDT,IBN)
  1. ; If the Patient has already been charged an Outpatient Copay for the Event Date, compare current charge being
  1. ; reviewed to the existing Outpatient Copay charge and determine what action to take.
  1. I IBBFO D Q
  1. . ; Set IBACTION = IEN of Outpatient Copay
  1. . S IBACTION=IBBFO
  1. . ; Quit if interactive
  1. . Q:IBINTACT
  1. . N IBCTOT,IBETOT
  1. . ; Load dollar amounts from the 2 charges. IBCTOT = Current Charge Being Reviewed Total, IBETOT = Existing Total
  1. . S IBCTOT=+$P($G(^IB(IBN,0)),U,7),IBETOT=+$P($G(^IB(+IBBFO,0)),U,7)
  1. . ; If the current charge being processed is <= to the existing Outpatient Copay charge
  1. . I IBCTOT<=IBETOT D Q
  1. . . ; Cancel current charge being reviewed with CANCELLATION REASON = 4 - ENTERED IN ERROR
  1. . . ; ### Uncomment for Phase 2 D CNCLCHRG^IBAUTL8A(IBN,4)
  1. . . ; Record related info into ^XTMP for MailMan message
  1. . . S IBRSN="EXISTING OUTPATIENT COPAY CHARGE AT SAME OR HIGHER TIER RATE"
  1. . . D STORE1^IBAUTL9(IBN,IBBFO,IBRSN)
  1. . ; If the current charge being processed is > than the existing Outpatient Copay charge
  1. . I IBCTOT>IBETOT D Q
  1. . . ; ### Uncomment for Phase 2
  1. . . ; IBND has to be set to 0 node for call to CANC^IBECEAU4
  1. . . ; ### N IBND S IBND=$G(^IB(IBN,0))
  1. . . ; IBFAC and IBSITE needed by Cancel operation below
  1. . . ; ### N IBFAC,IBSITE
  1. . . ; Calculate site from site parameters
  1. . . ; ### D SITE^IBAUTL
  1. . . ; If not interactive Cancel existing charge with Reason = 42 - BILLED AT HIGHER TIER RATE
  1. . . ; UNCOMMENT THIS AND TEST MORE ON WHAT HAPPENS IN THE CANCELLATION PROCESS
  1. . . ; ### I 'IBINTACT D CANC^IBECEAU4(IBBFO,42,1)
  1. . . ; Record related info into ^XTMP for MailMan message
  1. . . S IBRSN="ANOTHER OUTPATIENT COPAY CHARGE BILLED AT HIGHER TIER RATE"
  1. . . D STORE2^IBAUTL9(IBN,IBBFO,IBRSN)
  1. . . Q
  1. . Q
  1. ;
  1. ; Determine if the Patient has an Long Term Care Copay for the Event Date
  1. S IBLTC=$$LTC^IBAUTL8B(IBDFN,IBEVDT,IBN)
  1. ; If the patient has been charged a Long Term Care Copay for the Event Date, set IBACTION and quit
  1. I IBLTC D Q
  1. . ; Set IBACTION = IEN of Outpatient Copay
  1. . S IBACTION=IBLTC
  1. . ; Quit if interactive
  1. . Q:IBINTACT
  1. . ; Record related info into ^XTMP for MailMan message
  1. . S IBRSN="AN OUTPATIENT COPAY CHARGE BILLED AT HIGHER TIER RATE"
  1. . D STORE2^IBAUTL9(IBN,IBLTC,IBRSN)
  1. Q