XUTMQ0 ;SEA/RDS - TaskMan: Option, ZTMINQ, Part 2 (Modules) ;4/20/95 10:33 [ 04/02/2003 8:29 AM ]
;;8.0;KERNEL;**1002,1003,1004,1005,1007**;APR 1, 2003
;;8.0;KERNEL;;Jul 10, 1995
;
ENTRY G ^XUTMQ
;
ALL ;BRANCH^XUTMQ--all of one user's tasks.
;input: ZTKEY,ZTNAME,XUTMUCI
N DIR,DIRUT,DTOUT,DUOUT,X,ZT1,ZT2,ZT3,ZTC,ZTDUZ,ZTF,ZTH,ZTI,ZTOUT
N ZTREC,ZTS,ZTUSER K ^TMP($J)
S ZTC=0,ZTF=1,ZTH="All tasks created by ",ZTOUT=0
D KEY I ZTOUT Q
A1 ;
S ZTS=0 F ZTI=1:1 S ZTS=$O(^%ZTSK(ZTS)) Q:'ZTS D
.I '(ZTI#100) W "."
.I ZTI=10000 D
..W !!,$C(7),$C(7)
..W "You need to run XUTMQCLEAN more often or keep fewer tasks each run."
..W !,"Still searching..."
..Q
.I $$MATCH(ZTS,ZTDUZ,ZTUSER) D SORT(+$P($G(^%ZTSK(ZTS,0)),U,6),ZTS)
.Q
A2 ;
S ZTS=0 F S ZTS=$O(^%ZTSCH("TASK",ZTS)) Q:'ZTS D
.I $D(^%ZTSK(ZTS,0))#2 Q
.S ZTREC=$G(^%ZTSCH("TASK",ZTS))
.I ZTREC="" Q
.I $P(ZTREC,U,9)'=ZTDUZ,$P(ZTREC,U,9)'=ZTUSER Q
.D SORT($H,ZTS)
.Q
A3 ;
W "finished!",!
G:$O(^TMP($J,0))="" A4
S ZTSAVE("^TMP($J,")="" D EN^XUTMDEVQ("LIST^XUTMQ","TASK LIST",.ZTSAVE)
K ^TMP($J)
Q
S ZT1="" F S ZT1=$O(^TMP($J,ZT1),-1) Q:ZT1="" D I ZTOUT Q
. S ZTS=0 F S ZTS=$O(^TMP($J,ZT1,ZTS)) Q:'ZTS D I ZTOUT Q
.. D PRINT
.Q
I ZTOUT Q
A4 ;
I 'ZTC W !! D W " no tasks in this volume set's Task file.",!
.I ZTKEY W ZTUSER," has"
.E W "You have"
W !
S DIR(0)="E"
S DIR("A")="Press RETURN to continue" I ZTC D
.S DIR("A")="End of listing. "_DIR("A")
D ^DIR K ^TMP($J) Q
;
FUT ;BRANCH^XUTMQ--one user's future tasks.
;input: ZTKEY,ZTNAME,XUTMUCI
N DIR,DIRUT,DTOUT,DUOUT,X,ZT,ZT1,ZT2,ZT3,ZTC,ZTDUZ,ZTF,ZTH,ZTOUT
N ZTREC,ZTS,ZTUSER K ^TMP($J)
S X=0,ZTC=0,ZTF=1,ZTH="Scheduled and waiting tasks created by ",ZTOUT=0
D KEY I ZTOUT Q
;
F1 S ZT1=0 F S ZT1=$O(^%ZTSCH("JOB",ZT1)) Q:ZT1'>0 D
.S ZTS=0 F S ZTS=$O(^%ZTSCH("JOB",ZT1,ZTS)) Q:ZTS="" D
..I $$MATCH(ZTS,ZTDUZ,ZTUSER) D SORT(ZT1,ZTS)
.Q
;
F2 S ZT1=0 F S ZT1=$O(^%ZTSCH(ZT1)) Q:'ZT1 D
.S ZTS=0 F S ZTS=$O(^%ZTSCH(ZT1,ZTS)) Q:'ZTS D
..I $$MATCH(ZTS,ZTDUZ,ZTUSER) D SORT(ZT1,ZTS)
.Q
;
F3 S ZT1="" F S ZT1=$O(^%ZTSCH("IO",ZT1)) Q:ZT1="" D
.S ZT2="" F S ZT2=$O(^%ZTSCH("IO",ZT1,ZT2)) Q:'ZT2 D
..S ZTS="" F S ZTS=$O(^%ZTSCH("IO",ZT1,ZT2,ZTS)) Q:ZTS="" D
...I $$MATCH(ZTS,ZTDUZ,ZTUSER) D SORT(ZT2,ZTS)
.Q
;
F4 S ZT1="" F S ZT1=$O(^%ZTSCH("LINK",ZT1)) Q:ZT1="" D
.S ZT2="" F S ZT2=$O(^%ZTSCH("LINK",ZT1,ZT2)) Q:'ZT2 D
..S ZTS=0 F S ZTS=$O(^%ZTSCH("LINK",ZT1,ZT2,ZTS)) Q:'ZTS D
...I $$MATCH(ZTS,ZTDUZ,ZTUSER) D SORT(ZT2,ZTS)
.Q
W "finished!",!
;
F5 ;
G:$O(^TMP($J,0))="" F6
S ZTSAVE("^TMP($J,")="" D EN^XUTMDEVQ("LIST^XUTMQ","TASK LIST",.ZTSAVE)
K ^TMP($J)
Q
S ZT1="" F S ZT1=$O(^TMP($J,ZT1),-1) Q:ZT1="" D I ZTOUT Q
. S ZTS=0 F S ZTS=$O(^TMP($J,ZT1,ZTS)) Q:'ZTS D I ZTOUT Q
.. D PRINT
. Q
I ZTOUT Q
;
F6 I 'ZTC W !! D
.I ZTKEY W ZTUSER," has"
.E W "You have"
.W " no scheduled or waiting tasks in this volume set's Task File.",!
W ! S DIR(0)="E"
S DIR("A")="Press RETURN to continue" I ZTC D
.S DIR("A")="End of listing. "_DIR("A")
D ^DIR K ^TMP($J) Q
;
KEY ;ALL/FUT--set up variables for chosen user
;input: ZTKEY,ZTNAME
;input/output: ZTH,ZTOUT
;output: ZTDUZ,ZTUSER
N DIR,DIRUT,DTOUT,DUOUT,X,Y
I 'ZTKEY S ZTDUZ=DUZ,ZTUSER=ZTNAME,ZTH=ZTH_"you." Q
W !!,"Select the user whose tasks you wish to see.",!!
S DIR(0)="P^200:AEMNQ"
S DIR("B")=ZTNAME
S DIR("?")="Select the user whose tasks you wish to see."
K D ^DIR K DIR
I $D(DTOUT) W " ** TIMEOUT **",$C(7)
I $D(DUOUT) W " ** ^ ESCAPE **"
I $D(DIRUT) S ZTOUT=1 Q
W !!,"Please wait while I search for the tasks...searching..."
S ZTDUZ=$P(Y,U),ZTUSER=$P(Y,U,2)
I ZTUSER'=ZTNAME S ZTH=ZTH_$P(ZTUSER,",",2,999)_" "_$P(ZTUSER,",")_"."
E S ZTH=ZTH_"you."
Q
;
MATCH(ZTS,ZTDUZ,ZTREC) ;
;ALL/FUT--determine whether task was created by user
;input: task #, user #, user name
;output: Boolean, does task belong to user?
S ZTREC=$G(^%ZTSK(ZTS,0))
I ZTREC="" Q 0
I $P(ZTREC,U,3)'=ZTDUZ Q 0
I $P(ZTREC,U,10)="" Q 1
Q $P(ZTREC,U,10)=ZTUSER
;
SORT(ZTDTH,ZTSK) ;
;ALL/FUT--sort task by start time.
;input: start time, task number
;output: ^TMP($J) node
I ZTDTH["," S ZTDTH=$$H3^%ZTM(ZTDTH)
S ^TMP($J,ZTDTH,ZTSK)=""
Q
;
PRINT ;ALL/FUT--print a task
;input: ZTH,ZTKEY,ZTNAME,ZTS,XUTMUCI
;input/output: ZTC,ZTF
;output: ZTOUT
N DIR,DIRUT,DTOUT,DUOUT,X,Y,ZTSK
I 'ZTC W @IOF,!,ZTH,!
I 'ZTF W !,"-------------------------------------------------------------------------------"
S ZTF=0
D EN^XUTMTP(ZTS)
I $Y'>18 S ZTC=ZTC+1 Q
W ! S ZTF=1,DIR(0)="E" D ^DIR
S ZTOUT=$D(DTOUT)!$D(DUOUT) I ZTOUT Q
W @IOF Q
;
XUTMQ0 ;SEA/RDS - TaskMan: Option, ZTMINQ, Part 2 (Modules) ;4/20/95 10:33 [ 04/02/2003 8:29 AM ]
+1 ;;8.0;KERNEL;**1002,1003,1004,1005,1007**;APR 1, 2003
+2 ;;8.0;KERNEL;;Jul 10, 1995
+3 ;
ENTRY GOTO ^XUTMQ
+1 ;
ALL ;BRANCH^XUTMQ--all of one user's tasks.
+1 ;input: ZTKEY,ZTNAME,XUTMUCI
+2 NEW DIR,DIRUT,DTOUT,DUOUT,X,ZT1,ZT2,ZT3,ZTC,ZTDUZ,ZTF,ZTH,ZTI,ZTOUT
+3 NEW ZTREC,ZTS,ZTUSER
KILL ^TMP($JOB)
+4 SET ZTC=0
SET ZTF=1
SET ZTH="All tasks created by "
SET ZTOUT=0
+5 DO KEY
IF ZTOUT
QUIT
A1 ;
+1 SET ZTS=0
FOR ZTI=1:1
SET ZTS=$ORDER(^%ZTSK(ZTS))
IF 'ZTS
QUIT
Begin DoDot:1
+2 IF '(ZTI#100)
WRITE "."
+3 IF ZTI=10000
Begin DoDot:2
+4 WRITE !!,$CHAR(7),$CHAR(7)
+5 WRITE "You need to run XUTMQCLEAN more often or keep fewer tasks each run."
+6 WRITE !,"Still searching..."
+7 QUIT
End DoDot:2
+8 IF $$MATCH(ZTS,ZTDUZ,ZTUSER)
DO SORT(+$PIECE($GET(^%ZTSK(ZTS,0)),U,6),ZTS)
+9 QUIT
End DoDot:1
A2 ;
+1 SET ZTS=0
FOR
SET ZTS=$ORDER(^%ZTSCH("TASK",ZTS))
IF 'ZTS
QUIT
Begin DoDot:1
+2 IF $DATA(^%ZTSK(ZTS,0))#2
QUIT
+3 SET ZTREC=$GET(^%ZTSCH("TASK",ZTS))
+4 IF ZTREC=""
QUIT
+5 IF $PIECE(ZTREC,U,9)'=ZTDUZ
IF $PIECE(ZTREC,U,9)'=ZTUSER
QUIT
+6 DO SORT($HOROLOG,ZTS)
+7 QUIT
End DoDot:1
A3 ;
+1 WRITE "finished!",!
+2 IF $ORDER(^TMP($JOB,0))=""
GOTO A4
+3 SET ZTSAVE("^TMP($J,")=""
DO EN^XUTMDEVQ("LIST^XUTMQ","TASK LIST",.ZTSAVE)
+4 KILL ^TMP($JOB)
+5 QUIT
+6 SET ZT1=""
FOR
SET ZT1=$ORDER(^TMP($JOB,ZT1),-1)
IF ZT1=""
QUIT
Begin DoDot:1
+7 SET ZTS=0
FOR
SET ZTS=$ORDER(^TMP($JOB,ZT1,ZTS))
IF 'ZTS
QUIT
Begin DoDot:2
+8 DO PRINT
End DoDot:2
IF ZTOUT
QUIT
+9 QUIT
End DoDot:1
IF ZTOUT
QUIT
+10 IF ZTOUT
QUIT
A4 ;
+1 IF 'ZTC
WRITE !!
Begin DoDot:1
+2 IF ZTKEY
WRITE ZTUSER," has"
+3 IF '$TEST
WRITE "You have"
End DoDot:1
WRITE " no tasks in this volume set's Task file.",!
+4 WRITE !
+5 SET DIR(0)="E"
+6 SET DIR("A")="Press RETURN to continue"
IF ZTC
Begin DoDot:1
+7 SET DIR("A")="End of listing. "_DIR("A")
End DoDot:1
+8 DO ^DIR
KILL ^TMP($JOB)
QUIT
+9 ;
FUT ;BRANCH^XUTMQ--one user's future tasks.
+1 ;input: ZTKEY,ZTNAME,XUTMUCI
+2 NEW DIR,DIRUT,DTOUT,DUOUT,X,ZT,ZT1,ZT2,ZT3,ZTC,ZTDUZ,ZTF,ZTH,ZTOUT
+3 NEW ZTREC,ZTS,ZTUSER
KILL ^TMP($JOB)
+4 SET X=0
SET ZTC=0
SET ZTF=1
SET ZTH="Scheduled and waiting tasks created by "
SET ZTOUT=0
+5 DO KEY
IF ZTOUT
QUIT
+6 ;
F1 SET ZT1=0
FOR
SET ZT1=$ORDER(^%ZTSCH("JOB",ZT1))
IF ZT1'>0
QUIT
Begin DoDot:1
+1 SET ZTS=0
FOR
SET ZTS=$ORDER(^%ZTSCH("JOB",ZT1,ZTS))
IF ZTS=""
QUIT
Begin DoDot:2
+2 IF $$MATCH(ZTS,ZTDUZ,ZTUSER)
DO SORT(ZT1,ZTS)
End DoDot:2
+3 QUIT
End DoDot:1
+4 ;
F2 SET ZT1=0
FOR
SET ZT1=$ORDER(^%ZTSCH(ZT1))
IF 'ZT1
QUIT
Begin DoDot:1
+1 SET ZTS=0
FOR
SET ZTS=$ORDER(^%ZTSCH(ZT1,ZTS))
IF 'ZTS
QUIT
Begin DoDot:2
+2 IF $$MATCH(ZTS,ZTDUZ,ZTUSER)
DO SORT(ZT1,ZTS)
End DoDot:2
+3 QUIT
End DoDot:1
+4 ;
F3 SET ZT1=""
FOR
SET ZT1=$ORDER(^%ZTSCH("IO",ZT1))
IF ZT1=""
QUIT
Begin DoDot:1
+1 SET ZT2=""
FOR
SET ZT2=$ORDER(^%ZTSCH("IO",ZT1,ZT2))
IF 'ZT2
QUIT
Begin DoDot:2
+2 SET ZTS=""
FOR
SET ZTS=$ORDER(^%ZTSCH("IO",ZT1,ZT2,ZTS))
IF ZTS=""
QUIT
Begin DoDot:3
+3 IF $$MATCH(ZTS,ZTDUZ,ZTUSER)
DO SORT(ZT2,ZTS)
End DoDot:3
End DoDot:2
+4 QUIT
End DoDot:1
+5 ;
F4 SET ZT1=""
FOR
SET ZT1=$ORDER(^%ZTSCH("LINK",ZT1))
IF ZT1=""
QUIT
Begin DoDot:1
+1 SET ZT2=""
FOR
SET ZT2=$ORDER(^%ZTSCH("LINK",ZT1,ZT2))
IF 'ZT2
QUIT
Begin DoDot:2
+2 SET ZTS=0
FOR
SET ZTS=$ORDER(^%ZTSCH("LINK",ZT1,ZT2,ZTS))
IF 'ZTS
QUIT
Begin DoDot:3
+3 IF $$MATCH(ZTS,ZTDUZ,ZTUSER)
DO SORT(ZT2,ZTS)
End DoDot:3
End DoDot:2
+4 QUIT
End DoDot:1
+5 WRITE "finished!",!
+6 ;
F5 ;
+1 IF $ORDER(^TMP($JOB,0))=""
GOTO F6
+2 SET ZTSAVE("^TMP($J,")=""
DO EN^XUTMDEVQ("LIST^XUTMQ","TASK LIST",.ZTSAVE)
+3 KILL ^TMP($JOB)
+4 QUIT
+5 SET ZT1=""
FOR
SET ZT1=$ORDER(^TMP($JOB,ZT1),-1)
IF ZT1=""
QUIT
Begin DoDot:1
+6 SET ZTS=0
FOR
SET ZTS=$ORDER(^TMP($JOB,ZT1,ZTS))
IF 'ZTS
QUIT
Begin DoDot:2
+7 DO PRINT
End DoDot:2
IF ZTOUT
QUIT
+8 QUIT
End DoDot:1
IF ZTOUT
QUIT
+9 IF ZTOUT
QUIT
+10 ;
F6 IF 'ZTC
WRITE !!
Begin DoDot:1
+1 IF ZTKEY
WRITE ZTUSER," has"
+2 IF '$TEST
WRITE "You have"
+3 WRITE " no scheduled or waiting tasks in this volume set's Task File.",!
End DoDot:1
+4 WRITE !
SET DIR(0)="E"
+5 SET DIR("A")="Press RETURN to continue"
IF ZTC
Begin DoDot:1
+6 SET DIR("A")="End of listing. "_DIR("A")
End DoDot:1
+7 DO ^DIR
KILL ^TMP($JOB)
QUIT
+8 ;
KEY ;ALL/FUT--set up variables for chosen user
+1 ;input: ZTKEY,ZTNAME
+2 ;input/output: ZTH,ZTOUT
+3 ;output: ZTDUZ,ZTUSER
+4 NEW DIR,DIRUT,DTOUT,DUOUT,X,Y
+5 IF 'ZTKEY
SET ZTDUZ=DUZ
SET ZTUSER=ZTNAME
SET ZTH=ZTH_"you."
QUIT
+6 WRITE !!,"Select the user whose tasks you wish to see.",!!
+7 SET DIR(0)="P^200:AEMNQ"
+8 SET DIR("B")=ZTNAME
+9 SET DIR("?")="Select the user whose tasks you wish to see."
K DO ^DIR
KILL DIR
+1 IF $DATA(DTOUT)
WRITE " ** TIMEOUT **",$CHAR(7)
+2 IF $DATA(DUOUT)
WRITE " ** ^ ESCAPE **"
+3 IF $DATA(DIRUT)
SET ZTOUT=1
QUIT
+4 WRITE !!,"Please wait while I search for the tasks...searching..."
+5 SET ZTDUZ=$PIECE(Y,U)
SET ZTUSER=$PIECE(Y,U,2)
+6 IF ZTUSER'=ZTNAME
SET ZTH=ZTH_$PIECE(ZTUSER,",",2,999)_" "_$PIECE(ZTUSER,",")_"."
+7 IF '$TEST
SET ZTH=ZTH_"you."
+8 QUIT
+9 ;
MATCH(ZTS,ZTDUZ,ZTREC) ;
+1 ;ALL/FUT--determine whether task was created by user
+2 ;input: task #, user #, user name
+3 ;output: Boolean, does task belong to user?
+4 SET ZTREC=$GET(^%ZTSK(ZTS,0))
+5 IF ZTREC=""
QUIT 0
+6 IF $PIECE(ZTREC,U,3)'=ZTDUZ
QUIT 0
+7 IF $PIECE(ZTREC,U,10)=""
QUIT 1
+8 QUIT $PIECE(ZTREC,U,10)=ZTUSER
+9 ;
SORT(ZTDTH,ZTSK) ;
+1 ;ALL/FUT--sort task by start time.
+2 ;input: start time, task number
+3 ;output: ^TMP($J) node
+4 IF ZTDTH[","
SET ZTDTH=$$H3^%ZTM(ZTDTH)
+5 SET ^TMP($JOB,ZTDTH,ZTSK)=""
+6 QUIT
+7 ;
PRINT ;ALL/FUT--print a task
+1 ;input: ZTH,ZTKEY,ZTNAME,ZTS,XUTMUCI
+2 ;input/output: ZTC,ZTF
+3 ;output: ZTOUT
+4 NEW DIR,DIRUT,DTOUT,DUOUT,X,Y,ZTSK
+5 IF 'ZTC
WRITE @IOF,!,ZTH,!
+6 IF 'ZTF
WRITE !,"-------------------------------------------------------------------------------"
+7 SET ZTF=0
+8 DO EN^XUTMTP(ZTS)
+9 IF $Y'>18
SET ZTC=ZTC+1
QUIT
+10 WRITE !
SET ZTF=1
SET DIR(0)="E"
DO ^DIR
+11 SET ZTOUT=$DATA(DTOUT)!$DATA(DUOUT)
IF ZTOUT
QUIT
+12 WRITE @IOF
QUIT
+13 ;