ABMTALLY ; IHS/SD/SDR - Monthly tally report - 8/19/2005 1:28:34 PM
;;2.6;IHS Third Party Billing;**1**;NOV 12, 2009
;
; IHS/SD/SDR - v2.5 p10 - IM18370
; New report
; IHS/SD/SDR - abm*2.6*1 - HEAT3073 - fix <SUBSCR>COMPUTE+45^ABMTALLY
;
;Report to count:
; Number of visits (total; with and without TPB coverage)
; Number of claims (total; divided by claim status)
; Number of bills (total; divided by billed amount and outstanding)
; User will be prompted for (this will also be the sort order):
; Visit Location(s)
; Clinic Type(s)
; Date range
;OPTION: ABMD RP TALLY^VISIT/CLAIM/BILL TALLY REPORT
K ABM,ABMY
S ABM("RTYP")=1
S ABM("RTYP","NM")="TALLY LISTING"
;
SEL D LOOP Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)
S ABM("HD",0)="LISTING of TALLIED files "
S ABM("LVL")=0
D QUE
Q
;
QUE ;
S ZTRTN="COMPUTE^ABMTALLY"
S ZTDESC="TALLED REPORT OF PCC/TPB/AR"
S ZTSAVE("ABM*")=""
K ZTSK
;S ABMFILE=$P($G(^DIC(4,DUZ(2),0)),U)_DT_".txt" ;abm*2.6*1 HEAT3073
S ABMFILE=$TR($P($G(^DIC(4,DUZ(2),0)),U)_DT_".txt"," ","_") ;abm*2.6*1 HEAT3073
S ABMPATH=$P($G(^ABMDPARM(DUZ(2),1,4)),U,7)
S %ZIS("HFSNAME")=ABMPATH_ABMFILE
S %ZIS("HFSMODE")="W"
S %ZIS("B")="HFS"
S %ZIS="QN"
D ^%ZIS
Q:POP
S ZTIO="" ;force taskman NOT to use IO from here. TM gets confused and sends output to tmp.hfs
;file is transferred via ABMPATH and ABMFILE
D ^%ZTLOAD
I $G(ZTSK) D
.W !,"Task # ",ZTSK," queued."
.W !,"File to be created:"_ABMPATH_ABMFILE
.D ^%ZISC
D HOME^%ZIS
K DIR
S DIR(0)="E"
D ^DIR
Q
;
LOOP ;
; Display current exclusion parameters
S ABMY("X")="W $$SDT^ABMDUTL(X)"
G XIT:$D(DUOUT)!$D(DTOUT)!$D(DIROUT)
W !!?3,"EXCLUSION PARAMETERS Currently in Effect for RESTRICTING the EXPORT to:",!?3,"======================================================================="
W !?3,"- Visit Location.....: "
I $D(ABMY("LOC")) D
.S ABMI=0
.F S ABMI=$O(ABMY("LOC",ABMI)) Q:+ABMI=0 W !?12,$P(^DIC(4,ABMI,0),U)
E W "ALL"
I $D(ABMY("DT")) W !?3,"- Date Range....:"
I S X=ABMY("DT",1) X ABMY("X") W " to: " S X=ABMY("DT",2) X ABMY("X")
W !?3,"- Clinics...:"
I $D(ABMY("CLIN")) D
.S ABMI=0
.F S ABMI=$O(ABMY("CLIN",ABMI)) Q:+ABMI=0 W !?12,$P(^DIC(40.7,ABMI,0),U)
E W "ALL"
PARM ;
; Choose additional exclusion parameters
K DIR
S DIR(0)="SO^1:LOCATION;2:DATE RANGE;3:CLINIC"
S DIR("A")="Select ONE or MORE of the above EXCLUSION PARAMETERS"
S DIR("?")="The report can be restricted to one or more of the listed parameters. A parameter can be removed by reselecting it and making a null entry."
D ^DIR
K DIR
G XIT:$D(DIRUT)!$D(DIROUT)
I Y=1!(Y=2)!(Y=3) D @($S(Y=3:"CLIN",Y=1:"LOC",1:"DT")_"^ABMTALLY") G LOOP
Q
;
COMPUTE ;
S ABM("SUBR")="ABM-TALLY"
K ^TMP("ABM-TALLY",$J)
;PCC DATA
S ABMSDT=+$G(ABMY("DT",1)) ;start date
S ABMEDT=$S(+$G(ABMY("DT",2))'=0:+$G(ABMY("DT",2)),1:9999999) ;end date
S ABMVDT=ABMSDT-.01
F S ABMVDT=$O(^AUPNVSIT("B",ABMVDT)) Q:+ABMVDT=0!(ABMVDT>ABMEDT) D
.S ABMVIEN=0
.F S ABMVIEN=$O(^AUPNVSIT("B",ABMVDT,ABMVIEN)) Q:+ABMVIEN=0 D
..S ABMVL=$P($G(^AUPNVSIT(ABMVIEN,0)),U,6)
..S:ABMVL="" ABMVL="NO VISIT LOCATION"
..I $D(ABMY("LOC"))&('$D(ABMY("LOC",ABMVL))) Q ;not selected visit location
..S ABMCLN=$P($G(^AUPNVSIT(ABMVIEN,0)),U,8)
..S:ABMCLN="" ABMCLN=99999
..I $D(ABMY("CLIN"))&('$D(ABMY("CLIN",ABMCLN))) Q ;not selected clinic
..S ABMSCAT=$P($G(^AUPNVSIT(ABMVIEN,0)),U,7) ;SERVICE CATEGORY
..S:ABMSCAT="" ABMSCAT="NO SERVICE CATEGORY"
..S ABMTPB=$P($G(^AUPNVSIT(ABMVIEN,0)),U,4)
..S ^TMP("ABM-TALLY",$J,"VTOT")=+$G(^TMP("ABM-TALLY",$J,"VTOT"))+1 ;total visits
..S ABMSTODT=$E(ABMVDT,1,5) ;month and year of visit for sorting
..I ABMTPB=1!(ABMTPB=2)!(ABMTPB=24)!(ABMTPB=25) S ^TMP("ABM-TALLY",$J,"PCC",ABMVL,ABMCLN,ABMSCAT,ABMSTODT,"CLM")=+$G(^TMP("ABM-TALLY",$J,"PCC",ABMVL,ABMCLN,ABMSCAT,ABMSTODT,"CLM"))+1 ;clinic cnt w/clm
..E S ^TMP("ABM-TALLY",$J,"PCC",ABMVL,ABMCLN,ABMSCAT,ABMSTODT,"NOCLM")=+$G(^TMP("ABM-TALLY",$J,"PCC",ABMVL,ABMCLN,ABMSCAT,ABMSTODT,"NOCLM"))+1
;
;CLAIM DATA
S ABMCLMDT=ABMSDT-.01
F S ABMCLMDT=$O(^ABMDCLM(DUZ(2),"AC",ABMCLMDT)) Q:+ABMCLMDT=0!(ABMCLMDT>ABMEDT) D
.S ABMIEN=0
.F S ABMIEN=$O(^ABMDCLM(DUZ(2),"AC",ABMCLMDT,ABMIEN)) Q:+ABMIEN=0 D
..S ABMVL=$P($G(^ABMDCLM(DUZ(2),ABMIEN,0)),U,3)
..S:ABMVL="" ABMVL="NO VISIT LOCATION" ;NO VISIT LOCATION
..I $D(ABMY("LOC"))&('$D(ABMY("LOC",ABMVL))) Q ;not selected visit location
..S ABMCLN=$P($G(^ABMDCLM(DUZ(2),ABMIEN,0)),U,6) ;CLINIC
..S:ABMCLN="" ABMCLN=99999
..I $D(ABMY("CLIN"))&('$D(ABMY("CLIN",ABMCLN))) Q ;not selected clinic
..S ABMVTYP=$P($G(^ABMDCLM(DUZ(2),ABMIEN,0)),U,7) ;VISIT TYPE
..S:ABMVTYP="" ABMVTYP="UNKNOWN"
..S ABMCLST=$P($G(^ABMDCLM(DUZ(2),ABMIEN,0)),U,4) ;CLAIM STATUS
..S:ABMCLST="" ABMCLST="UNKNOWN" ;abm*2.6*1 HEAT3073
..S ABMACTI=$P($G(^ABMDCLM(DUZ(2),ABMIEN,0)),U,8) ;ACTIVE INSURER
..S:ABMACTI'="" ABMITYP=$P($G(^AUTNINS(ABMACTI,2)),U)
..S:ABMACTI'="" ABMACTI=$P($G(^AUTNINS(ABMACTI,0)),U) ;
..I ABMACTI="" S ABMACTI="NO INSURER"
..I ABMITYP="" S ABMITYP="NO INS. TYPE"
..S ABMSTODT=$E(ABMCLMDT,1,5) ;month and year of visit for sorting
..S ^TMP("ABM-TALLY",$J,"CTOT")=+$G(^TMP("ABM-TALLY",$J,"CTOT"))+1 ;total claims
..S ^TMP("ABM-TALLY",$J,"TPB",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMCLST,ABMITYP,ABMACTI)=+$G(^TMP("ABM-TALLY",$J,"TPB",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMCLST,ABMITYP,ABMACTI))+1
;now get cancelled claim data
S ABMCLMDT=ABMSDT-.01
S ABMCLST="X" ;CLAIM STATUS
F S ABMCLMDT=$O(^ABMCCLMS(DUZ(2),"AC",ABMCLMDT)) Q:+ABMCLMDT=0!(ABMCLMDT>ABMEDT) D
.S ABMIEN=0
.F S ABMIEN=$O(^ABMCCLMS(DUZ(2),"AC",ABMCLMDT,ABMIEN)) Q:+ABMIEN=0 D
..S ABMVL=$P($G(^ABMCCLMS(DUZ(2),ABMIEN,0)),U,3)
..S:ABMVL="" ABMVL="NO VISIT LOCATION" ;NO VISIT LOCATION
..I $D(ABMY("LOC"))&('$D(ABMY("LOC",ABMVL))) Q ;not selected visit location
..S ABMCLN=$P($G(^ABMCCLMS(DUZ(2),ABMIEN,0)),U,6) ;CLINIC
..S:ABMCLN="" ABMCLN=99999
..I $D(ABMY("CLIN"))&('$D(ABMY("CLIN",ABMCLN))) Q ;not selected clinic
..S ABMVTYP=$P($G(^ABMCCLMS(DUZ(2),ABMIEN,0)),U,7) ;VISIT TYPE
..S:ABMVTYP="" ABMVTYP="UNKNOWN"
..S ABMACTI=$P($G(^ABMCCLMS(DUZ(2),ABMIEN,0)),U,8) ;ACTIVE INSURER
..S:ABMACTI'="" ABMITYP=$P($G(^AUTNINS(ABMACTI,2)),U)
..S:ABMACTI'="" ABMACTI=$P($G(^AUTNINS(ABMACTI,0)),U)
..I ABMACTI="" S ABMACTI="NO INSURER"
..I ABMITYP="" S ABMITYP="NO INS. TYPE"
..S ABMSTODT=$E(ABMCLMDT,1,5) ;month and year of visit for sorting
..S ^TMP("ABM-TALLY",$J,"CTOT")=+$G(^TMP("ABM-TALLY",$J,"CTOT"))+1 ;total claims
..S ^TMP("ABM-TALLY",$J,"TPB",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMCLST,ABMITYP,ABMACTI)=+$G(^TMP("ABM-TALLY",$J,"TPB",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMCLST,ABMITYP,ABMACTI))+1
;
;BILL DATA
S ABMBDT=ABMSDT-.01
F S ABMBDT=$O(^BARBL(DUZ(2),"F",ABMBDT)) Q:+ABMBDT=0!(ABMBDT>ABMEDT) D
.S ABMBIEN=0
.F S ABMBIEN=$O(^BARBL(DUZ(2),"F",ABMBDT,ABMBIEN)) Q:+ABMBIEN=0 D
..S ABMACCTI=$P($G(^BARBL(DUZ(2),ABMBIEN,0)),U,3)
..S ABMACCT=$P($G(^BARAC(DUZ(2),ABMACCTI,0)),U)
..I (ABMACCT'["AUTNINS")&(ABMACCT'["AUPNDPT") Q ;only insurer/patient entries
..I ABMACCT[("AUTNINS") S ABMINS=$P($G(@(U_$P(ABMACCT,";",2)_+ABMACCT_",0)")),U)
..S:ABMINS="" ABMINS="NO INSURER"
..S D0=ABMACCTI,ABMITYP=$$VAL^BARVPM(8) ;insurer type
..S ABMVL=$P($G(^BARBL(DUZ(2),ABMBIEN,1)),U,8) ;visit location
..S:ABMVL="" ABMVL="NO VISIT LOCATION" ;NO VISIT LOCATION
..I $D(ABMY("LOC"))&('$D(ABMY("LOC",ABMVL))) Q ;not selected visit location
..S ABMCLN=$P($G(^BARBL(DUZ(2),ABMBIEN,1)),U,12) ;clinic
..S:ABMCLN="" ABMCLN=99999
..I $D(ABMY("CLIN"))&('$D(ABMY("CLIN",ABMCLN))) Q ;not selected clinic
..S ABMVTYP=$P($G(^BARBL(DUZ(2),ABMBIEN,1)),U,14) ;VISIT TYPE
..S:ABMVTYP="" ABMVTYP="UNKNOWN"
..S ABMSTODT=$E(ABMBDT,1,5) ;month and year of visit for sorting
..S ABMBLST=$$VAL^BAR3PINQ(ABMBIEN,"B",.04) ;bill status
..Q:ABMBLST="" ;NO BILL STATUS
..S ABMBILL=$P($G(^BARBL(DUZ(2),ABMBIEN,0)),U,13) ;amount billed
..S ABMCURR=$P($G(^BARBL(DUZ(2),ABMBIEN,0)),U,15) ;current bill amount
..S ^TMP("ABM-TALLY",$J,"BTOT")=+$G(^TMP("ABM-TALLY",$J,"BTOT"))+1 ;total bills
..S ^TMP("ABM-TALLY",$J,"BAR",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS)=+$G(^TMP("ABM-TALLY",$J,"BAR",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS))+1
..S ^TMP("ABM-TALLY",$J,"BAR-BILLED",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS)=+$G(^TMP("ABM-TALLY",$J,"BAR-BILLED",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS))+ABMBILL
..S ^TMP("ABM-TALLY",$J,"TBILLED")=+$G(^TMP("ABM-TALLY",$J,"TBILLED"))+ABMBILL
..S ^TMP("ABM-TALLY",$J,"BAR-CBILLED",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS)=+$G(^TMP("ABM-TALLY",$J,"BAR-CBILLED",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS))+ABMCURR
..S ^TMP("ABM-TALLY",$J,"TCBILLED")=+$G(^TMP("ABM-TALLY",$J,"TCBILLED"))+ABMCURR
..; now get transaction data
..S ABMTRIEN=0
..F S ABMTRIEN=$O(^BARTR(DUZ(2),"AC",ABMBIEN,ABMTRIEN)) Q:+ABMTRIEN=0 D
...S (ABM(1),ABM(2),ABM(3),ABM(4))=0
...I +ABMTRIEN<ABMSDT!(+ABMTRIEN>ABMEDT) Q ;outside date range
...D TRANS^ABMTALL2
...S ABMTR("ADJ CAT")=$P(ABMTR(1),U,2) ; Adjustment Category
...I ",3,4,13,14,15,16,19,20,"'[(","_ABMTR("ADJ CAT")_",")&(",40,49,39,108,503,"'[(","_ABMTR("T")_",")) Q
...S:(ABMTR("T")=49!(ABMTR("T")=503)) ABM(1)=ABMTR("CR-DB")
...S:ABMTR("T")=40 ABM(2)=ABMTR("CR-DB")
...S:(",3,4,13,14,15,16,20,"[(","_ABMTR("ADJ CAT")_",")) ABM(3)=ABMTR("CR-DB")
...S:ABMTR("T")=108 ABM(3)=ABMTR("CR-DB")
...S:(ABMTR("T")=39!(ABMTR("ADJ CAT")=19)) ABM(4)=ABMTR("CR-DB")
...S ^TMP("ABM-TALLY",$J,"PAYMENT",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS)=+$G(^TMP("ABM-TALLY",$J,"PAYMENT",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS))+ABM(2)
...S ^TMP("ABM-TALLY",$J,"TPAY")=+$G(^TMP("ABM-TALLY",$J,"TPAY"))+ABM(2)
...S ^TMP("ABM-TALLY",$J,"ADJUST",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS)=+$G(^TMP("ABM-TALLY",$J,"ADJUST",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS))+ABM(3)
...S ^TMP("ABM-TALLY",$J,"TADJ")=+$G(^TMP("ABM-TALLY",$J,"TADJ"))+ABM(3)
...S ^TMP("ABM-TALLY",$J,"REFUND",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS)=+$G(^TMP("ABM-TALLY",$J,"REFUND",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS))+ABM(4)
...S ^TMP("ABM-TALLY",$J,"TREF")=+$G(^TMP("ABM-TALLY",$J,"TREF"))+ABM(4)
D OPEN^%ZISH("ABMTALLY",ABMPATH,ABMFILE,"W")
Q:POP
U IO
D OUTPUT ;write data
D CLOSE^%ZISH("ABMTALLY")
K ^TMP("ABM-TALLY",$J)
Q
OUTPUT ;
D OUTPUT^ABMTALL2
Q
LOC ;EP
W ! K DIC,ABMY("LOC")
S DIC="^BAR(90052.05,DUZ(2),"
S DIC(0)="AEMQ"
S DIC("A")="Select LOCATION: ALL//"
F D Q:+Y<0
.I $D(ABMY("LOC")) S DIC("A")="Select Another Location: "
.D ^DIC
.Q:+Y<0
.S ABMY("LOC",+Y)=""
I '$D(ABMY("LOC")) D
.I $D(DUOUT) K ABMY("SORT") Q
.W "ALL"
K DIC
Q
DT ;EP
K DIR,ABMY("DT")
Q:$D(DIRUT)
S ABMY("DT")="E"
S Y="DATE"
W !!," ============ Entry of ",Y," Range =============",!
S DIR("A")="Enter STARTING "_Y_" for the Report"
S DIR(0)="DO^::EP"
D ^DIR
G DT:$D(DIRUT)
S ABMY("DT",1)=Y
W !
S DIR("A")="Enter ENDING DATE for the Report"
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
CLIN ;SELECT CLINICS
K ABMY("CLIN")
S DIC="^DIC(40.7,"
S DIC(0)="AEMQ"
S DIC("A")="Select Clinic: ALL// "
F D Q:+Y<0
.I $D(ABMY("CLIN")) S DIC("A")="Select Another Clinic: "
.D ^DIC
.Q:+Y<0
.S ABMY("CLIN",+Y)=""
I '$D(ABMY("CLIN")) D
.I $D(DUOUT) K ABMY("SORT") Q
.W "ALL"
K DIC
Q
XIT ;
K ABMY("I"),ABMY("X"),DIR
Q
HDR ;
I $D(ABMY("LOC")) S ABM("TXT")=$P(^DIC(4,ABMY("LOC"),0),U),ABM("CONJ")="at " D CHK
Q:$G(ABMY("DT",1))="" ;no dates
S ABM("CONJ")="with "
S ABM("TXT")="Edit Date" D CHK
S ABM("CONJ")="from ",ABM("TXT")=$$SDT^ABMDUTL(ABMY("DT",1)) D CHK
S ABM("CONJ")="to ",ABM("TXT")=$$SDT^ABMDUTL(ABMY("DT",2)) D CHK
Q
WHD ;EP for writing Report Header
W $$EN^ABMVDF("IOF"),!
I $D(ABM("PRIVACY")) W ?($S($D(ABM(132)):34,1:8)),"WARNING: Confidential Patient Information, Privacy Act Applies",!
K ABM("LINE") S $P(ABM("LINE"),"=",$S($D(ABM(132)):132,1:80))="" W ABM("LINE"),!
W ABM("HD",0),?$S($D(ABM(132)):108,1:57) S Y=DT X ^DD("DD") W Y," Page ",ABM("PG")
W:$G(ABM("HD",1))]"" !,ABM("HD",1)
W:$G(ABM("HD",2))]"" !,ABM("HD",2)
W !,ABM("LINE") K ABM("LINE")
Q
CHK I ($L(ABM("HD",ABM("LVL")))+1+$L(ABM("CONJ"))+$L(ABM("TXT")))<($S($D(ABM(132)):104,1:52)+$S(ABM("LVL")>0:28,1:0)) S ABM("HD",ABM("LVL"))=ABM("HD",ABM("LVL"))_" "_ABM("CONJ")_ABM("TXT")
E S ABM("LVL")=ABM("LVL")+1,ABM("HD",ABM("LVL"))=ABM("CONJ")_ABM("TXT")
Q
GETSVCAT(ABMCAT) ;EP-GET THE FULL SERVICE CATEGORY NAME
Q $P($P(ABMCATS,ABMCAT_":",2),";")
ABMTALLY ; IHS/SD/SDR - Monthly tally report - 8/19/2005 1:28:34 PM
+1 ;;2.6;IHS Third Party Billing;**1**;NOV 12, 2009
+2 ;
+3 ; IHS/SD/SDR - v2.5 p10 - IM18370
+4 ; New report
+5 ; IHS/SD/SDR - abm*2.6*1 - HEAT3073 - fix <SUBSCR>COMPUTE+45^ABMTALLY
+6 ;
+7 ;Report to count:
+8 ; Number of visits (total; with and without TPB coverage)
+9 ; Number of claims (total; divided by claim status)
+10 ; Number of bills (total; divided by billed amount and outstanding)
+11 ; User will be prompted for (this will also be the sort order):
+12 ; Visit Location(s)
+13 ; Clinic Type(s)
+14 ; Date range
+15 ;OPTION: ABMD RP TALLY^VISIT/CLAIM/BILL TALLY REPORT
+16 KILL ABM,ABMY
+17 SET ABM("RTYP")=1
+18 SET ABM("RTYP","NM")="TALLY LISTING"
+19 ;
SEL DO LOOP
IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIROUT)
QUIT
+1 SET ABM("HD",0)="LISTING of TALLIED files "
+2 SET ABM("LVL")=0
+3 DO QUE
+4 QUIT
+5 ;
QUE ;
+1 SET ZTRTN="COMPUTE^ABMTALLY"
+2 SET ZTDESC="TALLED REPORT OF PCC/TPB/AR"
+3 SET ZTSAVE("ABM*")=""
+4 KILL ZTSK
+5 ;S ABMFILE=$P($G(^DIC(4,DUZ(2),0)),U)_DT_".txt" ;abm*2.6*1 HEAT3073
+6 ;abm*2.6*1 HEAT3073
SET ABMFILE=$TRANSLATE($PIECE($GET(^DIC(4,DUZ(2),0)),U)_DT_".txt"," ","_")
+7 SET ABMPATH=$PIECE($GET(^ABMDPARM(DUZ(2),1,4)),U,7)
+8 SET %ZIS("HFSNAME")=ABMPATH_ABMFILE
+9 SET %ZIS("HFSMODE")="W"
+10 SET %ZIS("B")="HFS"
+11 SET %ZIS="QN"
+12 DO ^%ZIS
+13 IF POP
QUIT
+14 ;force taskman NOT to use IO from here. TM gets confused and sends output to tmp.hfs
SET ZTIO=""
+15 ;file is transferred via ABMPATH and ABMFILE
+16 DO ^%ZTLOAD
+17 IF $GET(ZTSK)
Begin DoDot:1
+18 WRITE !,"Task # ",ZTSK," queued."
+19 WRITE !,"File to be created:"_ABMPATH_ABMFILE
+20 DO ^%ZISC
End DoDot:1
+21 DO HOME^%ZIS
+22 KILL DIR
+23 SET DIR(0)="E"
+24 DO ^DIR
+25 QUIT
+26 ;
LOOP ;
+1 ; Display current exclusion parameters
+2 SET ABMY("X")="W $$SDT^ABMDUTL(X)"
+3 IF $DATA(DUOUT)!$DATA(DTOUT)!$DATA(DIROUT)
GOTO XIT
+4 WRITE !!?3,"EXCLUSION PARAMETERS Currently in Effect for RESTRICTING the EXPORT to:",!?3,"======================================================================="
+5 WRITE !?3,"- Visit Location.....: "
+6 IF $DATA(ABMY("LOC"))
Begin DoDot:1
+7 SET ABMI=0
+8 FOR
SET ABMI=$ORDER(ABMY("LOC",ABMI))
IF +ABMI=0
QUIT
WRITE !?12,$PIECE(^DIC(4,ABMI,0),U)
End DoDot:1
+9 IF '$TEST
WRITE "ALL"
+10 IF $DATA(ABMY("DT"))
WRITE !?3,"- Date Range....:"
+11 IF $TEST
SET X=ABMY("DT",1)
XECUTE ABMY("X")
WRITE " to: "
SET X=ABMY("DT",2)
XECUTE ABMY("X")
+12 WRITE !?3,"- Clinics...:"
+13 IF $DATA(ABMY("CLIN"))
Begin DoDot:1
+14 SET ABMI=0
+15 FOR
SET ABMI=$ORDER(ABMY("CLIN",ABMI))
IF +ABMI=0
QUIT
WRITE !?12,$PIECE(^DIC(40.7,ABMI,0),U)
End DoDot:1
+16 IF '$TEST
WRITE "ALL"
PARM ;
+1 ; Choose additional exclusion parameters
+2 KILL DIR
+3 SET DIR(0)="SO^1:LOCATION;2:DATE RANGE;3:CLINIC"
+4 SET DIR("A")="Select ONE or MORE of the above EXCLUSION PARAMETERS"
+5 SET DIR("?")="The report can be restricted to one or more of the listed parameters. A parameter can be removed by reselecting it and making a null entry."
+6 DO ^DIR
+7 KILL DIR
+8 IF $DATA(DIRUT)!$DATA(DIROUT)
GOTO XIT
+9 IF Y=1!(Y=2)!(Y=3)
DO @($SELECT(Y=3:"CLIN",Y=1:"LOC",1:"DT")_"^ABMTALLY")
GOTO LOOP
+10 QUIT
+11 ;
COMPUTE ;
+1 SET ABM("SUBR")="ABM-TALLY"
+2 KILL ^TMP("ABM-TALLY",$JOB)
+3 ;PCC DATA
+4 ;start date
SET ABMSDT=+$GET(ABMY("DT",1))
+5 ;end date
SET ABMEDT=$SELECT(+$GET(ABMY("DT",2))'=0:+$GET(ABMY("DT",2)),1:9999999)
+6 SET ABMVDT=ABMSDT-.01
+7 FOR
SET ABMVDT=$ORDER(^AUPNVSIT("B",ABMVDT))
IF +ABMVDT=0!(ABMVDT>ABMEDT)
QUIT
Begin DoDot:1
+8 SET ABMVIEN=0
+9 FOR
SET ABMVIEN=$ORDER(^AUPNVSIT("B",ABMVDT,ABMVIEN))
IF +ABMVIEN=0
QUIT
Begin DoDot:2
+10 SET ABMVL=$PIECE($GET(^AUPNVSIT(ABMVIEN,0)),U,6)
+11 IF ABMVL=""
SET ABMVL="NO VISIT LOCATION"
+12 ;not selected visit location
IF $DATA(ABMY("LOC"))&('$DATA(ABMY("LOC",ABMVL)))
QUIT
+13 SET ABMCLN=$PIECE($GET(^AUPNVSIT(ABMVIEN,0)),U,8)
+14 IF ABMCLN=""
SET ABMCLN=99999
+15 ;not selected clinic
IF $DATA(ABMY("CLIN"))&('$DATA(ABMY("CLIN",ABMCLN)))
QUIT
+16 ;SERVICE CATEGORY
SET ABMSCAT=$PIECE($GET(^AUPNVSIT(ABMVIEN,0)),U,7)
+17 IF ABMSCAT=""
SET ABMSCAT="NO SERVICE CATEGORY"
+18 SET ABMTPB=$PIECE($GET(^AUPNVSIT(ABMVIEN,0)),U,4)
+19 ;total visits
SET ^TMP("ABM-TALLY",$JOB,"VTOT")=+$GET(^TMP("ABM-TALLY",$JOB,"VTOT"))+1
+20 ;month and year of visit for sorting
SET ABMSTODT=$EXTRACT(ABMVDT,1,5)
+21 ;clinic cnt w/clm
IF ABMTPB=1!(ABMTPB=2)!(ABMTPB=24)!(ABMTPB=25)
SET ^TMP("ABM-TALLY",$JOB,"PCC",ABMVL,ABMCLN,ABMSCAT,ABMSTODT,"CLM")=+$GET(^TMP("ABM-TALLY",$JOB,"PCC",ABMVL,ABMCLN,ABMSCAT,ABMSTODT,"CLM"))+1
+22 IF '$TEST
SET ^TMP("ABM-TALLY",$JOB,"PCC",ABMVL,ABMCLN,ABMSCAT,ABMSTODT,"NOCLM")=+$GET(^TMP("ABM-TALLY",$JOB,"PCC",ABMVL,ABMCLN,ABMSCAT,ABMSTODT,"NOCLM"))+1
End DoDot:2
End DoDot:1
+23 ;
+24 ;CLAIM DATA
+25 SET ABMCLMDT=ABMSDT-.01
+26 FOR
SET ABMCLMDT=$ORDER(^ABMDCLM(DUZ(2),"AC",ABMCLMDT))
IF +ABMCLMDT=0!(ABMCLMDT>ABMEDT)
QUIT
Begin DoDot:1
+27 SET ABMIEN=0
+28 FOR
SET ABMIEN=$ORDER(^ABMDCLM(DUZ(2),"AC",ABMCLMDT,ABMIEN))
IF +ABMIEN=0
QUIT
Begin DoDot:2
+29 SET ABMVL=$PIECE($GET(^ABMDCLM(DUZ(2),ABMIEN,0)),U,3)
+30 ;NO VISIT LOCATION
IF ABMVL=""
SET ABMVL="NO VISIT LOCATION"
+31 ;not selected visit location
IF $DATA(ABMY("LOC"))&('$DATA(ABMY("LOC",ABMVL)))
QUIT
+32 ;CLINIC
SET ABMCLN=$PIECE($GET(^ABMDCLM(DUZ(2),ABMIEN,0)),U,6)
+33 IF ABMCLN=""
SET ABMCLN=99999
+34 ;not selected clinic
IF $DATA(ABMY("CLIN"))&('$DATA(ABMY("CLIN",ABMCLN)))
QUIT
+35 ;VISIT TYPE
SET ABMVTYP=$PIECE($GET(^ABMDCLM(DUZ(2),ABMIEN,0)),U,7)
+36 IF ABMVTYP=""
SET ABMVTYP="UNKNOWN"
+37 ;CLAIM STATUS
SET ABMCLST=$PIECE($GET(^ABMDCLM(DUZ(2),ABMIEN,0)),U,4)
+38 ;abm*2.6*1 HEAT3073
IF ABMCLST=""
SET ABMCLST="UNKNOWN"
+39 ;ACTIVE INSURER
SET ABMACTI=$PIECE($GET(^ABMDCLM(DUZ(2),ABMIEN,0)),U,8)
+40 IF ABMACTI'=""
SET ABMITYP=$PIECE($GET(^AUTNINS(ABMACTI,2)),U)
+41 ;
IF ABMACTI'=""
SET ABMACTI=$PIECE($GET(^AUTNINS(ABMACTI,0)),U)
+42 IF ABMACTI=""
SET ABMACTI="NO INSURER"
+43 IF ABMITYP=""
SET ABMITYP="NO INS. TYPE"
+44 ;month and year of visit for sorting
SET ABMSTODT=$EXTRACT(ABMCLMDT,1,5)
+45 ;total claims
SET ^TMP("ABM-TALLY",$JOB,"CTOT")=+$GET(^TMP("ABM-TALLY",$JOB,"CTOT"))+1
+46 SET ^TMP("ABM-TALLY",$JOB,"TPB",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMCLST,ABMITYP,ABMACTI)=+$GET(^TMP("ABM-TALLY",$JOB,"TPB",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMCLST,ABMITYP,ABMACTI))+1
End DoDot:2
End DoDot:1
+47 ;now get cancelled claim data
+48 SET ABMCLMDT=ABMSDT-.01
+49 ;CLAIM STATUS
SET ABMCLST="X"
+50 FOR
SET ABMCLMDT=$ORDER(^ABMCCLMS(DUZ(2),"AC",ABMCLMDT))
IF +ABMCLMDT=0!(ABMCLMDT>ABMEDT)
QUIT
Begin DoDot:1
+51 SET ABMIEN=0
+52 FOR
SET ABMIEN=$ORDER(^ABMCCLMS(DUZ(2),"AC",ABMCLMDT,ABMIEN))
IF +ABMIEN=0
QUIT
Begin DoDot:2
+53 SET ABMVL=$PIECE($GET(^ABMCCLMS(DUZ(2),ABMIEN,0)),U,3)
+54 ;NO VISIT LOCATION
IF ABMVL=""
SET ABMVL="NO VISIT LOCATION"
+55 ;not selected visit location
IF $DATA(ABMY("LOC"))&('$DATA(ABMY("LOC",ABMVL)))
QUIT
+56 ;CLINIC
SET ABMCLN=$PIECE($GET(^ABMCCLMS(DUZ(2),ABMIEN,0)),U,6)
+57 IF ABMCLN=""
SET ABMCLN=99999
+58 ;not selected clinic
IF $DATA(ABMY("CLIN"))&('$DATA(ABMY("CLIN",ABMCLN)))
QUIT
+59 ;VISIT TYPE
SET ABMVTYP=$PIECE($GET(^ABMCCLMS(DUZ(2),ABMIEN,0)),U,7)
+60 IF ABMVTYP=""
SET ABMVTYP="UNKNOWN"
+61 ;ACTIVE INSURER
SET ABMACTI=$PIECE($GET(^ABMCCLMS(DUZ(2),ABMIEN,0)),U,8)
+62 IF ABMACTI'=""
SET ABMITYP=$PIECE($GET(^AUTNINS(ABMACTI,2)),U)
+63 IF ABMACTI'=""
SET ABMACTI=$PIECE($GET(^AUTNINS(ABMACTI,0)),U)
+64 IF ABMACTI=""
SET ABMACTI="NO INSURER"
+65 IF ABMITYP=""
SET ABMITYP="NO INS. TYPE"
+66 ;month and year of visit for sorting
SET ABMSTODT=$EXTRACT(ABMCLMDT,1,5)
+67 ;total claims
SET ^TMP("ABM-TALLY",$JOB,"CTOT")=+$GET(^TMP("ABM-TALLY",$JOB,"CTOT"))+1
+68 SET ^TMP("ABM-TALLY",$JOB,"TPB",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMCLST,ABMITYP,ABMACTI)=+$GET(^TMP("ABM-TALLY",$JOB,"TPB",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMCLST,ABMITYP,ABMACTI))+1
End DoDot:2
End DoDot:1
+69 ;
+70 ;BILL DATA
+71 SET ABMBDT=ABMSDT-.01
+72 FOR
SET ABMBDT=$ORDER(^BARBL(DUZ(2),"F",ABMBDT))
IF +ABMBDT=0!(ABMBDT>ABMEDT)
QUIT
Begin DoDot:1
+73 SET ABMBIEN=0
+74 FOR
SET ABMBIEN=$ORDER(^BARBL(DUZ(2),"F",ABMBDT,ABMBIEN))
IF +ABMBIEN=0
QUIT
Begin DoDot:2
+75 SET ABMACCTI=$PIECE($GET(^BARBL(DUZ(2),ABMBIEN,0)),U,3)
+76 SET ABMACCT=$PIECE($GET(^BARAC(DUZ(2),ABMACCTI,0)),U)
+77 ;only insurer/patient entries
IF (ABMACCT'["AUTNINS")&(ABMACCT'["AUPNDPT")
QUIT
+78 IF ABMACCT[("AUTNINS")
SET ABMINS=$PIECE($GET(@(U_$PIECE(ABMACCT,";",2)_+ABMACCT_",0)")),U)
+79 IF ABMINS=""
SET ABMINS="NO INSURER"
+80 ;insurer type
SET D0=ABMACCTI
SET ABMITYP=$$VAL^BARVPM(8)
+81 ;visit location
SET ABMVL=$PIECE($GET(^BARBL(DUZ(2),ABMBIEN,1)),U,8)
+82 ;NO VISIT LOCATION
IF ABMVL=""
SET ABMVL="NO VISIT LOCATION"
+83 ;not selected visit location
IF $DATA(ABMY("LOC"))&('$DATA(ABMY("LOC",ABMVL)))
QUIT
+84 ;clinic
SET ABMCLN=$PIECE($GET(^BARBL(DUZ(2),ABMBIEN,1)),U,12)
+85 IF ABMCLN=""
SET ABMCLN=99999
+86 ;not selected clinic
IF $DATA(ABMY("CLIN"))&('$DATA(ABMY("CLIN",ABMCLN)))
QUIT
+87 ;VISIT TYPE
SET ABMVTYP=$PIECE($GET(^BARBL(DUZ(2),ABMBIEN,1)),U,14)
+88 IF ABMVTYP=""
SET ABMVTYP="UNKNOWN"
+89 ;month and year of visit for sorting
SET ABMSTODT=$EXTRACT(ABMBDT,1,5)
+90 ;bill status
SET ABMBLST=$$VAL^BAR3PINQ(ABMBIEN,"B",.04)
+91 ;NO BILL STATUS
IF ABMBLST=""
QUIT
+92 ;amount billed
SET ABMBILL=$PIECE($GET(^BARBL(DUZ(2),ABMBIEN,0)),U,13)
+93 ;current bill amount
SET ABMCURR=$PIECE($GET(^BARBL(DUZ(2),ABMBIEN,0)),U,15)
+94 ;total bills
SET ^TMP("ABM-TALLY",$JOB,"BTOT")=+$GET(^TMP("ABM-TALLY",$JOB,"BTOT"))+1
+95 SET ^TMP("ABM-TALLY",$JOB,"BAR",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS)=+$GET(^TMP("ABM-TALLY",$JOB,"BAR",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS))+1
+96 SET ^TMP("ABM-TALLY",$JOB,"BAR-BILLED",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS)=+$GET(^TMP("ABM-TALLY",$JOB,"BAR-BILLED",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS))+ABMBILL
+97 SET ^TMP("ABM-TALLY",$JOB,"TBILLED")=+$GET(^TMP("ABM-TALLY",$JOB,"TBILLED"))+ABMBILL
+98 SET ^TMP("ABM-TALLY",$JOB,"BAR-CBILLED",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS)=+$GET(^TMP("ABM-TALLY",$JOB,"BAR-CBILLED",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS))+ABMCURR
+99 SET ^TMP("ABM-TALLY",$JOB,"TCBILLED")=+$GET(^TMP("ABM-TALLY",$JOB,"TCBILLED"))+ABMCURR
+100 ; now get transaction data
+101 SET ABMTRIEN=0
+102 FOR
SET ABMTRIEN=$ORDER(^BARTR(DUZ(2),"AC",ABMBIEN,ABMTRIEN))
IF +ABMTRIEN=0
QUIT
Begin DoDot:3
+103 SET (ABM(1),ABM(2),ABM(3),ABM(4))=0
+104 ;outside date range
IF +ABMTRIEN<ABMSDT!(+ABMTRIEN>ABMEDT)
QUIT
+105 DO TRANS^ABMTALL2
+106 ; Adjustment Category
SET ABMTR("ADJ CAT")=$PIECE(ABMTR(1),U,2)
+107 IF ",3,4,13,14,15,16,19,20,"'[(","_ABMTR("ADJ CAT")_",")&(",40,49,39,108,503,"'[(","_ABMTR("T")_","))
QUIT
+108 IF (ABMTR("T")=49!(ABMTR("T")=503))
SET ABM(1)=ABMTR("CR-DB")
+109 IF ABMTR("T")=40
SET ABM(2)=ABMTR("CR-DB")
+110 IF (",3,4,13,14,15,16,20,"[(","_ABMTR("ADJ CAT")_","))
SET ABM(3)=ABMTR("CR-DB")
+111 IF ABMTR("T")=108
SET ABM(3)=ABMTR("CR-DB")
+112 IF (ABMTR("T")=39!(ABMTR("ADJ CAT")=19))
SET ABM(4)=ABMTR("CR-DB")
+113 SET ^TMP("ABM-TALLY",$JOB,"PAYMENT",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS)=+$GET(^TMP("ABM-TALLY",$JOB,"PAYMENT",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS))+ABM(2)
+114 SET ^TMP("ABM-TALLY",$JOB,"TPAY")=+$GET(^TMP("ABM-TALLY",$JOB,"TPAY"))+ABM(2)
+115 SET ^TMP("ABM-TALLY",$JOB,"ADJUST",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS)=+$GET(^TMP("ABM-TALLY",$JOB,"ADJUST",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS))+ABM(3)
+116 SET ^TMP("ABM-TALLY",$JOB,"TADJ")=+$GET(^TMP("ABM-TALLY",$JOB,"TADJ"))+ABM(3)
+117 SET ^TMP("ABM-TALLY",$JOB,"REFUND",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS)=+$GET(^TMP("ABM-TALLY",$JOB,"REFUND",ABMVL,ABMCLN,ABMVTYP,ABMSTODT,ABMBLST,ABMITYP,ABMINS))+ABM(4)
+118 SET ^TMP("ABM-TALLY",$JOB,"TREF")=+$GET(^TMP("ABM-TALLY",$JOB,"TREF"))+ABM(4)
End DoDot:3
End DoDot:2
End DoDot:1
+119 DO OPEN^%ZISH("ABMTALLY",ABMPATH,ABMFILE,"W")
+120 IF POP
QUIT
+121 USE IO
+122 ;write data
DO OUTPUT
+123 DO CLOSE^%ZISH("ABMTALLY")
+124 KILL ^TMP("ABM-TALLY",$JOB)
+125 QUIT
OUTPUT ;
+1 DO OUTPUT^ABMTALL2
+2 QUIT
LOC ;EP
+1 WRITE !
KILL DIC,ABMY("LOC")
+2 SET DIC="^BAR(90052.05,DUZ(2),"
+3 SET DIC(0)="AEMQ"
+4 SET DIC("A")="Select LOCATION: ALL//"
+5 FOR
Begin DoDot:1
+6 IF $DATA(ABMY("LOC"))
SET DIC("A")="Select Another Location: "
+7 DO ^DIC
+8 IF +Y<0
QUIT
+9 SET ABMY("LOC",+Y)=""
End DoDot:1
IF +Y<0
QUIT
+10 IF '$DATA(ABMY("LOC"))
Begin DoDot:1
+11 IF $DATA(DUOUT)
KILL ABMY("SORT")
QUIT
+12 WRITE "ALL"
End DoDot:1
+13 KILL DIC
+14 QUIT
DT ;EP
+1 KILL DIR,ABMY("DT")
+2 IF $DATA(DIRUT)
QUIT
+3 SET ABMY("DT")="E"
+4 SET Y="DATE"
+5 WRITE !!," ============ Entry of ",Y," Range =============",!
+6 SET DIR("A")="Enter STARTING "_Y_" for the Report"
+7 SET DIR(0)="DO^::EP"
+8 DO ^DIR
+9 IF $DATA(DIRUT)
GOTO DT
+10 SET ABMY("DT",1)=Y
+11 WRITE !
+12 SET DIR("A")="Enter ENDING DATE for the Report"
+13 DO ^DIR
+14 KILL DIR
+15 IF $DATA(DIRUT)
GOTO DT
+16 SET ABMY("DT",2)=Y
+17 IF ABMY("DT",1)>ABMY("DT",2)
WRITE !!,*7,"INPUT ERROR: Start Date is Greater than than the End Date, TRY AGAIN!",!!
GOTO DT
+18 QUIT
CLIN ;SELECT CLINICS
+1 KILL ABMY("CLIN")
+2 SET DIC="^DIC(40.7,"
+3 SET DIC(0)="AEMQ"
+4 SET DIC("A")="Select Clinic: ALL// "
+5 FOR
Begin DoDot:1
+6 IF $DATA(ABMY("CLIN"))
SET DIC("A")="Select Another Clinic: "
+7 DO ^DIC
+8 IF +Y<0
QUIT
+9 SET ABMY("CLIN",+Y)=""
End DoDot:1
IF +Y<0
QUIT
+10 IF '$DATA(ABMY("CLIN"))
Begin DoDot:1
+11 IF $DATA(DUOUT)
KILL ABMY("SORT")
QUIT
+12 WRITE "ALL"
End DoDot:1
+13 KILL DIC
+14 QUIT
XIT ;
+1 KILL ABMY("I"),ABMY("X"),DIR
+2 QUIT
HDR ;
+1 IF $DATA(ABMY("LOC"))
SET ABM("TXT")=$PIECE(^DIC(4,ABMY("LOC"),0),U)
SET ABM("CONJ")="at "
DO CHK
+2 ;no dates
IF $GET(ABMY("DT",1))=""
QUIT
+3 SET ABM("CONJ")="with "
+4 SET ABM("TXT")="Edit Date"
DO CHK
+5 SET ABM("CONJ")="from "
SET ABM("TXT")=$$SDT^ABMDUTL(ABMY("DT",1))
DO CHK
+6 SET ABM("CONJ")="to "
SET ABM("TXT")=$$SDT^ABMDUTL(ABMY("DT",2))
DO CHK
+7 QUIT
WHD ;EP for writing Report Header
+1 WRITE $$EN^ABMVDF("IOF"),!
+2 IF $DATA(ABM("PRIVACY"))
WRITE ?($SELECT($DATA(ABM(132)):34,1:8)),"WARNING: Confidential Patient Information, Privacy Act Applies",!
+3 KILL ABM("LINE")
SET $PIECE(ABM("LINE"),"=",$SELECT($DATA(ABM(132)):132,1:80))=""
WRITE ABM("LINE"),!
+4 WRITE ABM("HD",0),?$SELECT($DATA(ABM(132)):108,1:57)
SET Y=DT
XECUTE ^DD("DD")
WRITE Y," Page ",ABM("PG")
+5 IF $GET(ABM("HD",1))]""
WRITE !,ABM("HD",1)
+6 IF $GET(ABM("HD",2))]""
WRITE !,ABM("HD",2)
+7 WRITE !,ABM("LINE")
KILL ABM("LINE")
+8 QUIT
CHK IF ($LENGTH(ABM("HD",ABM("LVL")))+1+$LENGTH(ABM("CONJ"))+$LENGTH(ABM("TXT")))<($SELECT($DATA(ABM(132)):104,1:52)+$SELECT(ABM("LVL")>0:28,1:0))
SET ABM("HD",ABM("LVL"))=ABM("HD",ABM("LVL"))_" "_ABM("CONJ")_ABM("TXT")
+1 IF '$TEST
SET ABM("LVL")=ABM("LVL")+1
SET ABM("HD",ABM("LVL"))=ABM("CONJ")_ABM("TXT")
+2 QUIT
GETSVCAT(ABMCAT) ;EP-GET THE FULL SERVICE CATEGORY NAME
+1 QUIT $PIECE($PIECE(ABMCATS,ABMCAT_":",2),";")