ABMRSTIN ; IHS/SD/SDR - Split Claim Billing;
;;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")="ABMRSTIN" ;Routine used to get data
S ABMMENU="Split Claim Billing Report"
K ^TMP("ABM-SPIN",$J) ;this is from routine ABMRSPIN to gather data before splitting
K ^TMP("ABM-SPIN-DATA",$J) ;detail from ABMRSPIN
K ^TMP("ABM-SPIN-CNT",$J)
K ^TMP("ABM-STIN",$J)
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 menu option is going to take one claim and split it as many times as"
W !,"necessary to get either 1) one claim with one claim editor page of line items"
W !,"OR 2) one claim with 1 line item charge. The user will be prompted if they"
W !,"want the system to automatically find the claims, or if they would rather do"
W !,"it manually, one claim at a time. Either way, the user will get messages"
W !,"to the screen telling them the new claim numbers that generated based on"
W !,"their selection."
W !!,"This option should be used VERY CAUTIOUSLY since it could generate a LOT of"
W !,"claims based on how the prompts are answered."
;
MANORAUT ;
D ^XBFMK
S DIR(0)="SO^A:Automatically find and split claims;M:Manually select claims one at a time to split"
S DIR("A")="Select"
D ^DIR
Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
S ABMY("SPLIT")=Y
I ABMY("SPLIT")="M" D MANUAL Q ;prompt user to split one claim one at a time
I ABMY("SPLIT")="A" D AUTO Q ;split multiple claims/bills based on selection criteria
Q
MANUAL ;EP
K ABMP
MANUAL2 ;EP
D ^ABMDEDIC ;prompt for bill/claim number
Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
S ABMY("PGS")="^8Z^" ;make it capture everything
S ABMVSTCK=0 ;flag for if visit contains H or I visit
D DATA2^ABMRSPI1 ;get list of files
W !!
W !,"ST",?4,"SelectedClm#",?17,"HRN",?24,"Active Insurer",?40,"Visit Date",?51,"VTYP",?56,"Clinic",?65,"ServCat (VST)",!
F I=1:1:80 W "-"
S ABMCS=$P($G(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,4)
W !,$S(ABMCS="F":"FAB",ABMCS="E":"EDT",ABMCS="O":"ROL",ABMCS="C":"COM",ABMCS="P":"PEN",ABMCS="U":"UNB",ABMCS="X":"CLO",1:"")
W ?4,ABMP("CDFN")
W ?17,$P($G(^AUPNPAT($P($G(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U),41,$P($G(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,3),0)),U,2) ;HRN
W ?24,$E($P($G(^AUTNINS($P($G(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,8),0)),U),1,15) ;active insurer
W ?40,$$SDTO^ABMDUTL($P($G(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,2)) ;visit date
W ?51,$P($G(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,7) ;visit type
W ?56,$E($P($G(^DIC(40.7,$P($G(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,6),0)),U),1,8) ;clinic
S ABMV=0
F S ABMV=$O(^TMP("ABM-SPIN",$J,"VSTS",ABMV)) Q:'ABMV W ?65,$G(^TMP("ABM-SPIN",$J,"VSTS",ABMV))_" ("_ABMV_")",!
D VSTDISP^ABMRSTI1 ;display visit info
;
K ABMCK
I $P($G(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,22)'="" D SPLTCHK^ABMRSTI1 ;check if any portion of claim has already been split
I $D(ABMCK) D CLMDISP^ABMRSTI1 ;if there are orig/split claims, display them
;
I +$G(ABMVSTCK)=1 D G MANUAL2
.W !!?5,"At least one visit on this claim has a Service Category of"
.W !?5,"Hospitalization (H) or In Hospital (I) and is therefore unsplittable",!!
.H 2
;
;ask if they wish to continue since claim has already been split at least once
I $D(ABMCK) D G:Y<1 MANUAL
.D ^XBFMK
.S DIR(0)="Y",DIR("A")="This claim has already been split at least once. Do you wish to continue" D ^DIR K DIR
K ABMY("PGS") ;reset because it was set to 8Z to pull everything for display first
D PGS ;have user select pages; will be in ABMY("PGS") variable
I +$D(ABMY("PGS"))=0 Q ;don't ask anything more if they didn't pick pages
D SPLITHOW ;do they want one claim per charge or one claim per category picked?
I +$G(ABMY("SPLITHOW"))=0 Q
D ASKDEL ;ask if they want to delete sections after new claims are generated
;I +$G(ABMDLT)=0 Q
Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
K ^TMP("ABM-STIN",$J,"NEWCLMLST")
D INSSTMP^ABMRSTI4 ;abm*2.6*22 IHS/SD/SDR CR9700
D SPLITCLM^ABMRSTI2 ;creates the new claims and deletes from original
S ABMCDFN=ABMP("CDFN")
W $$EN^ABMVDF("IOF"),!
W "Split complete.",!
D PRINT2^ABMRSTI3 ;print claim summary with split info
D PAZ^ABMDRUTL
D ^XBFMK
K ^TMP("ABM-SPIN",$J) ;this is from routine ABMRSPIN to gather data before splitting
K ^TMP("ABM-SPIN-DATA",$J) ;detail from ABMRSPIN
K ^TMP("ABM-SPIN-CNT",$J)
K ^TMP("ABM-STIN",$J)
K ABMY,ABM
G MANUAL2
Q
PGS ;
S ABMSTRG=""
S ABMPG=""
S ABMPCNT=0
S DIR(0)="SO^"
F S ABMPG=$O(^TMP("ABM-SPIN",$J,"VLST",ABMP("CDFN"),ABMPG)) Q:$G(ABMPG)="" D
.S DIR(0)=DIR(0)_ABMPG_":"_$S(ABMPG["D":"MEDICATIONS",ABMPG["E":"LABORATORY",ABMPG["F":"RADIOLOGY",1:"HCPCS")_";"
.S ABMPCNT=+$G(ABMPCNT)+1 ;total pages to choose from
S:$L(DIR(0),":")>2 DIR(0)=DIR(0)_"8Z:ALL"
S DIR("A")="Move Which Section(s)? "
S ABMTPCNT=0
F D Q:(('Y)!(Y["8Z"))!(ABMTPCNT=ABMPCNT)
.D ^DIR
.Q:'Y
.S ABMY("PGS")=$S($G(ABMY("PGS"))="":"^"_Y,1:ABMY("PGS")_"^"_Y)
.S ABMTPCNT=+$G(ABMTPCNT)+1
I $G(ABMY("PGS"))["8Z" D
.K ABMY("PGS")
.S ABMPG=""
.F S ABMPG=$O(^TMP("ABM-SPIN",$J,"VLST",ABMP("CDFN"),ABMPG)) Q:$G(ABMPG)="" D
..S ABMY("PGS")=$G(ABMY("PGS"))_"^"_ABMPG
S:$G(ABMY("PGS"))'="" ABMY("PGS")=ABMY("PGS")_"^"
Q
SPLITHOW ;EP
D ^XBFMK
S DIR(0)="SO^C:1 Claim for each CHARGE;P:1 Claim for each PAGE"
S DIR("A")="Split it how? "
D ^DIR
I $G(Y)=""!$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT) Q ;exit option if they '^'
S ABMY("SPLITHOW")=$S(Y="C":1,1:2)
Q
ASKDEL ;EP
I ABMY("PGS")'["8Z" D Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
.S DIR(0)="Y",DIR("A")="Delete sections from original claim after split"
.S DIR("B")="NO"
.D ^DIR K DIR
.Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
.S:Y=1 ABMDLT=1
Q
AUTO ;
S ABMY("RTYP")=1
D INS^ABMRSPIN ;select insurer(s)
I '$D(ABMY("INS")) Q ;no insurer was selected
Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
D DT^ABMRSPIN ;select visit or approval date range
I '$D(ABMY("DT",1)) Q ;no dates were entered
Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
D CLMSTAT^ABMRSPIN ;What claim status (Open, complete, or both)
I '$D(ABMY("STA")) Q ;no claim status was selected
Q:$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
D PGS^ABMRSPIN ;what pages do you want to split (8D, 8E, 8F, 8H, 8Z)
I '$D(ABMY("PGS")) Q ;no pages were selected
Q:$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
I ABMY("PGS")["8Z" S ABMY("PGS")="^8D^8E^8F^8H^"
;
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(DUOUT)!$D(DTOUT)!$D(DIROUT)!$D(DIRUT)
;
I Y S ABMANS="A" ;they user said they want to continue, act like 'A'
I 'Y D
.K DIR,DIC,DIE,X,Y,DA,DR
.S DIR(0)="S^E:Exit Report;R:Reselect Parameters;A:Accept selection and continue"
.D ^DIR
S ABMANS=Y
K DIR
I ABMANS="E" Q ;exit report
I ABMANS="R" G AUTO ;reselect criteria
;note - ABMANS="A" should just continue on through code
;
W !!,"Now searching for claims that meet the selected criteria . . ."
K ^TMP("ABM-SPIN",$J,"VLST") ;this will be a list of counters
D COMPUTE^ABMRSPIN
D SPLIT
D ^XBFMK
K ^TMP("ABM-SPIN",$J) ;this is from routine ABMRSPIN to gather data before splitting
K ^TMP("ABM-SPIN-DATA",$J) ;detail from ABMRSPIN
K ^TMP("ABM-SPIN-CNT",$J)
K ^TMP("ABM-STIN",$J)
K ABMY,ABM
Q
SPLIT ;EP
W !!,"OK, "_+$G(^TMP("ABM-SPIN-CNT",$J))_" claims were found to split."
W !!
I +$G(^TMP("ABM-SPIN-CNT",$J))=0 W "Exiting option since no claims were found matching selected criteria." D PAZ^ABMDRUTL Q
D ^XBFMK
S DIR(0)="Y",DIR("A")="Do you wish to continue" D ^DIR K DIR
Q:+Y<1
Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
D SPLITHOW ;do they want one claim per charge or one claim per category picked?
Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
D ASKDEL ;ask if they want to delete sections after new claims are generated
Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
D INSSTMP^ABMRSTI4 ;stamp insurer with run info ;abm*2.6*22 IHS/SD/SDR CR9700
W !!,"Splitting claims..."
;loop thru claims and split them
K ^TMP("ABM-STIN",$J,"NEWCLMLST")
S ABMVLOC=""
F S ABMVLOC=$O(^TMP("ABM-SPIN",$J,ABMVLOC)) Q:$G(ABMVLOC)="" D
.S ABMVTYP=""
.F S ABMVTYP=$O(^TMP("ABM-SPIN",$J,ABMVLOC,ABMVTYP)) Q:$G(ABMVTYP)="" D
..S ABMVDT=0
..F S ABMVDT=$O(^TMP("ABM-SPIN",$J,ABMVLOC,ABMVTYP,ABMVDT)) Q:'ABMVDT D
...S ABMP("CDFN")=0
...F S ABMP("CDFN")=$O(^TMP("ABM-SPIN",$J,ABMVLOC,ABMVTYP,ABMVDT,ABMP("CDFN"))) Q:'ABMP("CDFN") D
....K ABMP("VDETAIL")
....D SPLITCLM^ABMRSTI2
D PRINT ;output report of original and split claims
Q
PRINT ;EP
S DIR(0)="Y"
S DIR("A","1")="Would you like a listing of the original claims and the new"
S DIR("A")="associated claim numbers"
D ^DIR K DIR
Q:Y<1
S %ZIS="QM"
D ^%ZIS Q:POP
I $D(IO("Q")) D Q
.S ZTRTN="PRINT^ABMRSTI3",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")
D PRINT^ABMRSTI3
D PAZ^ABMDRUTL
Q
ABMRSTIN ; IHS/SD/SDR - Split Claim Billing;
+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")="ABMRSTIN"
+2 SET ABMMENU="Split Claim Billing Report"
+3 ;this is from routine ABMRSPIN to gather data before splitting
KILL ^TMP("ABM-SPIN",$JOB)
+4 ;detail from ABMRSPIN
KILL ^TMP("ABM-SPIN-DATA",$JOB)
+5 KILL ^TMP("ABM-SPIN-CNT",$JOB)
+6 KILL ^TMP("ABM-STIN",$JOB)
+7 KILL ABMY,ABM
+8 KILL DTOUT,DIRUT,DUOUT,DIROUT
+9 IF $DATA(ABMY("RTYP"))
SET ABM("HD",0)=ABMY("RTYP","NM")_" "_ABMMENU
+10 IF '$TEST
SET ABM("HD",0)=ABMMENU
+11 WRITE !!,"This menu option is going to take one claim and split it as many times as"
+12 WRITE !,"necessary to get either 1) one claim with one claim editor page of line items"
+13 WRITE !,"OR 2) one claim with 1 line item charge. The user will be prompted if they"
+14 WRITE !,"want the system to automatically find the claims, or if they would rather do"
+15 WRITE !,"it manually, one claim at a time. Either way, the user will get messages"
+16 WRITE !,"to the screen telling them the new claim numbers that generated based on"
+17 WRITE !,"their selection."
+18 WRITE !!,"This option should be used VERY CAUTIOUSLY since it could generate a LOT of"
+19 WRITE !,"claims based on how the prompts are answered."
+20 ;
MANORAUT ;
+1 DO ^XBFMK
+2 SET DIR(0)="SO^A:Automatically find and split claims;M:Manually select claims one at a time to split"
+3 SET DIR("A")="Select"
+4 DO ^DIR
+5 IF $DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)
QUIT
+6 SET ABMY("SPLIT")=Y
+7 ;prompt user to split one claim one at a time
IF ABMY("SPLIT")="M"
DO MANUAL
QUIT
+8 ;split multiple claims/bills based on selection criteria
IF ABMY("SPLIT")="A"
DO AUTO
QUIT
+9 QUIT
MANUAL ;EP
+1 KILL ABMP
MANUAL2 ;EP
+1 ;prompt for bill/claim number
DO ^ABMDEDIC
+2 IF $DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)
QUIT
+3 ;make it capture everything
SET ABMY("PGS")="^8Z^"
+4 ;flag for if visit contains H or I visit
SET ABMVSTCK=0
+5 ;get list of files
DO DATA2^ABMRSPI1
+6 WRITE !!
+7 WRITE !,"ST",?4,"SelectedClm#",?17,"HRN",?24,"Active Insurer",?40,"Visit Date",?51,"VTYP",?56,"Clinic",?65,"ServCat (VST)",!
+8 FOR I=1:1:80
WRITE "-"
+9 SET ABMCS=$PIECE($GET(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,4)
+10 WRITE !,$SELECT(ABMCS="F":"FAB",ABMCS="E":"EDT",ABMCS="O":"ROL",ABMCS="C":"COM",ABMCS="P":"PEN",ABMCS="U":"UNB",ABMCS="X":"CLO",1:"")
+11 WRITE ?4,ABMP("CDFN")
+12 ;HRN
WRITE ?17,$PIECE($GET(^AUPNPAT($PIECE($GET(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U),41,$PIECE($GET(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,3),0)),U,2)
+13 ;active insurer
WRITE ?24,$EXTRACT($PIECE($GET(^AUTNINS($PIECE($GET(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,8),0)),U),1,15)
+14 ;visit date
WRITE ?40,$$SDTO^ABMDUTL($PIECE($GET(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,2))
+15 ;visit type
WRITE ?51,$PIECE($GET(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,7)
+16 ;clinic
WRITE ?56,$EXTRACT($PIECE($GET(^DIC(40.7,$PIECE($GET(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,6),0)),U),1,8)
+17 SET ABMV=0
+18 FOR
SET ABMV=$ORDER(^TMP("ABM-SPIN",$JOB,"VSTS",ABMV))
IF 'ABMV
QUIT
WRITE ?65,$GET(^TMP("ABM-SPIN",$JOB,"VSTS",ABMV))_" ("_ABMV_")",!
+19 ;display visit info
DO VSTDISP^ABMRSTI1
+20 ;
+21 KILL ABMCK
+22 ;check if any portion of claim has already been split
IF $PIECE($GET(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,22)'=""
DO SPLTCHK^ABMRSTI1
+23 ;if there are orig/split claims, display them
IF $DATA(ABMCK)
DO CLMDISP^ABMRSTI1
+24 ;
+25 IF +$GET(ABMVSTCK)=1
Begin DoDot:1
+26 WRITE !!?5,"At least one visit on this claim has a Service Category of"
+27 WRITE !?5,"Hospitalization (H) or In Hospital (I) and is therefore unsplittable",!!
+28 HANG 2
End DoDot:1
GOTO MANUAL2
+29 ;
+30 ;ask if they wish to continue since claim has already been split at least once
+31 IF $DATA(ABMCK)
Begin DoDot:1
+32 DO ^XBFMK
+33 SET DIR(0)="Y"
SET DIR("A")="This claim has already been split at least once. Do you wish to continue"
DO ^DIR
KILL DIR
End DoDot:1
IF Y<1
GOTO MANUAL
+34 ;reset because it was set to 8Z to pull everything for display first
KILL ABMY("PGS")
+35 ;have user select pages; will be in ABMY("PGS") variable
DO PGS
+36 ;don't ask anything more if they didn't pick pages
IF +$DATA(ABMY("PGS"))=0
QUIT
+37 ;do they want one claim per charge or one claim per category picked?
DO SPLITHOW
+38 IF +$GET(ABMY("SPLITHOW"))=0
QUIT
+39 ;ask if they want to delete sections after new claims are generated
DO ASKDEL
+40 ;I +$G(ABMDLT)=0 Q
+41 IF $DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)
QUIT
+42 KILL ^TMP("ABM-STIN",$JOB,"NEWCLMLST")
+43 ;abm*2.6*22 IHS/SD/SDR CR9700
DO INSSTMP^ABMRSTI4
+44 ;creates the new claims and deletes from original
DO SPLITCLM^ABMRSTI2
+45 SET ABMCDFN=ABMP("CDFN")
+46 WRITE $$EN^ABMVDF("IOF"),!
+47 WRITE "Split complete.",!
+48 ;print claim summary with split info
DO PRINT2^ABMRSTI3
+49 DO PAZ^ABMDRUTL
+50 DO ^XBFMK
+51 ;this is from routine ABMRSPIN to gather data before splitting
KILL ^TMP("ABM-SPIN",$JOB)
+52 ;detail from ABMRSPIN
KILL ^TMP("ABM-SPIN-DATA",$JOB)
+53 KILL ^TMP("ABM-SPIN-CNT",$JOB)
+54 KILL ^TMP("ABM-STIN",$JOB)
+55 KILL ABMY,ABM
+56 GOTO MANUAL2
+57 QUIT
PGS ;
+1 SET ABMSTRG=""
+2 SET ABMPG=""
+3 SET ABMPCNT=0
+4 SET DIR(0)="SO^"
+5 FOR
SET ABMPG=$ORDER(^TMP("ABM-SPIN",$JOB,"VLST",ABMP("CDFN"),ABMPG))
IF $GET(ABMPG)=""
QUIT
Begin DoDot:1
+6 SET DIR(0)=DIR(0)_ABMPG_":"_$SELECT(ABMPG["D":"MEDICATIONS",ABMPG["E":"LABORATORY",ABMPG["F":"RADIOLOGY",1:"HCPCS")_";"
+7 ;total pages to choose from
SET ABMPCNT=+$GET(ABMPCNT)+1
End DoDot:1
+8 IF $LENGTH(DIR(0),"
SET DIR(0)=DIR(0)_"8Z:ALL"
+9 SET DIR("A")="Move Which Section(s)? "
+10 SET ABMTPCNT=0
+11 FOR
Begin DoDot:1
+12 DO ^DIR
+13 IF 'Y
QUIT
+14 SET ABMY("PGS")=$SELECT($GET(ABMY("PGS"))="":"^"_Y,1:ABMY("PGS")_"^"_Y)
+15 SET ABMTPCNT=+$GET(ABMTPCNT)+1
End DoDot:1
IF (('Y)!(Y["8Z"))!(ABMTPCNT=ABMPCNT)
QUIT
+16 IF $GET(ABMY("PGS"))["8Z"
Begin DoDot:1
+17 KILL ABMY("PGS")
+18 SET ABMPG=""
+19 FOR
SET ABMPG=$ORDER(^TMP("ABM-SPIN",$JOB,"VLST",ABMP("CDFN"),ABMPG))
IF $GET(ABMPG)=""
QUIT
Begin DoDot:2
+20 SET ABMY("PGS")=$GET(ABMY("PGS"))_"^"_ABMPG
End DoDot:2
End DoDot:1
+21 IF $GET(ABMY("PGS"))'=""
SET ABMY("PGS")=ABMY("PGS")_"^"
+22 QUIT
SPLITHOW ;EP
+1 DO ^XBFMK
+2 SET DIR(0)="SO^C:1 Claim for each CHARGE;P:1 Claim for each PAGE"
+3 SET DIR("A")="Split it how? "
+4 DO ^DIR
+5 ;exit option if they '^'
IF $GET(Y)=""!$DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)
QUIT
+6 SET ABMY("SPLITHOW")=$SELECT(Y="C":1,1:2)
+7 QUIT
ASKDEL ;EP
+1 IF ABMY("PGS")'["8Z"
Begin DoDot:1
+2 SET DIR(0)="Y"
SET DIR("A")="Delete sections from original claim after split"
+3 SET DIR("B")="NO"
+4 DO ^DIR
KILL DIR
+5 IF $DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)
QUIT
+6 IF Y=1
SET ABMDLT=1
End DoDot:1
IF $DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)
QUIT
+7 QUIT
AUTO ;
+1 SET ABMY("RTYP")=1
+2 ;select insurer(s)
DO INS^ABMRSPIN
+3 ;no insurer was selected
IF '$DATA(ABMY("INS"))
QUIT
+4 IF $DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)
QUIT
+5 ;select visit or approval date range
DO DT^ABMRSPIN
+6 ;no dates were entered
IF '$DATA(ABMY("DT",1))
QUIT
+7 IF $DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)
QUIT
+8 ;What claim status (Open, complete, or both)
DO CLMSTAT^ABMRSPIN
+9 ;no claim status was selected
IF '$DATA(ABMY("STA"))
QUIT
+10 IF $DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)
QUIT
+11 ;what pages do you want to split (8D, 8E, 8F, 8H, 8Z)
DO PGS^ABMRSPIN
+12 ;no pages were selected
IF '$DATA(ABMY("PGS"))
QUIT
+13 IF $DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)
QUIT
+14 IF ABMY("PGS")["8Z"
SET ABMY("PGS")="^8D^8E^8F^8H^"
+15 ;
+16 WRITE !!,"You selected: "
+17 WRITE !?3,"Insurers: "
+18 SET ABMI=0
+19 FOR
SET ABMI=$ORDER(ABMY("INS",ABMI))
IF 'ABMI
QUIT
WRITE !?6,$PIECE($GET(^AUTNINS(ABMI,0)),U)
+20 WRITE !?3,$SELECT(ABMY("DT")="V":"Visit",1:"Approval")_" Dates: ",$$SDT^ABMDUTL(ABMY("DT",1))_" to "_$$SDT^ABMDUTL(ABMY("DT",2))
+21 WRITE !?3,"Claim Status: "
+22 FOR ABMI=1:1:$LENGTH(ABMY("STA","NM"),",")
WRITE !?6,$$TRIM^ABMUTLP($PIECE(ABMY("STA","NM"),",",ABMI),"L")
+23 WRITE !?3,"Check pages: "_$EXTRACT($TRANSLATE(ABMY("PGS"),"^",","),2,($LENGTH(ABMY("PGS"))-1))
+24 WRITE !?3,"Report Type: "_$SELECT(ABMY("RTYP")=2:"Statistical Summary Only",1:"Brief Listing"),!!
+25 SET DIR(0)="Y"
SET DIR("A")="Do you wish to continue"
DO ^DIR
KILL DIR
+26 IF $DATA(DUOUT)!$DATA(DTOUT)!$DATA(DIROUT)!$DATA(DIRUT)
QUIT
+27 ;
+28 ;they user said they want to continue, act like 'A'
IF Y
SET ABMANS="A"
+29 IF 'Y
Begin DoDot:1
+30 KILL DIR,DIC,DIE,X,Y,DA,DR
+31 SET DIR(0)="S^E:Exit Report;R:Reselect Parameters;A:Accept selection and continue"
+32 DO ^DIR
End DoDot:1
+33 SET ABMANS=Y
+34 KILL DIR
+35 ;exit report
IF ABMANS="E"
QUIT
+36 ;reselect criteria
IF ABMANS="R"
GOTO AUTO
+37 ;note - ABMANS="A" should just continue on through code
+38 ;
+39 WRITE !!,"Now searching for claims that meet the selected criteria . . ."
+40 ;this will be a list of counters
KILL ^TMP("ABM-SPIN",$JOB,"VLST")
+41 DO COMPUTE^ABMRSPIN
+42 DO SPLIT
+43 DO ^XBFMK
+44 ;this is from routine ABMRSPIN to gather data before splitting
KILL ^TMP("ABM-SPIN",$JOB)
+45 ;detail from ABMRSPIN
KILL ^TMP("ABM-SPIN-DATA",$JOB)
+46 KILL ^TMP("ABM-SPIN-CNT",$JOB)
+47 KILL ^TMP("ABM-STIN",$JOB)
+48 KILL ABMY,ABM
+49 QUIT
SPLIT ;EP
+1 WRITE !!,"OK, "_+$GET(^TMP("ABM-SPIN-CNT",$JOB))_" claims were found to split."
+2 WRITE !!
+3 IF +$GET(^TMP("ABM-SPIN-CNT",$JOB))=0
WRITE "Exiting option since no claims were found matching selected criteria."
DO PAZ^ABMDRUTL
QUIT
+4 DO ^XBFMK
+5 SET DIR(0)="Y"
SET DIR("A")="Do you wish to continue"
DO ^DIR
KILL DIR
+6 IF +Y<1
QUIT
+7 IF $DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)
QUIT
+8 ;do they want one claim per charge or one claim per category picked?
DO SPLITHOW
+9 IF $DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)
QUIT
+10 ;ask if they want to delete sections after new claims are generated
DO ASKDEL
+11 IF $DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)
QUIT
+12 ;stamp insurer with run info ;abm*2.6*22 IHS/SD/SDR CR9700
DO INSSTMP^ABMRSTI4
+13 WRITE !!,"Splitting claims..."
+14 ;loop thru claims and split them
+15 KILL ^TMP("ABM-STIN",$JOB,"NEWCLMLST")
+16 SET ABMVLOC=""
+17 FOR
SET ABMVLOC=$ORDER(^TMP("ABM-SPIN",$JOB,ABMVLOC))
IF $GET(ABMVLOC)=""
QUIT
Begin DoDot:1
+18 SET ABMVTYP=""
+19 FOR
SET ABMVTYP=$ORDER(^TMP("ABM-SPIN",$JOB,ABMVLOC,ABMVTYP))
IF $GET(ABMVTYP)=""
QUIT
Begin DoDot:2
+20 SET ABMVDT=0
+21 FOR
SET ABMVDT=$ORDER(^TMP("ABM-SPIN",$JOB,ABMVLOC,ABMVTYP,ABMVDT))
IF 'ABMVDT
QUIT
Begin DoDot:3
+22 SET ABMP("CDFN")=0
+23 FOR
SET ABMP("CDFN")=$ORDER(^TMP("ABM-SPIN",$JOB,ABMVLOC,ABMVTYP,ABMVDT,ABMP("CDFN")))
IF 'ABMP("CDFN")
QUIT
Begin DoDot:4
+24 KILL ABMP("VDETAIL")
+25 DO SPLITCLM^ABMRSTI2
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+26 ;output report of original and split claims
DO PRINT
+27 QUIT
PRINT ;EP
+1 SET DIR(0)="Y"
+2 SET DIR("A","1")="Would you like a listing of the original claims and the new"
+3 SET DIR("A")="associated claim numbers"
+4 DO ^DIR
KILL DIR
+5 IF Y<1
QUIT
+6 SET %ZIS="QM"
+7 DO ^%ZIS
IF POP
QUIT
+8 IF $DATA(IO("Q"))
Begin DoDot:1
+9 SET ZTRTN="PRINT^ABMRSTI3"
SET ZTDESC=XQY0
+10 SET ZTSAVE("ABM*")=""
+11 DO ^%ZTLOAD
+12 IF $DATA(ZTSK)[0
WRITE !!?5,"Report Cancelled!"
+13 IF '$TEST
WRITE !!?5,"Report queued to run on ",ZTSK," #"
+14 DO HOME^%ZIS
+15 KILL IO("Q")
End DoDot:1
QUIT
+16 DO PRINT^ABMRSTI3
+17 DO PAZ^ABMDRUTL
+18 QUIT