RCDPENER ;AITC/CJE - NEGATIVE ERA LINE REPORT ;Dec 20, 2014@18:42
;;4.5;Accounts Receivable;**424**;Mar 20, 1995;Build 11
;Per VA Directive 6402, this routine should not be modified.
;Read ^DGCR(399) via Private IA 3820
;Read ^DG(40.8) via Controlled IA 417
;Read ^IBM(361.1) via Private IA 4051
;Use DIVISION^VAUTOMA via Controlled IA 664
RPT ; entry point for Negative ERA Line Report [RCDPE NEGATIVE ERA LINE REPORT]
N POP,RCDISP,RCDIV,RCDIVS,RCDTRNG,RCJOB,RCLAIM,RCPAGE,RCPAR,RCPARRAY,RCPAY,RCPROG,RCRANGE
N RCSORT,RCWHICH,STANAM,STANUM,X,Y
S (RCDTRNG,RCPAGE)=0,RCPROG="RCDPENER",RCJOB=$J ; Initialize page and start point
S RCDIV=$$STADIV^RCDPEAPP(.RCDIVS) Q:RCDIV=-1 ; Select Filter/Sort by Division
;
S RCLAIM=$$RTYPE^RCDPEU1() Q:RCLAIM=-1 ; Tricare filter to Med/Pharm/Both
S RCWHICH=$$NMORTIN^RCDPEAPP() Q:RCWHICH=-1 ; Filter by Payer Name or TIN
;
S RCPAR("SELC")=$$PAYRNG^RCDPEU1(0,1,RCWHICH) ; Selected or Range of Payers
Q:RCPAR("SELC")=-1 ; '^' or timeout
S RCPAY=RCPAR("SELC")
;
I RCPAR("SELC")'="A" D Q:XX=-1 ; Since we don't want all payers
. S RCPAR("TYPE")=RCLAIM
. S RCPAR("SRCH")=$S(RCWHICH=2:"T",1:"N") ; prompt for payers we do want
. S RCPAR("FILE")=344.4
. S RCPAR("DICA")="Select Insurance Company"_$S(RCWHICH=1:" NAME: ",1:" TIN: ")
. S XX=$$SELPAY^RCDPEU1(.RCPAR)
;
S RCSORT=$$SORTT^RCDPEAPP() Q:RCSORT=-1 ; Select Sort
S RCRANGE=$$DTRNG() Q:RCRANGE=0 ; Select Date Range for Report
S RCDISP=$$DISPTY^RCDPEAPP() Q:RCDISP=-1 ; Output to Excel?
I RCDISP D INFO^RCDPEM6 ; Display capture information for Excel
;
I 'RCDISP W !,"This report requires 132 column display."
S %ZIS="QM" D ^%ZIS Q:POP ; Select output device
;
; Option to queue
I 'RCDISP,$D(IO("Q")) D Q
. N ZTDESC,ZTQUEUED,ZTRTN,ZTSAVE,ZTSK
. S ZTRTN="REPORT^RCDPENER"
. S ZTDESC="EDI LOCKBOX NEGATIVE ERA LINE REPORT"
. S ZTSAVE("RC*")="" ;**FA** ,ZTSAVE("VAUTD")=""
. S ZTSAVE("^TMP(""RCDPEU1"",$J,")="" ;
. D ^%ZTLOAD
. I $D(ZTSK) W !!,"Task number "_ZTSK_" was queued."
. E W !!,"Unable to queue this job."
. K IO("Q")
. D HOME^%ZIS
;
D REPORT ; Compile and print report
Q
REPORT ; Compile and print report
; Input: RCDISP - 0 - Output to paper or screen, 1 - Output to Excel
; RCDIV - 1 - All divisions, 2 - Selected divisions
; RCDIVS()- Array of selected divisions if RCDIV=2
; RCRANGE - 1^Start Date^End Date
; RCJOB - $J
; RCLAIM - "M" - Medical Claims, "P" - Pharmacy Claims, "B" - Both
; RCPAGE - Initialized to 0
; RCPARRAY- Array of selected payers
; RCPROG - "RCDPENER"
; RCSORT - 0 - Sort by Payer Name, 1 - Sort by Payer TIN
; RCWHICH - 1 - Filter by Payer Name, 2 - Filter by Payer TIN
; ^TMP("RCDPEU1",$J) - Selected payerers (see SELPAY^RCDPEU1 for details)
;
N GLOB,GTOTAL,ZTREQ
K ^TMP(RCPROG,$J),^TMP("RCDPEAPP2",$J)
S GLOB=$NA(^TMP(RCPROG,$J))
D COMPILE^RCDPENE1 ; Scan ERA file for entries in date range
D DISP ; Display the Report
;
; Clear ^TMP global
K ^TMP(RCPROG,$J),^TMP("RCSELPAY",RCJOB),^TMP("RCDPEAPP2",$J),^TMP("RCDPEU1",$J)
Q
;
DISP ; Format the display for screen/printer or MS Excel
; Input: GLOB - ^TMP("RCDPENER",$J) (See SAVE^RCDPENE1 for field order)
; RCDISP - 1 - Output to Excel, 0 otherwise
; RCDIV - 1 - All Divisions selected
; RCDIVS - Array of selected Divisions (if all not selected)
; RCPARRAY- Array of selected Payers
; RCPAY - 1 - All Payers selected
N DIVS,LINE1,LINE2,PAYERS,RCDATA,RCHDRDT,RCSTOP,SPACES,SUB,SUB1,SUB2,SUB3
S RCHDRDT=$$FMTE^XLFDT($$NOW^XLFDT,"2SZ") ; Date/time for header
S LINE1=$TR($J("",131)," ","-"),LINE2=$TR(LINE1,"-","=")
U IO
;
; Report by division or 'ALL'
D LINED^RCDPEAPP(RCDIV,.RCDIVS,.DIVS) ; Format Division filter
D LINEP^RCDPEAPP(RCPAY,.RCPARRAY,RCWHICH,.PAYERS) ; Format Payer filter
S SPACES=" "
S SUB="",RCSTOP=0
I RCDISP D HDR(.DIVS,.PAYERS) ; Single header for Excel
F S SUB=$O(@GLOB@(SUB)) Q:SUB="" D Q:RCSTOP ;
. I 'RCDISP D
. . D HDR(.DIVS,.PAYERS) ; Display Header
. . W !,"DIVISION: ",SUB
. S SUB1="" ; Division
. F S SUB1=$O(@GLOB@(SUB,SUB1)) Q:SUB1="" D Q:RCSTOP
. . S SUB2=""
. . F S SUB2=$O(@GLOB@(SUB,SUB1,SUB2)) Q:SUB2="" D Q:RCSTOP
. . . ;
. . . ; Display payer sub-header
. . . I 'RCDISP D HDRP^RCDPEAPP(SUB1_"/"_SUB2)
. . . S SUB3=""
. . . F S SUB3=$O(@GLOB@(SUB,SUB1,SUB2,SUB3)) Q:SUB3="" D Q:RCSTOP
. . . . S RCDATA=@GLOB@(SUB,SUB1,SUB2,SUB3)
. . . . I 'RCDISP D Q:RCSTOP
. . . . . I $Y>(IOSL-6) D HDR(.DIVS,.PAYERS) Q:RCSTOP
. . . . . W !,$P(RCDATA,U,4) ; Patient Name
. . . . . W ?30,$P(RCDATA,U,5) ; ERA#
. . . . . W ?37,$P(RCDATA,U,6) ; Date Received
. . . . . W ?48,$E($P(RCDATA,U,7),1,12) ; Bill #
. . . . . W ?57,$J($P(RCDATA,U,12),8)_" " ; Date of Service
. . . . . W $J($P(RCDATA,U,8),11,2)_" " ; Paid Amount
. . . . . W $E($E($P(RCDATA,U,10),1,11)_SPACES,1,13) ; Claim Status
. . . . . W $J($P(RCDATA,U,9),15,2) ; Claim Balance
. . . . . W !,?3,"Trace #: ",$P(RCDATA,U,11) ; Trace #
. . . . . ;
. . . . I RCDISP D
. . . . . I $L(RCDATA)>255 D ;
. . . . . . N RCPAY,RCTIN
. . . . . . S RCPAY=$P(RCDATA,"^",3)
. . . . . . S RCTIN=$P(RCPAY,"/",$S(RCSORT=0:2,1:1))
. . . . . . S RCPAY=$P(RCPAY,"/",$S(RCSORT=0:1,1:2))
. . . . . . S RCPAY=$E(RCPAY,1,$L(RCPAY)-($L(RCDATA)-255))
. . . . . . S RCPAY=$S(RCSORT=0:RCPAY_"/"_RCTIN,1:RCTIN_"/"_RCPAY)
. . . . . . S $P(RCDATA,"^",3)=RCPAY
. . . . . W !,RCDATA
. . . ;
;
I '$D(@GLOB) D ;
. I 'RCDISP D HDR(.DIVS,.PAYERS)
. W !!,"*** NO DATA FOUND FOR THIS DATE RANGE AND FILTER CONDITIONS ***",!!
;
I 'RCSTOP D ASK^RCDPEAPP(.RCSTOP)
;
; Close device
I '$D(ZTQUEUED) D ^%ZISC
I $D(ZTQUEUED) S ZTREQ="@"
Q
;
HDR(DIVS,PAYERS) ; Print the report header
; Input: DIVS() - Array of selected Division lines for Header
; PAYERS() - Array of selected Payer lines for Header
; RCDISP - 1 - Output to Excel, 0 otherwise
; RCHDRDT - External Print Date/Tim
; RCPAGE - Current Page number
; RCRANGE - Selected Date Range
; RCSORT - 0 - Sort by Payer Name, 1 - Sort by Payer TIN
; RCSTOP - 1 if display aborted
; Output: RCPAGE - Updated Page Number
; RCSTOP - 1 if display aborted
N END,LN,MSG,START,XX,Y
Q:RCSTOP
I RCDISP D Q ; Output to Excel
. S XX="STATION^STATION NUMBER^PAYER^PATIENT NAME/SSN^ERA#^DT REC'D"
. S XX=XX_"^BILL#^AMT PAID^CLAIM BALANCE^CLAIM STATUS^TRACE#^DOS"
. W !,XX
S START=$$FMTE^XLFDT($P(RCRANGE,U,2),"2DZ")
S END=$$FMTE^XLFDT($P(RCRANGE,U,3),"2DZ")
I RCPAGE D ASK^RCDPEAPP(.RCSTOP) Q:RCSTOP
S RCPAGE=RCPAGE+1
W @IOF
S MSG(1)="EDI LOCKBOX NEGATIVE ERA LINE REPORT"
S MSG(1)=MSG(1)_$J("",47)_"Print Date: "_RCHDRDT_" Page: "_RCPAGE
;
S LN=2,XX=""
F D Q:XX="" ; Display Division filters
. S XX=$O(DIVS(XX))
. Q:XX=""
. S MSG(LN)=DIVS(XX),LN=LN+1
;
S MSG(LN)="CLAIM TYPE: "
S MSG(LN)=MSG(LN)_$S(RCLAIM="P":"PHARMACY",RCLAIM="M":"MEDICAL",RCLAIM="T":"TRICARE",1:"ALL")
S MSG(LN)=MSG(LN)_$J("",55-$L(MSG(LN)))_"SORTED BY: "_$S(RCSORT=0:"PAYER NAME",1:"PAYER TIN")
S LN=LN+1
S MSG(LN)=$S(RCWHICH=2:"TINS",1:"PAYERS")_" : "_$S(RCPAY="S":"SELECTED",RCPAY="R":"RANGE",1:"ALL")
S LN=LN+1
S MSG(LN)="RESULTS FOR ERA FILED DATE RANGE: "_START_" - "_END
S LN=LN+1,MSG(LN)=LINE2
S LN=LN+1
S MSG(LN)="PATIENT NAME/SSN ERA# DT REC'D BILL# DOS AMOUNT BILL STATUS CURRENT BALANCE"
S LN=LN+1,MSG(LN)=LINE2
D EN^DDIOL(.MSG)
Q
;
DTRNG() ; Get the date range for the report
; Input: None
; Returns: 0 - User ^ or timed out
; 1^Start Date^End Date
N DIR,DIROUT,DIRUT,DTOUT,DUOUT,RCEND,RNGFLG,RCSTART,X,Y
D DATES(.RCSTART,.RCEND)
Q:RCSTART=-1 0
Q:RCSTART "1^"_RCSTART_"^"_RCEND
Q:'RCSTART "0^^"
Q 0
;
DATES(BDATE,EDATE) ; Get a date range.
; Input: None
; Output: BDATE - Internal Begin date
; EDATE - Internal End date
N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
S (BDATE,EDATE)=0
S DIR("?")="Enter the earliest ERA file date date to include on the report"
S DIR(0)="DAO^:"_DT_":APE",DIR("A")="Start Date: "
D ^DIR K DIR
I $D(DTOUT)!$D(DUOUT)!(Y="") S BDATE=-1 Q
S BDATE=Y
S DIR("?")="Enter the latest ERA file date date to include on the report"
S DIR("B")=Y(0)
S DIR(0)="DAO^"_BDATE_":"_DT_":APE",DIR("A")="End Date: "
D ^DIR K DIR
I $D(DTOUT)!$D(DUOUT)!(Y="") S BDATE=-1 Q
S EDATE=Y
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRCDPENER 9306 printed Nov 22, 2024@16:55:13 Page 2
RCDPENER ;AITC/CJE - NEGATIVE ERA LINE REPORT ;Dec 20, 2014@18:42
+1 ;;4.5;Accounts Receivable;**424**;Mar 20, 1995;Build 11
+2 ;Per VA Directive 6402, this routine should not be modified.
+3 ;Read ^DGCR(399) via Private IA 3820
+4 ;Read ^DG(40.8) via Controlled IA 417
+5 ;Read ^IBM(361.1) via Private IA 4051
+6 ;Use DIVISION^VAUTOMA via Controlled IA 664
RPT ; entry point for Negative ERA Line Report [RCDPE NEGATIVE ERA LINE REPORT]
+1 NEW POP,RCDISP,RCDIV,RCDIVS,RCDTRNG,RCJOB,RCLAIM,RCPAGE,RCPAR,RCPARRAY,RCPAY,RCPROG,RCRANGE
+2 NEW RCSORT,RCWHICH,STANAM,STANUM,X,Y
+3 ; Initialize page and start point
SET (RCDTRNG,RCPAGE)=0
SET RCPROG="RCDPENER"
SET RCJOB=$JOB
+4 ; Select Filter/Sort by Division
SET RCDIV=$$STADIV^RCDPEAPP(.RCDIVS)
if RCDIV=-1
QUIT
+5 ;
+6 ; Tricare filter to Med/Pharm/Both
SET RCLAIM=$$RTYPE^RCDPEU1()
if RCLAIM=-1
QUIT
+7 ; Filter by Payer Name or TIN
SET RCWHICH=$$NMORTIN^RCDPEAPP()
if RCWHICH=-1
QUIT
+8 ;
+9 ; Selected or Range of Payers
SET RCPAR("SELC")=$$PAYRNG^RCDPEU1(0,1,RCWHICH)
+10 ; '^' or timeout
if RCPAR("SELC")=-1
QUIT
+11 SET RCPAY=RCPAR("SELC")
+12 ;
+13 ; Since we don't want all payers
IF RCPAR("SELC")'="A"
Begin DoDot:1
+14 SET RCPAR("TYPE")=RCLAIM
+15 ; prompt for payers we do want
SET RCPAR("SRCH")=$SELECT(RCWHICH=2:"T",1:"N")
+16 SET RCPAR("FILE")=344.4
+17 SET RCPAR("DICA")="Select Insurance Company"_$SELECT(RCWHICH=1:" NAME: ",1:" TIN: ")
+18 SET XX=$$SELPAY^RCDPEU1(.RCPAR)
End DoDot:1
if XX=-1
QUIT
+19 ;
+20 ; Select Sort
SET RCSORT=$$SORTT^RCDPEAPP()
if RCSORT=-1
QUIT
+21 ; Select Date Range for Report
SET RCRANGE=$$DTRNG()
if RCRANGE=0
QUIT
+22 ; Output to Excel?
SET RCDISP=$$DISPTY^RCDPEAPP()
if RCDISP=-1
QUIT
+23 ; Display capture information for Excel
IF RCDISP
DO INFO^RCDPEM6
+24 ;
+25 IF 'RCDISP
WRITE !,"This report requires 132 column display."
+26 ; Select output device
SET %ZIS="QM"
DO ^%ZIS
if POP
QUIT
+27 ;
+28 ; Option to queue
+29 IF 'RCDISP
IF $DATA(IO("Q"))
Begin DoDot:1
+30 NEW ZTDESC,ZTQUEUED,ZTRTN,ZTSAVE,ZTSK
+31 SET ZTRTN="REPORT^RCDPENER"
+32 SET ZTDESC="EDI LOCKBOX NEGATIVE ERA LINE REPORT"
+33 ;**FA** ,ZTSAVE("VAUTD")=""
SET ZTSAVE("RC*")=""
+34 ;
SET ZTSAVE("^TMP(""RCDPEU1"",$J,")=""
+35 DO ^%ZTLOAD
+36 IF $DATA(ZTSK)
WRITE !!,"Task number "_ZTSK_" was queued."
+37 IF '$TEST
WRITE !!,"Unable to queue this job."
+38 KILL IO("Q")
+39 DO HOME^%ZIS
End DoDot:1
QUIT
+40 ;
+41 ; Compile and print report
DO REPORT
+42 QUIT
REPORT ; Compile and print report
+1 ; Input: RCDISP - 0 - Output to paper or screen, 1 - Output to Excel
+2 ; RCDIV - 1 - All divisions, 2 - Selected divisions
+3 ; RCDIVS()- Array of selected divisions if RCDIV=2
+4 ; RCRANGE - 1^Start Date^End Date
+5 ; RCJOB - $J
+6 ; RCLAIM - "M" - Medical Claims, "P" - Pharmacy Claims, "B" - Both
+7 ; RCPAGE - Initialized to 0
+8 ; RCPARRAY- Array of selected payers
+9 ; RCPROG - "RCDPENER"
+10 ; RCSORT - 0 - Sort by Payer Name, 1 - Sort by Payer TIN
+11 ; RCWHICH - 1 - Filter by Payer Name, 2 - Filter by Payer TIN
+12 ; ^TMP("RCDPEU1",$J) - Selected payerers (see SELPAY^RCDPEU1 for details)
+13 ;
+14 NEW GLOB,GTOTAL,ZTREQ
+15 KILL ^TMP(RCPROG,$JOB),^TMP("RCDPEAPP2",$JOB)
+16 SET GLOB=$NAME(^TMP(RCPROG,$JOB))
+17 ; Scan ERA file for entries in date range
DO COMPILE^RCDPENE1
+18 ; Display the Report
DO DISP
+19 ;
+20 ; Clear ^TMP global
+21 KILL ^TMP(RCPROG,$JOB),^TMP("RCSELPAY",RCJOB),^TMP("RCDPEAPP2",$JOB),^TMP("RCDPEU1",$JOB)
+22 QUIT
+23 ;
DISP ; Format the display for screen/printer or MS Excel
+1 ; Input: GLOB - ^TMP("RCDPENER",$J) (See SAVE^RCDPENE1 for field order)
+2 ; RCDISP - 1 - Output to Excel, 0 otherwise
+3 ; RCDIV - 1 - All Divisions selected
+4 ; RCDIVS - Array of selected Divisions (if all not selected)
+5 ; RCPARRAY- Array of selected Payers
+6 ; RCPAY - 1 - All Payers selected
+7 NEW DIVS,LINE1,LINE2,PAYERS,RCDATA,RCHDRDT,RCSTOP,SPACES,SUB,SUB1,SUB2,SUB3
+8 ; Date/time for header
SET RCHDRDT=$$FMTE^XLFDT($$NOW^XLFDT,"2SZ")
+9 SET LINE1=$TRANSLATE($JUSTIFY("",131)," ","-")
SET LINE2=$TRANSLATE(LINE1,"-","=")
+10 USE IO
+11 ;
+12 ; Report by division or 'ALL'
+13 ; Format Division filter
DO LINED^RCDPEAPP(RCDIV,.RCDIVS,.DIVS)
+14 ; Format Payer filter
DO LINEP^RCDPEAPP(RCPAY,.RCPARRAY,RCWHICH,.PAYERS)
+15 SET SPACES=" "
+16 SET SUB=""
SET RCSTOP=0
+17 ; Single header for Excel
IF RCDISP
DO HDR(.DIVS,.PAYERS)
+18 ;
FOR
SET SUB=$ORDER(@GLOB@(SUB))
if SUB=""
QUIT
Begin DoDot:1
+19 IF 'RCDISP
Begin DoDot:2
+20 ; Display Header
DO HDR(.DIVS,.PAYERS)
+21 WRITE !,"DIVISION: ",SUB
End DoDot:2
+22 ; Division
SET SUB1=""
+23 FOR
SET SUB1=$ORDER(@GLOB@(SUB,SUB1))
if SUB1=""
QUIT
Begin DoDot:2
+24 SET SUB2=""
+25 FOR
SET SUB2=$ORDER(@GLOB@(SUB,SUB1,SUB2))
if SUB2=""
QUIT
Begin DoDot:3
+26 ;
+27 ; Display payer sub-header
+28 IF 'RCDISP
DO HDRP^RCDPEAPP(SUB1_"/"_SUB2)
+29 SET SUB3=""
+30 FOR
SET SUB3=$ORDER(@GLOB@(SUB,SUB1,SUB2,SUB3))
if SUB3=""
QUIT
Begin DoDot:4
+31 SET RCDATA=@GLOB@(SUB,SUB1,SUB2,SUB3)
+32 IF 'RCDISP
Begin DoDot:5
+33 IF $Y>(IOSL-6)
DO HDR(.DIVS,.PAYERS)
if RCSTOP
QUIT
+34 ; Patient Name
WRITE !,$PIECE(RCDATA,U,4)
+35 ; ERA#
WRITE ?30,$PIECE(RCDATA,U,5)
+36 ; Date Received
WRITE ?37,$PIECE(RCDATA,U,6)
+37 ; Bill #
WRITE ?48,$EXTRACT($PIECE(RCDATA,U,7),1,12)
+38 ; Date of Service
WRITE ?57,$JUSTIFY($PIECE(RCDATA,U,12),8)_" "
+39 ; Paid Amount
WRITE $JUSTIFY($PIECE(RCDATA,U,8),11,2)_" "
+40 ; Claim Status
WRITE $EXTRACT($EXTRACT($PIECE(RCDATA,U,10),1,11)_SPACES,1,13)
+41 ; Claim Balance
WRITE $JUSTIFY($PIECE(RCDATA,U,9),15,2)
+42 ; Trace #
WRITE !,?3,"Trace #: ",$PIECE(RCDATA,U,11)
+43 ;
End DoDot:5
if RCSTOP
QUIT
+44 IF RCDISP
Begin DoDot:5
+45 ;
IF $LENGTH(RCDATA)>255
Begin DoDot:6
+46 NEW RCPAY,RCTIN
+47 SET RCPAY=$PIECE(RCDATA,"^",3)
+48 SET RCTIN=$PIECE(RCPAY,"/",$SELECT(RCSORT=0:2,1:1))
+49 SET RCPAY=$PIECE(RCPAY,"/",$SELECT(RCSORT=0:1,1:2))
+50 SET RCPAY=$EXTRACT(RCPAY,1,$LENGTH(RCPAY)-($LENGTH(RCDATA)-255))
+51 SET RCPAY=$SELECT(RCSORT=0:RCPAY_"/"_RCTIN,1:RCTIN_"/"_RCPAY)
+52 SET $PIECE(RCDATA,"^",3)=RCPAY
End DoDot:6
+53 WRITE !,RCDATA
End DoDot:5
End DoDot:4
if RCSTOP
QUIT
+54 ;
End DoDot:3
if RCSTOP
QUIT
End DoDot:2
if RCSTOP
QUIT
End DoDot:1
if RCSTOP
QUIT
+55 ;
+56 ;
IF '$DATA(@GLOB)
Begin DoDot:1
+57 IF 'RCDISP
DO HDR(.DIVS,.PAYERS)
+58 WRITE !!,"*** NO DATA FOUND FOR THIS DATE RANGE AND FILTER CONDITIONS ***",!!
End DoDot:1
+59 ;
+60 IF 'RCSTOP
DO ASK^RCDPEAPP(.RCSTOP)
+61 ;
+62 ; Close device
+63 IF '$DATA(ZTQUEUED)
DO ^%ZISC
+64 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+65 QUIT
+66 ;
HDR(DIVS,PAYERS) ; Print the report header
+1 ; Input: DIVS() - Array of selected Division lines for Header
+2 ; PAYERS() - Array of selected Payer lines for Header
+3 ; RCDISP - 1 - Output to Excel, 0 otherwise
+4 ; RCHDRDT - External Print Date/Tim
+5 ; RCPAGE - Current Page number
+6 ; RCRANGE - Selected Date Range
+7 ; RCSORT - 0 - Sort by Payer Name, 1 - Sort by Payer TIN
+8 ; RCSTOP - 1 if display aborted
+9 ; Output: RCPAGE - Updated Page Number
+10 ; RCSTOP - 1 if display aborted
+11 NEW END,LN,MSG,START,XX,Y
+12 if RCSTOP
QUIT
+13 ; Output to Excel
IF RCDISP
Begin DoDot:1
+14 SET XX="STATION^STATION NUMBER^PAYER^PATIENT NAME/SSN^ERA#^DT REC'D"
+15 SET XX=XX_"^BILL#^AMT PAID^CLAIM BALANCE^CLAIM STATUS^TRACE#^DOS"
+16 WRITE !,XX
End DoDot:1
QUIT
+17 SET START=$$FMTE^XLFDT($PIECE(RCRANGE,U,2),"2DZ")
+18 SET END=$$FMTE^XLFDT($PIECE(RCRANGE,U,3),"2DZ")
+19 IF RCPAGE
DO ASK^RCDPEAPP(.RCSTOP)
if RCSTOP
QUIT
+20 SET RCPAGE=RCPAGE+1
+21 WRITE @IOF
+22 SET MSG(1)="EDI LOCKBOX NEGATIVE ERA LINE REPORT"
+23 SET MSG(1)=MSG(1)_$JUSTIFY("",47)_"Print Date: "_RCHDRDT_" Page: "_RCPAGE
+24 ;
+25 SET LN=2
SET XX=""
+26 ; Display Division filters
FOR
Begin DoDot:1
+27 SET XX=$ORDER(DIVS(XX))
+28 if XX=""
QUIT
+29 SET MSG(LN)=DIVS(XX)
SET LN=LN+1
End DoDot:1
if XX=""
QUIT
+30 ;
+31 SET MSG(LN)="CLAIM TYPE: "
+32 SET MSG(LN)=MSG(LN)_$SELECT(RCLAIM="P":"PHARMACY",RCLAIM="M":"MEDICAL",RCLAIM="T":"TRICARE",1:"ALL")
+33 SET MSG(LN)=MSG(LN)_$JUSTIFY("",55-$LENGTH(MSG(LN)))_"SORTED BY: "_$SELECT(RCSORT=0:"PAYER NAME",1:"PAYER TIN")
+34 SET LN=LN+1
+35 SET MSG(LN)=$SELECT(RCWHICH=2:"TINS",1:"PAYERS")_" : "_$SELECT(RCPAY="S":"SELECTED",RCPAY="R":"RANGE",1:"ALL")
+36 SET LN=LN+1
+37 SET MSG(LN)="RESULTS FOR ERA FILED DATE RANGE: "_START_" - "_END
+38 SET LN=LN+1
SET MSG(LN)=LINE2
+39 SET LN=LN+1
+40 SET MSG(LN)="PATIENT NAME/SSN ERA# DT REC'D BILL# DOS AMOUNT BILL STATUS CURRENT BALANCE"
+41 SET LN=LN+1
SET MSG(LN)=LINE2
+42 DO EN^DDIOL(.MSG)
+43 QUIT
+44 ;
DTRNG() ; Get the date range for the report
+1 ; Input: None
+2 ; Returns: 0 - User ^ or timed out
+3 ; 1^Start Date^End Date
+4 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,RCEND,RNGFLG,RCSTART,X,Y
+5 DO DATES(.RCSTART,.RCEND)
+6 if RCSTART=-1
QUIT 0
+7 if RCSTART
QUIT "1^"_RCSTART_"^"_RCEND
+8 if 'RCSTART
QUIT "0^^"
+9 QUIT 0
+10 ;
DATES(BDATE,EDATE) ; Get a date range.
+1 ; Input: None
+2 ; Output: BDATE - Internal Begin date
+3 ; EDATE - Internal End date
+4 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
+5 SET (BDATE,EDATE)=0
+6 SET DIR("?")="Enter the earliest ERA file date date to include on the report"
+7 SET DIR(0)="DAO^:"_DT_":APE"
SET DIR("A")="Start Date: "
+8 DO ^DIR
KILL DIR
+9 IF $DATA(DTOUT)!$DATA(DUOUT)!(Y="")
SET BDATE=-1
QUIT
+10 SET BDATE=Y
+11 SET DIR("?")="Enter the latest ERA file date date to include on the report"
+12 SET DIR("B")=Y(0)
+13 SET DIR(0)="DAO^"_BDATE_":"_DT_":APE"
SET DIR("A")="End Date: "
+14 DO ^DIR
KILL DIR
+15 IF $DATA(DTOUT)!$DATA(DUOUT)!(Y="")
SET BDATE=-1
QUIT
+16 SET EDATE=Y
+17 QUIT