PSXSMRY ;BIR/BAB-CMOP Summary by Date ;04/08/97 2:06 PM
;;2.0;CMOP;**32,38**;11 Apr 97
;Reference to file #4 supported by DBIA #10090
;This routine will provide a summary report for a selected date range
;All Data Received,Processed,Query summary and Released
STRT K ^TMP($J,"PSXSUM")
S %DT="AEX",%DT("A")="Enter to BEGIN SUMMARY: ",%DT(0)="-DT",%DT("B")="TODAY" D ^%DT K %DT("A") G:Y<0!($D(DTOUT)) EX1
S START=Y,ST=Y-.0001
S %DT("A")="Enter date to END SUMMARY: ",%DT(0)="-DT",%DT("B")="TODAY" D ^%DT K %DT G:Y<0!($D(DTOUT)) EX1
S (END,LAST)=Y I '(LAST#1) S LAST=Y+.9999
I END<START W !,"Ending date must follow starting date!" G STRT
S DIC=552,DIC(0)="AEQMZ",DIC("A")="Select FACILITY or RETURN for all: "
D ^DIC K DIC I $D(DUOUT)!($D(DTOUT))!(X["^") G EX1
S:$G(Y)'>0 ALL=1,FAC1=0 G:$G(Y)'>0 DEV
I Y>0 S FAC1=$$GET1^DIQ(552,+Y,5)
I FAC1'>0 S XX=$P(Y,U,2)_",",FAC1=$$GET1^DIQ(4,XX,99) ;getting site/div num
;S:+Y>0 XX=$P(Y,"^",2) N X,Y S X=XX,DIC="4",DIC(0)="MOXZ" S:$D(^PSX(552,"D",X)) X=$E(X,2,99) D ^DIC S FAC1=+Y K DIC ;****DOD L1
;S:+Y>0 XX=$P(Y,"^",2) N X,Y S X=XX,AGNCY="VASTANUM" S:$D(^PSX(552,"D",X)) X=$E(X,2,99),AGNCY="DMIS" S FAC1=$$IEN^XUMF(4,AGNCY,X) K DIC,AGNCY ;****DOD L1
;S:$G(Y)'>0 FAC1=0 K Y,X,DIC,DUOUT,DTOUT
K Y,X,DIC,DUOUT,DTOUT
DEV S %ZIS="Q" D ^%ZIS S PGL=($G(IOSL)-2) I POP W !,"No Device Selected!" G EX1
I $D(IO("Q")) D QUE Q
;Called by Taskman to produce CMOP summary report
EN ;
U IO S XXC=0
F S ST=$O(^PSX(552.1,"AR",ST)) Q:(ST>LAST)!(ST="") S:FAC1'>0 BF="" S:FAC1>0 BF=FAC1_"-"_0 D
. F S BF=$O(^PSX(552.1,"AR",ST,BF)) Q:'BF D
.. S REC=0 F S REC=$O(^PSX(552.1,"AR",ST,BF,REC)) Q:'REC D TRN
TOTALS ;
Q:$G(STOP)=1
S Y=START X ^DD("DD") S START=Y S Y=END X ^DD("DD") S END=Y
S HDATE="For "_START_" thru "_END,SP1=(80-$L(HDATE))/2
I '$D(^TMP($J,"PSXSUM")) W !,"No data for the report!" D PGBK G EX2
S S="" F S S=$O(^TMP($J,"PSXSUM",S)) Q:S=""!($G(STOP)=1) D:$G(XXC)>0 PGBK D OUT,OUT1
K ^TMP($J,"PSXSUM")
G:$G(STOP)>0 EX1 G EXIT
OUT ;
Q:$G(STOP)=1
S SNAME="For "_$G(S),SP=(80-$L(SNAME))/2
S (TOR,TRX,TCO,TCA,TUN)=0
S F=0 F S F=$O(^TMP($J,"PSXSUM",S,F)) Q:'F S B=0 F S B=$O(^TMP($J,"PSXSUM",S,F,B)) Q:'B S TOR=TOR+$P(^(B),U),TRX=TRX+$P(^(B),U,2),TCO=TCO+$P(^(B),U,4),TCA=TCA+$P(^(B),U,5),TUN=TUN+$P(^(B),U,6)
Q
OUT1 ;
Q:$G(STOP)=1
D HDR
S F=0 F S F=$O(^TMP($J,"PSXSUM",S,F)) Q:'F Q:$G(STOP)>0 S B=0 F S B=$O(^TMP($J,"PSXSUM",S,F,B)) Q:'B S NODE=$G(^TMP($J,"PSXSUM",S,F,B)) D PRT
G GT
HDR ;S Y=START X ^DD("DD") S START=Y S Y=END X ^DD("DD") S END=Y,LCNT=0
S LCNT=0
W @IOF,!!,?13,"CONSOLIDATED MAIL OUTPATIENT PHARMACY ACTIVITY SUMMARY"
;W !,?23,"From "_START_" thru "_END
W !,?SP1,HDATE
W !,?SP,$G(SNAME),!!
;W !,"TRANS #",?12,"DIVISION",?30,"PROC",?36,"ORDERS",?46,"RXS",?53,"RELEASED",?63,"NOT DISP",?74,"UNREL"
W !,?66,$J("NOT",6)
W !,"TRANS #",?18,"DIVISION",?36,$J("PROC",4),?42,$J("ORDERS",6),?50,$J("RXS",6),?58,$J("REL",6)
W ?66,$J("DISP",6),?74,$J("UNREL",6)
W ! F X=0:1:79 W "-"
S LCNT=8
PRT ;
Q:$G(NODE)=""!($G(STOP)=1)
S XXC=1,STOP=0
;W !,$J((F_"-"_B),10),?12,$E($P(NODE,"^",7),1,16),?30,$J($S($P(NODE,U,3)=0:"NO",1:"YES"),4)
;W ?37,$J($P(NODE,U),5),?43,$J($P(NODE,U,2),6),?55,$J($P(NODE,U,4),6),?65,$J($P(NODE,U,5),6),?73,$J($P(NODE,U,6),6)
;W !,"TRANS #",?18,"DIVISION",?36,$J("PROC",6),?42,$J("ORDERS",6),?50,$J("RXS",6),?58,$J("REL",6)
W !,$J((F_"-"_B),15),?18,$E($P(NODE,"^",7),1,16),?36,$J($S($P(NODE,U,3)=0:"NO",1:"YES"),4)
W ?42,$J($P(NODE,U),6),?50,$J($P(NODE,U,2),6),?58,$J($P(NODE,U,4),6),?66,$J($P(NODE,U,5),6),?74,$J($P(NODE,U,6),6)
S LCNT=LCNT+1,GRX=$G(GRX)+$P(NODE,U,2),GCOM=$G(GCOM)+$P(NODE,U,4),GORD=$G(GORD)+$P(NODE,"^"),GND=$G(GND)+$P(NODE,"^",5),GUNREL=$G(GUNREL)+$P(NODE,"^",6)
K NODE
I $G(IOST)["C-" D
.I LCNT>$G(PGL) S DIR(0)="E" D ^DIR K DIR S:$G(Y)=0 STOP=1 Q:$G(STOP)>0
.G:LCNT>$G(PGL) HDR
I $G(IOST)'["C-" G:LCNT>$G(PGL) HDR
Q
GT ;
Q:$G(STOP)>0
W ! F I=0:1:79 W "-"
;W ?42,$J($P(NODE,U),6),?50,$J($P(NODE,U,2),6),?58,$J($P(NODE,U,4),6),?66,$J($P(NODE,U,5),6),?74,$J($P(NODE,U,6),6)
W !!,"TOTAL",?42,$J(TOR,6),?50,$J(TRX,6),?58,$J(TCO,6),?66,$J(TCA,6),?74,$J(TUN,6)
Q
TRN ;
Q:($P(^PSX(552.1,REC,0),U,2)=99)!($P(^(0),U,2)=5)
I $G(FAC1)>0 Q:($P(^PSX(552.1,REC,0),"-")'[$G(FAC1))
;S BAT=+$P(BF,"-",2),(X,FAC)=+BF,DIC="4",DIC(0)="MOXZ" D ^DIC S SNO=+Y,SITE=$P(Y,"^",2) S:SITE']"" SITE="UNKNOWN"
S AGNCY="VASTANUM"
S BAT=+$P(BF,"-",2),(X,FAC)=+BF S:$D(^PSX(552,"D",X)) X=$E(X,2,99),AGNCY="DMIS"
S Y=$$IEN^XUMF(4,AGNCY,X) S SNO=+Y,SITE=$$GET1^DIQ(4,Y,.01) S:SITE']"" SITE="UNKNOWN"
S ORD=$P(^PSX(552.1,REC,1),U,3),RXS=$P(^PSX(552.1,REC,1),U,4)
S PROC=$S(+$P(^PSX(552.1,REC,0),U,6):1,1:0),DIV=$P(^PSX(552.1,REC,"P"),"^")
S MST=$O(^PSX(552.4,"B",REC,0)) Q:'MST
S (RX,CA,CO,UN)=0 F S RX=$O(^PSX(552.4,MST,1,RX)) Q:'RX S RST=+$P(^PSX(552.4,MST,1,RX,0),U,2) S:RST=0 UN=UN+1 S:RST=1 CO=CO+1 S:RST=2 CA=CA+1
S ^TMP($J,"PSXSUM",SITE,FAC,BAT)=ORD_U_RXS_U_+$G(PROC)_U_CO_U_CA_U_UN_U_DIV
K ORD,RXS,PROC,CO,CA,UN,RST,RX,MST Q
PGBK I $G(IOST)["C-" S DIR(0)="E" D ^DIR S:$G(Y)=0 STOP=1 K DIR
Q
W @IOF Q
EXIT I $G(ALL) W !!,"GRAND TOTAL",?42,$J(GORD,6),?50,$J(GRX,6),?58,$J(GCOM,6),?66,$J(GND,6),?74,$J(GUNREL,6) D PGBK
EX2 I '$G(ALL) D PGBK
;W !!,"TOTAL RX's: ",$G(GRAND),?30,"TOTAL COMP: ",$G(GCOM) D PGBK
EX1 K TCO,TCA,TRX,TUN,BAT,BF,F,FAC,TOR,SITE,ST,SNO,LAST,REC,X,Y,B,END,S,START,ZTDESC,ZTDTH,ZTRTN,ZTSK,ZTSAVE,%ZIS,DTOUT,%DT,I,DIROUT,DIRUT,DTOUT,DUOUT,DIR,LCNT,NODE
K GRX,GCOM,GORD,GND,GUNREL,ALL,HDATE,SNAME,SP,SP1,FAC1,XX,XC,XXC,STOP
W @IOF
S:$D(ZTQUEUED) ZTREQ="@"
D ^%ZISC K:$D(IO("Q")) IO("Q")
Q
QUE I $D(IO("Q")) S ZTRTN="EN^PSXSMRY",ZTDESC="CMOP Activity Summary",ZTDTH="",ZTSAVE("START")="",ZTSAVE("ST")="",ZTSAVE("END")="",ZTSAVE("LAST")="",ZTSAVE("FAC1")="",ZTSAVE("PGL")=""
S ZTSAVE("GRX")="",ZTSAVE("GCOM")="",ZTSAVE("GORD")="",ZTSAVE("GND")="",ZTSAVE("GUNREL")="",ZTSAVE("ALL")=""
K IO("Q") D ^%ZTLOAD I $D(ZTSK)[0 W !,"Job cancelled!"
E W !,"REPORT Queued!"
G EX2
PSXSMRY ;BIR/BAB-CMOP Summary by Date ;04/08/97 2:06 PM
+1 ;;2.0;CMOP;**32,38**;11 Apr 97
+2 ;Reference to file #4 supported by DBIA #10090
+3 ;This routine will provide a summary report for a selected date range
+4 ;All Data Received,Processed,Query summary and Released
STRT KILL ^TMP($JOB,"PSXSUM")
+1 SET %DT="AEX"
SET %DT("A")="Enter to BEGIN SUMMARY: "
SET %DT(0)="-DT"
SET %DT("B")="TODAY"
DO ^%DT
KILL %DT("A")
IF Y<0!($DATA(DTOUT))
GOTO EX1
+2 SET START=Y
SET ST=Y-.0001
+3 SET %DT("A")="Enter date to END SUMMARY: "
SET %DT(0)="-DT"
SET %DT("B")="TODAY"
DO ^%DT
KILL %DT
IF Y<0!($DATA(DTOUT))
GOTO EX1
+4 SET (END,LAST)=Y
IF '(LAST#1)
SET LAST=Y+.9999
+5 IF END<START
WRITE !,"Ending date must follow starting date!"
GOTO STRT
+6 SET DIC=552
SET DIC(0)="AEQMZ"
SET DIC("A")="Select FACILITY or RETURN for all: "
+7 DO ^DIC
KILL DIC
IF $DATA(DUOUT)!($DATA(DTOUT))!(X["^")
GOTO EX1
+8 IF $GET(Y)'>0
SET ALL=1
SET FAC1=0
IF $GET(Y)'>0
GOTO DEV
+9 IF Y>0
SET FAC1=$$GET1^DIQ(552,+Y,5)
+10 ;getting site/div num
IF FAC1'>0
SET XX=$PIECE(Y,U,2)_","
SET FAC1=$$GET1^DIQ(4,XX,99)
+11 ;S:+Y>0 XX=$P(Y,"^",2) N X,Y S X=XX,DIC="4",DIC(0)="MOXZ" S:$D(^PSX(552,"D",X)) X=$E(X,2,99) D ^DIC S FAC1=+Y K DIC ;****DOD L1
+12 ;S:+Y>0 XX=$P(Y,"^",2) N X,Y S X=XX,AGNCY="VASTANUM" S:$D(^PSX(552,"D",X)) X=$E(X,2,99),AGNCY="DMIS" S FAC1=$$IEN^XUMF(4,AGNCY,X) K DIC,AGNCY ;****DOD L1
+13 ;S:$G(Y)'>0 FAC1=0 K Y,X,DIC,DUOUT,DTOUT
+14 KILL Y,X,DIC,DUOUT,DTOUT
DEV SET %ZIS="Q"
DO ^%ZIS
SET PGL=($GET(IOSL)-2)
IF POP
WRITE !,"No Device Selected!"
GOTO EX1
+1 IF $DATA(IO("Q"))
DO QUE
QUIT
+2 ;Called by Taskman to produce CMOP summary report
EN ;
+1 USE IO
SET XXC=0
+2 FOR
SET ST=$ORDER(^PSX(552.1,"AR",ST))
IF (ST>LAST)!(ST="")
QUIT
IF FAC1'>0
SET BF=""
IF FAC1>0
SET BF=FAC1_"-"_0
Begin DoDot:1
+3 FOR
SET BF=$ORDER(^PSX(552.1,"AR",ST,BF))
IF 'BF
QUIT
Begin DoDot:2
+4 SET REC=0
FOR
SET REC=$ORDER(^PSX(552.1,"AR",ST,BF,REC))
IF 'REC
QUIT
DO TRN
End DoDot:2
End DoDot:1
TOTALS ;
+1 IF $GET(STOP)=1
QUIT
+2 SET Y=START
XECUTE ^DD("DD")
SET START=Y
SET Y=END
XECUTE ^DD("DD")
SET END=Y
+3 SET HDATE="For "_START_" thru "_END
SET SP1=(80-$LENGTH(HDATE))/2
+4 IF '$DATA(^TMP($JOB,"PSXSUM"))
WRITE !,"No data for the report!"
DO PGBK
GOTO EX2
+5 SET S=""
FOR
SET S=$ORDER(^TMP($JOB,"PSXSUM",S))
IF S=""!($GET(STOP)=1)
QUIT
IF $GET(XXC)>0
DO PGBK
DO OUT
DO OUT1
+6 KILL ^TMP($JOB,"PSXSUM")
+7 IF $GET(STOP)>0
GOTO EX1
GOTO EXIT
OUT ;
+1 IF $GET(STOP)=1
QUIT
+2 SET SNAME="For "_$GET(S)
SET SP=(80-$LENGTH(SNAME))/2
+3 SET (TOR,TRX,TCO,TCA,TUN)=0
+4 SET F=0
FOR
SET F=$ORDER(^TMP($JOB,"PSXSUM",S,F))
IF 'F
QUIT
SET B=0
FOR
SET B=$ORDER(^TMP($JOB,"PSXSUM",S,F,B))
IF 'B
QUIT
SET TOR=TOR+$PIECE(^(B),U)
SET TRX=TRX+$PIECE(^(B),U,2)
SET TCO=TCO+$PIECE(^(B),U,4)
SET TCA=TCA+$PIECE(^(B),U,5)
SET TUN=TUN+$PIECE(^(B),U,6)
+5 QUIT
OUT1 ;
+1 IF $GET(STOP)=1
QUIT
+2 DO HDR
+3 SET F=0
FOR
SET F=$ORDER(^TMP($JOB,"PSXSUM",S,F))
IF 'F
QUIT
IF $GET(STOP)>0
QUIT
SET B=0
FOR
SET B=$ORDER(^TMP($JOB,"PSXSUM",S,F,B))
IF 'B
QUIT
SET NODE=$GET(^TMP($JOB,"PSXSUM",S,F,B))
DO PRT
+4 GOTO GT
HDR ;S Y=START X ^DD("DD") S START=Y S Y=END X ^DD("DD") S END=Y,LCNT=0
+1 SET LCNT=0
+2 WRITE @IOF,!!,?13,"CONSOLIDATED MAIL OUTPATIENT PHARMACY ACTIVITY SUMMARY"
+3 ;W !,?23,"From "_START_" thru "_END
+4 WRITE !,?SP1,HDATE
+5 WRITE !,?SP,$GET(SNAME),!!
+6 ;W !,"TRANS #",?12,"DIVISION",?30,"PROC",?36,"ORDERS",?46,"RXS",?53,"RELEASED",?63,"NOT DISP",?74,"UNREL"
+7 WRITE !,?66,$JUSTIFY("NOT",6)
+8 WRITE !,"TRANS #",?18,"DIVISION",?36,$JUSTIFY("PROC",4),?42,$JUSTIFY("ORDERS",6),?50,$JUSTIFY("RXS",6),?58,$JUSTIFY("REL",6)
+9 WRITE ?66,$JUSTIFY("DISP",6),?74,$JUSTIFY("UNREL",6)
+10 WRITE !
FOR X=0:1:79
WRITE "-"
+11 SET LCNT=8
PRT ;
+1 IF $GET(NODE)=""!($GET(STOP)=1)
QUIT
+2 SET XXC=1
SET STOP=0
+3 ;W !,$J((F_"-"_B),10),?12,$E($P(NODE,"^",7),1,16),?30,$J($S($P(NODE,U,3)=0:"NO",1:"YES"),4)
+4 ;W ?37,$J($P(NODE,U),5),?43,$J($P(NODE,U,2),6),?55,$J($P(NODE,U,4),6),?65,$J($P(NODE,U,5),6),?73,$J($P(NODE,U,6),6)
+5 ;W !,"TRANS #",?18,"DIVISION",?36,$J("PROC",6),?42,$J("ORDERS",6),?50,$J("RXS",6),?58,$J("REL",6)
+6 WRITE !,$JUSTIFY((F_"-"_B),15),?18,$EXTRACT($PIECE(NODE,"^",7),1,16),?36,$JUSTIFY($SELECT($PIECE(NODE,U,3)=0:"NO",1:"YES"),4)
+7 WRITE ?42,$JUSTIFY($PIECE(NODE,U),6),?50,$JUSTIFY($PIECE(NODE,U,2),6),?58,$JUSTIFY($PIECE(NODE,U,4),6),?66,$JUSTIFY($PIECE(NODE,U,5),6),?74,$JUSTIFY($PIECE(NODE,U,6),6)
+8 SET LCNT=LCNT+1
SET GRX=$GET(GRX)+$PIECE(NODE,U,2)
SET GCOM=$GET(GCOM)+$PIECE(NODE,U,4)
SET GORD=$GET(GORD)+$PIECE(NODE,"^")
SET GND=$GET(GND)+$PIECE(NODE,"^",5)
SET GUNREL=$GET(GUNREL)+$PIECE(NODE,"^",6)
+9 KILL NODE
+10 IF $GET(IOST)["C-"
Begin DoDot:1
+11 IF LCNT>$GET(PGL)
SET DIR(0)="E"
DO ^DIR
KILL DIR
IF $GET(Y)=0
SET STOP=1
IF $GET(STOP)>0
QUIT
+12 IF LCNT>$GET(PGL)
GOTO HDR
End DoDot:1
+13 IF $GET(IOST)'["C-"
IF LCNT>$GET(PGL)
GOTO HDR
+14 QUIT
GT ;
+1 IF $GET(STOP)>0
QUIT
+2 WRITE !
FOR I=0:1:79
WRITE "-"
+3 ;W ?42,$J($P(NODE,U),6),?50,$J($P(NODE,U,2),6),?58,$J($P(NODE,U,4),6),?66,$J($P(NODE,U,5),6),?74,$J($P(NODE,U,6),6)
+4 WRITE !!,"TOTAL",?42,$JUSTIFY(TOR,6),?50,$JUSTIFY(TRX,6),?58,$JUSTIFY(TCO,6),?66,$JUSTIFY(TCA,6),?74,$JUSTIFY(TUN,6)
+5 QUIT
TRN ;
+1 IF ($PIECE(^PSX(552.1,REC,0),U,2)=99)!($PIECE(^(0),U,2)=5)
QUIT
+2 IF $GET(FAC1)>0
IF ($PIECE(^PSX(552.1,REC,0),"-")'[$GET(FAC1))
QUIT
+3 ;S BAT=+$P(BF,"-",2),(X,FAC)=+BF,DIC="4",DIC(0)="MOXZ" D ^DIC S SNO=+Y,SITE=$P(Y,"^",2) S:SITE']"" SITE="UNKNOWN"
+4 SET AGNCY="VASTANUM"
+5 SET BAT=+$PIECE(BF,"-",2)
SET (X,FAC)=+BF
IF $DATA(^PSX(552,"D",X))
SET X=$EXTRACT(X,2,99)
SET AGNCY="DMIS"
+6 SET Y=$$IEN^XUMF(4,AGNCY,X)
SET SNO=+Y
SET SITE=$$GET1^DIQ(4,Y,.01)
IF SITE']""
SET SITE="UNKNOWN"
+7 SET ORD=$PIECE(^PSX(552.1,REC,1),U,3)
SET RXS=$PIECE(^PSX(552.1,REC,1),U,4)
+8 SET PROC=$SELECT(+$PIECE(^PSX(552.1,REC,0),U,6):1,1:0)
SET DIV=$PIECE(^PSX(552.1,REC,"P"),"^")
+9 SET MST=$ORDER(^PSX(552.4,"B",REC,0))
IF 'MST
QUIT
+10 SET (RX,CA,CO,UN)=0
FOR
SET RX=$ORDER(^PSX(552.4,MST,1,RX))
IF 'RX
QUIT
SET RST=+$PIECE(^PSX(552.4,MST,1,RX,0),U,2)
IF RST=0
SET UN=UN+1
IF RST=1
SET CO=CO+1
IF RST=2
SET CA=CA+1
+11 SET ^TMP($JOB,"PSXSUM",SITE,FAC,BAT)=ORD_U_RXS_U_+$GET(PROC)_U_CO_U_CA_U_UN_U_DIV
+12 KILL ORD,RXS,PROC,CO,CA,UN,RST,RX,MST
QUIT
PGBK IF $GET(IOST)["C-"
SET DIR(0)="E"
DO ^DIR
IF $GET(Y)=0
SET STOP=1
KILL DIR
+1 QUIT
+2 WRITE @IOF
QUIT
EXIT IF $GET(ALL)
WRITE !!,"GRAND TOTAL",?42,$JUSTIFY(GORD,6),?50,$JUSTIFY(GRX,6),?58,$JUSTIFY(GCOM,6),?66,$JUSTIFY(GND,6),?74,$JUSTIFY(GUNREL,6)
DO PGBK
EX2 IF '$GET(ALL)
DO PGBK
+1 ;W !!,"TOTAL RX's: ",$G(GRAND),?30,"TOTAL COMP: ",$G(GCOM) D PGBK
EX1 KILL TCO,TCA,TRX,TUN,BAT,BF,F,FAC,TOR,SITE,ST,SNO,LAST,REC,X,Y,B,END,S,START,ZTDESC,ZTDTH,ZTRTN,ZTSK,ZTSAVE,%ZIS,DTOUT,%DT,I,DIROUT,DIRUT,DTOUT,DUOUT,DIR,LCNT,NODE
+1 KILL GRX,GCOM,GORD,GND,GUNREL,ALL,HDATE,SNAME,SP,SP1,FAC1,XX,XC,XXC,STOP
+2 WRITE @IOF
+3 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+4 DO ^%ZISC
IF $DATA(IO("Q"))
KILL IO("Q")
+5 QUIT
QUE IF $DATA(IO("Q"))
SET ZTRTN="EN^PSXSMRY"
SET ZTDESC="CMOP Activity Summary"
SET ZTDTH=""
SET ZTSAVE("START")=""
SET ZTSAVE("ST")=""
SET ZTSAVE("END")=""
SET ZTSAVE("LAST")=""
SET ZTSAVE("FAC1")=""
SET ZTSAVE("PGL")=""
+1 SET ZTSAVE("GRX")=""
SET ZTSAVE("GCOM")=""
SET ZTSAVE("GORD")=""
SET ZTSAVE("GND")=""
SET ZTSAVE("GUNREL")=""
SET ZTSAVE("ALL")=""
+2 KILL IO("Q")
DO ^%ZTLOAD
IF $DATA(ZTSK)[0
WRITE !,"Job cancelled!"
+3 IF '$TEST
WRITE !,"REPORT Queued!"
+4 GOTO EX2