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

IBCNERP4.m

Go to the documentation of this file.
  1. IBCNERP4 ;DAOU/BHS - IBCNE USER INTERFACE eIV PAYER REPORT ;03-JUN-2002
  1. ;;2.0;INTEGRATED BILLING;**184,271,300,416,528,668,737**;21-MAR-94;Build 19
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ; eIV - Insurance Verification Interface
  1. ;
  1. ; IB*737/TAZ - Remove refrences to ~NO PAYER
  1. ;
  1. ; Input parameter: N/A
  1. ; Other relevant variables:
  1. ; IBCNERTN = "IBCNERP4" (current routine name for queueing the
  1. ; COMPILE process)
  1. ; IBCNESPC("BEGDT") = start date for date range
  1. ; IBCNESPC("ENDDT") = end date for date range
  1. ; IBCNESPC("PYR") = payer ien for report, if = "", then include all
  1. ; IBCNESPC("SORT") = 1 - Payer name OR 2 - Total Inqs (PAYER)
  1. ; IBCNESPC("DTL") = 1 - YES OR 0 - NO Include Rejection Detail in
  1. ; report output - rejections broken down by code
  1. ;
  1. ; Enter only from EN tag
  1. ;
  1. ; Added tag DATA as split out from program IBCNERP5 for size restrictions
  1. QUIT
  1. ;
  1. ; Entry point
  1. EN ;
  1. ; Initialize variables
  1. NEW STOP,IBCNERTN,POP,IBCNESPC,IBOUT
  1. ;
  1. S STOP=0
  1. S IBCNERTN="IBCNERP4"
  1. W @IOF
  1. W !,"eIV Payer Report",!
  1. W !,"Insurance verification inquiries are created daily."
  1. W !,"Select a date range in which inquiries were created by the eIV extracts."
  1. ;
  1. ; Prompts for Payer Report
  1. ; Date Range parameters
  1. P10 D DTRANGE I STOP G EXIT
  1. ; Payer Selection parameter
  1. P20 D PYRSEL^IBCNERP1 I STOP G:$$STOP^IBCNERP1 EXIT G P10
  1. ; Include Rejection Detail in Payer report
  1. P30 D REJDTL I STOP G:$$STOP^IBCNERP1 EXIT G P20
  1. ; Sort by parameter - Payer or Total Inquiries
  1. P40 D SORT I STOP G:$$STOP^IBCNERP1 EXIT G P30
  1. ; Select the output type
  1. P60 S IBOUT=$$OUT I STOP G:$$STOP^IBCNERP1 EXIT G P40
  1. ; Select the output device
  1. P100 D DEVICE^IBCNERP1(IBCNERTN,.IBCNESPC,IBOUT) I STOP G:$$STOP^IBCNERP1 EXIT G P40
  1. ;
  1. EXIT ; Quit this routine
  1. QUIT
  1. ;
  1. ;
  1. SORT ; Prompt to allow users to sort the report
  1. ; by Payer(default) OR Total Inquiries, then Payer
  1. ; Initialize variables
  1. NEW DIR,X,Y,DIRUT
  1. ;
  1. S DIR(0)="S^1:Payer Name;2:Total Inquiries"
  1. S DIR("A")=" Select the primary sort field"
  1. S DIR("B")=1
  1. S DIR("?",1)=" 1 - Payer Name is the only sort. (Default)"
  1. S DIR("?",2)=" 2 - Total Inquiries is the primary sort, Payer Name is"
  1. S DIR("?")=" the secondary sort."
  1. D ^DIR K DIR
  1. I $D(DIRUT) S STOP=1 G SORTX
  1. S IBCNESPC("SORT")=Y
  1. ;
  1. SORTX ; SORT exit point
  1. QUIT
  1. ;
  1. ;
  1. REJDTL ; Prompt to allow users to include the Rejection Detail in the report
  1. ; Initialize variables
  1. NEW DIR,X,Y,DIRUT
  1. ;
  1. S DIR(0)="Y"
  1. S DIR("A")=" Include Rejection Detail"
  1. S DIR("B")="NO"
  1. S DIR("?",1)=" N - No, exclude Rejection Detail totals from report. (Default)"
  1. S DIR("?")=" Y - Yes, include Rejection Detail totals in report."
  1. D ^DIR K DIR
  1. I $D(DIRUT) S STOP=1 G REJDTLX
  1. S IBCNESPC("DTL")=Y
  1. ;
  1. REJDTLX ; REJDTL exit point
  1. QUIT
  1. ;
  1. ;
  1. DTRANGE ; Determine the start and end dates for the date range parameter
  1. ; Initialize variables
  1. NEW X,Y,DIRUT
  1. ;
  1. W !
  1. ;
  1. S DIR(0)="D^::EX"
  1. S DIR("A")="Start DATE"
  1. S DIR("?",1)=" Please enter a valid date for which an eIV Inquiry"
  1. S DIR("?")=" would have been created."
  1. D ^DIR K DIR
  1. I $D(DIRUT) S STOP=1 G DTRANGX
  1. S IBCNESPC("BEGDT")=Y
  1. ; End date
  1. DTRANG1 S DIR(0)="D^::EX"
  1. S DIR("A")=" End DATE"
  1. S DIR("?",1)=" Please enter a valid date for which an eIV Inquiry"
  1. S DIR("?",2)=" would have been created. This date must not precede"
  1. S DIR("?")=" the Start Date."
  1. D ^DIR K DIR
  1. I $D(DIRUT) S STOP=1 G DTRANGX
  1. I Y<IBCNESPC("BEGDT") D G DTRANG1
  1. . W !," End Date must not precede the Start Date."
  1. . W !," Please reenter."
  1. S IBCNESPC("ENDDT")=Y
  1. ;
  1. DTRANGX ; DTRANGE exit point
  1. QUIT
  1. ;
  1. ;
  1. ; called from IBCNERP5
  1. ; Loop through the eIV Response File (#365)
  1. ; By DATE/TIME RECEIVED & PAYER & PATIENT Cross-Reference ("AE")
  1. ;
  1. ;IB*737/TAZ - Remove references to Most Popular Payer and "~NO PAYER"
  1. DATA N DEACT,RDATA,RDATA1,TQDATA,IBCNEDT,IBCNEPTR,IBCNEPAT,RPYRIEN,RPYNM,PYRIEN,IBPNM,ERRCON
  1. N IBPIEN,PC,ERR,ERRTXT,PYRNM,APIEN,IBCNEPTD,TQIEN
  1. S IBCNEDT=$O(^IBCN(365,"AD",IBCNEDT1),-1)
  1. F S IBCNEDT=$O(^IBCN(365,"AD",IBCNEDT)) Q:IBCNEDT=""!($P(IBCNEDT,".",1)>IBCNEDT2) D Q:$G(ZTSTOP)
  1. . I $D(ZTQUEUED),$$S^%ZTLOAD() S ZTSTOP=1 QUIT
  1. . S IBCNEPAT=0
  1. . F S IBCNEPAT=$O(^IBCN(365,"AD",IBCNEDT,IBCNEPAT)) Q:'IBCNEPAT D Q:$G(ZTSTOP)
  1. .. S IBCNEPTD=0
  1. .. F S IBCNEPTD=$O(^IBCN(365,"AD",IBCNEDT,IBCNEPAT,IBCNEPTD)) Q:'IBCNEPTD D Q:$G(ZTSTOP)
  1. ... S IBCNEPTR=0
  1. ... F S IBCNEPTR=$O(^IBCN(365,"AD",IBCNEDT,IBCNEPAT,IBCNEPTD,IBCNEPTR)) Q:'IBCNEPTR D Q:$G(ZTSTOP)
  1. .... ; Get data from Resp File
  1. .... S RDATA=$G(^IBCN(365,IBCNEPTR,0))
  1. .... I RDATA="" Q
  1. .... ; ONLY select Transmission status 3
  1. .... I $P($G(RDATA),U,6)'=3 Q
  1. .... ; Determine Payer name from Payer File (#365.12)
  1. .... S RPYRIEN=$P($G(RDATA),U,3)
  1. .... I 'RPYRIEN Q
  1. .... ; Check payer filter
  1. .... I IBCNEPY'="",RPYRIEN'=IBCNEPY Q
  1. .... S RPYNM=$P($G(^IBE(365.12,RPYRIEN,0)),U)
  1. .... I RPYNM="" Q
  1. .... ; link to TQ file
  1. .... S TQIEN=$P($G(RDATA),U,5)
  1. .... I TQIEN="" Q
  1. .... ; Get data from TQ file (365.1)
  1. .... S TQDATA=$G(^IBCN(365.1,TQIEN,0))
  1. .... I TQDATA="" Q
  1. .... ; Get TQ Payer from (365.1) File
  1. .... S PYRIEN=$P($G(TQDATA),U,3) Q:PYRIEN=""
  1. .... S PYRNM=$P($G(^IBE(365.12,PYRIEN,0)),U)
  1. .... ; Cancelled (7) - Payer deactivated
  1. .... I $P($G(TQDATA),U,4)=7 Q
  1. .... ;IB*668/TAZ - Call PYRDEACT to get Payer Deactivated from new file location.
  1. .... ; Determine Deactivation DTM for eIV application
  1. .... S DEACT=$$PYRDEACT^IBCNINSU(RPYRIEN)
  1. .... I +DEACT S $P(^TMP($J,IBCNERTN,RPYNM,RPYRIEN,"*"),U,11)=$P(DEACT,U,2)
  1. .... ; Determine Deactivation DTM for eIV application
  1. .... I PYRIEN'=RPYRIEN D
  1. ..... S DEACT=$$PYRDEACT^IBCNINSU(PYRIEN)
  1. ..... I +DEACT S $P(^TMP($J,IBCNERTN,PYNM,PYRIEN,"*"),U,11)=$P(DEACT,U,2)
  1. .... ; Get error text
  1. .... S ERRTXT=$G(^IBCN(365,IBCNEPTR,4))
  1. .... ; Now get the data from Response file for the report
  1. .... S RDATA1=$G(^IBCN(365,IBCNEPTR,1)),ERRCON=$P($G(RDATA1),U,14)
  1. .... ; Increment for non-error (GOOD) response and quit
  1. .... I ERRCON="",ERRTXT="" D Q
  1. ..... S $P(^TMP($J,IBCNERTN,RPYNM,RPYRIEN,"*"),U,6)=$P($G(^TMP($J,IBCNERTN,RPYNM,RPYRIEN,"*")),U,6)+1
  1. .... ; Rejection is defined as having a value in the Error Condition field or Error Text field
  1. .... ; Increment for error response
  1. .... S $P(^TMP($J,IBCNERTN,RPYNM,RPYRIEN,"*"),U,7)=$P($G(^TMP($J,IBCNERTN,RPYNM,RPYRIEN,"*")),U,7)+1
  1. .... ; Store rejection detail only if user requested it
  1. .... I 'IBCNEDTL Q
  1. .... I ERRCON S ^TMP($J,IBCNERTN,RPYNM,RPYRIEN,"*",ERRCON)=$G(^TMP($J,IBCNERTN,RPYNM,RPYRIEN,"*",ERRCON))+1
  1. .... I 'ERRCON,ERRTXT'="" S ^TMP($J,IBCNERTN,RPYNM,RPYRIEN,"*",0_U_ERRTXT)=$G(^TMP($J,IBCNERTN,RPYNM,RPYRIEN,"*",0_U_ERRTXT))+1
  1. Q
  1. ;
  1. OUT() ; Prompt to allow users to select output format
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. W !
  1. S DIR(0)="SA^E:Excel;R:Report"
  1. S DIR("A")="(E)xcel Format or (R)eport Format: "
  1. S DIR("B")="Report"
  1. D ^DIR I $D(DIRUT) S STOP=1 Q ""
  1. Q Y