IBCEPTC1 ;ALB/TMK - EDI PREV TRANSMITTED CLAIMS REPORT OUTPUT ;01/20/05
;;2.0;INTEGRATED BILLING;**296,320,547,592**;21-MAR-94;Build 58
;;Per VA Directive 6402, this routine should not be modified.
;
RPT(IBSORT,IBDT1,IBDT2) ; Output transmitted claims report
; global ^TMP("IB_PREV_CLAIM",$J,srt1,srt2,ien of entry file 364)=""
; IB*2.0*547 Variable IBLOC is pre-defined (in IBCEPTC)
N IBDA,IBIFN,IBPAGE,IBSTOP,IBHDR,IBS1,IBS2,Z,IBZ,IBREP
S (IBPAGE,IBSTOP)=0,IBPAGE(0)="",IBPAGE(1)="",IBREP="R"
; IB*2.0*547 adds ability for locally printed as well as transmitted claims
S IBHDR=$S(IBLOC:"Printed",1:"Transmitted")_" Claims Report for period covering "_$$FMTE^XLFDT(IBDT1,1)_" thru "_$$FMTE^XLFDT(IBDT2,1)_$J("",14)_$$HTE^XLFDT($H,"1M"),IBHDR=IBHDR_$J("",124-$L(IBHDR))_"Page"
S IBS1="" F S IBS1=$O(^TMP("IB_PREV_CLAIM",$J,IBS1)) Q:IBS1="" D Q:IBSTOP
. ; First level sort
. D:($Y+6)>IOSL!'IBPAGE HDR(IBHDR,IBSORT,.IBPAGE,.IBSTOP) Q:IBSTOP
. S IBPAGE(1)=IBS1,IBPAGE(0)="" ; Hold data for hdr repeated on new pg
. D HDR1(IBSORT,IBS1,.IBPAGE,.IBSTOP) Q:IBSTOP
. ;
. S IBPAGE(0)=1
. S IBS2="" F S IBS2=$O(^TMP("IB_PREV_CLAIM",$J,IBS1,IBS2)) Q:IBS2=""!IBSTOP S IBDA=0 F S IBDA=$O(^TMP("IB_PREV_CLAIM",$J,IBS1,IBS2,IBDA)) Q:'IBDA!IBSTOP D
.. S IBIFN=$S(IBLOC:+IBDA,1:+$G(^IBA(364,+IBDA,0)))
.. ;
.. D:($Y+5)>IOSL!'IBPAGE HDR(IBHDR,IBSORT,.IBPAGE,.IBSTOP) Q:IBSTOP
.. D WRT^IBCEPTC2(IBS1,IBS2,IBDA,IBIFN,IBSORT,IBREP,"",.IBPAGE,.IBSTOP) Q:IBSTOP
. S IBPAGE(0)=""
;
G:IBSTOP STOP
I 'IBPAGE D WRT^IBCEPTC2("NO PREVIOUSLY "_$S(IBLOC:"PRINTED",1:"TRANSMITTED")_" CLAIMS EXIST TO MATCH THE SEARCH CRITERIA SELECTED","",0,0,IBSORT,IBREP,IBHDR,0,0)
;
I $E(IOST,1,2)["C-" K DIR S DIR(0)="E" D ^DIR K DIR
;
STOP I $D(ZTQUEUED) S ZTREQ="@"
I '$D(ZTQUEUED) W ! D ^%ZISC
;
Q
;
HDR1(IBSORT,IBDATA,IBPAGE,IBSTOP) ; First level report sort headers
; IBSORT = sort type
; IBDATA = data at the 1st sort level
I ($Y+11)>IOSL D HDR(IBHDR,IBSORT,.IBPAGE,.IBSTOP) Q:IBSTOP
N Z,X,Y,Q
I IBSORT=1 D
. S Q=$S(IBLOC:"",1:"Batch Number: ")_$P(IBDATA,U,2)_$S('$P(IBDATA,U,4):"",1:" ** This batch was rejected **")_$S('$P(IBDATA,U,3):"",1:" ** This batch was a test batch **")
. W !!,Q W:$G(IBPAGE(0)) $J("",120-$L(Q)),"(Continued)" W !,"Date Last "_$S(IBLOC:"Printed: ",1:"Transmitted: "),$$FMTE^XLFDT(99999999-IBDATA,1)
. S Z="",$P(Z,"=",133)="" W !,Z
. ;JWS;IB*2.0*592 - move Type column header over 1 char
. W !,"Claim # Form Type Seq Status A/R Current Payer",$J("",13),"Payer Address",$J("",17),"Other Payer(s) Patient Name",!
;
I IBSORT=2 D
. N IBZ,IBIFN
. S IBIFN=""
. I IBDATA'="" S IBIFN=+$G(^TMP("IB_PREV_CLAIM",$J,IBDATA))
. S Q="Current Payer: "_$P(IBDATA,U)
. D F^IBCEF("N-CURR INS CO FULL ADDRESS","IBZ",,IBIFN)
. S Q=Q_" "_$G(IBZ(1))_$S($G(IBZ(1))'="":",",1:"")_" "_$G(IBZ(4))_$S($G(IBZ(4))'="":",",1:"")_" "_$P($G(^DIC(5,+$G(IBZ(5)),0)),U,2)
. W !!,Q
. I $G(IBPAGE(0)) D
.. I $L(Q)>119 S Q="" W !
.. W $J("",120-$L(Q)),"(Continued)"
. S Z="",$P(Z,"=",133)="" W !,Z
. ;JWS;IB*2.0*592; move Type column header over 1 char
. W !,"Claim # Form Type Seq Status A/R Other Payer(s)",$J("",6),"Patient Name",$J("",10),"Last "_$S(IBLOC:"Printed",1:"Transmit Batch Number"),!
;
Q
;
HDR(IBHDR,IBSORT,IBPAGE,IBSTOP) ; Report header
;
N Z,DIR,X,Y
I IBPAGE D Q:IBSTOP
. I $E(IOST,1,2)["C-" K DIR S DIR(0)="E" D ^DIR K DIR S IBSTOP=('Y) Q:IBSTOP
. W @IOF
S IBPAGE=IBPAGE+1,Z=IBHDR_$J(IBPAGE,4)
W !,Z
W:IBLOC'=1 !,"** A claim may appear on this report multiple times if it has been transmitted more than once. **"
I IBSORT=2,IBLOC'=1 D
. W !,"** T indicates the claim was transmitted as a test claim prior to turning on EDI live for the payer. **"
. W !,"** R indicates that the batch was rejected. **"
I IBPAGE>1,$G(IBPAGE(0)) D HDR1(IBSORT,IBPAGE(1),.IBPAGE,.IBSTOP)
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBCEPTC1 3928 printed Oct 16, 2024@18:12:43 Page 2
IBCEPTC1 ;ALB/TMK - EDI PREV TRANSMITTED CLAIMS REPORT OUTPUT ;01/20/05
+1 ;;2.0;INTEGRATED BILLING;**296,320,547,592**;21-MAR-94;Build 58
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 ;
RPT(IBSORT,IBDT1,IBDT2) ; Output transmitted claims report
+1 ; global ^TMP("IB_PREV_CLAIM",$J,srt1,srt2,ien of entry file 364)=""
+2 ; IB*2.0*547 Variable IBLOC is pre-defined (in IBCEPTC)
+3 NEW IBDA,IBIFN,IBPAGE,IBSTOP,IBHDR,IBS1,IBS2,Z,IBZ,IBREP
+4 SET (IBPAGE,IBSTOP)=0
SET IBPAGE(0)=""
SET IBPAGE(1)=""
SET IBREP="R"
+5 ; IB*2.0*547 adds ability for locally printed as well as transmitted claims
+6 SET IBHDR=$SELECT(IBLOC:"Printed",1:"Transmitted")_" Claims Report for period covering "_$$FMTE^XLFDT(IBDT1,1)_" thru "_$$FMTE^XLFDT(IBDT2,1)_$JUSTIFY("",14)_$$HTE^XLFDT($HOROLOG,"1M")
SET IBHDR=IBHDR_$JUSTIFY("",124-$LENGTH(IBHDR))_"Page"
+7 SET IBS1=""
FOR
SET IBS1=$ORDER(^TMP("IB_PREV_CLAIM",$JOB,IBS1))
if IBS1=""
QUIT
Begin DoDot:1
+8 ; First level sort
+9 if ($Y+6)>IOSL!'IBPAGE
DO HDR(IBHDR,IBSORT,.IBPAGE,.IBSTOP)
if IBSTOP
QUIT
+10 ; Hold data for hdr repeated on new pg
SET IBPAGE(1)=IBS1
SET IBPAGE(0)=""
+11 DO HDR1(IBSORT,IBS1,.IBPAGE,.IBSTOP)
if IBSTOP
QUIT
+12 ;
+13 SET IBPAGE(0)=1
+14 SET IBS2=""
FOR
SET IBS2=$ORDER(^TMP("IB_PREV_CLAIM",$JOB,IBS1,IBS2))
if IBS2=""!IBSTOP
QUIT
SET IBDA=0
FOR
SET IBDA=$ORDER(^TMP("IB_PREV_CLAIM",$JOB,IBS1,IBS2,IBDA))
if 'IBDA!IBSTOP
QUIT
Begin DoDot:2
+15 SET IBIFN=$SELECT(IBLOC:+IBDA,1:+$GET(^IBA(364,+IBDA,0)))
+16 ;
+17 if ($Y+5)>IOSL!'IBPAGE
DO HDR(IBHDR,IBSORT,.IBPAGE,.IBSTOP)
if IBSTOP
QUIT
+18 DO WRT^IBCEPTC2(IBS1,IBS2,IBDA,IBIFN,IBSORT,IBREP,"",.IBPAGE,.IBSTOP)
if IBSTOP
QUIT
End DoDot:2
+19 SET IBPAGE(0)=""
End DoDot:1
if IBSTOP
QUIT
+20 ;
+21 if IBSTOP
GOTO STOP
+22 IF 'IBPAGE
DO WRT^IBCEPTC2("NO PREVIOUSLY "_$SELECT(IBLOC:"PRINTED",1:"TRANSMITTED")_" CLAIMS EXIST TO MATCH THE SEARCH CRITERIA SELECTED","",0,0,IBSORT,IBREP,IBHDR,0,0)
+23 ;
+24 IF $EXTRACT(IOST,1,2)["C-"
KILL DIR
SET DIR(0)="E"
DO ^DIR
KILL DIR
+25 ;
STOP IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+1 IF '$DATA(ZTQUEUED)
WRITE !
DO ^%ZISC
+2 ;
+3 QUIT
+4 ;
HDR1(IBSORT,IBDATA,IBPAGE,IBSTOP) ; First level report sort headers
+1 ; IBSORT = sort type
+2 ; IBDATA = data at the 1st sort level
+3 IF ($Y+11)>IOSL
DO HDR(IBHDR,IBSORT,.IBPAGE,.IBSTOP)
if IBSTOP
QUIT
+4 NEW Z,X,Y,Q
+5 IF IBSORT=1
Begin DoDot:1
+6 SET Q=$SELECT(IBLOC:"",1:"Batch Number: ")_$PIECE(IBDATA,U,2)_$SELECT('$PIECE(IBDATA,U,4):"",1:" ** This batch was rejected **")_$SELECT('$PIECE(IBDATA,U,3):"",1:" ** This batch was a test batch **")
+7 WRITE !!,Q
if $GET(IBPAGE(0))
WRITE $JUSTIFY("",120-$LENGTH(Q)),"(Continued)"
WRITE !,"Date Last "_$SELECT(IBLOC:"Printed: ",1:"Transmitted: "),$$FMTE^XLFDT(99999999-IBDATA,1)
+8 SET Z=""
SET $PIECE(Z,"=",133)=""
WRITE !,Z
+9 ;JWS;IB*2.0*592 - move Type column header over 1 char
+10 WRITE !,"Claim # Form Type Seq Status A/R Current Payer",$JUSTIFY("",13),"Payer Address",$JUSTIFY("",17),"Other Payer(s) Patient Name",!
End DoDot:1
+11 ;
+12 IF IBSORT=2
Begin DoDot:1
+13 NEW IBZ,IBIFN
+14 SET IBIFN=""
+15 IF IBDATA'=""
SET IBIFN=+$GET(^TMP("IB_PREV_CLAIM",$JOB,IBDATA))
+16 SET Q="Current Payer: "_$PIECE(IBDATA,U)
+17 DO F^IBCEF("N-CURR INS CO FULL ADDRESS","IBZ",,IBIFN)
+18 SET Q=Q_" "_$GET(IBZ(1))_$SELECT($GET(IBZ(1))'="":",",1:"")_" "_$GET(IBZ(4))_$SELECT($GET(IBZ(4))'="":",",1:"")_" "_$PIECE($GET(^DIC(5,+$GET(IBZ(5)),0)),U,2)
+19 WRITE !!,Q
+20 IF $GET(IBPAGE(0))
Begin DoDot:2
+21 IF $LENGTH(Q)>119
SET Q=""
WRITE !
+22 WRITE $JUSTIFY("",120-$LENGTH(Q)),"(Continued)"
End DoDot:2
+23 SET Z=""
SET $PIECE(Z,"=",133)=""
WRITE !,Z
+24 ;JWS;IB*2.0*592; move Type column header over 1 char
+25 WRITE !,"Claim # Form Type Seq Status A/R Other Payer(s)",$JUSTIFY("",6),"Patient Name",$JUSTIFY("",10),"Last "_$SELECT(IBLOC:"Printed",1:"Transmit Batch Number"),!
End DoDot:1
+26 ;
+27 QUIT
+28 ;
HDR(IBHDR,IBSORT,IBPAGE,IBSTOP) ; Report header
+1 ;
+2 NEW Z,DIR,X,Y
+3 IF IBPAGE
Begin DoDot:1
+4 IF $EXTRACT(IOST,1,2)["C-"
KILL DIR
SET DIR(0)="E"
DO ^DIR
KILL DIR
SET IBSTOP=('Y)
if IBSTOP
QUIT
+5 WRITE @IOF
End DoDot:1
if IBSTOP
QUIT
+6 SET IBPAGE=IBPAGE+1
SET Z=IBHDR_$JUSTIFY(IBPAGE,4)
+7 WRITE !,Z
+8 if IBLOC'=1
WRITE !,"** A claim may appear on this report multiple times if it has been transmitted more than once. **"
+9 IF IBSORT=2
IF IBLOC'=1
Begin DoDot:1
+10 WRITE !,"** T indicates the claim was transmitted as a test claim prior to turning on EDI live for the payer. **"
+11 WRITE !,"** R indicates that the batch was rejected. **"
End DoDot:1
+12 IF IBPAGE>1
IF $GET(IBPAGE(0))
DO HDR1(IBSORT,IBPAGE(1),.IBPAGE,.IBSTOP)
+13 QUIT
+14 ;