1 | XUTMD ;SEA/RDS - TaskMan: Option, XUTMDEL, Part 1 (Single) ;12/28/94 14:23
|
---|
2 | ;;8.0;KERNEL;;Jul 10, 1995
|
---|
3 | ;
|
---|
4 | ENV ;Establish Routine Environment
|
---|
5 | N DDH,DIR,X,Y,ZTENV,ZTKEY,ZTNAME,ZTSK,XUTMUCI
|
---|
6 | D ENV^XUTMUTL Q:'$D(ZTENV)
|
---|
7 | ;
|
---|
8 | SELECT ;Prompt User To Select Task Or Tasks To Delete
|
---|
9 | W !
|
---|
10 | S XUTMT(0)="AL" D ^XUTMT
|
---|
11 | I 'ZTSK K ^TMP($J,"XUTMT") Q
|
---|
12 | I ZTSK["-"!(ZTSK[",") D ^XUTMD1 Q:$D(DTOUT) G SELECT
|
---|
13 | S XUTMT=ZTSK,XUTMT(0)="R3" D ^XUTMT
|
---|
14 | ;
|
---|
15 | STATUS ;Report On Status Of Task And Whether User May Delete It
|
---|
16 | I $D(ZTSK(.11))#2,ZTSK(.11)="UNDEFINED",$O(ZTSK(.3))="" W !!?5,"That task is not defined.",$C(7) G SELECT
|
---|
17 | I $D(ZTSK(.11))#2,ZTSK(.11)="UNDEFINED",$O(ZTSK(.3))="TASK",$O(ZTSK("TASK"))="" W !!?5,"That task is running and has no record." G SELECT
|
---|
18 | I $D(ZTSK(.11))#2,ZTSK(.11)="UNDEFINED" W !!?5,"That task is scheduled but has no record." G CONFIRM:ZTKEY G SELECT
|
---|
19 | ;
|
---|
20 | S5 I $D(ZTSK(.11))#2,$O(ZTSK(.3))="" W !!?5,"That task's record is incomplete." G CONFIRM:ZTKEY G SELECT
|
---|
21 | I $D(ZTSK(.11))#2,$O(ZTSK(.3))="TASK",$O(ZTSK("TASK"))="" W !!?5,"That task is running and has an incomplete record." G SELECT
|
---|
22 | I $D(ZTSK(.11))#2 W !!?5,"That task is scheduled, but has an incomplete record." G CONFIRM:ZTKEY G SELECT
|
---|
23 | ;
|
---|
24 | S9 I $O(ZTSK(.3))="TASK",$O(ZTSK("TASK"))="" W !!?5,"That task is running." G SELECT
|
---|
25 | I 'ZTKEY,$S($P(ZTSK(0),U,11)_","_$P(ZTSK(0),U,12)=XUTMUCI:DUZ'=$P(ZTSK(0),U,3),1:ZTNAME'=$P(ZTSK(0),U,10)) W !!?5,"You may only delete your own tasks." G SELECT
|
---|
26 | ;
|
---|
27 | CONFIRM ;Prompt User To Confirm Unscheduling
|
---|
28 | I $S($D(ZTSK(.11))[0:1,1:ZTSK(.11)'="UNDEFINED") W ! D EN^XUTMTP(ZTSK)
|
---|
29 | W !
|
---|
30 | K DIR
|
---|
31 | S DIR(0)="Y"
|
---|
32 | S DIR("A")="Are you sure you want to delete this task"
|
---|
33 | S DIR("B")="NO"
|
---|
34 | S DIR("?")=" Answer YES to delete the task."
|
---|
35 | D ^DIR
|
---|
36 | I 'Y W !!?5,"Tasks NOT deleted!"
|
---|
37 | I $D(DTOUT) W $C(7) Q
|
---|
38 | K DIR,DIRUT,DTOUT,DUOUT
|
---|
39 | I 'Y G SELECT
|
---|
40 | ;
|
---|
41 | DELETE ;Delete Task
|
---|
42 | I $D(ZTSK(0))#2,ZTSK(0)["ZTSK^XQ1",$P(ZTSK(0),U,11)_","_$P(ZTSK(0),U,12)=XUTMUCI,$P(ZTSK(0),U,8)]"" D
|
---|
43 | . F DA=0:0 S DA=$O(^DIC(19.2,DA)) Q:DA'>0 I $G(^DIC(19.2,DA,1))=ZTSK D
|
---|
44 | . . N DIE S DIE="^DIC(19.2,",DR="2///@;12///@" D ^DIE Q
|
---|
45 | . Q
|
---|
46 | S XUTMT=ZTSK,XUTMT(0)="D" D ^XUTMT
|
---|
47 | W !!?5,"Deleted!"
|
---|
48 | G SELECT
|
---|
49 | ;
|
---|