IBCNERP1 ;DAOU/BHS - IBCNE USER IF eIV RESPONSE REPORT ; 03-JUN-2002
;;2.0;INTEGRATED BILLING;**184,271,416,528,549,668,702,737,752,763**;21-MAR-94;Build 29
;;Per VA Directive 6402, this routine should not be modified.
;
; eIV - Insurance Verification Interface
;
; IB*737/TAZ - Remove references to ~NO PAYER
; IB*763/TAZ - Remove references to routines IBCNERPF, IBCNERPG, and IBCNERPH.
;
; Input parameters: N/A
; Other relevant variables ZTSAVED for queueing:
; IBCNERTN = "IBCNERP1" (current routine name for queueing the
; COMPILE process)
; IBCNESPC("BEGDT")=start dt for rpt
; IBCNESPC("ENDDT")=end dt for rpt
; IBCNESPC("PYR")=payer ien (365.12) or "" for all payers
; IBCNESPC("SORT")=1 (Payer name) OR 2 (Patient name)
; IBCNESPC("PAT")=patient ien (2) or "" for all patients
; IBCNESPC("TYPE")=A (All Responses) for date range OR M (Most Recent
; Responses) for date range (by unique Payer/Pat pair)
; IBCNESPC("TRCN")=Trace #^IEN, if non-null all other params are null
; IBCNESPC("RFLAG")=Report Flag used to indicate which report is being
; run. Response Report (0), Inactive Report (1), or Ambiguous
; Report (2).
; IBCNESPC("DTEXP")=Expiration date used in the inactive policy report
; IBOUT="R" for Report format or "E" for Excel format
;
; Only call this routine at a tag
Q
EN(IPRF) ; Main entry pt
; Init vars
N IBCNERTN,IBCNESPC,IBOUT,POP,STOP
N IBSTOP ; IB*702 to control initial quit point
S IPRF=$G(IPRF) ; IB*702
S IBCNESPC("RFLAG")=$G(IPRF)
;
S STOP=0
S IBCNERTN="IBCNERP1"
W @IOF
W !,"eIV ",$S(IPRF=1:"Inactive Policy",IPRF=2:"Ambiguous Policy",1:"Response")," Report",!
I $G(IPRF) D
. ; IB*702/DTG start update initial report statement
. ;W !,"Please select a date range to view ",$S(IPRF=1:"inactive",1:"ambiguous")," policy information that the eIV"
. ;W !,"process turned up while attempting to discover previously unknown"
. ;W !,"insurance policies. (Date range selection is based on the date that"
. ;W !,"eIV receives the response from the payer.)"
. ;
. W !,"Please select a date range in which ",$S(IPRF=1:"inactive",1:"ambiguous")," responses were received to view"
. W !,"the associated response detail. Date range selection is based on the date"
. W !,"that eIV receives the response from the payer."
. ; IB*702/DTG end update initial report statement
;
I '$G(IPRF) D
. W !,"Insurance verification responses are received daily."
. W !,"Please select a date range in which responses were received to view the"
. W !,"associated response detail. Otherwise, select a Trace # to view specific"
. W !,"response detail."
;
; Rpt by Date Range or Trace #
R05 I '$G(IPRF) D RTYPE I STOP G EXIT ;IB*752/CKB - if user entered '^', exit option
; If rpt by Trace # - no other criteria is necessary
I $G(IBCNESPC("TRCN")) G R60
; Date Range params
; IB*702/DTG start exit if up caret on start date for inactive/ambiguous
R10 ;D DTRANGE I STOP G:$$STOP EXIT G R05
S IBSTOP=0 D DTRANGE
I IBSTOP&(IPRF) G EXIT
I STOP G:$$STOP EXIT G R05
; IB*702/DTG end exit if up caret on start date for inactiver/ambiguous
; Payer Selection param
R20 D PYRSEL I STOP G:$$STOP EXIT G R10
; Patient Selection param
R30 D PTSEL I STOP G:$$STOP EXIT G R20
; Type of data to return param
R40 D TYPE I STOP G:$$STOP EXIT G R30
; IB*702/DTG start remove policy exp date
; How far back do you want the expiration date
R45 ; I $G(IPRF)=1 D DTEXP I STOP G:$$STOP EXIT G R40
S IBCNESPC("DTEXP")=""
; Sort by param - Payer or Patient
R50 ;D SORT I STOP G:$$STOP EXIT G R45
D SORT I STOP G:$$STOP EXIT G R40
; IB*702/DTG end remove policy exp date
; Select the output type
R60 S IBOUT=$$OUT I STOP G:$$STOP EXIT G R50
I IBOUT="E" W !!,"To avoid undesired wrapping, please enter '0;256;999' at the 'DEVICE:' prompt.",!
; Select output device
; IB*702/DTG start go back 1 if up caret and no to quit
R100 ;D DEVICE(IBCNERTN,.IBCNESPC,IBOUT) I STOP Q:+$G(IBFRB)&($G(IBOUT)="E") G:$$STOP EXIT G:$G(IBCNESPC("TRCN"))'="" R05 G R50
D DEVICE(IBCNERTN,.IBCNESPC,IBOUT)
;IB*752/DTG remove step back if upcaret and go to exit
;I STOP Q:+$G(IBFRB)&($G(IBOUT)="E") G:$$STOP EXIT G:$G(IBCNESPC("TRCN"))'="" R05 G R60 ; IB*702/DTG start go back 1 if up caret and no to quit
I STOP G EXIT
;
EXIT ; Exit pt
Q
;
COMPILE(IBCNERTN,IBCNESPC,IBOUT) ;
; Entry point called from EN^XUTMDEVQ in either direct or queued mode.
; Input params:
; IBCNERTN = Routine name for ^TMP($J,...
; IBCNESPC = Array passed by ref of the report params
;
; Init scratch globals
K ^TMP($J,IBCNERTN),^TMP($J,IBCNERTN_"X")
; Compile
I IBCNERTN="IBCNERP1" D EN^IBCNERP2(IBCNERTN,.IBCNESPC,IBOUT)
I IBCNERTN="IBCNERP4" D EN^IBCNERP5(IBCNERTN,.IBCNESPC)
I IBCNERTN="IBCNERP7" D EN^IBCNERP8(IBCNERTN,.IBCNESPC)
; Print
I '$G(ZTSTOP) D
. I IBCNERTN="IBCNERP1" D EN3^IBCNERPA(IBCNERTN,.IBCNESPC,IBOUT)
. I IBCNERTN="IBCNERP4" D EN6^IBCNERPA(IBCNERTN,.IBCNESPC,IBOUT)
. I IBCNERTN="IBCNERP7" D EN^IBCNERP9(IBCNERTN,.IBCNESPC,IBOUT)
; Close device
D ^%ZISC
; Kill scratch globals
K ^TMP($J,IBCNERTN),^TMP($J,IBCNERTN_"X")
; Purge task record
I $D(ZTQUEUED) S ZTREQ="@"
;
COMPILX ; COMPILE exit pt
Q
;
STOP() ; Determine if user wants to exit out of the whole option
; Init vars
N DIR,X,Y,DIRUT
;
W !
S DIR(0)="Y"
S DIR("A")="Do you want to exit out of this option entirely"
S DIR("B")="YES"
S DIR("?",1)=" Enter YES to immediately exit out of this option."
S DIR("?")=" Enter NO to return to the previous question."
D ^DIR K DIR
I $D(DIRUT) S (STOP,Y)=1 G STOPX
I 'Y S STOP=0
;
STOPX ; STOP exit pt
Q Y
;
DTRANGE ; Determine start and end dates for date range param
; Init vars
N X,Y,DIRUT
;
W !
;
S DIR(0)="D^:-NOW:EX"
S DIR("A")="Start DATE"
S DIR("?",1)=" Please enter a valid date for which an eIV Response"
S DIR("?")=" would have been received. Future dates are not allowed."
D ^DIR K DIR
; IB*702/DTG start exit if up caret on start date for inactive/ambiguous
;I $D(DIRUT) S STOP=1 G DTRANGX
I $D(DIRUT) D G DTRANGX
. I $G(IPRF)=1!($G(IPRF)=2) S IBSTOP=1 Q
. S STOP=1
; IB*702/DTG end exit if up caret on start date for inactive/ambiguous
S IBCNESPC("BEGDT")=Y
; End date
DTRANG1 S DIR(0)="DA^"_Y_":-NOW:EX"
S DIR("A")=" End DATE: "
S DIR("?",1)=" Please enter a valid date for which an eIV Response"
S DIR("?",2)=" would have been received. This date must not precede"
S DIR("?")=" the Start Date. Future dates are not allowed."
D ^DIR K DIR
I $D(DIRUT) S STOP=1 G DTRANGX
S IBCNESPC("ENDDT")=Y
;
DTRANGX ; DTRANGE exit pt
Q
;
PYRSEL ; Select one payer or ALL - File #365.12
; Init vars
NEW DIC,DTOUT,DUOUT,X,Y
;
W !
S DIC(0)="ABEQ"
S DIC("A")=$$FO^IBCNEUT1("Payer or <Return> for All Payers: ",40,"R")
; Do not allow selection of non-eIV payers
;IB*668/TAZ - Changed Payer Application from IIV to EIV
S DIC("S")="I $$PYRAPP^IBCNEUT5(""EIV"",$G(Y))'="""""
S DIC="^IBE(365.12,"
D ^DIC
I $D(DUOUT)!$D(DTOUT) S STOP=1 G PYRSELX
; If nothing was selected (Y=-1), select ALL payers
S IBCNESPC("PYR")=$S(Y=-1:"",1:$P(Y,U,1))
;
PYRSELX ; PYRSEL exit pt
Q
;
PTSEL ; Select one patient or ALL - File #2
; Init vars
NEW DIC,DTOUT,DUOUT,X,Y
; Patient lookup
W !
S DIC(0)="AEQM"
S DIC("A")=$$FO^IBCNEUT1("Patient or <Return> for All Patients: ",40,"R")
S DIC="^DPT("
D ^DIC
I $D(DUOUT)!$D(DTOUT) S STOP=1 G PTSELX
; If nothing was selected (Y=-1), select ALL patients
S IBCNESPC("PAT")=$S(Y=-1:"",1:$P(Y,U,1))
;
PTSELX ; PTSEL exit pt
Q
;
TYPE ; Prompt to select to display All or Most Recent Responses for
; Patient/Payer combos
; Init vars
N DIR,X,Y,DIRUT
;
S DIR(0)="S^A:All Responses;M:Most Recent Responses"
S DIR("A")="Select the type of responses to display"
S DIR("B")="A"
S DIR("?",1)=" A - All responses from the payer during the date range will be"
S DIR("?",2)=" displayed for each unique payer/patient combination."
S DIR("?",3)=" (Default)"
S DIR("?",4)=" M - Only the most recently received response from the payer"
S DIR("?",5)=" during the date range will be displayed for each unique"
S DIR("?")=" payer/patient combination."
D ^DIR K DIR
I $D(DIRUT) S STOP=1 G TYPEX
S IBCNESPC("TYPE")=Y
;
TYPEX ; TYPE exit pt
Q
;
DTEXP ; Prompt for oldest expiration date to pull for.
; Init Vars
N Y,DIRUT,TODAY
;
W !
;
S DIR(0)="D^:-NOW:EX"
S DIR("A")="Earliest Policy Expiration Date to Select From"
S DIR("B")="T-365"
S DIR("?",1)=" Please enter a valid date in the past. Any policy with a reported"
S DIR("?")=" expiration date prior to this date will not be selected."
D ^DIR K DIR
I $D(DIRUT) S STOP=1 G DTEXPX
S IBCNESPC("DTEXP")=Y
;
DTEXPX ; DTEXP Exit
Q
;
SORT ; Prompt to allow users to sort the report by Payer(default) or
; Patient
; Init vars
N DIR,X,Y,DIRUT
;
S DIR(0)="S^1:Payer Name;2:Patient Name"
S DIR("A")="Select the primary sort field"
S DIR("B")=1
S DIR("?",1)=" 1 - Payer Name is the primary sort, Patient Name is secondary."
S DIR("?",2)=" (Default)"
S DIR("?")=" 2 - Patient Name is the primary sort, Payer Name is secondary."
D ^DIR K DIR
I $D(DIRUT) S STOP=1 G SORTX
S IBCNESPC("SORT")=Y
;
SORTX ; SORT exit pt
Q
;
RTYPE ; Prompt to allow users to report by date range or Trace #
; Init vars
N D,DIC,DIR,X,Y,DIRUT,DTOUT,DUOUT
;
S DIR(0)="S^1:Report by Date Range;2:Report by Trace #"
S DIR("A")="Select the type of report to generate"
S DIR("B")=1
S DIR("?",1)=" 1 - Generate report by date range, payer range, patient range"
S DIR("?",2)=" and All or Most Recent responses for payer/patient."
S DIR("?",3)=" (Default)"
S DIR("?",4)=" 2 - Generate report for a specific Trace # which corresponds"
S DIR("?")=" to an unique response."
D ^DIR K DIR
I $D(DIRUT) S STOP=1 G RTYPEX
I Y=1 S IBCNESPC("TRCN")="" G RTYPEX
;
; Allow user to select Trace # from x-ref "C"
W !
S DIC(0)="AEVZSQ"
S DIC="^IBCN(365,",D="C",DIC("A")="Enter Trace # for report: "
; IB*702/TAZ,CKB - added screen for transactions with a "WH" prefix on the Trace #
S DIC("S")="I $E($P($G(^(0)),U,9),1,2)'=""WH"""
S DIC("W")="N IBX S IBX=$P($G(^(0)),U,2,3) W:$P(IBX,U,1) $P($G(^DPT($P(IBX,U,1),0)),U,1) W:$P(IBX,U,2) "" ""_$P($G(^IBE(365.12,$P(IBX,U,2),0)),U,1)"
D IX^DIC K DIC
I $D(DTOUT)!$D(DUOUT) S STOP=1 G RTYPEX
I 'Y!(Y<0) S STOP=1 G RTYPEX
S IBCNESPC("TRCN")=$P(Y(0),U,9)_"^"_$P(Y,U,1)
;
RTYPEX ; RTYPE exit pt
Q
;
DEVICE(IBCNERTN,IBCNESPC,IBOUT) ; Device Handler and possible TaskManager calls
;
; Input params:
; IBCNERTN = Routine name for ^TMP($J,...
; IBCNESPC = Array passed by ref of the report params
; IBOUT = "R" for Report format or "E" for Excel format
;
; Output params:
; STOP = Flag to stop routine
;
; Init vars
N POP,ZTDESC,ZTRTN,ZTSAVE
;
I IBCNERTN="IBCNERP4"!(IBCNERTN="IBCNERPF"&($G(IBCNESPC("TYPE"))="D")) W:$G(IBOUT)="R" !!!,"*** This report is 132 characters wide ***",!
S ZTRTN="COMPILE^IBCNERP1("""_IBCNERTN_""",.IBCNESPC,"""_IBOUT_""")"
; IB*2.0*549 Change name of report from "Patient Insurance Update" to "Auto Update"
S ZTDESC="IBCNE eIV "_$S(IBCNERTN="IBCNERP1":"Response",IBCNERTN="IBCNERPF":"Auto Update",1:"Payer")_" Report"
S ZTSAVE("IBCNESPC(")=""
S ZTSAVE("IBCNERTN")=""
S ZTSAVE("IBOUT")=""
D EN^XUTMDEVQ(ZTRTN,ZTDESC,.ZTSAVE,"QM",1)
I POP S STOP=1
;
DEVICEX ; DEVICE exit pt
Q
;
OUT() ; Prompt to allow users to select output format
N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
W !
S DIR(0)="SA^E:Excel;R:Report"
S DIR("A")="(E)xcel Format or (R)eport Format: "
S DIR("B")="Report"
D ^DIR I $D(DIRUT) S STOP=1 Q ""
Q Y
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBCNERP1 11919 printed Oct 16, 2024@18:15:38 Page 2
IBCNERP1 ;DAOU/BHS - IBCNE USER IF eIV RESPONSE REPORT ; 03-JUN-2002
+1 ;;2.0;INTEGRATED BILLING;**184,271,416,528,549,668,702,737,752,763**;21-MAR-94;Build 29
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 ; eIV - Insurance Verification Interface
+5 ;
+6 ; IB*737/TAZ - Remove references to ~NO PAYER
+7 ; IB*763/TAZ - Remove references to routines IBCNERPF, IBCNERPG, and IBCNERPH.
+8 ;
+9 ; Input parameters: N/A
+10 ; Other relevant variables ZTSAVED for queueing:
+11 ; IBCNERTN = "IBCNERP1" (current routine name for queueing the
+12 ; COMPILE process)
+13 ; IBCNESPC("BEGDT")=start dt for rpt
+14 ; IBCNESPC("ENDDT")=end dt for rpt
+15 ; IBCNESPC("PYR")=payer ien (365.12) or "" for all payers
+16 ; IBCNESPC("SORT")=1 (Payer name) OR 2 (Patient name)
+17 ; IBCNESPC("PAT")=patient ien (2) or "" for all patients
+18 ; IBCNESPC("TYPE")=A (All Responses) for date range OR M (Most Recent
+19 ; Responses) for date range (by unique Payer/Pat pair)
+20 ; IBCNESPC("TRCN")=Trace #^IEN, if non-null all other params are null
+21 ; IBCNESPC("RFLAG")=Report Flag used to indicate which report is being
+22 ; run. Response Report (0), Inactive Report (1), or Ambiguous
+23 ; Report (2).
+24 ; IBCNESPC("DTEXP")=Expiration date used in the inactive policy report
+25 ; IBOUT="R" for Report format or "E" for Excel format
+26 ;
+27 ; Only call this routine at a tag
+28 QUIT
EN(IPRF) ; Main entry pt
+1 ; Init vars
+2 NEW IBCNERTN,IBCNESPC,IBOUT,POP,STOP
+3 ; IB*702 to control initial quit point
NEW IBSTOP
+4 ; IB*702
SET IPRF=$GET(IPRF)
+5 SET IBCNESPC("RFLAG")=$GET(IPRF)
+6 ;
+7 SET STOP=0
+8 SET IBCNERTN="IBCNERP1"
+9 WRITE @IOF
+10 WRITE !,"eIV ",$SELECT(IPRF=1:"Inactive Policy",IPRF=2:"Ambiguous Policy",1:"Response")," Report",!
+11 IF $GET(IPRF)
Begin DoDot:1
+12 ; IB*702/DTG start update initial report statement
+13 ;W !,"Please select a date range to view ",$S(IPRF=1:"inactive",1:"ambiguous")," policy information that the eIV"
+14 ;W !,"process turned up while attempting to discover previously unknown"
+15 ;W !,"insurance policies. (Date range selection is based on the date that"
+16 ;W !,"eIV receives the response from the payer.)"
+17 ;
+18 WRITE !,"Please select a date range in which ",$SELECT(IPRF=1:"inactive",1:"ambiguous")," responses were received to view"
+19 WRITE !,"the associated response detail. Date range selection is based on the date"
+20 WRITE !,"that eIV receives the response from the payer."
+21 ; IB*702/DTG end update initial report statement
End DoDot:1
+22 ;
+23 IF '$GET(IPRF)
Begin DoDot:1
+24 WRITE !,"Insurance verification responses are received daily."
+25 WRITE !,"Please select a date range in which responses were received to view the"
+26 WRITE !,"associated response detail. Otherwise, select a Trace # to view specific"
+27 WRITE !,"response detail."
End DoDot:1
+28 ;
+29 ; Rpt by Date Range or Trace #
R05 ;IB*752/CKB - if user entered '^', exit option
IF '$GET(IPRF)
DO RTYPE
IF STOP
GOTO EXIT
+1 ; If rpt by Trace # - no other criteria is necessary
+2 IF $GET(IBCNESPC("TRCN"))
GOTO R60
+3 ; Date Range params
+4 ; IB*702/DTG start exit if up caret on start date for inactive/ambiguous
R10 ;D DTRANGE I STOP G:$$STOP EXIT G R05
+1 SET IBSTOP=0
DO DTRANGE
+2 IF IBSTOP&(IPRF)
GOTO EXIT
+3 IF STOP
if $$STOP
GOTO EXIT
GOTO R05
+4 ; IB*702/DTG end exit if up caret on start date for inactiver/ambiguous
+5 ; Payer Selection param
R20 DO PYRSEL
IF STOP
if $$STOP
GOTO EXIT
GOTO R10
+1 ; Patient Selection param
R30 DO PTSEL
IF STOP
if $$STOP
GOTO EXIT
GOTO R20
+1 ; Type of data to return param
R40 DO TYPE
IF STOP
if $$STOP
GOTO EXIT
GOTO R30
+1 ; IB*702/DTG start remove policy exp date
+2 ; How far back do you want the expiration date
R45 ; I $G(IPRF)=1 D DTEXP I STOP G:$$STOP EXIT G R40
+1 SET IBCNESPC("DTEXP")=""
+2 ; Sort by param - Payer or Patient
R50 ;D SORT I STOP G:$$STOP EXIT G R45
+1 DO SORT
IF STOP
if $$STOP
GOTO EXIT
GOTO R40
+2 ; IB*702/DTG end remove policy exp date
+3 ; Select the output type
R60 SET IBOUT=$$OUT
IF STOP
if $$STOP
GOTO EXIT
GOTO R50
+1 IF IBOUT="E"
WRITE !!,"To avoid undesired wrapping, please enter '0;256;999' at the 'DEVICE:' prompt.",!
+2 ; Select output device
+3 ; IB*702/DTG start go back 1 if up caret and no to quit
R100 ;D DEVICE(IBCNERTN,.IBCNESPC,IBOUT) I STOP Q:+$G(IBFRB)&($G(IBOUT)="E") G:$$STOP EXIT G:$G(IBCNESPC("TRCN"))'="" R05 G R50
+1 DO DEVICE(IBCNERTN,.IBCNESPC,IBOUT)
+2 ;IB*752/DTG remove step back if upcaret and go to exit
+3 ;I STOP Q:+$G(IBFRB)&($G(IBOUT)="E") G:$$STOP EXIT G:$G(IBCNESPC("TRCN"))'="" R05 G R60 ; IB*702/DTG start go back 1 if up caret and no to quit
+4 IF STOP
GOTO EXIT
+5 ;
EXIT ; Exit pt
+1 QUIT
+2 ;
COMPILE(IBCNERTN,IBCNESPC,IBOUT) ;
+1 ; Entry point called from EN^XUTMDEVQ in either direct or queued mode.
+2 ; Input params:
+3 ; IBCNERTN = Routine name for ^TMP($J,...
+4 ; IBCNESPC = Array passed by ref of the report params
+5 ;
+6 ; Init scratch globals
+7 KILL ^TMP($JOB,IBCNERTN),^TMP($JOB,IBCNERTN_"X")
+8 ; Compile
+9 IF IBCNERTN="IBCNERP1"
DO EN^IBCNERP2(IBCNERTN,.IBCNESPC,IBOUT)
+10 IF IBCNERTN="IBCNERP4"
DO EN^IBCNERP5(IBCNERTN,.IBCNESPC)
+11 IF IBCNERTN="IBCNERP7"
DO EN^IBCNERP8(IBCNERTN,.IBCNESPC)
+12 ; Print
+13 IF '$GET(ZTSTOP)
Begin DoDot:1
+14 IF IBCNERTN="IBCNERP1"
DO EN3^IBCNERPA(IBCNERTN,.IBCNESPC,IBOUT)
+15 IF IBCNERTN="IBCNERP4"
DO EN6^IBCNERPA(IBCNERTN,.IBCNESPC,IBOUT)
+16 IF IBCNERTN="IBCNERP7"
DO EN^IBCNERP9(IBCNERTN,.IBCNESPC,IBOUT)
End DoDot:1
+17 ; Close device
+18 DO ^%ZISC
+19 ; Kill scratch globals
+20 KILL ^TMP($JOB,IBCNERTN),^TMP($JOB,IBCNERTN_"X")
+21 ; Purge task record
+22 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+23 ;
COMPILX ; COMPILE exit pt
+1 QUIT
+2 ;
STOP() ; Determine if user wants to exit out of the whole option
+1 ; Init vars
+2 NEW DIR,X,Y,DIRUT
+3 ;
+4 WRITE !
+5 SET DIR(0)="Y"
+6 SET DIR("A")="Do you want to exit out of this option entirely"
+7 SET DIR("B")="YES"
+8 SET DIR("?",1)=" Enter YES to immediately exit out of this option."
+9 SET DIR("?")=" Enter NO to return to the previous question."
+10 DO ^DIR
KILL DIR
+11 IF $DATA(DIRUT)
SET (STOP,Y)=1
GOTO STOPX
+12 IF 'Y
SET STOP=0
+13 ;
STOPX ; STOP exit pt
+1 QUIT Y
+2 ;
DTRANGE ; Determine start and end dates for date range param
+1 ; Init vars
+2 NEW X,Y,DIRUT
+3 ;
+4 WRITE !
+5 ;
+6 SET DIR(0)="D^:-NOW:EX"
+7 SET DIR("A")="Start DATE"
+8 SET DIR("?",1)=" Please enter a valid date for which an eIV Response"
+9 SET DIR("?")=" would have been received. Future dates are not allowed."
+10 DO ^DIR
KILL DIR
+11 ; IB*702/DTG start exit if up caret on start date for inactive/ambiguous
+12 ;I $D(DIRUT) S STOP=1 G DTRANGX
+13 IF $DATA(DIRUT)
Begin DoDot:1
+14 IF $GET(IPRF)=1!($GET(IPRF)=2)
SET IBSTOP=1
QUIT
+15 SET STOP=1
End DoDot:1
GOTO DTRANGX
+16 ; IB*702/DTG end exit if up caret on start date for inactive/ambiguous
+17 SET IBCNESPC("BEGDT")=Y
+18 ; End date
DTRANG1 SET DIR(0)="DA^"_Y_":-NOW:EX"
+1 SET DIR("A")=" End DATE: "
+2 SET DIR("?",1)=" Please enter a valid date for which an eIV Response"
+3 SET DIR("?",2)=" would have been received. This date must not precede"
+4 SET DIR("?")=" the Start Date. Future dates are not allowed."
+5 DO ^DIR
KILL DIR
+6 IF $DATA(DIRUT)
SET STOP=1
GOTO DTRANGX
+7 SET IBCNESPC("ENDDT")=Y
+8 ;
DTRANGX ; DTRANGE exit pt
+1 QUIT
+2 ;
PYRSEL ; Select one payer or ALL - File #365.12
+1 ; Init vars
+2 NEW DIC,DTOUT,DUOUT,X,Y
+3 ;
+4 WRITE !
+5 SET DIC(0)="ABEQ"
+6 SET DIC("A")=$$FO^IBCNEUT1("Payer or <Return> for All Payers: ",40,"R")
+7 ; Do not allow selection of non-eIV payers
+8 ;IB*668/TAZ - Changed Payer Application from IIV to EIV
+9 SET DIC("S")="I $$PYRAPP^IBCNEUT5(""EIV"",$G(Y))'="""""
+10 SET DIC="^IBE(365.12,"
+11 DO ^DIC
+12 IF $DATA(DUOUT)!$DATA(DTOUT)
SET STOP=1
GOTO PYRSELX
+13 ; If nothing was selected (Y=-1), select ALL payers
+14 SET IBCNESPC("PYR")=$SELECT(Y=-1:"",1:$PIECE(Y,U,1))
+15 ;
PYRSELX ; PYRSEL exit pt
+1 QUIT
+2 ;
PTSEL ; Select one patient or ALL - File #2
+1 ; Init vars
+2 NEW DIC,DTOUT,DUOUT,X,Y
+3 ; Patient lookup
+4 WRITE !
+5 SET DIC(0)="AEQM"
+6 SET DIC("A")=$$FO^IBCNEUT1("Patient or <Return> for All Patients: ",40,"R")
+7 SET DIC="^DPT("
+8 DO ^DIC
+9 IF $DATA(DUOUT)!$DATA(DTOUT)
SET STOP=1
GOTO PTSELX
+10 ; If nothing was selected (Y=-1), select ALL patients
+11 SET IBCNESPC("PAT")=$SELECT(Y=-1:"",1:$PIECE(Y,U,1))
+12 ;
PTSELX ; PTSEL exit pt
+1 QUIT
+2 ;
TYPE ; Prompt to select to display All or Most Recent Responses for
+1 ; Patient/Payer combos
+2 ; Init vars
+3 NEW DIR,X,Y,DIRUT
+4 ;
+5 SET DIR(0)="S^A:All Responses;M:Most Recent Responses"
+6 SET DIR("A")="Select the type of responses to display"
+7 SET DIR("B")="A"
+8 SET DIR("?",1)=" A - All responses from the payer during the date range will be"
+9 SET DIR("?",2)=" displayed for each unique payer/patient combination."
+10 SET DIR("?",3)=" (Default)"
+11 SET DIR("?",4)=" M - Only the most recently received response from the payer"
+12 SET DIR("?",5)=" during the date range will be displayed for each unique"
+13 SET DIR("?")=" payer/patient combination."
+14 DO ^DIR
KILL DIR
+15 IF $DATA(DIRUT)
SET STOP=1
GOTO TYPEX
+16 SET IBCNESPC("TYPE")=Y
+17 ;
TYPEX ; TYPE exit pt
+1 QUIT
+2 ;
DTEXP ; Prompt for oldest expiration date to pull for.
+1 ; Init Vars
+2 NEW Y,DIRUT,TODAY
+3 ;
+4 WRITE !
+5 ;
+6 SET DIR(0)="D^:-NOW:EX"
+7 SET DIR("A")="Earliest Policy Expiration Date to Select From"
+8 SET DIR("B")="T-365"
+9 SET DIR("?",1)=" Please enter a valid date in the past. Any policy with a reported"
+10 SET DIR("?")=" expiration date prior to this date will not be selected."
+11 DO ^DIR
KILL DIR
+12 IF $DATA(DIRUT)
SET STOP=1
GOTO DTEXPX
+13 SET IBCNESPC("DTEXP")=Y
+14 ;
DTEXPX ; DTEXP Exit
+1 QUIT
+2 ;
SORT ; Prompt to allow users to sort the report by Payer(default) or
+1 ; Patient
+2 ; Init vars
+3 NEW DIR,X,Y,DIRUT
+4 ;
+5 SET DIR(0)="S^1:Payer Name;2:Patient Name"
+6 SET DIR("A")="Select the primary sort field"
+7 SET DIR("B")=1
+8 SET DIR("?",1)=" 1 - Payer Name is the primary sort, Patient Name is secondary."
+9 SET DIR("?",2)=" (Default)"
+10 SET DIR("?")=" 2 - Patient Name is the primary sort, Payer Name is secondary."
+11 DO ^DIR
KILL DIR
+12 IF $DATA(DIRUT)
SET STOP=1
GOTO SORTX
+13 SET IBCNESPC("SORT")=Y
+14 ;
SORTX ; SORT exit pt
+1 QUIT
+2 ;
RTYPE ; Prompt to allow users to report by date range or Trace #
+1 ; Init vars
+2 NEW D,DIC,DIR,X,Y,DIRUT,DTOUT,DUOUT
+3 ;
+4 SET DIR(0)="S^1:Report by Date Range;2:Report by Trace #"
+5 SET DIR("A")="Select the type of report to generate"
+6 SET DIR("B")=1
+7 SET DIR("?",1)=" 1 - Generate report by date range, payer range, patient range"
+8 SET DIR("?",2)=" and All or Most Recent responses for payer/patient."
+9 SET DIR("?",3)=" (Default)"
+10 SET DIR("?",4)=" 2 - Generate report for a specific Trace # which corresponds"
+11 SET DIR("?")=" to an unique response."
+12 DO ^DIR
KILL DIR
+13 IF $DATA(DIRUT)
SET STOP=1
GOTO RTYPEX
+14 IF Y=1
SET IBCNESPC("TRCN")=""
GOTO RTYPEX
+15 ;
+16 ; Allow user to select Trace # from x-ref "C"
+17 WRITE !
+18 SET DIC(0)="AEVZSQ"
+19 SET DIC="^IBCN(365,"
SET D="C"
SET DIC("A")="Enter Trace # for report: "
+20 ; IB*702/TAZ,CKB - added screen for transactions with a "WH" prefix on the Trace #
+21 SET DIC("S")="I $E($P($G(^(0)),U,9),1,2)'=""WH"""
+22 SET DIC("W")="N IBX S IBX=$P($G(^(0)),U,2,3) W:$P(IBX,U,1) $P($G(^DPT($P(IBX,U,1),0)),U,1) W:$P(IBX,U,2) "" ""_$P($G(^IBE(365.12,$P(IBX,U,2),0)),U,1)"
+23 DO IX^DIC
KILL DIC
+24 IF $DATA(DTOUT)!$DATA(DUOUT)
SET STOP=1
GOTO RTYPEX
+25 IF 'Y!(Y<0)
SET STOP=1
GOTO RTYPEX
+26 SET IBCNESPC("TRCN")=$PIECE(Y(0),U,9)_"^"_$PIECE(Y,U,1)
+27 ;
RTYPEX ; RTYPE exit pt
+1 QUIT
+2 ;
DEVICE(IBCNERTN,IBCNESPC,IBOUT) ; Device Handler and possible TaskManager calls
+1 ;
+2 ; Input params:
+3 ; IBCNERTN = Routine name for ^TMP($J,...
+4 ; IBCNESPC = Array passed by ref of the report params
+5 ; IBOUT = "R" for Report format or "E" for Excel format
+6 ;
+7 ; Output params:
+8 ; STOP = Flag to stop routine
+9 ;
+10 ; Init vars
+11 NEW POP,ZTDESC,ZTRTN,ZTSAVE
+12 ;
+13 IF IBCNERTN="IBCNERP4"!(IBCNERTN="IBCNERPF"&($GET(IBCNESPC("TYPE"))="D"))
if $GET(IBOUT)="R"
WRITE !!!,"*** This report is 132 characters wide ***",!
+14 SET ZTRTN="COMPILE^IBCNERP1("""_IBCNERTN_""",.IBCNESPC,"""_IBOUT_""")"
+15 ; IB*2.0*549 Change name of report from "Patient Insurance Update" to "Auto Update"
+16 SET ZTDESC="IBCNE eIV "_$SELECT(IBCNERTN="IBCNERP1":"Response",IBCNERTN="IBCNERPF":"Auto Update",1:"Payer")_" Report"
+17 SET ZTSAVE("IBCNESPC(")=""
+18 SET ZTSAVE("IBCNERTN")=""
+19 SET ZTSAVE("IBOUT")=""
+20 DO EN^XUTMDEVQ(ZTRTN,ZTDESC,.ZTSAVE,"QM",1)
+21 IF POP
SET STOP=1
+22 ;
DEVICEX ; DEVICE exit pt
+1 QUIT
+2 ;
OUT() ; Prompt to allow users to select output format
+1 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
+2 WRITE !
+3 SET DIR(0)="SA^E:Excel;R:Report"
+4 SET DIR("A")="(E)xcel Format or (R)eport Format: "
+5 SET DIR("B")="Report"
+6 DO ^DIR
IF $DATA(DIRUT)
SET STOP=1
QUIT ""
+7 QUIT Y