AMQQRMT ; IHS/CMI/THL - TIME SERIES REPORT ;
;;2.0;IHS PCC SUITE;;MAY 14, 2009
;-----
I AMQQCCLS="V" G:$D(AMQP(1)) START Q
I '$D(AMQQHOLD)!('$D(AMQQUATN)) Q
S %=$P($G(^UTILITY("AMQQ",$J,"AG",AMQQUATN,AMQQHOLD)),U,3)
I '% Q
S AMQP(1)=%
START I '$D(AMQQTZ) S (AMQQTZ,AMQQTX)=0
S AMQQTZ=AMQQTZ+1
I IOST["C-",AMQQTZ>1 W $C(13),AMQQTZ I AMQQTX W " (",AMQQTX,")"
I AMQQTZ>1 D SET Q
I IOST["C-" W !!!!,"CRUNCH, CRUNCH....",!!
D PRE
D SET
EXIT K %,%H,%T,%Y,A,G,I,J,N
Q
;
FAIL S AMQQTX=AMQQTX+1
I AMQQTZ>1 W $C(13),AMQQTZ," (",AMQQTX,")"
Q
;
RANGE S AMQQTDS=AMQQTDS\1
S AMQQTDF=AMQQTDF\1
S (Z(1),Y)=AMQQTDS\1
X ^DD("DD")
S AMQQTDS=Y
S (Z(2),Y)=AMQQTDF\1
X ^DD("DD")
S AMQQTDF=Y
S Z(3)=Z(2)-Z(1)+1
S AMQQTDS=$P(AMQQTDS,",",2)
S AMQQTDF=$P(AMQQTDF,",",2)
S (Z,AMQQTY2)=1700+$E(Z(2),1,3)
S AMQQTY1=1700+$E(Z(1),1,3)
I Z(3)>6 S Z(3)=6
F I=1:1:Z(3) S $P(AMQQTCS,U,I)=(Z-I+1)
S AMQQTST=(+$E(Z(2),1,3)-5)*10000
S AMQQTNM=Z(3)*12
K Z
Q
;
PRE K ^UTILITY("AMQQ",$J,"TS")
S AMQQTGR="^UTILITY(""AMQQ"",$J,""TS"")"
S AMQQTTOT=0
Q
;
SET S %=+^AUPNVSIT(AMQP(1),0)
I %'["." D FAIL Q
I '$D(AMQQTDS) S AMQQTDS=%
I '$D(AMQQTDF) S AMQQTDF=%
I %<AMQQTDS S AMQQTDS=%
I %>AMQQTDF S AMQQTDF=%
S AMQQTMON=+$E(%,4,5),AMQQTYR=1700+$E(%,1,3)
S %=$G(@AMQQTGR@(AMQQTYR,AMQQTMON)),^(AMQQTMON)=%+1
S %=$G(@AMQQTGR@(AMQQTYR)),^(AMQQTYR)=%+1
S %=$G(@AMQQTGR@(AMQQTMON)),^(AMQQTMON)=%+1
S AMQQTTOT=AMQQTTOT+1
Q
;
PRINT I '$D(AMQQTDS) G PEXIT
D RANGE
D HEADER
F AMQQTMON=1:1:12 D
.W !,$P("JANUARY^FEBRUARY^MARCH^APRIL^MAY^JUNE^JULY^AUGUST^SEPTEMBER^OCTOBER^NOVEMBER^DECEMBER",U,AMQQTMON)
.S AMQQTAB=11 F AMQQTYR=AMQQTY2:-1:AMQQTY1 D
..W ?AMQQTAB,$J(+$G(@AMQQTGR@(AMQQTYR,AMQQTMON)),6) S AMQQTAB=AMQQTAB+11
..I AMQQTYR=AMQQTY1 W ?66,$J(+$G(@AMQQTGR@(AMQQTMON)),6)
W !!,"TOTAL"
S AMQQTAB=11
F AMQQTYR=AMQQTY2:-1:AMQQTY1 W ?AMQQTAB,$J(+$G(@AMQQTGR@(AMQQTYR)),6) S AMQQTAB=AMQQTAB+11 I AMQQTYR=AMQQTY1 W ?66,$J(AMQQTOT,6)
W !,"CUMUL."
S X=0
S AMQQTAB=11
F AMQQTYR=AMQQTY2:-1:AMQQTY1 S X=X+$G(@AMQQTGR@(AMQQTYR)) W ?AMQQTAB,$J(X,6) S AMQQTAB=AMQQTAB+11 I AMQQTYR=AMQQTY1 W ?66,$J(X,6)
W !,"AVG/MONTH"
S AMQQTAB=11
F AMQQTYR=AMQQTY2:-1:AMQQTY1 S X=+$G(@AMQQTGR@(AMQQTYR))\12 W ?AMQQTAB,$J(X,6) S AMQQTAB=AMQQTAB+11 I AMQQTYR=AMQQTY1 W ?66,$J((AMQQTOT\AMQQTNM),6)
I IOST'?1"C-".E W @IOF D ^%ZISC G PEXIT
D ^%ZISC
R !!,"<>",AMQQTY:DTIME
PEXIT K X,Y,Z,A,G,AMQQTZ,AMQQTX,AMQQTLIN,N,AMQQTAY,AMQQTTIM,AMQQTTOT,%H,%Y,%T,AMQQTY,AMQQTGR,AMQQTDS,AMQQTDF,AMQQTCS,AMQQTST,AMQQTY1,AMQQTY2,AMQQTNM,AMQQTMON,AMQQTYR,AMQQTAB,AMQQRMFL
Q
;
AVE S I=I+1
I '$P(AMQQTD,U,I) S %=0
E S %=@AMQQTGR@("C",I-1)/$P(AMQQTD,U,I)
S %=$J(%,1,1)
W ?J,%
Q
;
B1 S %=AMQQTLIN
S %=%*100
S X=%
S Y=%+59
S I=0
I %<1000 S X="0"_X,Y="0"_Y
I X="00" S X="0000",Y="0059"
W !,X,"-",Y
F J=16:8 W ?J,$S($D(@AMQQTGR@("A",AMQQTLIN,I)):^(I),1:".") S I=I+1 I I=7 W ?(J+8),@AMQQTGR@("B",AMQQTLIN) Q
Q
;
PAUSE I IOST["C-" R !,"<>",AMQQRQ:DTIME S:'$T!(AMQQRQ=U) AMQQTLIN=999999 K AMQQRQ
I AMQQTLIN=999999 Q
D HEADER
Q
;
W !,"TIME SERIES REPORT: ",AMQQTDS," to ",AMQQTDF,!!
S I=0
F X=13:11:60 S I=I+1 W ?X,$P(AMQQTCS,U,I)
W ?66,"TOTAL"
S AMQQTY=""
S $P(AMQQTY,"-",75)=""
W !,AMQQTY
K AMQQRI,AMQQRJ,AMQQTY
Q
;
TIMETASK S ZTRTN="TIMERUN^AMQQRMT"
S ZTIO=ION
S ZTDTH="NOW"
F I=1:1 S %=$P("AMQQRMFL;AMQV(;AMQQ200(;AMQQRV;AMQQNV;AMQQXV;^UTILITY(""AMQQ"",$J,;^UTILITY(""AMQQ RAND"",$J,;^UTILITY(""AMQQ TAX"",$J,",";",I) Q:%="" S ZTSAVE(%)=""
S ZTDESC="Q-MAN TIME-SERIES REPORT"
D ^%ZTLOAD
D ^%ZISC
W !!,$S($D(ZTSK):"Request queued!",1:"Request cancelled!"),!!!
H 3
Q
;
TIME ; ENTRY POINT FROM AMQQCMPL
D DEV
I $D(AMQQQUIT) Q
S AMQQRMFL="^AMQQRMT"
I $D(IO("Q")) D TIMETASK D ^%ZISC W @IOF Q
U IO D TIMERUN D ^%ZISC
Q
;
DEV W !!!
S %ZIS="Q"
D ^%ZIS
I POP K DUOUT,DTOUT,POP S AMQQQUIT=""
D PRINT^AMQQSEC E W " <= Not a secure device!!",*7 G DEV
I $D(IO("Q")),IO=IO(0) W !!,"You can not queue a job to a slave printer..Try again",!!,*7 G DEV
Q
;
TIMERUN W @IOF
X AMQV(0)
D PRINT
I IOST["P-" W @IOF
I $D(ZTQUEUED) D EXIT2^AMQQKILL S ZTREQ="@"
Q
;
AMQQRMT ; IHS/CMI/THL - TIME SERIES REPORT ;
+1 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
+2 ;-----
+3 IF AMQQCCLS="V"
IF $DATA(AMQP(1))
GOTO START
QUIT
+4 IF '$DATA(AMQQHOLD)!('$DATA(AMQQUATN))
QUIT
+5 SET %=$PIECE($GET(^UTILITY("AMQQ",$JOB,"AG",AMQQUATN,AMQQHOLD)),U,3)
+6 IF '%
QUIT
+7 SET AMQP(1)=%
START IF '$DATA(AMQQTZ)
SET (AMQQTZ,AMQQTX)=0
+1 SET AMQQTZ=AMQQTZ+1
+2 IF IOST["C-"
IF AMQQTZ>1
WRITE $CHAR(13),AMQQTZ
IF AMQQTX
WRITE " (",AMQQTX,")"
+3 IF AMQQTZ>1
DO SET
QUIT
+4 IF IOST["C-"
WRITE !!!!,"CRUNCH, CRUNCH....",!!
+5 DO PRE
+6 DO SET
EXIT KILL %,%H,%T,%Y,A,G,I,J,N
+1 QUIT
+2 ;
FAIL SET AMQQTX=AMQQTX+1
+1 IF AMQQTZ>1
WRITE $CHAR(13),AMQQTZ," (",AMQQTX,")"
+2 QUIT
+3 ;
RANGE SET AMQQTDS=AMQQTDS\1
+1 SET AMQQTDF=AMQQTDF\1
+2 SET (Z(1),Y)=AMQQTDS\1
+3 XECUTE ^DD("DD")
+4 SET AMQQTDS=Y
+5 SET (Z(2),Y)=AMQQTDF\1
+6 XECUTE ^DD("DD")
+7 SET AMQQTDF=Y
+8 SET Z(3)=Z(2)-Z(1)+1
+9 SET AMQQTDS=$PIECE(AMQQTDS,",",2)
+10 SET AMQQTDF=$PIECE(AMQQTDF,",",2)
+11 SET (Z,AMQQTY2)=1700+$EXTRACT(Z(2),1,3)
+12 SET AMQQTY1=1700+$EXTRACT(Z(1),1,3)
+13 IF Z(3)>6
SET Z(3)=6
+14 FOR I=1:1:Z(3)
SET $PIECE(AMQQTCS,U,I)=(Z-I+1)
+15 SET AMQQTST=(+$EXTRACT(Z(2),1,3)-5)*10000
+16 SET AMQQTNM=Z(3)*12
+17 KILL Z
+18 QUIT
+19 ;
PRE KILL ^UTILITY("AMQQ",$JOB,"TS")
+1 SET AMQQTGR="^UTILITY(""AMQQ"",$J,""TS"")"
+2 SET AMQQTTOT=0
+3 QUIT
+4 ;
SET SET %=+^AUPNVSIT(AMQP(1),0)
+1 IF %'["."
DO FAIL
QUIT
+2 IF '$DATA(AMQQTDS)
SET AMQQTDS=%
+3 IF '$DATA(AMQQTDF)
SET AMQQTDF=%
+4 IF %<AMQQTDS
SET AMQQTDS=%
+5 IF %>AMQQTDF
SET AMQQTDF=%
+6 SET AMQQTMON=+$EXTRACT(%,4,5)
SET AMQQTYR=1700+$EXTRACT(%,1,3)
+7 SET %=$GET(@AMQQTGR@(AMQQTYR,AMQQTMON))
SET ^(AMQQTMON)=%+1
+8 SET %=$GET(@AMQQTGR@(AMQQTYR))
SET ^(AMQQTYR)=%+1
+9 SET %=$GET(@AMQQTGR@(AMQQTMON))
SET ^(AMQQTMON)=%+1
+10 SET AMQQTTOT=AMQQTTOT+1
+11 QUIT
+12 ;
PRINT IF '$DATA(AMQQTDS)
GOTO PEXIT
+1 DO RANGE
+2 DO HEADER
+3 FOR AMQQTMON=1:1:12
Begin DoDot:1
+4 WRITE !,$PIECE("JANUARY^FEBRUARY^MARCH^APRIL^MAY^JUNE^JULY^AUGUST^SEPTEMBER^OCTOBER^NOVEMBER^DECEMBER",U,AMQQTMON)
+5 SET AMQQTAB=11
FOR AMQQTYR=AMQQTY2:-1:AMQQTY1
Begin DoDot:2
+6 WRITE ?AMQQTAB,$JUSTIFY(+$GET(@AMQQTGR@(AMQQTYR,AMQQTMON)),6)
SET AMQQTAB=AMQQTAB+11
+7 IF AMQQTYR=AMQQTY1
WRITE ?66,$JUSTIFY(+$GET(@AMQQTGR@(AMQQTMON)),6)
End DoDot:2
End DoDot:1
+8 WRITE !!,"TOTAL"
+9 SET AMQQTAB=11
+10 FOR AMQQTYR=AMQQTY2:-1:AMQQTY1
WRITE ?AMQQTAB,$JUSTIFY(+$GET(@AMQQTGR@(AMQQTYR)),6)
SET AMQQTAB=AMQQTAB+11
IF AMQQTYR=AMQQTY1
WRITE ?66,$JUSTIFY(AMQQTOT,6)
+11 WRITE !,"CUMUL."
+12 SET X=0
+13 SET AMQQTAB=11
+14 FOR AMQQTYR=AMQQTY2:-1:AMQQTY1
SET X=X+$GET(@AMQQTGR@(AMQQTYR))
WRITE ?AMQQTAB,$JUSTIFY(X,6)
SET AMQQTAB=AMQQTAB+11
IF AMQQTYR=AMQQTY1
WRITE ?66,$JUSTIFY(X,6)
+15 WRITE !,"AVG/MONTH"
+16 SET AMQQTAB=11
+17 FOR AMQQTYR=AMQQTY2:-1:AMQQTY1
SET X=+$GET(@AMQQTGR@(AMQQTYR))\12
WRITE ?AMQQTAB,$JUSTIFY(X,6)
SET AMQQTAB=AMQQTAB+11
IF AMQQTYR=AMQQTY1
WRITE ?66,$JUSTIFY((AMQQTOT\AMQQTNM),6)
+18 IF IOST'?1"C-".E
WRITE @IOF
DO ^%ZISC
GOTO PEXIT
+19 DO ^%ZISC
+20 READ !!,"<>",AMQQTY:DTIME
PEXIT KILL X,Y,Z,A,G,AMQQTZ,AMQQTX,AMQQTLIN,N,AMQQTAY,AMQQTTIM,AMQQTTOT,%H,%Y,%T,AMQQTY,AMQQTGR,AMQQTDS,AMQQTDF,AMQQTCS,AMQQTST,AMQQTY1,AMQQTY2,AMQQTNM,AMQQTMON,AMQQTYR,AMQQTAB,AMQQRMFL
+1 QUIT
+2 ;
AVE SET I=I+1
+1 IF '$PIECE(AMQQTD,U,I)
SET %=0
+2 IF '$TEST
SET %=@AMQQTGR@("C",I-1)/$PIECE(AMQQTD,U,I)
+3 SET %=$JUSTIFY(%,1,1)
+4 WRITE ?J,%
+5 QUIT
+6 ;
B1 SET %=AMQQTLIN
+1 SET %=%*100
+2 SET X=%
+3 SET Y=%+59
+4 SET I=0
+5 IF %<1000
SET X="0"_X
SET Y="0"_Y
+6 IF X="00"
SET X="0000"
SET Y="0059"
+7 WRITE !,X,"-",Y
+8 FOR J=16:8
WRITE ?J,$SELECT($DATA(@AMQQTGR@("A",AMQQTLIN,I)):^(I),1:".")
SET I=I+1
IF I=7
WRITE ?(J+8),@AMQQTGR@("B",AMQQTLIN)
QUIT
+9 QUIT
+10 ;
PAUSE IF IOST["C-"
READ !,"<>",AMQQRQ:DTIME
IF '$TEST!(AMQQRQ=U)
SET AMQQTLIN=999999
KILL AMQQRQ
+1 IF AMQQTLIN=999999
QUIT
+2 DO HEADER
+3 QUIT
+4 ;
+1 WRITE !,"TIME SERIES REPORT: ",AMQQTDS," to ",AMQQTDF,!!
+2 SET I=0
+3 FOR X=13:11:60
SET I=I+1
WRITE ?X,$PIECE(AMQQTCS,U,I)
+4 WRITE ?66,"TOTAL"
+5 SET AMQQTY=""
+6 SET $PIECE(AMQQTY,"-",75)=""
+7 WRITE !,AMQQTY
+8 KILL AMQQRI,AMQQRJ,AMQQTY
+9 QUIT
+10 ;
TIMETASK SET ZTRTN="TIMERUN^AMQQRMT"
+1 SET ZTIO=ION
+2 SET ZTDTH="NOW"
+3 FOR I=1:1
SET %=$PIECE("AMQQRMFL;AMQV(;AMQQ200(;AMQQRV;AMQQNV;AMQQXV;^UTILITY(""AMQQ"",$J,;^UTILITY(""AMQQ RAND"",$J,;^UTILITY(""AMQQ TAX"",$J,",";",I)
IF %=""
QUIT
SET ZTSAVE(%)=""
+4 SET ZTDESC="Q-MAN TIME-SERIES REPORT"
+5 DO ^%ZTLOAD
+6 DO ^%ZISC
+7 WRITE !!,$SELECT($DATA(ZTSK):"Request queued!",1:"Request cancelled!"),!!!
+8 HANG 3
+9 QUIT
+10 ;
TIME ; ENTRY POINT FROM AMQQCMPL
+1 DO DEV
+2 IF $DATA(AMQQQUIT)
QUIT
+3 SET AMQQRMFL="^AMQQRMT"
+4 IF $DATA(IO("Q"))
DO TIMETASK
DO ^%ZISC
WRITE @IOF
QUIT
+5 USE IO
DO TIMERUN
DO ^%ZISC
+6 QUIT
+7 ;
DEV WRITE !!!
+1 SET %ZIS="Q"
+2 DO ^%ZIS
+3 IF POP
KILL DUOUT,DTOUT,POP
SET AMQQQUIT=""
+4 DO PRINT^AMQQSEC
IF '$TEST
WRITE " <= Not a secure device!!",*7
GOTO DEV
+5 IF $DATA(IO("Q"))
IF IO=IO(0)
WRITE !!,"You can not queue a job to a slave printer..Try again",!!,*7
GOTO DEV
+6 QUIT
+7 ;
TIMERUN WRITE @IOF
+1 XECUTE AMQV(0)
+2 DO PRINT
+3 IF IOST["P-"
WRITE @IOF
+4 IF $DATA(ZTQUEUED)
DO EXIT2^AMQQKILL
SET ZTREQ="@"
+5 QUIT
+6 ;