ABMRSPIN ; IHS/SD/SDR - Claims Identified as Potential Split Billing Report;
;;2.6;IHS 3P BILLING SYSTEM;**22**;NOV 12, 2009;Build 418
;IHS/SD/SDR 2.6*22 HEAT335246 - New routine
;
Q
START ;
S ABMP("RTN")="ABMRSPIN" ;Routine used to get data
S ABMMENU="Claims ID'd as Potential Split Billing Report"
K ^TMP("ABM-SPIN",$J),^TMP("ABM-SPIN-DATA",$J),^TMP("ABM-SPIN-CNT",$J)
SEL ;
K ABMY,ABM
K DTOUT,DIRUT,DUOUT,DIROUT
I $D(ABMY("RTYP")) S ABM("HD",0)=ABMY("RTYP","NM")_" "_ABMMENU
E S ABM("HD",0)=ABMMENU
W !!,"This report will look through claims/bills based on the selection criteria"
W !,"chosen and report any claims that match. This report is meant as a tool for the"
W !,"user to identify potential bills that can be split for further billing due to"
W !,"multiple entries in V-files."
W !!,"NOTE: all prompts are required"
W !
D INS ;select insurer(s)
I '$D(ABMY("INS")) Q ;no insurer was selected
Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT)
D DT ;select visit or approval date range
I '$D(ABMY("DT",1)) Q ;no dates were entered
D CLMSTAT ;What claim status (Open, complete, or both)
I '$D(ABMY("STA")) Q ;no claim status was selected
Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)
D PGS ;what pages do you want to split (8D, 8E, 8F, 8H, 8Z)
I '$D(ABMY("PGS")) Q ;no pages were selected
Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)
D RTYP ;brief or statistical
I '$D(ABMY("RTYP")) Q ;no format was selected
;
W !!,"You selected: "
W !?3,"Insurers: "
S ABMI=0
F S ABMI=$O(ABMY("INS",ABMI)) Q:'ABMI W !?6,$P($G(^AUTNINS(ABMI,0)),U)
W !?3,$S(ABMY("DT")="V":"Visit",1:"Approval")_" Dates: ",$$SDT^ABMDUTL(ABMY("DT",1))_" to "_$$SDT^ABMDUTL(ABMY("DT",2))
W !?3,"Claim Status: "
F ABMI=1:1:$L(ABMY("STA","NM"),",") W !?6,$$TRIM^ABMUTLP($P(ABMY("STA","NM"),",",ABMI),"L")
W !?3,"Check pages: "_$E($TR(ABMY("PGS"),"^",","),2,($L(ABMY("PGS"))-1))
W !?3,"Report Type: "_$S(ABMY("RTYP")=2:"Statistical Summary Only",1:"Brief Listing"),!!
S DIR(0)="Y",DIR("A")="Do you wish to continue" D ^DIR K DIR
Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT)
I 'Y G SEL ;start over if they say NO
;
S %ZIS="QM"
D ^%ZIS Q:POP
I $D(IO("Q")) D Q
.S ZTRTN="PRINT^ABMRSPIN",ZTDESC=XQY0
.S ZTSAVE("ABM*")=""
.D ^%ZTLOAD
.I $D(ZTSK)[0 W !!?5,"Report Cancelled!"
.E W !!?5,"Report queued to run on ",ZTSK," #"
.D HOME^%ZIS
.K IO("Q")
U IO
D COMPUTE
D PRINT
D ^%ZISC
D HOME^%ZIS
Q
PRINT ;
S ABM("HD",1)="with "_$S(ABMY("DT")="V":"Visit",1:"Approval")_" Dates from "_$$SDT^ABMDUTL(ABMY("DT",1))_" to "_$$SDT^ABMDUTL(ABMY("DT",2))
S ABM("HD",1)=ABM("HD",1)_" AND for page"_$S(($L(ABMY("PGS"),"^")>3):"s",1:"")_" "_$E($TR($G(ABMY("PGS")),"^",","),2,$L(ABMY("PGS"))-1)
S ABM("HD",2)="for insurer"_$S((+$G(ABMY("INS"))>1):"s",1:"")_" "
S ABMI=0
S ABMJ=0
F S ABMI=$O(ABMY("INS",ABMI)) Q:'ABMI S ABM("HD",2)=ABM("HD",2)_$S(ABMJ=1:", ",1:"")_$P($G(^AUTNINS(ABMI,0)),U) S ABMJ=1
S ABM("PG")=0
;
I ABMY("RTYP")'=1 D SUMMARY Q ;summary, not detail
D HDB
S ABMP("VLOC")=""
S (ABM("CNT"),ABM("SUBCNT"))=0,(ABM("L"),ABM("V"))=""
F S ABMP("VLOC")=$O(^TMP("ABM-SPIN",$J,ABMP("VLOC"))) Q:($G(ABMP("VLOC"))="") D Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT)
.Q:ABMP("VLOC")="VLST" ;other data in same array; don't print it
.Q:ABMP("VLOC")="VSTS" ;other data in array
.D LOC
.I $Y>(IOSL-5) D HD Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT) D LOC W " (cont)"
.S ABMP("VTYP")=""
.F S ABMP("VTYP")=$O(^TMP("ABM-SPIN",$J,ABMP("VLOC"),ABMP("VTYP"))) Q:($G(ABMP("VTYP"))="") D Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT)
..D VTYP
..I $Y>(IOSL-5) D HD Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT) D VTYP W " (cont)"
..S ABMP("SDT")=0
..F S ABMP("SDT")=$O(^TMP("ABM-SPIN",$J,ABMP("VLOC"),ABMP("VTYP"),ABMP("SDT"))) Q:'ABMP("SDT") D Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT)
...S ABMP("CDFN")=0
...F S ABMP("CDFN")=$O(^TMP("ABM-SPIN",$J,ABMP("VLOC"),ABMP("VTYP"),ABMP("SDT"),ABMP("CDFN"))) Q:'ABMP("CDFN") D Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT)
....S ABMPREC=$G(^TMP("ABM-SPIN",$J,ABMP("VLOC"),ABMP("VTYP"),ABMP("SDT"),ABMP("CDFN")))
....W !,$P(ABMPREC,U) ;claim/bill status
....S ABMSSTAT=$P(ABMPREC,U,2)
....W ?4,$S(ABMSSTAT="O":"Orig",ABMSSTAT="S":"Splt",ABMSSTAT="A":"Auto",1:"N/A")
....W ?9,$E($P(ABMPREC,U,3),1,10) ;patient name
....W ?21,$P(ABMPREC,U,4) ;HRN
....W ?28,$E($P(ABMPREC,U,5),1,12) ;active insurer
....W ?41,$P(ABMPREC,U,6)
....W ?53,$$SDTO^ABMDUTL(ABMP("SDT")) ;visit date
....W ?63,$P(ABMPREC,U,8) ;8D
....W ?67,$P(ABMPREC,U,9) ;8E
....W ?71,$P(ABMPREC,U,10) ;8F
....W ?75,$P(ABMPREC,U,11) ;8H
....S ABM("SUBCNT")=+$G(ABM("SUBCNT"))+1
....S ABM("CNT")=+$G(ABM("CNT"))+1
....I $Y>(IOSL-5) D HD Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT) D LOC,VTYP W " (cont)"
..D SUB
W !?44,"======"
W !?35,"Total:",?45,$FN(ABM("CNT"),",",0)
D ^%ZISC
D PAZ^ABMDRUTL
Q
SUMMARY ;
D HDB
S ABMP("VLOC")=""
S (ABM("CNT"),ABM("SUBCNT"))=0,(ABM("L"),ABM("V"))=""
F S ABMP("VLOC")=$O(^TMP("ABM-SPIN",$J,ABMP("VLOC"))) Q:($G(ABMP("VLOC"))="") D
.Q:ABMP("VLOC")="VLST" ;other data in same array; don't print it
.Q:ABMP("VLOC")="VSTS" ;other data in array
.W !?4,ABMP("VLOC")
.I $Y>(IOSL-5) D HD Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT) D LOC W " (cont)"
.S ABMP("VTYP")=""
.F S ABMP("VTYP")=$O(^TMP("ABM-SPIN",$J,ABMP("VLOC"),ABMP("VTYP"))) Q:($G(ABMP("VTYP"))="") D
..W !?40,ABMP("VTYP")
..W ?65,$G(^TMP("ABM-SPIN",$J,ABMP("VLOC"),ABMP("VTYP")))
..S ABM("CNT")=+$G(ABM("CNT"))+$G(^TMP("ABM-SPIN",$J,ABMP("VLOC"),ABMP("VTYP")))
W !?65,"======"
W !?58,"Total:",?65,$FN(ABM("CNT"),",",0)
D ^%ZISC
Q
HD ;
D PAZ^ABMDRUTL Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!$D(DIRUT)
HDB ;
S ABM("PG")=ABM("PG")+1 D WHD^ABMDRHD
I ABMY("RTYP")=1 W !?63," - - PAGE - - ",!,"ST",?4,"O/S",?9,"Patient",?21,"HRN",?28,"Active Insurer",?41,"Claim#",?53,"Visit Dt",?63,"D",?67,"E",?71,"F",?75,"H",!
E W !,"Location",?40,"Visit Type",?65,"# Claims",!
F I=1:1:80 W "-"
Q
LOC ;
W !?3,"Visit Location: ",ABMP("VLOC")
Q
VTYP ;
W !?5,"Visit Type: ",ABMP("VTYP")
Q
SUB ;
Q:'ABM("SUBCNT")
W !?46,"------"
W !?37,"Subtotal:",?50,$FN(ABM("SUBCNT"),",",0)
S ABM("SUBCNT")=0
Q
COMPUTE ;
;search by visit date range
K ^TMP("ABM-SPIN-DATA",$J)
K ^TMP("ABM-SPIN",$J,"VLST") ;this will be a list of counters
I ABMY("DT")="V" D VISIT^ABMRSPI1 Q
;search by approval date range
I ABMY("DT")="A" D APPROVAL^ABMRSPI1
Q
INS ;EP
K ABMY("INS")
W !!,"Insurers selected here MUST be the active insurer in order for claims/bills"
W !,"to display on the report!",!
F D Q:(+Y<0&(X=""))!$D(DUOUT)!$D(DTOUT)!$D(DIROUT)!$D(DIRUT)
.D ^XBFMK
.S DIC="^AUTNINS("
.S DIC(0)="QEAMZ"
.D ^DIC
.Q:$D(DUOUT)!$D(DTOUT)!$D(DIROUT)!$D(DIRUT)
.Q:+Y<0
.;check if the insurer they selected is merged
.I $$GET1^DIQ(9999999.18,+Y,".27","E")'="" D Q:(+Y<1)!$D(DUOUT)!$D(DTOUT)!$D(DIROUT)!$D(DIRUT)
..W !!!,"The insurer you selected has been merged into insurer "_$$GET1^DIQ(9999999.18,+Y,".27","E")
..S ABMITMP=+Y
..D ^XBFMK
..S DIR(0)="Y",DIR("A")="Do you wish to continue" D ^DIR K DIR
..Q:+Y<1
..S Y=ABMITMP
.S ABMY("INS",+Y)=""
.S ABMY("INS")=+$G(ABMY("INS"))+1
Q
DT ;EP
D ^XBFMK
K ABMY("DT")
I $G(ABM("DT"))="C" S Y=4 G DTYP
I $D(ABM("STA")),($G(ABM("STA"))'="M") S Y=2 G DTYP
S DIR(0)="S^1:Approval Date;2:Visit Date"
G DDIR:$G(ABMP("TYP"))=2
I $G(ABM("STA"))="M" G DTYP2
;
DDIR ;
S DIR("A")="Select TYPE of DATE Desired"
D ^DIR
Q:$D(DIROUT)!$D(DIRUT)
I Y=3 S Y=$S(DIR(0)["Pay":5,1:3)
;
DTYP ;
Q:$D(DIRUT)
S ABMY("DT")=$S(Y=1:"A",1:"V")
S Y=$S(Y=1:"APPROVAL",1:"VISIT")_" DATE"
W !!," ============ Entry of ",Y," Range =============",!
S DIR("A")="Enter STARTING "_Y
S DIR(0)="DO^::EP"
D ^DIR
G DT:$D(DIRUT)
S ABMY("DT",1)=Y
W !
S DIR("A")="Enter ENDING DATE"
D ^DIR
K DIR
G DT:$D(DIRUT)
S ABMY("DT",2)=Y
I ABMY("DT",1)>ABMY("DT",2) W !!,*7,"INPUT ERROR: Start Date is Greater than than the End Date, TRY AGAIN!",!! G DT
Q
CLMSTAT ;
D ^XBFMK
I ABMY("DT")="V" D
.S DIR(0)="SO^F:Flagged as Billable;E:In Edit Mode;O:ROLLED-In Edit Mode;P:Pending;C:Completed;U:Uneditable (Billed);X:Closed"
.S DIR("A")="Select TYPE of CLAIM STATUS to Display"
I ABMY("DT")="A" D
.S DIR(0)="SO^A:Approved;B:Billed;C:Completed;X:Cancelled"
.S DIR("A")="Select TYPE of BILL STATUS to Display"
F D Q:$D(DIRUT)!$D(DIROUT)
.D ^DIR
.Q:$D(DIRUT)!$D(DIROUT)
.Q:$G(ABMY("STA"))[Y ;they already selected this status; don't save it again
.S ABMY("STA")=$G(ABMY("STA"))_"^"_Y
.S ABMY("STA","NM")=$G(ABMY("STA","NM"))_$S($G(ABMY("STA","NM"))'="":", ",1:"")_Y(0)
K DIR
Q
PGS ;
S ABMSTRG=""
S DIR(0)="SO^8D:MEDICATIONS;8E:LABORATORY;8F:RADIOLOGY;8H:HCPCS;8Z:ALL"
S DIR("A")="Move Which Section(s)? "
F D Q:(('Y)!(Y["8Z"))
.D ^DIR
.Q:'Y
.Q:$G(ABMY("PGS"))[Y ;quit if they already selected this page
.S ABMY("PGS")=$S($G(ABMY("PGS"))="":"^"_Y,1:ABMY("PGS")_"^"_Y)
S:$G(ABMY("PGS"))'="" ABMY("PGS")=ABMY("PGS")_"^"
Q
RTYP ;EP
K DIR
S DIR(0)="SO^1:BRIEF LISTING (80 Width);2:STATISTICAL SUMMARY ONLY"
S DIR("A")="Select TYPE of LISTING to Display"
S DIR("B")=1
D ^DIR
K DIR
Q:$D(DIRUT)
S ABMY("RTYP")=Y
S ABM("RTYP","NM")=Y(0)
Q
ABMRSPIN ; IHS/SD/SDR - Claims Identified as Potential Split Billing Report;
+1 ;;2.6;IHS 3P BILLING SYSTEM;**22**;NOV 12, 2009;Build 418
+2 ;IHS/SD/SDR 2.6*22 HEAT335246 - New routine
+3 ;
+4 QUIT
START ;
+1 ;Routine used to get data
SET ABMP("RTN")="ABMRSPIN"
+2 SET ABMMENU="Claims ID'd as Potential Split Billing Report"
+3 KILL ^TMP("ABM-SPIN",$JOB),^TMP("ABM-SPIN-DATA",$JOB),^TMP("ABM-SPIN-CNT",$JOB)
SEL ;
+1 KILL ABMY,ABM
+2 KILL DTOUT,DIRUT,DUOUT,DIROUT
+3 IF $DATA(ABMY("RTYP"))
SET ABM("HD",0)=ABMY("RTYP","NM")_" "_ABMMENU
+4 IF '$TEST
SET ABM("HD",0)=ABMMENU
+5 WRITE !!,"This report will look through claims/bills based on the selection criteria"
+6 WRITE !,"chosen and report any claims that match. This report is meant as a tool for the"
+7 WRITE !,"user to identify potential bills that can be split for further billing due to"
+8 WRITE !,"multiple entries in V-files."
+9 WRITE !!,"NOTE: all prompts are required"
+10 WRITE !
+11 ;select insurer(s)
DO INS
+12 ;no insurer was selected
IF '$DATA(ABMY("INS"))
QUIT
+13 IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIROUT)!$DATA(DIRUT)
QUIT
+14 ;select visit or approval date range
DO DT
+15 ;no dates were entered
IF '$DATA(ABMY("DT",1))
QUIT
+16 ;What claim status (Open, complete, or both)
DO CLMSTAT
+17 ;no claim status was selected
IF '$DATA(ABMY("STA"))
QUIT
+18 IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIROUT)
QUIT
+19 ;what pages do you want to split (8D, 8E, 8F, 8H, 8Z)
DO PGS
+20 ;no pages were selected
IF '$DATA(ABMY("PGS"))
QUIT
+21 IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIROUT)
QUIT
+22 ;brief or statistical
DO RTYP
+23 ;no format was selected
IF '$DATA(ABMY("RTYP"))
QUIT
+24 ;
+25 WRITE !!,"You selected: "
+26 WRITE !?3,"Insurers: "
+27 SET ABMI=0
+28 FOR
SET ABMI=$ORDER(ABMY("INS",ABMI))
IF 'ABMI
QUIT
WRITE !?6,$PIECE($GET(^AUTNINS(ABMI,0)),U)
+29 WRITE !?3,$SELECT(ABMY("DT")="V":"Visit",1:"Approval")_" Dates: ",$$SDT^ABMDUTL(ABMY("DT",1))_" to "_$$SDT^ABMDUTL(ABMY("DT",2))
+30 WRITE !?3,"Claim Status: "
+31 FOR ABMI=1:1:$LENGTH(ABMY("STA","NM"),",")
WRITE !?6,$$TRIM^ABMUTLP($PIECE(ABMY("STA","NM"),",",ABMI),"L")
+32 WRITE !?3,"Check pages: "_$EXTRACT($TRANSLATE(ABMY("PGS"),"^",","),2,($LENGTH(ABMY("PGS"))-1))
+33 WRITE !?3,"Report Type: "_$SELECT(ABMY("RTYP")=2:"Statistical Summary Only",1:"Brief Listing"),!!
+34 SET DIR(0)="Y"
SET DIR("A")="Do you wish to continue"
DO ^DIR
KILL DIR
+35 IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIROUT)!$DATA(DIRUT)
QUIT
+36 ;start over if they say NO
IF 'Y
GOTO SEL
+37 ;
+38 SET %ZIS="QM"
+39 DO ^%ZIS
IF POP
QUIT
+40 IF $DATA(IO("Q"))
Begin DoDot:1
+41 SET ZTRTN="PRINT^ABMRSPIN"
SET ZTDESC=XQY0
+42 SET ZTSAVE("ABM*")=""
+43 DO ^%ZTLOAD
+44 IF $DATA(ZTSK)[0
WRITE !!?5,"Report Cancelled!"
+45 IF '$TEST
WRITE !!?5,"Report queued to run on ",ZTSK," #"
+46 DO HOME^%ZIS
+47 KILL IO("Q")
End DoDot:1
QUIT
+48 USE IO
+49 DO COMPUTE
+50 DO PRINT
+51 DO ^%ZISC
+52 DO HOME^%ZIS
+53 QUIT
PRINT ;
+1 SET ABM("HD",1)="with "_$SELECT(ABMY("DT")="V":"Visit",1:"Approval")_" Dates from "_$$SDT^ABMDUTL(ABMY("DT",1))_" to "_$$SDT^ABMDUTL(ABMY("DT",2))
+2 SET ABM("HD",1)=ABM("HD",1)_" AND for page"_$SELECT(($LENGTH(ABMY("PGS"),"^")>3):"s",1:"")_" "_$EXTRACT($TRANSLATE($GET(ABMY("PGS")),"^",","),2,$LENGTH(ABMY("PGS"))-1)
+3 SET ABM("HD",2)="for insurer"_$SELECT((+$GET(ABMY("INS"))>1):"s",1:"")_" "
+4 SET ABMI=0
+5 SET ABMJ=0
+6 FOR
SET ABMI=$ORDER(ABMY("INS",ABMI))
IF 'ABMI
QUIT
SET ABM("HD",2)=ABM("HD",2)_$SELECT(ABMJ=1:", ",1:"")_$PIECE($GET(^AUTNINS(ABMI,0)),U)
SET ABMJ=1
+7 SET ABM("PG")=0
+8 ;
+9 ;summary, not detail
IF ABMY("RTYP")'=1
DO SUMMARY
QUIT
+10 DO HDB
+11 SET ABMP("VLOC")=""
+12 SET (ABM("CNT"),ABM("SUBCNT"))=0
SET (ABM("L"),ABM("V"))=""
+13 FOR
SET ABMP("VLOC")=$ORDER(^TMP("ABM-SPIN",$JOB,ABMP("VLOC")))
IF ($GET(ABMP("VLOC"))="")
QUIT
Begin DoDot:1
+14 ;other data in same array; don't print it
IF ABMP("VLOC")="VLST"
QUIT
+15 ;other data in array
IF ABMP("VLOC")="VSTS"
QUIT
+16 DO LOC
+17 IF $Y>(IOSL-5)
DO HD
IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIROUT)!$DATA(DIRUT)
QUIT
DO LOC
WRITE " (cont)"
+18 SET ABMP("VTYP")=""
+19 FOR
SET ABMP("VTYP")=$ORDER(^TMP("ABM-SPIN",$JOB,ABMP("VLOC"),ABMP("VTYP")))
IF ($GET(ABMP("VTYP"))="")
QUIT
Begin DoDot:2
+20 DO VTYP
+21 IF $Y>(IOSL-5)
DO HD
IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIROUT)!$DATA(DIRUT)
QUIT
DO VTYP
WRITE " (cont)"
+22 SET ABMP("SDT")=0
+23 FOR
SET ABMP("SDT")=$ORDER(^TMP("ABM-SPIN",$JOB,ABMP("VLOC"),ABMP("VTYP"),ABMP("SDT")))
IF 'ABMP("SDT")
QUIT
Begin DoDot:3
+24 SET ABMP("CDFN")=0
+25 FOR
SET ABMP("CDFN")=$ORDER(^TMP("ABM-SPIN",$JOB,ABMP("VLOC"),ABMP("VTYP"),ABMP("SDT"),ABMP("CDFN")))
IF 'ABMP("CDFN")
QUIT
Begin DoDot:4
+26 SET ABMPREC=$GET(^TMP("ABM-SPIN",$JOB,ABMP("VLOC"),ABMP("VTYP"),ABMP("SDT"),ABMP("CDFN")))
+27 ;claim/bill status
WRITE !,$PIECE(ABMPREC,U)
+28 SET ABMSSTAT=$PIECE(ABMPREC,U,2)
+29 WRITE ?4,$SELECT(ABMSSTAT="O":"Orig",ABMSSTAT="S":"Splt",ABMSSTAT="A":"Auto",1:"N/A")
+30 ;patient name
WRITE ?9,$EXTRACT($PIECE(ABMPREC,U,3),1,10)
+31 ;HRN
WRITE ?21,$PIECE(ABMPREC,U,4)
+32 ;active insurer
WRITE ?28,$EXTRACT($PIECE(ABMPREC,U,5),1,12)
+33 WRITE ?41,$PIECE(ABMPREC,U,6)
+34 ;visit date
WRITE ?53,$$SDTO^ABMDUTL(ABMP("SDT"))
+35 ;8D
WRITE ?63,$PIECE(ABMPREC,U,8)
+36 ;8E
WRITE ?67,$PIECE(ABMPREC,U,9)
+37 ;8F
WRITE ?71,$PIECE(ABMPREC,U,10)
+38 ;8H
WRITE ?75,$PIECE(ABMPREC,U,11)
+39 SET ABM("SUBCNT")=+$GET(ABM("SUBCNT"))+1
+40 SET ABM("CNT")=+$GET(ABM("CNT"))+1
+41 IF $Y>(IOSL-5)
DO HD
IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIROUT)!$DATA(DIRUT)
QUIT
DO LOC
DO VTYP
WRITE " (cont)"
End DoDot:4
IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIROUT)!$DATA(DIRUT)
QUIT
End DoDot:3
IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIROUT)!$DATA(DIRUT)
QUIT
+42 DO SUB
End DoDot:2
IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIROUT)!$DATA(DIRUT)
QUIT
End DoDot:1
IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIROUT)!$DATA(DIRUT)
QUIT
+43 WRITE !?44,"======"
+44 WRITE !?35,"Total:",?45,$FNUMBER(ABM("CNT"),",",0)
+45 DO ^%ZISC
+46 DO PAZ^ABMDRUTL
+47 QUIT
SUMMARY ;
+1 DO HDB
+2 SET ABMP("VLOC")=""
+3 SET (ABM("CNT"),ABM("SUBCNT"))=0
SET (ABM("L"),ABM("V"))=""
+4 FOR
SET ABMP("VLOC")=$ORDER(^TMP("ABM-SPIN",$JOB,ABMP("VLOC")))
IF ($GET(ABMP("VLOC"))="")
QUIT
Begin DoDot:1
+5 ;other data in same array; don't print it
IF ABMP("VLOC")="VLST"
QUIT
+6 ;other data in array
IF ABMP("VLOC")="VSTS"
QUIT
+7 WRITE !?4,ABMP("VLOC")
+8 IF $Y>(IOSL-5)
DO HD
IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIROUT)!$DATA(DIRUT)
QUIT
DO LOC
WRITE " (cont)"
+9 SET ABMP("VTYP")=""
+10 FOR
SET ABMP("VTYP")=$ORDER(^TMP("ABM-SPIN",$JOB,ABMP("VLOC"),ABMP("VTYP")))
IF ($GET(ABMP("VTYP"))="")
QUIT
Begin DoDot:2
+11 WRITE !?40,ABMP("VTYP")
+12 WRITE ?65,$GET(^TMP("ABM-SPIN",$JOB,ABMP("VLOC"),ABMP("VTYP")))
+13 SET ABM("CNT")=+$GET(ABM("CNT"))+$GET(^TMP("ABM-SPIN",$JOB,ABMP("VLOC"),ABMP("VTYP")))
End DoDot:2
End DoDot:1
+14 WRITE !?65,"======"
+15 WRITE !?58,"Total:",?65,$FNUMBER(ABM("CNT"),",",0)
+16 DO ^%ZISC
+17 QUIT
HD ;
+1 DO PAZ^ABMDRUTL
IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIROUT)!$DATA(DIRUT)
QUIT
HDB ;
+1 SET ABM("PG")=ABM("PG")+1
DO WHD^ABMDRHD
+2 IF ABMY("RTYP")=1
WRITE !?63," - - PAGE - - ",!,"ST",?4,"O/S",?9,"Patient",?21,"HRN",?28,"Active Insurer",?41,"Claim#",?53,"Visit Dt",?63,"D",?67,"E",?71,"F",?75,"H",!
+3 IF '$TEST
WRITE !,"Location",?40,"Visit Type",?65,"# Claims",!
+4 FOR I=1:1:80
WRITE "-"
+5 QUIT
LOC ;
+1 WRITE !?3,"Visit Location: ",ABMP("VLOC")
+2 QUIT
VTYP ;
+1 WRITE !?5,"Visit Type: ",ABMP("VTYP")
+2 QUIT
SUB ;
+1 IF 'ABM("SUBCNT")
QUIT
+2 WRITE !?46,"------"
+3 WRITE !?37,"Subtotal:",?50,$FNUMBER(ABM("SUBCNT"),",",0)
+4 SET ABM("SUBCNT")=0
+5 QUIT
COMPUTE ;
+1 ;search by visit date range
+2 KILL ^TMP("ABM-SPIN-DATA",$JOB)
+3 ;this will be a list of counters
KILL ^TMP("ABM-SPIN",$JOB,"VLST")
+4 IF ABMY("DT")="V"
DO VISIT^ABMRSPI1
QUIT
+5 ;search by approval date range
+6 IF ABMY("DT")="A"
DO APPROVAL^ABMRSPI1
+7 QUIT
INS ;EP
+1 KILL ABMY("INS")
+2 WRITE !!,"Insurers selected here MUST be the active insurer in order for claims/bills"
+3 WRITE !,"to display on the report!",!
+4 FOR
Begin DoDot:1
+5 DO ^XBFMK
+6 SET DIC="^AUTNINS("
+7 SET DIC(0)="QEAMZ"
+8 DO ^DIC
+9 IF $DATA(DUOUT)!$DATA(DTOUT)!$DATA(DIROUT)!$DATA(DIRUT)
QUIT
+10 IF +Y<0
QUIT
+11 ;check if the insurer they selected is merged
+12 IF $$GET1^DIQ(9999999.18,+Y,".27","E")'=""
Begin DoDot:2
+13 WRITE !!!,"The insurer you selected has been merged into insurer "_$$GET1^DIQ(9999999.18,+Y,".27","E")
+14 SET ABMITMP=+Y
+15 DO ^XBFMK
+16 SET DIR(0)="Y"
SET DIR("A")="Do you wish to continue"
DO ^DIR
KILL DIR
+17 IF +Y<1
QUIT
+18 SET Y=ABMITMP
End DoDot:2
IF (+Y<1)!$DATA(DUOUT)!$DATA(DTOUT)!$DATA(DIROUT)!$DATA(DIRUT)
QUIT
+19 SET ABMY("INS",+Y)=""
+20 SET ABMY("INS")=+$GET(ABMY("INS"))+1
End DoDot:1
IF (+Y<0&(X=""))!$DATA(DUOUT)!$DATA(DTOUT)!$DATA(DIROUT)!$DATA(DIRUT)
QUIT
+21 QUIT
DT ;EP
+1 DO ^XBFMK
+2 KILL ABMY("DT")
+3 IF $GET(ABM("DT"))="C"
SET Y=4
GOTO DTYP
+4 IF $DATA(ABM("STA"))
IF ($GET(ABM("STA"))'="M")
SET Y=2
GOTO DTYP
+5 SET DIR(0)="S^1:Approval Date;2:Visit Date"
+6 IF $GET(ABMP("TYP"))=2
GOTO DDIR
+7 IF $GET(ABM("STA"))="M"
GOTO DTYP2
+8 ;
DDIR ;
+1 SET DIR("A")="Select TYPE of DATE Desired"
+2 DO ^DIR
+3 IF $DATA(DIROUT)!$DATA(DIRUT)
QUIT
+4 IF Y=3
SET Y=$SELECT(DIR(0)["Pay":5,1:3)
+5 ;
DTYP ;
+1 IF $DATA(DIRUT)
QUIT
+2 SET ABMY("DT")=$SELECT(Y=1:"A",1:"V")
+3 SET Y=$SELECT(Y=1:"APPROVAL",1:"VISIT")_" DATE"
+4 WRITE !!," ============ Entry of ",Y," Range =============",!
+5 SET DIR("A")="Enter STARTING "_Y
+6 SET DIR(0)="DO^::EP"
+7 DO ^DIR
+8 IF $DATA(DIRUT)
GOTO DT
+9 SET ABMY("DT",1)=Y
+10 WRITE !
+11 SET DIR("A")="Enter ENDING DATE"
+12 DO ^DIR
+13 KILL DIR
+14 IF $DATA(DIRUT)
GOTO DT
+15 SET ABMY("DT",2)=Y
+16 IF ABMY("DT",1)>ABMY("DT",2)
WRITE !!,*7,"INPUT ERROR: Start Date is Greater than than the End Date, TRY AGAIN!",!!
GOTO DT
+17 QUIT
CLMSTAT ;
+1 DO ^XBFMK
+2 IF ABMY("DT")="V"
Begin DoDot:1
+3 SET DIR(0)="SO^F:Flagged as Billable;E:In Edit Mode;O:ROLLED-In Edit Mode;P:Pending;C:Completed;U:Uneditable (Billed);X:Closed"
+4 SET DIR("A")="Select TYPE of CLAIM STATUS to Display"
End DoDot:1
+5 IF ABMY("DT")="A"
Begin DoDot:1
+6 SET DIR(0)="SO^A:Approved;B:Billed;C:Completed;X:Cancelled"
+7 SET DIR("A")="Select TYPE of BILL STATUS to Display"
End DoDot:1
+8 FOR
Begin DoDot:1
+9 DO ^DIR
+10 IF $DATA(DIRUT)!$DATA(DIROUT)
QUIT
+11 ;they already selected this status; don't save it again
IF $GET(ABMY("STA"))[Y
QUIT
+12 SET ABMY("STA")=$GET(ABMY("STA"))_"^"_Y
+13 SET ABMY("STA","NM")=$GET(ABMY("STA","NM"))_$SELECT($GET(ABMY("STA","NM"))'="":", ",1:"")_Y(0)
End DoDot:1
IF $DATA(DIRUT)!$DATA(DIROUT)
QUIT
+14 KILL DIR
+15 QUIT
PGS ;
+1 SET ABMSTRG=""
+2 SET DIR(0)="SO^8D:MEDICATIONS;8E:LABORATORY;8F:RADIOLOGY;8H:HCPCS;8Z:ALL"
+3 SET DIR("A")="Move Which Section(s)? "
+4 FOR
Begin DoDot:1
+5 DO ^DIR
+6 IF 'Y
QUIT
+7 ;quit if they already selected this page
IF $GET(ABMY("PGS"))[Y
QUIT
+8 SET ABMY("PGS")=$SELECT($GET(ABMY("PGS"))="":"^"_Y,1:ABMY("PGS")_"^"_Y)
End DoDot:1
IF (('Y)!(Y["8Z"))
QUIT
+9 IF $GET(ABMY("PGS"))'=""
SET ABMY("PGS")=ABMY("PGS")_"^"
+10 QUIT
RTYP ;EP
+1 KILL DIR
+2 SET DIR(0)="SO^1:BRIEF LISTING (80 Width);2:STATISTICAL SUMMARY ONLY"
+3 SET DIR("A")="Select TYPE of LISTING to Display"
+4 SET DIR("B")=1
+5 DO ^DIR
+6 KILL DIR
+7 IF $DATA(DIRUT)
QUIT
+8 SET ABMY("RTYP")=Y
+9 SET ABM("RTYP","NM")=Y(0)
+10 QUIT