RCDPEV0 ;ALB/TMK - EDI LOCKBOX WORKLIST VERIFY PAYMENTS ;Jun 06, 2014@19:11:19
;;4.5;Accounts Receivable;**208,261,298,326**;Mar 20, 1995;Build 26
;Per VA Directive 6402, this routine should not be modified.
Q
;
RPT(RCSCR) ; Print/display discrepancy report
D FULL^VALM1
N %ZIS,ZTRTN,ZTSAVE,ZTDESC,POP
S %ZIS="QM" D ^%ZIS G:POP RPTQ
I $D(IO("Q")) D G RPTQ
. S ZTRTN="DISRPT^RCDPEV0("_RCSCR_","_+$G(^TMP("RCBATCH_SELECTED",$J))_")",ZTDESC="AR - Print ERA Discrepancy Report From Worklist"
. D ^%ZTLOAD
. W !!,$S($D(ZTSK):"Your task number"_ZTSK_" has been queued.",1:"Unable to queue this job.")
. K ZTSK,IO("Q") D HOME^%ZIS
U IO
D DISRPT(RCSCR,+$G(^TMP("RCBATCH_SELECTED",$J)))
RPTQ Q
;
; BEGIN EPRCA*4.5*326
RPT1(RCSCR) ; Print/display discrepancy report - Auto-post ERA
D FULL^VALM1
N %ZIS,ZTRTN,ZTSAVE,ZTDESC,POP
S %ZIS="QM" D ^%ZIS G:POP RPTQ
I $D(IO("Q")) D G RPTQ
. S ZTRTN="DISRPT^RCDPEV0("_RCSCR_","_+$G(^TMP("RCBATCH_SELECTED",$J))_")",ZTDESC="AR - Print Auto-post ERA Discrepancy Report From Worklist"
. D ^%ZTLOAD
. W !!,$S($D(ZTSK):"Your task number"_ZTSK_" has been queued.",1:"Unable to queue this job.")
. K ZTSK,IO("Q") D HOME^%ZIS
U IO
D DISRPT1(RCSCR,+$G(^TMP("RCBATCH_SELECTED",$J)))
RPT1Q Q
; END PRCA*4.5*326
;
DISRPT(RCSCR,RCBATCH) ; Queued job entrypoint
; RCSCR = the ien of the entry in file 344.49
; RCBATCH = the # of the batch within the ERA. If all batches, this is null
N X,Z,Z0,RC3444,RCSTOP,RCPG,RCANY,RCZ,RCZ0,RCZ1,SPLIT,SSN,AMT1,AMT2,RCBILL,RESULT,DTFR1,DTFR2,DTTO1,DTTO2
S (RCSTOP,RCPG,RCANY)=0
S RCZ=0 F S RCZ=$O(^RCY(344.49,RCSCR,1,"ANV",0,RCZ)) Q:'RCZ D Q:RCSTOP
. I $D(ZTQUEUED),$$S^%ZTLOAD S (RCSTOP,ZTSTOP)=1 K ZTREQ W:+$G(RCPG) !,"***TASK STOPPED BY USER***" Q
. S RCZ0=$G(^RCY(344.49,RCSCR,1,RCZ,0))
. Q:'$D(^RCY(344.49,RCSCR,1,"ASEQ",+RCZ0,RCZ)) ; Not top level
. Q:RCZ0=""
. I $G(RCBATCH),$P(RCZ0,U,14)'=RCBATCH Q ; Not in the batch
. S SPLIT=(+$O(^RCY(344.49,RCSCR,1,"B",+RCZ0_".9999"),-1)'=(+RCZ0_".001"))
. S RC3444=$G(^RCY(344.4,RCSCR,1,+$P(RCZ0,U,9),0))
. S RCBILL=+$G(^IBM(361.1,+$P(RC3444,U,2),0))
. I 'RCBILL Q ; PRCA*4.5*326
. S RCANY=1 ; PRCA*4.5*326
. S RESULT=$$VER^RCDPEV(RCSCR,RCBILL,+$P(RCZ0,U,9),1)
. S AMT1=$S($E($P(RESULT,U,5))="*":"*",1:"")_$S($TR($P(RESULT,U,5),"*")="":"NO DATA",1:$J($TR($P(RESULT,U,5),"*"),"",2))
. S AMT2=$S($E($P(RESULT,U,4))="*":"*",1:"")_$S($TR($P(RESULT,U,4),"*")="":"NO DATA",1:$J($TR($P(RESULT,U,4),"*"),"",2))
. S DTFR1=$S($TR($P(RESULT,U,7),"*")="":"",1:$S($E($P(RESULT,U,7))="*":"*",1:"")_$$FMTE^XLFDT($TR($P(RESULT,U,7),"*"),"2D"))
. S DTFR2=$S($TR($P(RESULT,U,6),"*")="":"",1:$S($E($P(RESULT,U,6))="*":"*",1:"")_$$FMTE^XLFDT($TR($P(RESULT,U,6),"*"),"2D"))
. S DTTO1=$S($TR($P(RESULT,U,9),"*")="":"",1:$S($E($P(RESULT,U,9))="*":"*",1:"")_$$FMTE^XLFDT($TR($P(RESULT,U,9),"*"),"2D"))
. S DTTO2=$S($TR($P(RESULT,U,8),"*")="":"",1:$S($E($P(RESULT,U,8))="*":"*",1:"")_$$FMTE^XLFDT($TR($P(RESULT,U,8),"*"),"2D"))
. S X="EEOB Sequence #(s) on the ERA: "_$P(RCZ0,U,9)_" "_$S($P(RC3444,U,5)'="":$P(RC3444,U,5),$P(RC3444,U,17)'="":$P(RC3444,U,17),$G(RCBILL):$P($G(^DGCR(399,+RCBILL,0)),U),1:"")
. I ($Y+7)>IOSL!'RCPG D HDR(.RCPG,RCSCR,$G(RCBATCH),.RCSTOP,"U") Q:RCSTOP ; PRCA*4.5*326
. W !!,X
. I ($Y+5)>IOSL D HDR(.RCPG,RCSCR,$G(RCBATCH),.RCSTOP,"U") Q:RCSTOP ; PRCA*4.5*326
. S X="VistA: ",SSN=$P(RESULT,U,10),SSN=$E($E(SSN,$L(SSN)-3,$L(SSN))_$J("",4),1,4)
. S X=X_$S('RCBILL:"NOT RELATED TO A VistA BILL",1:$E($P(RESULT,U,2)_$J("",30),1,30)_" "_SSN_" "_$E(AMT2_$J("",15),1,15)_" "_$E($S(DTFR2="":"NO DATA",1:DTFR2)_$J("",9),1,9)_"- "_$S(DTTO2'="":DTTO2,1:"NO DATA"))
. W !,X
. S X=" ERA: "_$E($P(RESULT,U,3)_$J("",30),1,30)_$J("",7)_$E(AMT1_$J("",15),1,15)_" "_$E($S(DTFR1="":"NO DATA",1:DTFR1)_$J("",9),1,9)_"- "_$S(DTTO1'="":DTTO1,1:"NO DATA")
. W !,X
. Q:'SPLIT
. W !,?9,"<<< THIS EEOB HAS BEEN SPLIT >>>"
. S RCZ1=+RCZ0 F S RCZ1=$O(^RCY(344.49,RCSCR,1,"B",RCZ1)) Q:(RCZ1\1)'=+RCZ0!RCSTOP D
.. S Z=+$O(^RCY(344.49,RCSCR,1,"B",RCZ1,0))
.. S Z0=$G(^RCY(344.49,RCSCR,1,Z,0))
.. I ($Y+5)>IOSL D HDR(.RCPG,RCSCR,$G(RCBATCH),.RCSTOP,"U") Q:RCSTOP ; PRCA*4.5*326
.. W !,?15,$S($P(Z0,U,7):"",1:"BILL NOT IN VISTA: "),$P(Z0,U,2)_" "_$J($P(Z0,U,5),"",2)
. W !
;
I 'RCANY D:'RCPG HDR(.RCPG,RCSCR,$G(RCBATCH),.RCSTOP,"U") W !,"THERE ARE NO UNVERIFIED LINES WITH DISCREPANCIES IN THIS ERA"_$S($G(RCBATCH):" BATCH",1:"") ; PRCA*4.5*326
I '$D(ZTQUEUED),'RCSTOP,RCPG D ASK()
I $D(ZTQUEUED) S ZTREQ="@"
I '$D(ZTQUEUED) D ^%ZISC
Q
;
; BEGIN PRCA*4.5*326
DISRPT1(RCSCR,RCBATCH) ; Queued job entrypoint - Auto-post ERA
; RCSCR = the ien of the entry in file 344.49
; RCBATCH = the # of the batch within the ERA. If all batches, this is null
;
; Sort verified status into scratchpad sequence
N ARR,RCZ,RCVER
F RCVER=0,1 D
.S RCZ=0
.F S RCZ=$O(^RCY(344.49,RCSCR,1,"ANV",RCVER,RCZ)) Q:'RCZ D
. . S ARR(RCZ)=RCVER
;
N AMT1,AMT2,DTFR1,DTFR2,DTTO1,DTTO2,RCANY,RCSTOP,RCPG,RCZ0,RCZ1,RCBILL,RCEOB,RCLINE,RESULT
N SPLIT,SSN,X,Z,Z0
S (RCSTOP,RCPG,RCANY,RCZ)=0
F S RCZ=$O(ARR(RCZ)) Q:'RCZ D Q:RCSTOP
. I $D(ZTQUEUED),$$S^%ZTLOAD S (RCSTOP,ZTSTOP)=1 K ZTREQ W:+$G(RCPG) !,"***TASK STOPPED BY USER***" Q
. S RCZ0=$G(^RCY(344.49,RCSCR,1,RCZ,0))
. Q:'$D(^RCY(344.49,RCSCR,1,"ASEQ",+RCZ0,RCZ)) ; Not top level
. Q:RCZ0=""
. I $G(RCBATCH),$$GET1^DIQ(344.491,RCZ_","_RCSCR_",",.14)'=RCBATCH Q ; Not in the batch
. S SPLIT=(+$O(^RCY(344.49,RCSCR,1,"B",+RCZ0_".9999"),-1)'=(+RCZ0_".001"))
. S RC3444=$G(^RCY(344.4,RCSCR,1,+$P(RCZ0,U,9),0))
. S RCLINE=+$$GET1^DIQ(344.491,RCZ_","_RCSCR_",",.09)
. S RCEOB=+$$GET1^DIQ(344.41,RCLINE_","_RCSCR_",",.02,"I")
. S RCBILL=+$$GET1^DIQ(361.1,RCEOB_",",.01,"I")
. S RESULT=$$VER^RCDPEV(RCSCR,RCBILL,+RC3444,1)
. ; Ignore lines with no discrepancies
. Q:'$F(RESULT,"^*")
. S RCANY=1
. S RCVER=ARR(RCZ) ; Verification status
. S AMT1=$S($E($P(RESULT,U,5))="*":"*",1:"")_$S($TR($P(RESULT,U,5),"*")="":"NO DATA",1:$J($TR($P(RESULT,U,5),"*"),"",2))
. S AMT2=$S($E($P(RESULT,U,4))="*":"*",1:"")_$S($TR($P(RESULT,U,4),"*")="":"NO DATA",1:$J($TR($P(RESULT,U,4),"*"),"",2))
. S DTFR1=$S($TR($P(RESULT,U,7),"*")="":"",1:$S($E($P(RESULT,U,7))="*":"*",1:"")_$$FMTE^XLFDT($TR($P(RESULT,U,7),"*"),"2D"))
. S DTFR2=$S($TR($P(RESULT,U,6),"*")="":"",1:$S($E($P(RESULT,U,6))="*":"*",1:"")_$$FMTE^XLFDT($TR($P(RESULT,U,6),"*"),"2D"))
. S DTTO1=$S($TR($P(RESULT,U,9),"*")="":"",1:$S($E($P(RESULT,U,9))="*":"*",1:"")_$$FMTE^XLFDT($TR($P(RESULT,U,9),"*"),"2D"))
. S DTTO2=$S($TR($P(RESULT,U,8),"*")="":"",1:$S($E($P(RESULT,U,8))="*":"*",1:"")_$$FMTE^XLFDT($TR($P(RESULT,U,8),"*"),"2D"))
. S X="EEOB Sequence #(s) on the ERA: "_$P(RCZ0,U,9)_" "_$S($P(RC3444,U,5)'="":$P(RC3444,U,5),$P(RC3444,U,17)'="":$P(RC3444,U,17),$G(RCBILL):$P($G(^DGCR(399,+RCBILL,0)),U),1:"")
. W " ("_$S(RCVER:"Verified",1:"Unverified")
. I ($Y+7)>IOSL!'RCPG D HDR(.RCPG,RCSCR,$G(RCBATCH),.RCSTOP,"A") Q:RCSTOP
. W !!,X
. I ($Y+5)>IOSL D HDR(.RCPG,RCSCR,$G(RCBATCH),.RCSTOP,"A") Q:RCSTOP
. S X="VistA: ",SSN=$P(RESULT,U,10),SSN=$E($E(SSN,$L(SSN)-3,$L(SSN))_$J("",4),1,4)
. S X=X_$S('RCBILL:"NOT RELATED TO A VistA BILL",1:$E($P(RESULT,U,2)_$J("",30),1,30)_" "_SSN_" "_$E(AMT2_$J("",15),1,15)_" "_$E($S(DTFR2="":"NO DATA",1:DTFR2)_$J("",9),1,9)_"- "_$S(DTTO2'="":DTTO2,1:"NO DATA"))
. W !,X
. S X=" ERA: "_$E($P(RESULT,U,3)_$J("",30),1,30)_$J("",7)_$E(AMT1_$J("",15),1,15)_" "_$E($S(DTFR1="":"NO DATA",1:DTFR1)_$J("",9),1,9)_"- "_$S(DTTO1'="":DTTO1,1:"NO DATA")
. W !,X
. Q:'SPLIT
. W !,?9,"<<< THIS EEOB HAS BEEN SPLIT >>>"
. S RCZ1=+RCZ0 F S RCZ1=$O(^RCY(344.49,RCSCR,1,"B",RCZ1)) Q:(RCZ1\1)'=+RCZ0!RCSTOP D
.. S Z=+$O(^RCY(344.49,RCSCR,1,"B",RCZ1,0))
.. S Z0=$G(^RCY(344.49,RCSCR,1,Z,0))
.. I ($Y+5)>IOSL D HDR(.RCPG,RCSCR,$G(RCBATCH),.RCSTOP,"A") Q:RCSTOP
.. W !,?15,$S($P(Z0,U,7):"",1:"BILL NOT IN VISTA: "),$P(Z0,U,2)_" "_$J($P(Z0,U,5),"",2)
. W !
;
I 'RCANY D
.D:'RCPG HDR(.RCPG,RCSCR,$G(RCBATCH),.RCSTOP,"A")
.W !,"THERE ARE NO AUTO-POST LINES WITH DISCREPANCIES IN THIS ERA"
.W $S($G(RCBATCH):" BATCH",1:"")
I '$D(ZTQUEUED),'RCSTOP,RCPG D ASK()
I $D(ZTQUEUED) S ZTREQ="@"
I '$D(ZTQUEUED) D ^%ZISC
Q
; END PRCA*4.5*326
;
HDR(RCPG,RCSCR,RCBATCH,RCSTOP,RCTYP) ;Print header - RCTYP added - PRCA*4.5*326
; RCPG = last page #
; RCSCR = the entry # in file 344.49
; RCSTOP = returned as 1 if abort is detected
; RCTYP = 'A' for all verification discrepancies, 'U' for unverified discrepancies only
N RCDAT,RCPAY,RCTRACE ; PRCA*4.5*326
I $D(ZTQUEUED),$$S^%ZTLOAD S (RCSTOP,ZTSTOP)=1 K ZTREQ W:+$G(RCPG) !,"***TASK STOPPED BY USER***" Q
I RCPG&($E(IOST,1,2)="C-") D ASK(.RCSTOP) Q:RCSTOP
S RCDAT=$$GET1^DIQ(344.4,RCSCR_",",.04,"I") ; PRCA*4.5*326
S RCPAY=$$GET1^DIQ(344.4,RCSCR_",",.06,"I") ; PRCA*4.5*326
S RCTRACE=$$GET1^DIQ(344.4,RCSCR_",",.02,"I") ; PRCA*4.5*326
W !,@IOF,*13
S RCPG=$G(RCPG)+1
; BEGIN PRCA*4.5*326
I RCTYP="U" W !,"EDI LBOX WORKLIST - UNVERIFIED LINES DISCREPANCIES REPORT",?59
E W !,"EDI LBOX WORKLIST - AUTOPOST ERA LINES DISCREPANCIES REPORT",?61
W $$FMTE^XLFDT(DT,2),?70,"Page: ",RCPG,!
W !,"ERA #: ",RCSCR,?20
W $S($O(^RCY(344.49,RCSCR,3,0)):"BATCH: "_$E($S($G(RCBATCH):+RCBATCH,1:"ALL")_$J("",11),1,11),1:$J("",18))
W "TRACE #: "_RCTRACE
W !,"PAYER: "_$E(RCPAY_$J("",30),1,30)_" ERA DT: "_$$FMTE^XLFDT(RCDAT,"2D")
; END PRCA*4.5*326
W !!,?7,"PATIENT NAME"_$J("",25)_"SUBMITTED AMT SVC DATE(S)"
W !,"* preceding data = data has discrepancy"
W !,$TR($J("",IOM)," ","=")
Q
;
ASK(RCSTOP) ; Ask to continue
; If passed by reference ,RCSTOP is returned as 1 if print is aborted
I $E(IOST,1,2)'["C-" Q
N DIR,DIROUT,DIRUT,DTOUT,DUOUT
S DIR(0)="E" W ! D ^DIR
I ($D(DIRUT))!($D(DUOUT)) S RCSTOP=1 Q
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRCDPEV0 9849 printed Nov 22, 2024@16:55:49 Page 2
RCDPEV0 ;ALB/TMK - EDI LOCKBOX WORKLIST VERIFY PAYMENTS ;Jun 06, 2014@19:11:19
+1 ;;4.5;Accounts Receivable;**208,261,298,326**;Mar 20, 1995;Build 26
+2 ;Per VA Directive 6402, this routine should not be modified.
+3 QUIT
+4 ;
RPT(RCSCR) ; Print/display discrepancy report
+1 DO FULL^VALM1
+2 NEW %ZIS,ZTRTN,ZTSAVE,ZTDESC,POP
+3 SET %ZIS="QM"
DO ^%ZIS
if POP
GOTO RPTQ
+4 IF $DATA(IO("Q"))
Begin DoDot:1
+5 SET ZTRTN="DISRPT^RCDPEV0("_RCSCR_","_+$GET(^TMP("RCBATCH_SELECTED",$JOB))_")"
SET ZTDESC="AR - Print ERA Discrepancy Report From Worklist"
+6 DO ^%ZTLOAD
+7 WRITE !!,$SELECT($DATA(ZTSK):"Your task number"_ZTSK_" has been queued.",1:"Unable to queue this job.")
+8 KILL ZTSK,IO("Q")
DO HOME^%ZIS
End DoDot:1
GOTO RPTQ
+9 USE IO
+10 DO DISRPT(RCSCR,+$GET(^TMP("RCBATCH_SELECTED",$JOB)))
RPTQ QUIT
+1 ;
+2 ; BEGIN EPRCA*4.5*326
RPT1(RCSCR) ; Print/display discrepancy report - Auto-post ERA
+1 DO FULL^VALM1
+2 NEW %ZIS,ZTRTN,ZTSAVE,ZTDESC,POP
+3 SET %ZIS="QM"
DO ^%ZIS
if POP
GOTO RPTQ
+4 IF $DATA(IO("Q"))
Begin DoDot:1
+5 SET ZTRTN="DISRPT^RCDPEV0("_RCSCR_","_+$GET(^TMP("RCBATCH_SELECTED",$JOB))_")"
SET ZTDESC="AR - Print Auto-post ERA Discrepancy Report From Worklist"
+6 DO ^%ZTLOAD
+7 WRITE !!,$SELECT($DATA(ZTSK):"Your task number"_ZTSK_" has been queued.",1:"Unable to queue this job.")
+8 KILL ZTSK,IO("Q")
DO HOME^%ZIS
End DoDot:1
GOTO RPTQ
+9 USE IO
+10 DO DISRPT1(RCSCR,+$GET(^TMP("RCBATCH_SELECTED",$JOB)))
RPT1Q QUIT
+1 ; END PRCA*4.5*326
+2 ;
DISRPT(RCSCR,RCBATCH) ; Queued job entrypoint
+1 ; RCSCR = the ien of the entry in file 344.49
+2 ; RCBATCH = the # of the batch within the ERA. If all batches, this is null
+3 NEW X,Z,Z0,RC3444,RCSTOP,RCPG,RCANY,RCZ,RCZ0,RCZ1,SPLIT,SSN,AMT1,AMT2,RCBILL,RESULT,DTFR1,DTFR2,DTTO1,DTTO2
+4 SET (RCSTOP,RCPG,RCANY)=0
+5 SET RCZ=0
FOR
SET RCZ=$ORDER(^RCY(344.49,RCSCR,1,"ANV",0,RCZ))
if 'RCZ
QUIT
Begin DoDot:1
+6 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET (RCSTOP,ZTSTOP)=1
KILL ZTREQ
if +$GET(RCPG)
WRITE !,"***TASK STOPPED BY USER***"
QUIT
+7 SET RCZ0=$GET(^RCY(344.49,RCSCR,1,RCZ,0))
+8 ; Not top level
if '$DATA(^RCY(344.49,RCSCR,1,"ASEQ",+RCZ0,RCZ))
QUIT
+9 if RCZ0=""
QUIT
+10 ; Not in the batch
IF $GET(RCBATCH)
IF $PIECE(RCZ0,U,14)'=RCBATCH
QUIT
+11 SET SPLIT=(+$ORDER(^RCY(344.49,RCSCR,1,"B",+RCZ0_".9999"),-1)'=(+RCZ0_".001"))
+12 SET RC3444=$GET(^RCY(344.4,RCSCR,1,+$PIECE(RCZ0,U,9),0))
+13 SET RCBILL=+$GET(^IBM(361.1,+$PIECE(RC3444,U,2),0))
+14 ; PRCA*4.5*326
IF 'RCBILL
QUIT
+15 ; PRCA*4.5*326
SET RCANY=1
+16 SET RESULT=$$VER^RCDPEV(RCSCR,RCBILL,+$PIECE(RCZ0,U,9),1)
+17 SET AMT1=$SELECT($EXTRACT($PIECE(RESULT,U,5))="*":"*",1:"")_$SELECT($TRANSLATE($PIECE(RESULT,U,5),"*")="":"NO DATA",1:$JUSTIFY($TRANSLATE($PIECE(RESULT,U,5),"*"),"",2))
+18 SET AMT2=$SELECT($EXTRACT($PIECE(RESULT,U,4))="*":"*",1:"")_$SELECT($TRANSLATE($PIECE(RESULT,U,4),"*")="":"NO DATA",1:$JUSTIFY($TRANSLATE($PIECE(RESULT,U,4),"*"),"",2))
+19 SET DTFR1=$SELECT($TRANSLATE($PIECE(RESULT,U,7),"*")="":"",1:$SELECT($EXTRACT($PIECE(RESULT,U,7))="*":"*",1:"")_$$FMTE^XLFDT($TRANSLATE($PIECE(RESULT,U,7),"*"),"2D"))
+20 SET DTFR2=$SELECT($TRANSLATE($PIECE(RESULT,U,6),"*")="":"",1:$SELECT($EXTRACT($PIECE(RESULT,U,6))="*":"*",1:"")_$$FMTE^XLFDT($TRANSLATE($PIECE(RESULT,U,6),"*"),"2D"))
+21 SET DTTO1=$SELECT($TRANSLATE($PIECE(RESULT,U,9),"*")="":"",1:$SELECT($EXTRACT($PIECE(RESULT,U,9))="*":"*",1:"")_$$FMTE^XLFDT($TRANSLATE($PIECE(RESULT,U,9),"*"),"2D"))
+22 SET DTTO2=$SELECT($TRANSLATE($PIECE(RESULT,U,8),"*")="":"",1:$SELECT($EXTRACT($PIECE(RESULT,U,8))="*":"*",1:"")_$$FMTE^XLFDT($TRANSLATE($PIECE(RESULT,U,8),"*"),"2D"))
+23 SET X="EEOB Sequence #(s) on the ERA: "_$PIECE(RCZ0,U,9)_" "_$SELECT($PIECE(RC3444,U,5)'="":$PIECE(RC3444,U,5),$PIECE(RC3444,U,17)'="":$PIECE(RC3444,U,17),$GET(RCBILL):$PIECE($GET(^DGCR(399,+RCBILL,0)),U),1:"")
+24 ; PRCA*4.5*326
IF ($Y+7)>IOSL!'RCPG
DO HDR(.RCPG,RCSCR,$GET(RCBATCH),.RCSTOP,"U")
if RCSTOP
QUIT
+25 WRITE !!,X
+26 ; PRCA*4.5*326
IF ($Y+5)>IOSL
DO HDR(.RCPG,RCSCR,$GET(RCBATCH),.RCSTOP,"U")
if RCSTOP
QUIT
+27 SET X="VistA: "
SET SSN=$PIECE(RESULT,U,10)
SET SSN=$EXTRACT($EXTRACT(SSN,$LENGTH(SSN)-3,$LENGTH(SSN))_$JUSTIFY("",4),1,4)
+28 SET X=X_$SELECT('RCBILL:"NOT RELATED TO A VistA BILL",1:$EXTRACT($PIECE(RESULT,U,2)_$JUSTIFY("",30),1,30)_" "_SSN_" "_$EXTRACT(AMT2_$JUSTIFY("",15),1,15)_" "_$EXTRACT(...
... $SELECT(DTFR2="":"NO DATA",1:DTFR2)_$JUSTIFY("",9),1,9)_"- "_$SELECT(DTTO2'="":DTTO2,1:"NO DATA"))
+29 WRITE !,X
+30 SET X=" ERA: "_$EXTRACT($PIECE(RESULT,U,3)_$JUSTIFY("",30),1,30)_$JUSTIFY("",7)_$EXTRACT(AMT1_$JUSTIFY("",15),1,15)_" "_$EXTRACT($SELECT(DTFR1="":"NO DATA",1:DTFR1)_$JUSTIFY("",9),1,9)_"- "_$SELECT(DTTO1'="":DTTO1,1:"NO DATA")
+31 WRITE !,X
+32 if 'SPLIT
QUIT
+33 WRITE !,?9,"<<< THIS EEOB HAS BEEN SPLIT >>>"
+34 SET RCZ1=+RCZ0
FOR
SET RCZ1=$ORDER(^RCY(344.49,RCSCR,1,"B",RCZ1))
if (RCZ1\1)'=+RCZ0!RCSTOP
QUIT
Begin DoDot:2
+35 SET Z=+$ORDER(^RCY(344.49,RCSCR,1,"B",RCZ1,0))
+36 SET Z0=$GET(^RCY(344.49,RCSCR,1,Z,0))
+37 ; PRCA*4.5*326
IF ($Y+5)>IOSL
DO HDR(.RCPG,RCSCR,$GET(RCBATCH),.RCSTOP,"U")
if RCSTOP
QUIT
+38 WRITE !,?15,$SELECT($PIECE(Z0,U,7):"",1:"BILL NOT IN VISTA: "),$PIECE(Z0,U,2)_" "_$JUSTIFY($PIECE(Z0,U,5),"",2)
End DoDot:2
+39 WRITE !
End DoDot:1
if RCSTOP
QUIT
+40 ;
+41 ; PRCA*4.5*326
IF 'RCANY
if 'RCPG
DO HDR(.RCPG,RCSCR,$GET(RCBATCH),.RCSTOP,"U")
WRITE !,"THERE ARE NO UNVERIFIED LINES WITH DISCREPANCIES IN THIS ERA"_$SELECT($GET(RCBATCH):" BATCH",1:"")
+42 IF '$DATA(ZTQUEUED)
IF 'RCSTOP
IF RCPG
DO ASK()
+43 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+44 IF '$DATA(ZTQUEUED)
DO ^%ZISC
+45 QUIT
+46 ;
+47 ; BEGIN PRCA*4.5*326
DISRPT1(RCSCR,RCBATCH) ; Queued job entrypoint - Auto-post ERA
+1 ; RCSCR = the ien of the entry in file 344.49
+2 ; RCBATCH = the # of the batch within the ERA. If all batches, this is null
+3 ;
+4 ; Sort verified status into scratchpad sequence
+5 NEW ARR,RCZ,RCVER
+6 FOR RCVER=0,1
Begin DoDot:1
+7 SET RCZ=0
+8 FOR
SET RCZ=$ORDER(^RCY(344.49,RCSCR,1,"ANV",RCVER,RCZ))
if 'RCZ
QUIT
Begin DoDot:2
+9 SET ARR(RCZ)=RCVER
End DoDot:2
End DoDot:1
+10 ;
+11 NEW AMT1,AMT2,DTFR1,DTFR2,DTTO1,DTTO2,RCANY,RCSTOP,RCPG,RCZ0,RCZ1,RCBILL,RCEOB,RCLINE,RESULT
+12 NEW SPLIT,SSN,X,Z,Z0
+13 SET (RCSTOP,RCPG,RCANY,RCZ)=0
+14 FOR
SET RCZ=$ORDER(ARR(RCZ))
if 'RCZ
QUIT
Begin DoDot:1
+15 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET (RCSTOP,ZTSTOP)=1
KILL ZTREQ
if +$GET(RCPG)
WRITE !,"***TASK STOPPED BY USER***"
QUIT
+16 SET RCZ0=$GET(^RCY(344.49,RCSCR,1,RCZ,0))
+17 ; Not top level
if '$DATA(^RCY(344.49,RCSCR,1,"ASEQ",+RCZ0,RCZ))
QUIT
+18 if RCZ0=""
QUIT
+19 ; Not in the batch
IF $GET(RCBATCH)
IF $$GET1^DIQ(344.491,RCZ_","_RCSCR_",",.14)'=RCBATCH
QUIT
+20 SET SPLIT=(+$ORDER(^RCY(344.49,RCSCR,1,"B",+RCZ0_".9999"),-1)'=(+RCZ0_".001"))
+21 SET RC3444=$GET(^RCY(344.4,RCSCR,1,+$PIECE(RCZ0,U,9),0))
+22 SET RCLINE=+$$GET1^DIQ(344.491,RCZ_","_RCSCR_",",.09)
+23 SET RCEOB=+$$GET1^DIQ(344.41,RCLINE_","_RCSCR_",",.02,"I")
+24 SET RCBILL=+$$GET1^DIQ(361.1,RCEOB_",",.01,"I")
+25 SET RESULT=$$VER^RCDPEV(RCSCR,RCBILL,+RC3444,1)
+26 ; Ignore lines with no discrepancies
+27 if '$FIND(RESULT,"^*")
QUIT
+28 SET RCANY=1
+29 ; Verification status
SET RCVER=ARR(RCZ)
+30 SET AMT1=$SELECT($EXTRACT($PIECE(RESULT,U,5))="*":"*",1:"")_$SELECT($TRANSLATE($PIECE(RESULT,U,5),"*")="":"NO DATA",1:$JUSTIFY($TRANSLATE($PIECE(RESULT,U,5),"*"),"",2))
+31 SET AMT2=$SELECT($EXTRACT($PIECE(RESULT,U,4))="*":"*",1:"")_$SELECT($TRANSLATE($PIECE(RESULT,U,4),"*")="":"NO DATA",1:$JUSTIFY($TRANSLATE($PIECE(RESULT,U,4),"*"),"",2))
+32 SET DTFR1=$SELECT($TRANSLATE($PIECE(RESULT,U,7),"*")="":"",1:$SELECT($EXTRACT($PIECE(RESULT,U,7))="*":"*",1:"")_$$FMTE^XLFDT($TRANSLATE($PIECE(RESULT,U,7),"*"),"2D"))
+33 SET DTFR2=$SELECT($TRANSLATE($PIECE(RESULT,U,6),"*")="":"",1:$SELECT($EXTRACT($PIECE(RESULT,U,6))="*":"*",1:"")_$$FMTE^XLFDT($TRANSLATE($PIECE(RESULT,U,6),"*"),"2D"))
+34 SET DTTO1=$SELECT($TRANSLATE($PIECE(RESULT,U,9),"*")="":"",1:$SELECT($EXTRACT($PIECE(RESULT,U,9))="*":"*",1:"")_$$FMTE^XLFDT($TRANSLATE($PIECE(RESULT,U,9),"*"),"2D"))
+35 SET DTTO2=$SELECT($TRANSLATE($PIECE(RESULT,U,8),"*")="":"",1:$SELECT($EXTRACT($PIECE(RESULT,U,8))="*":"*",1:"")_$$FMTE^XLFDT($TRANSLATE($PIECE(RESULT,U,8),"*"),"2D"))
+36 SET X="EEOB Sequence #(s) on the ERA: "_$PIECE(RCZ0,U,9)_" "_$SELECT($PIECE(RC3444,U,5)'="":$PIECE(RC3444,U,5),$PIECE(RC3444,U,17)'="":$PIECE(RC3444,U,17),$GET(RCBILL):$PIECE($GET(^DGCR(399,+RCBILL,0)),U),1:"")
+37 WRITE " ("_$SELECT(RCVER:"Verified",1:"Unverified")
+38 IF ($Y+7)>IOSL!'RCPG
DO HDR(.RCPG,RCSCR,$GET(RCBATCH),.RCSTOP,"A")
if RCSTOP
QUIT
+39 WRITE !!,X
+40 IF ($Y+5)>IOSL
DO HDR(.RCPG,RCSCR,$GET(RCBATCH),.RCSTOP,"A")
if RCSTOP
QUIT
+41 SET X="VistA: "
SET SSN=$PIECE(RESULT,U,10)
SET SSN=$EXTRACT($EXTRACT(SSN,$LENGTH(SSN)-3,$LENGTH(SSN))_$JUSTIFY("",4),1,4)
+42 SET X=X_$SELECT('RCBILL:"NOT RELATED TO A VistA BILL",1:$EXTRACT($PIECE(RESULT,U,2)_$JUSTIFY("",30),1,30)_" "_SSN_" "_$EXTRACT(AMT2_$JUSTIFY("",15),1,15)_" "_$EXTRACT($SELECT(DTFR2="":"NO DATA",1:DTFR2)_...
... $JUSTIFY("",9),1,9)_"- "_$SELECT(DTTO2'="":DTTO2,1:"NO DATA"))
+43 WRITE !,X
+44 SET X=" ERA: "_$EXTRACT($PIECE(RESULT,U,3)_$JUSTIFY("",30),1,30)_$JUSTIFY("",7)_$EXTRACT(AMT1_$JUSTIFY("",15),1,15)_" "_$EXTRACT($SELECT(DTFR1="":"NO DATA",1:DTFR1)_$JUSTIFY("",9),1,9)_"- "_$SELECT(DTTO1'="":DTTO1,1:"NO DATA")
+45 WRITE !,X
+46 if 'SPLIT
QUIT
+47 WRITE !,?9,"<<< THIS EEOB HAS BEEN SPLIT >>>"
+48 SET RCZ1=+RCZ0
FOR
SET RCZ1=$ORDER(^RCY(344.49,RCSCR,1,"B",RCZ1))
if (RCZ1\1)'=+RCZ0!RCSTOP
QUIT
Begin DoDot:2
+49 SET Z=+$ORDER(^RCY(344.49,RCSCR,1,"B",RCZ1,0))
+50 SET Z0=$GET(^RCY(344.49,RCSCR,1,Z,0))
+51 IF ($Y+5)>IOSL
DO HDR(.RCPG,RCSCR,$GET(RCBATCH),.RCSTOP,"A")
if RCSTOP
QUIT
+52 WRITE !,?15,$SELECT($PIECE(Z0,U,7):"",1:"BILL NOT IN VISTA: "),$PIECE(Z0,U,2)_" "_$JUSTIFY($PIECE(Z0,U,5),"",2)
End DoDot:2
+53 WRITE !
End DoDot:1
if RCSTOP
QUIT
+54 ;
+55 IF 'RCANY
Begin DoDot:1
+56 if 'RCPG
DO HDR(.RCPG,RCSCR,$GET(RCBATCH),.RCSTOP,"A")
+57 WRITE !,"THERE ARE NO AUTO-POST LINES WITH DISCREPANCIES IN THIS ERA"
+58 WRITE $SELECT($GET(RCBATCH):" BATCH",1:"")
End DoDot:1
+59 IF '$DATA(ZTQUEUED)
IF 'RCSTOP
IF RCPG
DO ASK()
+60 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+61 IF '$DATA(ZTQUEUED)
DO ^%ZISC
+62 QUIT
+63 ; END PRCA*4.5*326
+64 ;
HDR(RCPG,RCSCR,RCBATCH,RCSTOP,RCTYP) ;Print header - RCTYP added - PRCA*4.5*326
+1 ; RCPG = last page #
+2 ; RCSCR = the entry # in file 344.49
+3 ; RCSTOP = returned as 1 if abort is detected
+4 ; RCTYP = 'A' for all verification discrepancies, 'U' for unverified discrepancies only
+5 ; PRCA*4.5*326
NEW RCDAT,RCPAY,RCTRACE
+6 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET (RCSTOP,ZTSTOP)=1
KILL ZTREQ
if +$GET(RCPG)
WRITE !,"***TASK STOPPED BY USER***"
QUIT
+7 IF RCPG&($EXTRACT(IOST,1,2)="C-")
DO ASK(.RCSTOP)
if RCSTOP
QUIT
+8 ; PRCA*4.5*326
SET RCDAT=$$GET1^DIQ(344.4,RCSCR_",",.04,"I")
+9 ; PRCA*4.5*326
SET RCPAY=$$GET1^DIQ(344.4,RCSCR_",",.06,"I")
+10 ; PRCA*4.5*326
SET RCTRACE=$$GET1^DIQ(344.4,RCSCR_",",.02,"I")
+11 WRITE !,@IOF,*13
+12 SET RCPG=$GET(RCPG)+1
+13 ; BEGIN PRCA*4.5*326
+14 IF RCTYP="U"
WRITE !,"EDI LBOX WORKLIST - UNVERIFIED LINES DISCREPANCIES REPORT",?59
+15 IF '$TEST
WRITE !,"EDI LBOX WORKLIST - AUTOPOST ERA LINES DISCREPANCIES REPORT",?61
+16 WRITE $$FMTE^XLFDT(DT,2),?70,"Page: ",RCPG,!
+17 WRITE !,"ERA #: ",RCSCR,?20
+18 WRITE $SELECT($ORDER(^RCY(344.49,RCSCR,3,0)):"BATCH: "_$EXTRACT($SELECT($GET(RCBATCH):+RCBATCH,1:"ALL")_$JUSTIFY("",11),1,11),1:$JUSTIFY("",18))
+19 WRITE "TRACE #: "_RCTRACE
+20 WRITE !,"PAYER: "_$EXTRACT(RCPAY_$JUSTIFY("",30),1,30)_" ERA DT: "_$$FMTE^XLFDT(RCDAT,"2D")
+21 ; END PRCA*4.5*326
+22 WRITE !!,?7,"PATIENT NAME"_$JUSTIFY("",25)_"SUBMITTED AMT SVC DATE(S)"
+23 WRITE !,"* preceding data = data has discrepancy"
+24 WRITE !,$TRANSLATE($JUSTIFY("",IOM)," ","=")
+25 QUIT
+26 ;
ASK(RCSTOP) ; Ask to continue
+1 ; If passed by reference ,RCSTOP is returned as 1 if print is aborted
+2 IF $EXTRACT(IOST,1,2)'["C-"
QUIT
+3 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT
+4 SET DIR(0)="E"
WRITE !
DO ^DIR
+5 IF ($DATA(DIRUT))!($DATA(DUOUT))
SET RCSTOP=1
QUIT
+6 QUIT
+7 ;