PSXDQUE ;BIR/WPB-Terminate Auto Processing ;[ 04/08/97 2:06 PM ]
;;2.0;CMOP;;11 Apr 97
DQ ;
G:'$D(^PSX(550,"AT")) DQ1
S REC=$O(^PSX(550,"AT",""))
S TASK=$P($G(^PSX(550,+PSXSYS,"T",REC,0)),U,7)
DQ1 I '$D(TASK) W !,"There isn't an automatic job queued to run under this option.",! G EXIT
S TIME=$$FMTE^XLFDT($P(^PSX(550,+PSXSYS,"T",REC,0),U,2),"1P"),FREQ=$P(^(0),U,3),THRU=$P(^(0),U,8)
S DIR(0)="Y",DIR("A",2)="Auto Transmissions are already scheduled.",DIR("A",3)="Current schedule began : "_TIME,DIR("A",4)="Number of days to transmit thru: "_$S($G(THRU)>0:$G(THRU),$G(THRU)'>0:0,1:0)
S DIR("A",5)="Next transmission scheduled for: "_$$FMTE^XLFDT($P(^PSX(550,+PSXSYS,"T",REC,0),"^",4),1),DIR("A",6)="Rescheduling Frequency : "_FREQ_$S(FREQ=1:" hour",FREQ>1:" hours",1:"")
S DIR("A",1)="",DIR("A",7)=""
S DIR("A")="Do you want to unschedule automatic processing ",DIR("B")="NO" D ^DIR K DIR G:Y=0!($D(DIRUT)) EXIT
S ZTSK=TASK,PSXZTSK="" D STAT^%ZTLOAD
I ZTSK(1)=2 W !,"This job is currently running, wait until the task has finished before stopping the job.",! Q
I ZTSK(1)'=2 D KILL^%ZTLOAD
I ZTSK(0)=0!(ZTSK(0)=1) L +^PSX(550,+PSXSYS,0):30 D G:'$T EXIT
.I '$T W !!,"The CMOP System file is in use, try later." Q
.S DA=REC,DA(1)=+PSXSYS,DIE="^PSX(550,"_+PSXSYS_",""T"",",DR=".01////2;6////@" D ^DIE L -^PSX(550,+PSXSYS,0) K DIE,DA,DR,PSXZTSK,REC,TREC,TASK W !,"Job Unscheduled.",!
I ZTSK(0)<1 W !,"This task does not exist." G EXIT
MSG D NOW^%DTC S (PSXDATE,DTE)=%,SITE=$P($G(PSXSYS),U,3),NAME=$P($G(^VA(200,DUZ,0)),U,1),TIME=$$FMTE^XLFDT(DTE,"1")
S XMDUZ=.5,XMSUB=("CMOP Auto-Transmission Terminated"),LCNT=5
D XMZ^XMA2 G:XMZ<1 MSG
S ^XMB(3.9,XMZ,2,1,0)="Cancellation of Auto-Transmission Schedule."
S ^XMB(3.9,XMZ,2,2,0)=""
S ^XMB(3.9,XMZ,2,3,0)="Facility : "_SITE
S ^XMB(3.9,XMZ,2,4,0)="Initiating Official: "_NAME
S ^XMB(3.9,XMZ,2,5,0)="Date Cancelled : "_$P(TIME,":",1,2)
S ^XMB(3.9,XMZ,2,0)="^3.92A^"_LCNT_U_LCNT_U_DT,XMDUN="CMOP Manager"
K XMY S XMDUZ=.5 D GRP^PSXNOTE,ENT1^XMD
S (PSXAUTO,PSXHOUR)=0 D SERV^PSXMISC
EXIT S PSXSTAT="H" D PSXSTAT^PSXRSYU
K TIME,STDATE,NUM,X,Y,PSXTRANS,PSXFLAG,FREQ,PSXZTSK,START,ZTSK,%,DAY,DTE,LCNT,NAME,PSXAUTO,PSXDATE,PSXHOUR,SITE,XMDUN,XMDUZ,XMSUB,XMZ,PSXDUZ
K DIR,DTOUT,DUOUT,DIRUT,DIROUT
Q
PSXDQUE ;BIR/WPB-Terminate Auto Processing ;[ 04/08/97 2:06 PM ]
+1 ;;2.0;CMOP;;11 Apr 97
DQ ;
+1 IF '$DATA(^PSX(550,"AT"))
GOTO DQ1
+2 SET REC=$ORDER(^PSX(550,"AT",""))
+3 SET TASK=$PIECE($GET(^PSX(550,+PSXSYS,"T",REC,0)),U,7)
DQ1 IF '$DATA(TASK)
WRITE !,"There isn't an automatic job queued to run under this option.",!
GOTO EXIT
+1 SET TIME=$$FMTE^XLFDT($PIECE(^PSX(550,+PSXSYS,"T",REC,0),U,2),"1P")
SET FREQ=$PIECE(^(0),U,3)
SET THRU=$PIECE(^(0),U,8)
+2 SET DIR(0)="Y"
SET DIR("A",2)="Auto Transmissions are already scheduled."
SET DIR("A",3)="Current schedule began : "_TIME
SET DIR("A",4)="Number of days to transmit thru: "_$SELECT($GET(THRU)>0:$GET(THRU),$GET(THRU)'>0:0,1:0)
+3 SET DIR("A",5)="Next transmission scheduled for: "_$$FMTE^XLFDT($PIECE(^PSX(550,+PSXSYS,"T",REC,0),"^",4),1)
SET DIR("A",6)="Rescheduling Frequency : "_FREQ_$SELECT(FREQ=1:" hour",FREQ>1:" hours",1:"")
+4 SET DIR("A",1)=""
SET DIR("A",7)=""
+5 SET DIR("A")="Do you want to unschedule automatic processing "
SET DIR("B")="NO"
DO ^DIR
KILL DIR
IF Y=0!($DATA(DIRUT))
GOTO EXIT
+6 SET ZTSK=TASK
SET PSXZTSK=""
DO STAT^%ZTLOAD
+7 IF ZTSK(1)=2
WRITE !,"This job is currently running, wait until the task has finished before stopping the job.",!
QUIT
+8 IF ZTSK(1)'=2
DO KILL^%ZTLOAD
+9 IF ZTSK(0)=0!(ZTSK(0)=1)
LOCK +^PSX(550,+PSXSYS,0):30
Begin DoDot:1
+10 IF '$TEST
WRITE !!,"The CMOP System file is in use, try later."
QUIT
+11 SET DA=REC
SET DA(1)=+PSXSYS
SET DIE="^PSX(550,"_+PSXSYS_",""T"","
SET DR=".01////2;6////@"
DO ^DIE
LOCK -^PSX(550,+PSXSYS,0)
KILL DIE,DA,DR,PSXZTSK,REC,TREC,TASK
WRITE !,"Job Unscheduled.",!
End DoDot:1
IF '$TEST
GOTO EXIT
+12 IF ZTSK(0)<1
WRITE !,"This task does not exist."
GOTO EXIT
MSG DO NOW^%DTC
SET (PSXDATE,DTE)=%
SET SITE=$PIECE($GET(PSXSYS),U,3)
SET NAME=$PIECE($GET(^VA(200,DUZ,0)),U,1)
SET TIME=$$FMTE^XLFDT(DTE,"1")
+1 SET XMDUZ=.5
SET XMSUB=("CMOP Auto-Transmission Terminated")
SET LCNT=5
+2 DO XMZ^XMA2
IF XMZ<1
GOTO MSG
+3 SET ^XMB(3.9,XMZ,2,1,0)="Cancellation of Auto-Transmission Schedule."
+4 SET ^XMB(3.9,XMZ,2,2,0)=""
+5 SET ^XMB(3.9,XMZ,2,3,0)="Facility : "_SITE
+6 SET ^XMB(3.9,XMZ,2,4,0)="Initiating Official: "_NAME
+7 SET ^XMB(3.9,XMZ,2,5,0)="Date Cancelled : "_$PIECE(TIME,":",1,2)
+8 SET ^XMB(3.9,XMZ,2,0)="^3.92A^"_LCNT_U_LCNT_U_DT
SET XMDUN="CMOP Manager"
+9 KILL XMY
SET XMDUZ=.5
DO GRP^PSXNOTE
DO ENT1^XMD
+10 SET (PSXAUTO,PSXHOUR)=0
DO SERV^PSXMISC
EXIT SET PSXSTAT="H"
DO PSXSTAT^PSXRSYU
+1 KILL TIME,STDATE,NUM,X,Y,PSXTRANS,PSXFLAG,FREQ,PSXZTSK,START,ZTSK,%,DAY,DTE,LCNT,NAME,PSXAUTO,PSXDATE,PSXHOUR,SITE,XMDUN,XMDUZ,XMSUB,XMZ,PSXDUZ
+2 KILL DIR,DTOUT,DUOUT,DIRUT,DIROUT
+3 QUIT