ABMEBDSP ; IHS/ASDST/DMJ - ELECTRONIC CLAIMS DISPLAY ;
;;2.6;IHS 3P BILLING SYSTEM;**3,6,8**;NOV 12, 2009
;Original;DMJ;
; IHS/ASDS/DMJ - V2.4 P7 - 9/7/01 - NOIS NDA-0301-180017 - Modified to resolve <UNDEF>PCN+1^ABMERUTL for all electronic
; modes of export.
; IHS/SD/SDR 10/10/02 - V2.5 P2 - XAA-0501-200006 - Modified to display # of bills on the bill total line
; IHS/SD/SDR - abm*2.6*6 - 5010 - clearinghouse changes
DOC ;
; The purpose of this routine is to show the user summary
; information of a specified electronically transmitted batch
; of bills. The data is grouped by bill type within site with
; subtotals shown. A grand total (amt billed) is also shown.
; The data fields are: bill number, health record number,
; patient name, service date from, and amount billed.
;
; INPUT: none
;
; OUTPUT: none
;
START ;START HERE
; Find the requested transmission batch in the transmission
; file. Screen out those entries that don't have an EMC
; file name.
;
BEG ;
; Find beginning export batch
W !
S DIC="^ABMDTXST(DUZ(2),"
S DIC("S")="I $L($P($G(^(1)),""^"",4))"
S DIC(0)="AEMQ"
S DIC("A")="Select beginning export batch: "
D ^DIC
Q:Y<0
S ABME("XMITB")=+Y
;
END ;
; Find ending export batch
W !
S DIC("A")="Select ending export batch: "
D ^DIC
K DIC
Q:Y<0
S ABME("XMITE")=+Y
I ABME("XMITE")<ABME("XMITB") W !!,"INVALID RANGE!" G BEG
;
;start new code abm*2.6*6 5010
LIST ; EP
W !!,"Checking...",!
K ABMP("XLIST")
K ABMP("CHKLIST")
S ABMP("XCNT")=0
S ABMP("XMIT")=ABME("XMITB")-1
F S ABMP("XMIT")=$O(^ABMDTXST(DUZ(2),ABMP("XMIT"))) Q:'+ABMP("XMIT")!(ABMP("XMIT")>ABME("XMITE")) D
.Q:$P($G(^ABMDEXP($P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),0)),U,2),0)),U)'["837"
.S ABMP("SIEN")=$O(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,9999999),-1) ;look at last entry only
.I ABMP("SIEN")'="" S ABMP("GCN")=$P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,ABMP("SIEN"),0)),U,2)
.;I $G(ABMP("GCN"))="" S ABMP("GCN")=$P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),1)),U,6) ;abm*2.6*8 HEAT42133
.I $G(ABMP("GCN"))="" S ABMP("GCN")=$P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),1)),U,6),ABMP("SIEN")=$P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),0)),U) ;abm*2.6*8 HEAT42133
.S ABMP("CHKLIST",ABMP("XMIT"))=1
.S ABMP("XCNT")=+$G(ABMP("XCNT"))+1
.S ABMP("XLIST",ABMP("XCNT"),ABMP("XMIT"),ABMP("SIEN"),ABMP("GCN"))=""
.S ABMP("GLIST",ABMP("GCN"))=""
S ABMP("XCNTL")=0
F S ABMP("XCNTL")=$O(ABMP("GLIST",ABMP("XCNTL"))) Q:'ABMP("XCNTL") D
.S ABMP("GCN")=0
.F S ABMP("GCN")=$O(ABMP("GLIST",ABMP("GCN"))) Q:'ABMP("GCN") D
..S ABMP("XGMIT")=0
..F S ABMP("XGMIT")=$O(^ABMDTXST(DUZ(2),"EGCN",ABMP("GCN"),ABMP("XGMIT"))) Q:'ABMP("XGMIT") D
...S ABMP("SIEN")=$O(^ABMDTXST(DUZ(2),"EGCN",ABMP("GCN"),ABMP("XGMIT"),99999),-1)
...I +$G(ABMP("CHKLIST",ABMP("XGMIT")))'=0 Q ;already have transmission on list
...S ABMP("CHKLIST",ABMP("XGMIT"))=1
...S ABMP("XCNT")=+$G(ABMP("XCNT"))+1
...S ABMP("XLIST",ABMP("XCNT"),ABMP("XGMIT"),ABMP("SIEN"),ABMP("GCN"))=""
;
I ABMP("XCNT")=1 S ABMP("ANS")=2,ABMSEL=1 ;default to one entry if only one found
I +$G(ABMP("XCNT"))>1 D
.W !,"There are multiple batches associated with your selection."
.W !!,"Select from the following:",!
.D BATCHLST
S ABMQUIT=0
I +$G(ABMP("XCNT"))>1 D
.K DIR,DIE,DIC,X,Y,DA
.S DIR(0)="SO^1:All associated batches;2:A single batch entry;3:Reselect export dates;4:Quit"
.S DIR("A")="Select"
.D ^DIR K DIR
.S ABMP("ANS")=+Y
.I ABMP("ANS")=1 ;print all entries
.I ABMP("ANS")=2 D ;select one entry
..D BATCHLST
..K DIR,DIE,DIC,X,Y,DA
..S DIR(0)="NO^1:"_(ABMP("XCNT")-1)
..S DIR("A")="Select"
..D ^DIR K DIR
..I +Y=0 S ABMQUIT=1
..S ABMSEL=Y
.I ABMP("ANS")=3 G START ;start over
.I ABMP("ANS")=4 S ABMQUIT=1 Q ;quit w/out printing anything
Q:ABMQUIT
I ABMP("ANS")=2 D
.S ABMECHK=0
.F S ABMECHK=$O(ABMP("XLIST",ABMECHK)) Q:'ABMECHK D
..I ABMECHK'=ABMSEL K ABMP("XLIST",ABMECHK)
;end new code 5010
SEL ;
; Select device
S %ZIS="NQ"
S %ZIS("A")="Enter DEVICE: "
D ^%ZIS Q:POP
I IO'=IO(0) D QUE,HOME^%ZIS S DIR(0)="E" D ^DIR K DIR Q
I $D(IO("S")) S IOP=ION D ^%ZIS
;
PRINT ;
; Callable point for queuing
S ABME("PG")=0
;start old code abm*2.6*6 5010
;S ABMP("XMIT")=ABME("XMITB")-1
;F S ABMP("XMIT")=$O(^ABMDTXST(DUZ(2),ABMP("XMIT"))) Q:'+ABMP("XMIT")!(ABMP("XMIT")>ABME("XMITE")) D SET
;Q:Y=0
;end old code start new code 5010
S ABME("CUMTOT")=0
S ABME("CUMCNT")=0
;
S ABME("XCNT")=0
F S ABME("XCNT")=$O(ABMP("XLIST",ABME("XCNT"))) Q:'ABME("XCNT") D
.S ABMP("XMIT")=0
.F S ABMP("XMIT")=$O(ABMP("XLIST",ABME("XCNT"),ABMP("XMIT"))) Q:'ABMP("XMIT") D
..S ABMP("SIEN")=0
..F S ABMP("SIEN")=$O(ABMP("XLIST",ABME("XCNT"),ABMP("XMIT"),ABMP("SIEN"))) Q:'ABMP("SIEN") D
...S ABMP("GCN")=0
...F S ABMP("GCN")=$O(ABMP("XLIST",ABME("XCNT"),ABMP("XMIT"),ABMP("SIEN"),ABMP("GCN"))) Q:'ABMP("GCN") D
....D SET
....Q:Y=0
;end new code 5010
W !!,$$EN^ABMVDF("HIN"),"E N D O F R E P O R T",$$EN^ABMVDF("HIF"),!
I $E(IOST)="C" S DIR(0)="E" D ^DIR K DIR
I $E(IOST)="P" W $$EN^ABMVDF("IOF")
I $D(IO("S")) D ^%ZISC
K ABME
Q
;
SET ;SET UP SOME THINGS
;
; ABME("BDATE") = Batch export date
; ABMP("EXP") = Export mode
; ABME("FORMAT") = Format
; ABMP("INS") = Insurer IEN
; ABME("INS") = Insurer name
; ABME("EMC") = EMC file name
;
S Y=$P(^ABMDTXST(DUZ(2),ABMP("XMIT"),0),U)
S ABMP("SAV")=0 ;abm*2.6*6
D DD^%DT
S ABME("BDATE")=Y
S ABMP("EXP")=$P(^ABMDTXST(DUZ(2),ABMP("XMIT"),0),"^",2)
Q:$P($G(^ABMDEXP(ABMP("EXP"),1)),U,5)'["E" ; Quit if not electronic
S ABME("FORMAT")=$P(^ABMDEXP(ABMP("EXP"),0),U,7)
S ABMP("INS")=$P(^ABMDTXST(DUZ(2),ABMP("XMIT"),0),"^",4)
S ABME("INS")=$P(^AUTNINS(ABMP("INS"),0),U)
S ABME("EMC")=$P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),1)),U,4)
;S ABME("GRPN")=$P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),1)),U,6) ;Control number ;abm*2.6*3
;start new code abm*2.6*3
S ABMGDT=$O(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,"B",9999999),-1)
I $G(ABMGDT)'="" D
.S ABMGIEN=$O(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,"B",ABMGDT,0))
.S ABME("GRPN")=$P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,ABMGIEN,0)),U,2)
I $G(ABME("GRPN"))="" S ABME("GRPN")=$P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),1)),U,6)
;end new code abm*2.6*3
S ABME("TOT")=0
S ABME("STOT")=0
S ABME("CNT")=0
S ABME("OLDLOC")=0
S ABME("OLDBTYP")=0
S $P(ABME("-"),"-",81)=""
S $P(ABME("EQ"),"=",81)=""
D HD
;
LOOP ; Loop through the bills of specified batch to gather data and
; print the report.
S I=0
F S I=$O(^ABMDTXST(DUZ(2),ABMP("XMIT"),2,I)) Q:'I D Q:Y=0
.S DA=+^ABMDTXST(DUZ(2),ABMP("XMIT"),2,I,0) ; Bill number (IEN)
.Q:'$D(^ABMDBILL(DUZ(2),DA,0)) ; Quit if not in file (wrong site)
.Q:$P(^ABMDBILL(DUZ(2),DA,0),U,4)="X" ; Quit if bill cancelled
.D DTAIL Q:Y=0
.S ABME("STOT")=ABME("STOT")+$G(ABME(21))
.S ABME("TOT")=ABME("TOT")+$G(ABME(21))
.S ABME("CNT")=ABME("CNT")+1
.Q
S ABME("CUMCNT")=+$G(ABME("CUMCNT"))+ABME("CNT")
S ABME("CUMTOT")=+$G(ABME("CUMTOT"))+ABME("TOT")
Q:Y=0
;W !!,$$EN^ABMVDF("HIN"),"BATCH TOTAL: ",$$EN^ABMVDF("HIF"),?40,ABME("CNT")_"bills",?68,$J($FN(ABME("TOT"),",",2),10) ;abm*2.6*6 5010
I $D(ABMP("XLIST",ABME("XCNT"))) W !!?20,$$EN^ABMVDF("HIN"),"Insurer total: ",$$EN^ABMVDF("HIF"),?40,ABME("CNT")_$S(ABME("CNT")=1:" bill",1:" bills"),?68,$J($FN(ABME("TOT"),",",2),10) ;abm*2.6*6 5010
I +$O(ABMP("XLIST",ABME("XCNT")))=0 W !!,$$EN^ABMVDF("HIN"),"BATCH TOTAL: ",$$EN^ABMVDF("HIF"),?40,ABME("CUMCNT")_$S(ABME("CUMCNT")=1:" bill",1:" bills"),?68,$J($FN(ABME("CUMTOT"),",",2),10) ;abm*2.6*6 5010
S ABME("TOT")=0
Q
;
DTAIL ;DISPLAY DETAIL
;
; ABME(1) = Bill number
; ABME(2) = Bill type
; ABME(3) = Visit location
; ABME(5) = Patient IEN
; ABME(8) = Active Insurer IEN
; ABME(21) = Bill amount
; ABME(71) = Service date from
;
N I
Q:'$D(^ABMDBILL(DUZ(2),DA)) ; Quit if no bill data
F I=1,2,3,5,8 S ABME(I)=$P(^ABMDBILL(DUZ(2),DA,0),"^",I)
I ABME(3)'=ABME("OLDLOC")!(ABME(2)'=ABME("OLDBTYP")) D
.I ABME("OLDLOC") D STOT
.W !!,$$EN^ABMVDF("HIN"),"SITE: ",$$EN^ABMVDF("HIF"),$P($G(^AUTTLOC(+ABME(3),0)),"^",2)
.W ?41,$$EN^ABMVDF("HIN"),"BILL TYPE: ",$$EN^ABMVDF("HIF"),ABME(2),!
.;start new code abm*2.6*6 5010
.I $P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,ABMP("SIEN"),0)),U,7)'="" D
..W ?1,$$EN^ABMVDF("HIN"),"INSURER: ",ABME("INS"),?40,"ST02: ",$$FMT^ABMERUTL($P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),1)),U,7),"4NR"),$$EN^ABMVDF("HIF")
.;end new code 5010
.S ABME("OLDLOC")=ABME(3)
.S ABME("OLDBTYP")=ABME(2)
.S ABME("OLDINS")=ABME("INS") ;abm*2.6*6 5010
.Q
S ABME(21)=$P($G(^ABMDBILL(DUZ(2),DA,2)),U)
S ABME(71)=$P($G(^ABMDBILL(DUZ(2),DA,7)),U)
S Y=ABME(71)
D DD^%DT
S ABME(71)=Y
S ABME("HRN")=$P($G(^AUPNPAT(+ABME(5),41,+ABME(3),0)),"^",2)
W !?3,ABME(1),?13,ABME("HRN"),?21,$P($G(^DPT(+ABME(5),0)),U),?51,ABME(71),?68,$J($FN(ABME(21),",",2),10)
I $Y+5>IOSL D HD Q:Y=0
Q
;
HD ;HEADER FOR DETAIL LISTING
I ABME("PG"),$E(IOST)="C" S DIR(0)="E" D ^DIR K DIR Q:Y=0
S ABME("PG")=ABME("PG")+1
I (ABME("XCNT")>1&(($E(IOST)'="C")&($Y+5<IOSL))&(ABMP("XMIT")=ABMP("SAV"))) W ! Q ;abm*2.6*6 5010
S ABMP("SAV")=ABMP("XMIT") ;abm*2.6*6
W $$EN^ABMVDF("IOF"),!,?30,$$EN^ABMVDF("HIN"),"BATCH SUMMARY",?70,"Page: ",$$EN^ABMVDF("HIF"),ABME("PG")
W !,$$EN^ABMVDF("HIN"),"BATCH DATE: ",$$EN^ABMVDF("HIF"),ABME("BDATE")
;W !,$$EN^ABMVDF("HIN"),"INSURER: ",$$EN^ABMVDF("HIF"),ABME("INS") ;abm*2.6*6 5010
I $P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,ABMP("SIEN"),0)),U,7)="" W !,$$EN^ABMVDF("HIN"),"INSURER: ",$$EN^ABMVDF("HIF"),ABME("INS") ;abm*2.6*6 5010
I $P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,ABMP("SIEN"),0)),U,7)'="" W !,$$EN^ABMVDF("HIN"),"CLEARINGHOUSE: ",$$EN^ABMVDF("HIF"),$P($G(^ABMRECVR($P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,ABMP("SIEN"),0)),U,7),0)),U) ;abm*2.6*6 5010
W !,$$EN^ABMVDF("HIN"),"FORMAT: ",$$EN^ABMVDF("HIF"),ABME("FORMAT")
W !,$$EN^ABMVDF("HIN"),"EMC FILE NAME: ",$$EN^ABMVDF("HIF"),ABME("EMC")
W ?50,$$EN^ABMVDF("HIN"),"GROUP CONTROL #: ",$$EN^ABMVDF("HIF"),ABME("GRPN") ;grp control #
W !,$$EN^ABMVDF("HIN"),ABME("EQ")
W !,"BILL #",?13,"HRN",?21,"PATIENT",?48,"SERVICE DATE FROM",?72,"AMOUNT"
W !,ABME("-"),!,$$EN^ABMVDF("HIF")
Q
;
STOT ;SITE TOTAL
W !!,$$EN^ABMVDF("HIN"),"SITE/BILL TYPE TOTAL:",$$EN^ABMVDF("HIF"),?68,$J($FN(ABME("STOT"),",",2),10)
S ABME("STOT")=0
Q
;
QUE ;QUE TO TASKMAN
S ZTRTN="PRINT^ABMEBDSP"
S ZTDESC="3P TX BATCH SUMMARY"
S ZTSAVE("ABME(""XMITE"")")=""
S ZTSAVE("ABME(""XMITB"")")=""
S ZTSAVE("ABM*")=""
K ZTSK
D ^%ZTLOAD
W:$G(ZTSK) !,"Task # ",ZTSK," queued.",!
Q
;start new code abm*2.6*6 5010
BATCHLST ;
W !
S ABME("XCNT")=0
F S ABME("XCNT")=$O(ABMP("XLIST",ABME("XCNT"))) Q:'ABME("XCNT") D
.S ABMP("XMIT")=0
.F S ABMP("XMIT")=$O(ABMP("XLIST",ABME("XCNT"),ABMP("XMIT"))) Q:'ABMP("XMIT") D
..S ABMP("SIEN")=0
..F S ABMP("SIEN")=$O(ABMP("XLIST",ABME("XCNT"),ABMP("XMIT"),ABMP("SIEN"))) Q:'ABMP("SIEN") D
...S ABMP("GCN")=0
...F S ABMP("GCN")=$O(ABMP("XLIST",ABME("XCNT"),ABMP("XMIT"),ABMP("SIEN"),ABMP("GCN"))) Q:'ABMP("GCN") D
....S ABMPIT=$P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),0)),U,3)
....S ABMP("ITYP")=$S(ABMPIT="P":"PRIVATE",ABMPIT="D":"MEDICAID",ABMPIT="R":"MEDICARE",ABMPIT="N":"NON-BEN",ABMPIT="W":"WORK.COMP",ABMPIT="C":"CHAMPUS",1:"ALL SOURCES")
....W ABME("XCNT"),?3,$$BDT^ABMDUTL($P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),0)),U)),?23,ABMP("GCN")
....W ?30,$P($G(^ABMDEXP($P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),0)),U,2),0)),U)
....W ?47,ABMP("ITYP")
....W:$P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,ABMP("SIEN"),0)),U,7) ?59,$P($G(^ABMRECVR($P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,ABMP("SIEN"),0)),U,7),0)),U)
....W !?23,$P($G(^AUTNINS($P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),0)),U,4),0)),U)
....W:$P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),0)),U,5) ?46,$P($G(^VA(200,$P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),0)),U,5),0)),U)
....W:$P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,ABMP("SIEN"),0)),U,6) ?70,"ST02: ",$$FMT^ABMERUTL($P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,ABMP("SIEN"),0)),U,6),"4NR")
....W !
Q
;end new code 5010
ABMEBDSP ; IHS/ASDST/DMJ - ELECTRONIC CLAIMS DISPLAY ;
+1 ;;2.6;IHS 3P BILLING SYSTEM;**3,6,8**;NOV 12, 2009
+2 ;Original;DMJ;
+3 ; IHS/ASDS/DMJ - V2.4 P7 - 9/7/01 - NOIS NDA-0301-180017 - Modified to resolve <UNDEF>PCN+1^ABMERUTL for all electronic
+4 ; modes of export.
+5 ; IHS/SD/SDR 10/10/02 - V2.5 P2 - XAA-0501-200006 - Modified to display # of bills on the bill total line
+6 ; IHS/SD/SDR - abm*2.6*6 - 5010 - clearinghouse changes
DOC ;
+1 ; The purpose of this routine is to show the user summary
+2 ; information of a specified electronically transmitted batch
+3 ; of bills. The data is grouped by bill type within site with
+4 ; subtotals shown. A grand total (amt billed) is also shown.
+5 ; The data fields are: bill number, health record number,
+6 ; patient name, service date from, and amount billed.
+7 ;
+8 ; INPUT: none
+9 ;
+10 ; OUTPUT: none
+11 ;
START ;START HERE
+1 ; Find the requested transmission batch in the transmission
+2 ; file. Screen out those entries that don't have an EMC
+3 ; file name.
+4 ;
BEG ;
+1 ; Find beginning export batch
+2 WRITE !
+3 SET DIC="^ABMDTXST(DUZ(2),"
+4 SET DIC("S")="I $L($P($G(^(1)),""^"",4))"
+5 SET DIC(0)="AEMQ"
+6 SET DIC("A")="Select beginning export batch: "
+7 DO ^DIC
+8 IF Y<0
QUIT
+9 SET ABME("XMITB")=+Y
+10 ;
END ;
+1 ; Find ending export batch
+2 WRITE !
+3 SET DIC("A")="Select ending export batch: "
+4 DO ^DIC
+5 KILL DIC
+6 IF Y<0
QUIT
+7 SET ABME("XMITE")=+Y
+8 IF ABME("XMITE")<ABME("XMITB")
WRITE !!,"INVALID RANGE!"
GOTO BEG
+9 ;
+10 ;start new code abm*2.6*6 5010
LIST ; EP
+1 WRITE !!,"Checking...",!
+2 KILL ABMP("XLIST")
+3 KILL ABMP("CHKLIST")
+4 SET ABMP("XCNT")=0
+5 SET ABMP("XMIT")=ABME("XMITB")-1
+6 FOR
SET ABMP("XMIT")=$ORDER(^ABMDTXST(DUZ(2),ABMP("XMIT")))
IF '+ABMP("XMIT")!(ABMP("XMIT")>ABME("XMITE"))
QUIT
Begin DoDot:1
+7 IF $PIECE($GET(^ABMDEXP($PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),0)),U,2),0)),U)'["837"
QUIT
+8 ;look at last entry only
SET ABMP("SIEN")=$ORDER(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,9999999),-1)
+9 IF ABMP("SIEN")'=""
SET ABMP("GCN")=$PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,ABMP("SIEN"),0)),U,2)
+10 ;I $G(ABMP("GCN"))="" S ABMP("GCN")=$P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),1)),U,6) ;abm*2.6*8 HEAT42133
+11 ;abm*2.6*8 HEAT42133
IF $GET(ABMP("GCN"))=""
SET ABMP("GCN")=$PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),1)),U,6)
SET ABMP("SIEN")=$PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),0)),U)
+12 SET ABMP("CHKLIST",ABMP("XMIT"))=1
+13 SET ABMP("XCNT")=+$GET(ABMP("XCNT"))+1
+14 SET ABMP("XLIST",ABMP("XCNT"),ABMP("XMIT"),ABMP("SIEN"),ABMP("GCN"))=""
+15 SET ABMP("GLIST",ABMP("GCN"))=""
End DoDot:1
+16 SET ABMP("XCNTL")=0
+17 FOR
SET ABMP("XCNTL")=$ORDER(ABMP("GLIST",ABMP("XCNTL")))
IF 'ABMP("XCNTL")
QUIT
Begin DoDot:1
+18 SET ABMP("GCN")=0
+19 FOR
SET ABMP("GCN")=$ORDER(ABMP("GLIST",ABMP("GCN")))
IF 'ABMP("GCN")
QUIT
Begin DoDot:2
+20 SET ABMP("XGMIT")=0
+21 FOR
SET ABMP("XGMIT")=$ORDER(^ABMDTXST(DUZ(2),"EGCN",ABMP("GCN"),ABMP("XGMIT")))
IF 'ABMP("XGMIT")
QUIT
Begin DoDot:3
+22 SET ABMP("SIEN")=$ORDER(^ABMDTXST(DUZ(2),"EGCN",ABMP("GCN"),ABMP("XGMIT"),99999),-1)
+23 ;already have transmission on list
IF +$GET(ABMP("CHKLIST",ABMP("XGMIT")))'=0
QUIT
+24 SET ABMP("CHKLIST",ABMP("XGMIT"))=1
+25 SET ABMP("XCNT")=+$GET(ABMP("XCNT"))+1
+26 SET ABMP("XLIST",ABMP("XCNT"),ABMP("XGMIT"),ABMP("SIEN"),ABMP("GCN"))=""
End DoDot:3
End DoDot:2
End DoDot:1
+27 ;
+28 ;default to one entry if only one found
IF ABMP("XCNT")=1
SET ABMP("ANS")=2
SET ABMSEL=1
+29 IF +$GET(ABMP("XCNT"))>1
Begin DoDot:1
+30 WRITE !,"There are multiple batches associated with your selection."
+31 WRITE !!,"Select from the following:",!
+32 DO BATCHLST
End DoDot:1
+33 SET ABMQUIT=0
+34 IF +$GET(ABMP("XCNT"))>1
Begin DoDot:1
+35 KILL DIR,DIE,DIC,X,Y,DA
+36 SET DIR(0)="SO^1:All associated batches;2:A single batch entry;3:Reselect export dates;4:Quit"
+37 SET DIR("A")="Select"
+38 DO ^DIR
KILL DIR
+39 SET ABMP("ANS")=+Y
+40 ;print all entries
IF ABMP("ANS")=1
+41 ;select one entry
IF ABMP("ANS")=2
Begin DoDot:2
+42 DO BATCHLST
+43 KILL DIR,DIE,DIC,X,Y,DA
+44 SET DIR(0)="NO^1:"_(ABMP("XCNT")-1)
+45 SET DIR("A")="Select"
+46 DO ^DIR
KILL DIR
+47 IF +Y=0
SET ABMQUIT=1
+48 SET ABMSEL=Y
End DoDot:2
+49 ;start over
IF ABMP("ANS")=3
GOTO START
+50 ;quit w/out printing anything
IF ABMP("ANS")=4
SET ABMQUIT=1
QUIT
End DoDot:1
+51 IF ABMQUIT
QUIT
+52 IF ABMP("ANS")=2
Begin DoDot:1
+53 SET ABMECHK=0
+54 FOR
SET ABMECHK=$ORDER(ABMP("XLIST",ABMECHK))
IF 'ABMECHK
QUIT
Begin DoDot:2
+55 IF ABMECHK'=ABMSEL
KILL ABMP("XLIST",ABMECHK)
End DoDot:2
End DoDot:1
+56 ;end new code 5010
SEL ;
+1 ; Select device
+2 SET %ZIS="NQ"
+3 SET %ZIS("A")="Enter DEVICE: "
+4 DO ^%ZIS
IF POP
QUIT
+5 IF IO'=IO(0)
DO QUE
DO HOME^%ZIS
SET DIR(0)="E"
DO ^DIR
KILL DIR
QUIT
+6 IF $DATA(IO("S"))
SET IOP=ION
DO ^%ZIS
+7 ;
PRINT ;
+1 ; Callable point for queuing
+2 SET ABME("PG")=0
+3 ;start old code abm*2.6*6 5010
+4 ;S ABMP("XMIT")=ABME("XMITB")-1
+5 ;F S ABMP("XMIT")=$O(^ABMDTXST(DUZ(2),ABMP("XMIT"))) Q:'+ABMP("XMIT")!(ABMP("XMIT")>ABME("XMITE")) D SET
+6 ;Q:Y=0
+7 ;end old code start new code 5010
+8 SET ABME("CUMTOT")=0
+9 SET ABME("CUMCNT")=0
+10 ;
+11 SET ABME("XCNT")=0
+12 FOR
SET ABME("XCNT")=$ORDER(ABMP("XLIST",ABME("XCNT")))
IF 'ABME("XCNT")
QUIT
Begin DoDot:1
+13 SET ABMP("XMIT")=0
+14 FOR
SET ABMP("XMIT")=$ORDER(ABMP("XLIST",ABME("XCNT"),ABMP("XMIT")))
IF 'ABMP("XMIT")
QUIT
Begin DoDot:2
+15 SET ABMP("SIEN")=0
+16 FOR
SET ABMP("SIEN")=$ORDER(ABMP("XLIST",ABME("XCNT"),ABMP("XMIT"),ABMP("SIEN")))
IF 'ABMP("SIEN")
QUIT
Begin DoDot:3
+17 SET ABMP("GCN")=0
+18 FOR
SET ABMP("GCN")=$ORDER(ABMP("XLIST",ABME("XCNT"),ABMP("XMIT"),ABMP("SIEN"),ABMP("GCN")))
IF 'ABMP("GCN")
QUIT
Begin DoDot:4
+19 DO SET
+20 IF Y=0
QUIT
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+21 ;end new code 5010
+22 WRITE !!,$$EN^ABMVDF("HIN"),"E N D O F R E P O R T",$$EN^ABMVDF("HIF"),!
+23 IF $EXTRACT(IOST)="C"
SET DIR(0)="E"
DO ^DIR
KILL DIR
+24 IF $EXTRACT(IOST)="P"
WRITE $$EN^ABMVDF("IOF")
+25 IF $DATA(IO("S"))
DO ^%ZISC
+26 KILL ABME
+27 QUIT
+28 ;
SET ;SET UP SOME THINGS
+1 ;
+2 ; ABME("BDATE") = Batch export date
+3 ; ABMP("EXP") = Export mode
+4 ; ABME("FORMAT") = Format
+5 ; ABMP("INS") = Insurer IEN
+6 ; ABME("INS") = Insurer name
+7 ; ABME("EMC") = EMC file name
+8 ;
+9 SET Y=$PIECE(^ABMDTXST(DUZ(2),ABMP("XMIT"),0),U)
+10 ;abm*2.6*6
SET ABMP("SAV")=0
+11 DO DD^%DT
+12 SET ABME("BDATE")=Y
+13 SET ABMP("EXP")=$PIECE(^ABMDTXST(DUZ(2),ABMP("XMIT"),0),"^",2)
+14 ; Quit if not electronic
IF $PIECE($GET(^ABMDEXP(ABMP("EXP"),1)),U,5)'["E"
QUIT
+15 SET ABME("FORMAT")=$PIECE(^ABMDEXP(ABMP("EXP"),0),U,7)
+16 SET ABMP("INS")=$PIECE(^ABMDTXST(DUZ(2),ABMP("XMIT"),0),"^",4)
+17 SET ABME("INS")=$PIECE(^AUTNINS(ABMP("INS"),0),U)
+18 SET ABME("EMC")=$PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),1)),U,4)
+19 ;S ABME("GRPN")=$P($G(^ABMDTXST(DUZ(2),ABMP("XMIT"),1)),U,6) ;Control number ;abm*2.6*3
+20 ;start new code abm*2.6*3
+21 SET ABMGDT=$ORDER(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,"B",9999999),-1)
+22 IF $GET(ABMGDT)'=""
Begin DoDot:1
+23 SET ABMGIEN=$ORDER(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,"B",ABMGDT,0))
+24 SET ABME("GRPN")=$PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,ABMGIEN,0)),U,2)
End DoDot:1
+25 IF $GET(ABME("GRPN"))=""
SET ABME("GRPN")=$PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),1)),U,6)
+26 ;end new code abm*2.6*3
+27 SET ABME("TOT")=0
+28 SET ABME("STOT")=0
+29 SET ABME("CNT")=0
+30 SET ABME("OLDLOC")=0
+31 SET ABME("OLDBTYP")=0
+32 SET $PIECE(ABME("-"),"-",81)=""
+33 SET $PIECE(ABME("EQ"),"=",81)=""
+34 DO HD
+35 ;
LOOP ; Loop through the bills of specified batch to gather data and
+1 ; print the report.
+2 SET I=0
+3 FOR
SET I=$ORDER(^ABMDTXST(DUZ(2),ABMP("XMIT"),2,I))
IF 'I
QUIT
Begin DoDot:1
+4 ; Bill number (IEN)
SET DA=+^ABMDTXST(DUZ(2),ABMP("XMIT"),2,I,0)
+5 ; Quit if not in file (wrong site)
IF '$DATA(^ABMDBILL(DUZ(2),DA,0))
QUIT
+6 ; Quit if bill cancelled
IF $PIECE(^ABMDBILL(DUZ(2),DA,0),U,4)="X"
QUIT
+7 DO DTAIL
IF Y=0
QUIT
+8 SET ABME("STOT")=ABME("STOT")+$GET(ABME(21))
+9 SET ABME("TOT")=ABME("TOT")+$GET(ABME(21))
+10 SET ABME("CNT")=ABME("CNT")+1
+11 QUIT
End DoDot:1
IF Y=0
QUIT
+12 SET ABME("CUMCNT")=+$GET(ABME("CUMCNT"))+ABME("CNT")
+13 SET ABME("CUMTOT")=+$GET(ABME("CUMTOT"))+ABME("TOT")
+14 IF Y=0
QUIT
+15 ;W !!,$$EN^ABMVDF("HIN"),"BATCH TOTAL: ",$$EN^ABMVDF("HIF"),?40,ABME("CNT")_"bills",?68,$J($FN(ABME("TOT"),",",2),10) ;abm*2.6*6 5010
+16 ;abm*2.6*6 5010
IF $DATA(ABMP("XLIST",ABME("XCNT")))
WRITE !!?20,$$EN^ABMVDF("HIN"),"Insurer total: ",$$EN^ABMVDF("HIF"),?40,ABME("CNT")_$SELECT(ABME("CNT")=1:" bill",1:" bills"),?68,$JUSTIFY($FNUMBER(ABME("TOT"),",",2),10)
+17 ;abm*2.6*6 5010
IF +$ORDER(ABMP("XLIST",ABME("XCNT")))=0
WRITE !!,$$EN^ABMVDF("HIN"),"BATCH TOTAL: ",$$EN^ABMVDF("HIF"),?40,ABME("CUMCNT")_$SELECT(ABME("CUMCNT")=1:" bill",1:" bills"),?68,$JUSTIFY($FNUMBER(ABME("CUMTOT"),",",2),10)
+18 SET ABME("TOT")=0
+19 QUIT
+20 ;
DTAIL ;DISPLAY DETAIL
+1 ;
+2 ; ABME(1) = Bill number
+3 ; ABME(2) = Bill type
+4 ; ABME(3) = Visit location
+5 ; ABME(5) = Patient IEN
+6 ; ABME(8) = Active Insurer IEN
+7 ; ABME(21) = Bill amount
+8 ; ABME(71) = Service date from
+9 ;
+10 NEW I
+11 ; Quit if no bill data
IF '$DATA(^ABMDBILL(DUZ(2),DA))
QUIT
+12 FOR I=1,2,3,5,8
SET ABME(I)=$PIECE(^ABMDBILL(DUZ(2),DA,0),"^",I)
+13 IF ABME(3)'=ABME("OLDLOC")!(ABME(2)'=ABME("OLDBTYP"))
Begin DoDot:1
+14 IF ABME("OLDLOC")
DO STOT
+15 WRITE !!,$$EN^ABMVDF("HIN"),"SITE: ",$$EN^ABMVDF("HIF"),$PIECE($GET(^AUTTLOC(+ABME(3),0)),"^",2)
+16 WRITE ?41,$$EN^ABMVDF("HIN"),"BILL TYPE: ",$$EN^ABMVDF("HIF"),ABME(2),!
+17 ;start new code abm*2.6*6 5010
+18 IF $PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,ABMP("SIEN"),0)),U,7)'=""
Begin DoDot:2
+19 WRITE ?1,$$EN^ABMVDF("HIN"),"INSURER: ",ABME("INS"),?40,"ST02: ",$$FMT^ABMERUTL($PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),1)),U,7),"4NR"),$$EN^ABMVDF("HIF")
End DoDot:2
+20 ;end new code 5010
+21 SET ABME("OLDLOC")=ABME(3)
+22 SET ABME("OLDBTYP")=ABME(2)
+23 ;abm*2.6*6 5010
SET ABME("OLDINS")=ABME("INS")
+24 QUIT
End DoDot:1
+25 SET ABME(21)=$PIECE($GET(^ABMDBILL(DUZ(2),DA,2)),U)
+26 SET ABME(71)=$PIECE($GET(^ABMDBILL(DUZ(2),DA,7)),U)
+27 SET Y=ABME(71)
+28 DO DD^%DT
+29 SET ABME(71)=Y
+30 SET ABME("HRN")=$PIECE($GET(^AUPNPAT(+ABME(5),41,+ABME(3),0)),"^",2)
+31 WRITE !?3,ABME(1),?13,ABME("HRN"),?21,$PIECE($GET(^DPT(+ABME(5),0)),U),?51,ABME(71),?68,$JUSTIFY($FNUMBER(ABME(21),",",2),10)
+32 IF $Y+5>IOSL
DO HD
IF Y=0
QUIT
+33 QUIT
+34 ;
HD ;HEADER FOR DETAIL LISTING
+1 IF ABME("PG")
IF $EXTRACT(IOST)="C"
SET DIR(0)="E"
DO ^DIR
KILL DIR
IF Y=0
QUIT
+2 SET ABME("PG")=ABME("PG")+1
+3 ;abm*2.6*6 5010
IF (ABME("XCNT")>1&(($EXTRACT(IOST)'="C")&($Y+5<IOSL))&(ABMP("XMIT")=ABMP("SAV")))
WRITE !
QUIT
+4 ;abm*2.6*6
SET ABMP("SAV")=ABMP("XMIT")
+5 WRITE $$EN^ABMVDF("IOF"),!,?30,$$EN^ABMVDF("HIN"),"BATCH SUMMARY",?70,"Page: ",$$EN^ABMVDF("HIF"),ABME("PG")
+6 WRITE !,$$EN^ABMVDF("HIN"),"BATCH DATE: ",$$EN^ABMVDF("HIF"),ABME("BDATE")
+7 ;W !,$$EN^ABMVDF("HIN"),"INSURER: ",$$EN^ABMVDF("HIF"),ABME("INS") ;abm*2.6*6 5010
+8 ;abm*2.6*6 5010
IF $PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,ABMP("SIEN"),0)),U,7)=""
WRITE !,$$EN^ABMVDF("HIN"),"INSURER: ",$$EN^ABMVDF("HIF"),ABME("INS")
+9 ;abm*2.6*6 5010
IF $PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,ABMP("SIEN"),0)),U,7)'=""
WRITE !,$$EN^ABMVDF("HIN"),"CLEARINGHOUSE: ",$$EN^ABMVDF("HIF"),$PIECE($GET(^ABMRECVR($PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,ABMP("SIEN"),0)),U,7),0)),U)
+10 WRITE !,$$EN^ABMVDF("HIN"),"FORMAT: ",$$EN^ABMVDF("HIF"),ABME("FORMAT")
+11 WRITE !,$$EN^ABMVDF("HIN"),"EMC FILE NAME: ",$$EN^ABMVDF("HIF"),ABME("EMC")
+12 ;grp control #
WRITE ?50,$$EN^ABMVDF("HIN"),"GROUP CONTROL #: ",$$EN^ABMVDF("HIF"),ABME("GRPN")
+13 WRITE !,$$EN^ABMVDF("HIN"),ABME("EQ")
+14 WRITE !,"BILL #",?13,"HRN",?21,"PATIENT",?48,"SERVICE DATE FROM",?72,"AMOUNT"
+15 WRITE !,ABME("-"),!,$$EN^ABMVDF("HIF")
+16 QUIT
+17 ;
STOT ;SITE TOTAL
+1 WRITE !!,$$EN^ABMVDF("HIN"),"SITE/BILL TYPE TOTAL:",$$EN^ABMVDF("HIF"),?68,$JUSTIFY($FNUMBER(ABME("STOT"),",",2),10)
+2 SET ABME("STOT")=0
+3 QUIT
+4 ;
QUE ;QUE TO TASKMAN
+1 SET ZTRTN="PRINT^ABMEBDSP"
+2 SET ZTDESC="3P TX BATCH SUMMARY"
+3 SET ZTSAVE("ABME(""XMITE"")")=""
+4 SET ZTSAVE("ABME(""XMITB"")")=""
+5 SET ZTSAVE("ABM*")=""
+6 KILL ZTSK
+7 DO ^%ZTLOAD
+8 IF $GET(ZTSK)
WRITE !,"Task # ",ZTSK," queued.",!
+9 QUIT
+10 ;start new code abm*2.6*6 5010
BATCHLST ;
+1 WRITE !
+2 SET ABME("XCNT")=0
+3 FOR
SET ABME("XCNT")=$ORDER(ABMP("XLIST",ABME("XCNT")))
IF 'ABME("XCNT")
QUIT
Begin DoDot:1
+4 SET ABMP("XMIT")=0
+5 FOR
SET ABMP("XMIT")=$ORDER(ABMP("XLIST",ABME("XCNT"),ABMP("XMIT")))
IF 'ABMP("XMIT")
QUIT
Begin DoDot:2
+6 SET ABMP("SIEN")=0
+7 FOR
SET ABMP("SIEN")=$ORDER(ABMP("XLIST",ABME("XCNT"),ABMP("XMIT"),ABMP("SIEN")))
IF 'ABMP("SIEN")
QUIT
Begin DoDot:3
+8 SET ABMP("GCN")=0
+9 FOR
SET ABMP("GCN")=$ORDER(ABMP("XLIST",ABME("XCNT"),ABMP("XMIT"),ABMP("SIEN"),ABMP("GCN")))
IF 'ABMP("GCN")
QUIT
Begin DoDot:4
+10 SET ABMPIT=$PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),0)),U,3)
+11 SET ABMP("ITYP")=$SELECT(ABMPIT="P":"PRIVATE",ABMPIT="D":"MEDICAID",ABMPIT="R":"MEDICARE",ABMPIT="N":"NON-BEN",ABMPIT="W":"WORK.COMP",ABMPIT="C":"CHAMPUS",1:"ALL SOURCES")
+12 WRITE ABME("XCNT"),?3,$$BDT^ABMDUTL($PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),0)),U)),?23,ABMP("GCN")
+13 WRITE ?30,$PIECE($GET(^ABMDEXP($PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),0)),U,2),0)),U)
+14 WRITE ?47,ABMP("ITYP")
+15 IF $PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,ABMP("SIEN"),0)),U,7)
WRITE ?59,$PIECE($GET(^ABMRECVR($PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,ABMP("SIEN"),0)),U,7),0)),U)
+16 WRITE !?23,$PIECE($GET(^AUTNINS($PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),0)),U,4),0)),U)
+17 IF $PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),0)),U,5)
WRITE ?46,$PIECE($GET(^VA(200,$PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),0)),U,5),0)),U)
+18 IF $PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,ABMP("SIEN"),0)),U,6)
WRITE ?70,"ST02: ",$$FMT^ABMERUTL($PIECE($GET(^ABMDTXST(DUZ(2),ABMP("XMIT"),3,ABMP("SIEN"),0)),U,6),"4NR")
+19 WRITE !
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+20 QUIT
+21 ;end new code 5010