source: FOIAVistA/tag/r/SCHEDULING-SD-SC/SCCVCST1.m@ 1625

Last change on this file since 1625 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 7.5 KB
Line 
1SCCVCST1 ; ALB/TMP - SCHED VSTS CONV/ARCHIVE - REQUEST/EDIT ; 25-NOV-97
2 ;;5.3;Scheduling;**211**;Aug 13, 1993
3 ;
4REQ(SCFUNC,SCCVSCRN,ASKBULL) ; -- Schedule request to run/stop
5 ; SCFUNC = 0 if from add new template, 1 if from edit or schedule
6 ; SCCVSCRN = 1 if called from main menu, 2 if called from log menu
7 ; ASKBULL = 1 if user should be asked to answer send bulletin question
8 ; = 0 if user already answered the question during this action
9 ; Assumes SCCVDA = template entry ien from List Manager selection
10 ;
11 N DA,DIC,DIE,DR,SCCV,SCCV0,SCCV1,SCCVACT,SCCVDA1,SCCVOK,SCCVNOW,SCCV7,SCCV8,SCCV5,SCRESULT,SCSTOP,SCABORT,X,Y
12 D FULL^VALM1
13 I $G(SCCVDA),$P($G(^SD(404.98,SCCVDA,0)),U,9) D G REQX
14 . W *7,!,"You cannot run a canceled template!"
15 . D PAUSE^SCCVU
16 I $D(SCCVDONE) D DONE G REQX
17 I '$G(SCCVDA) D SELX^SCCVDSP("CST",1)
18 G:'$G(SCCVDA) REQX
19 ;
20 S SCCV0=$G(^SD(404.98,SCCVDA,0)),SCCV1=$G(^(1)),SCCV7=$P(SCCV0,U,7),SCCV5=$P(SCCV0,U,5),SCCV8=$P(SCCV0,U,8),SCCVACT="",SCABORT=0
21 ;
22 ; -- quit is convert or reconvert and conversion disabled
23 IF SCCV5=1!(SCCV5=2),'$$OK^SCCVU(1) S SCABORT=1 G REQX
24 ;
25 I $P(SCCV1,U,3) D G:SCABORT REQX ; Check log's task
26 . D TASKSTA^SCCVU1(.SCRESULT,SCCVDA)
27 . Q:$S($G(SCRESULT):0,$P(SCRESULT,U,3)=0:1,"124"[SCCV7:1,1:$P(SCRESULT,U,3)>2)
28 . W !!,$S($G(SCRESULT):"An error has occurred (",1:"This CST already has a valid task "_$P(SCCV1,U,3)_" (")_$P(SCRESULT,U,2)_")."
29 . I $G(SCRESULT) D PAUSE^SCCVU K:$G(SCCVSCRN)'=2 SCCVDA S SCABORT=1 Q
30 ;
31 I SCCV7=5 D G:SCABORT REQX ;Last event completed
32 .;
33 . I $P(SCCV0,U,5)=1 D K:$G(SCCVSCRN)'=2 SCCVDA Q ;Convert complete
34 .. W !!,"This CST has completed converting the data in its date range."
35 .. W !,"The event must be 'RE-CONVERT' in order to run this CST again."
36 .. D PAUSE^SCCVU
37 .. S SCABORT=1
38 .;
39 . I $P(SCCV0,U,5)=2 D Q ;Re-convert complete
40 .. S DIR(0)="YA",DIR("B")="NO",DIR("A",1)="You are about to request a RE-CONVERT event 'again' using this CST."
41 .. S DIR("A")="Are you sure you want to do this?: "
42 .. D ^DIR K DIR
43 .. I Y'=1 K:$G(SCCVSCRN)'=2 SCCVDA S SCABORT=1
44 .;
45 . I '$P(SCCV0,U,5) D Q ;Estimate complete
46 .. S DIR(0)="YA",DIR("B")="NO"
47 .. S DIR("A",1)=" ",DIR("A",2)="This CST has already completed an ESTIMATE event.",DIR("A",3)="Re-running the ESTIMATE will delete the totals previously stored."
48 .. S DIR("A")="Are you sure you want to do this?: "
49 .. D ^DIR K DIR
50 .. I Y'=1 K:$G(SCCVSCRN)'=2 SCCVDA S SCABORT=1
51 ;
52 W !!,"Requested Event : ",$$EXPAND^SCCVDSP2(404.98,.05,$P(SCCV0,U,5))
53 W !,"Last Event Status : ",$$EXPAND^SCCVDSP2(404.98,.07,$P(SCCV0,U,7))
54 W !,"Last Requested Action: ",$$NONE^SCCVDSP2(404.98,.08,$P(SCCV0,U,8),"<No action requested>"),!
55 ;
56 D G:SCCVACT'>0 REQX
57 .I SCCV7<2 S SCCVACT=1 Q ;Never started
58 .S DIR(0)="SABM^"
59 .I SCCV5 S DIR(0)=DIR(0)_$S(SCCV7'=5&(SCCV5=1):"1:SCHEDULE;",SCCV7=5&(SCCV5=2):"1:SCHEDULE",1:"")_$S(SCCV7'=5:"2:STOP;3:RE-START",1:"")
60 .I 'SCCV5 S DIR(0)=DIR(0)_$S(SCCV7'=4:"1:SCHEDULE"_$S(SCCV7'=5:";",1:""),1:"")_$S(SCCV7'=5:"2:STOP",1:"")
61 .S DIR("A")="Request Action: "
62 .I SCCV5 S DIR("B")=$S("23"[SCCV7:"RE-START",SCCV7=5:"SCHEDULE",1:"STOP")
63 .I 'SCCV5 S DIR("B")=$S("35"[SCCV7:"SCHEDULE",1:"STOP")
64 .W !
65 .D ^DIR K DIR
66 .S SCCVACT=+Y
67 .IF SCCVACT'>0 S SCCVACT="" Q
68 .I $S(SCCVACT=2:SCCV7=3,SCCVACT=1!(SCCVACT=3):SCCV7=2!(SCCV7=4)!(SCCV7=6),1:0) D
69 ..S Z=1,DIR(0)="YA",DIR("B")="NO"
70 ..S:SCCVACT=2 DIR("A",1)="You are requesting to STOP the running of this CST.",Z=Z+1
71 ..S DIR("A",Z)="This ACTION is the same(or similar) as the previous action on this CST."
72 ..S DIR("A")="Are you sure you want to do this?: "
73 ..D ^DIR K DIR
74 ..I Y'=1 S SCCVACT=""
75 I SCCVACT=2 D G:SCCVACT'>0 REQX
76 .S SCSTOP=1
77 .I SCCV7'=3 S DIR(0)="YA",DIR("A",1)="You are requesting to STOP the running of this CST.",DIR("A")="Are you sure you want to do this?: ",DIR("B")="NO" D ^DIR K DIR I Y'=1 S SCCVACT=""
78 S SCCVOK=0 K SCCVDA1
79 S DIE="^SD(404.98,",DR="[SCCV SCHEDULE REQUEST]",DA=SCCVDA
80 D ^DIE
81 I 'SCCVOK D:$G(SCCVDA1) NOTDONE G REQX
82 ;
83 S SCCV("TEMPLNO")=SCCVDA,SCCV("REQNUM")=SCCVDA1
84 D PROCREQ^SCCVU1(.SCRESULT,.SCCV)
85 ;
86 I $G(SCFUNC) D
87 .I $G(SCCVSCRN)=2 D BLD^SCCVCDS1
88 .I $G(SCCVSCRN)=1 D BLD^SCCVDSP("CST")
89REQX S VALMBCK="R"
90 I $G(SCCVSCRN)'=2 K SCCVDA
91 Q
92 ;
93NOTDONE ; -- all needed fields not answered - delete entry
94 N DIK,DA,X,Y
95 S DA(1)=SCCVDA,DA=SCCVDA1,DIK="^SD(404.98,"_DA(1)_",""R""," D ^DIK
96 W !,"All fields must be answered. Nothing has been scheduled."
97 D PAUSE^SCCVU
98 Q
99 ;
100EDIT(SCCVSCRN) ; -- Edit the selected CST
101 N DA,DIC,DIE,DIR,DR,SCCV,SCCVX,SCCV0,SCCV1,SCCVY,SCRERUN,X,Y
102 ;
103 D FULL^VALM1
104 I $G(SCCVDA),$P($G(^SD(404.98,SCCVDA,0)),U,9) D G EDITX
105 .W *7,!,"You cannot edit a canceled template!"
106 .D PAUSE^SCCVU
107 I $G(SCCVDONE) D DONE G EDITX
108 I $G(SCCVSCRN)=1 N SCCVDA D SELX^SCCVDSP("CST",1)
109 G:'$G(SCCVDA) EDITX
110 ;
111 S SCCV0=$G(^SD(404.98,SCCVDA,0)),SCCV1=$G(^(1))
112 S SCCV("STARTDT")=$P(SCCV0,U,3),SCCV("ENDDT")=$P(SCCV0,U,4)
113 S SCCVY=""
114 ;
115 IF $P(SCCV0,U,5),$P(SCCV0,U,7)=5 S SCRERUN=0 D G:'SCRERUN EDITX
116 . W !!,"This template has completed its "_$P("^re-",U,$P(SCCV0,U,5))_"conversion."
117 . ; -- site parameter must allow re-convert
118 . IF '$P($G(^SD(404.91,1,"CNV")),U,6) D PAUSE^SCCVU Q
119 . ;
120 . S DIR("A")="Do you want to request a"_$P("^nother",U,$P(SCCV0,U,5))_" 'RE-CONVERT' to be run for this CST?: "
121 . S DIR(0)="YA",DIR("B")="NO"
122 . D ^DIR K DIR
123 . IF Y S SCCVY="@12",SCRERUN=1
124 ;
125 S DIE("NO^")="",DIE="^SD(404.98,",DA=SCCVDA,DR="[SCCV EDIT TEMPLATE]",SCCVY=$S(SCCVY'="":SCCVY,$P(SCCV1,U,2):"@15",$$CNVTSCH^SCCVU1(SCCVDA):"@15",1:"@5") D ^DIE K DIE
126 S SCCV0=$G(^SD(404.98,SCCVDA,0))
127 W !
128 S DIR(0)="YA",DIR("A")="Do you want to schedule this "_$$EXPAND^SCCVDSP2(404.98,.05,$P(SCCV0,U,5))_" event to run?: ",DIR("B")="YES" D ^DIR K DIR
129 D
130 .I Y D REQ(1,$G(SCCVSCRN),0) Q
131 .I $G(SCCVSCRN)=2 D BLD^SCCVCDS1,HDR^SCCVDSP1(SCCVDA,"CST")
132 .I $G(SCCVSCRN)=1 D BLD^SCCVDSP("CST")
133EDITX S VALMBCK="R"
134 Q
135 ;
136BULL ; Re-generate bulletin for estimate
137 N SCCVSENT,SCEST,Z
138 D FULL^VALM1
139 ;
140 I $D(SCCVDONE) D DONE G BULLX
141 I $G(SCCVSCRN)=1 N SCCVDA D SELX^SCCVDSP("CST")
142 G:'$G(SCCVDA) BULLX
143 ;
144 S SCEST=$$CHKACT^SCCVLOG(SCCVDA,0,5,"CST")
145 ;
146 I 'SCEST D G BULLX
147 . W !,"The CST must have a completed ESTIMATE event to re-generate the bulletin."
148 . D PAUSE^SCCVU
149 ;
150 D MAILSUM^SCCVEGD0(SCCVDA,.SCCVSENT)
151 ;
152 W !,"Estimate bulletin "_$S($G(SCCVSENT):"has been sent to "_SCCVSENT_" user"_$S(SCCVSENT>1:"s",1:""),1:"was not generated due to an error - try agin later")_"."
153 D PAUSE^SCCVU
154 ;
155BULLX S VALMBCK="R"
156 Q
157 ;
158CANCEL ; Cancel a selected CST that has not been completely converted
159 N SCCVLST,SCCVEVT,SCCVACT,SCCVOK
160 D FULL^VALM1
161 I $D(SCCVDONE) D DONE G CANCQ
162 I $G(SCCVSCRN)=1 N SCCVDA D SELX^SCCVDSP("CST",1)
163 G:'$G(SCCVDA) CANCQ
164 ;
165 S SCCV0=$G(^SD(404.98,SCCVDA,0))
166 S SCCVLST=+$$LSTACT^SCCVLOG(SCCVDA)
167 S SCCVEVT=+$$LSTEVT^SCCVLOG(SCCVDA)
168 S SCCVOK=0
169 ;
170 ; Check: If reconvert or convert, did it ever finish?
171 I SCCVEVT=0 S SCCVOK=1
172 I (SCCVEVT=1!(SCCVEVT=2)),'$$CHKACT^SCCVLOG(SCCVDA,SCCVEVT,5,"CST") S SCCVOK=1
173 ;
174 I 'SCCVOK D G CANCQ
175 . W !,"This template has "_$S(SCCVEVT<3:"completed successfully and does not need to be canceled",1:"already been canceled")_"."
176 . D PAUSE^SCCVU
177 ;
178 I SCCVEVT,SCCVOK S DIR("A",1)="This CST has started, but has not successfully completed running."
179 W !
180 S DIR(0)="YA",DIR("A")="Are you sure you want to cancel this CST? ",DIR("B")="NO" D ^DIR K DIR
181 G:Y'=1 CANCQ
182 W !
183 S DIE="^SD(404.98,",DR="[SCCV CONV CANCEL]",DA=SCCVDA D ^DIE
184 I $G(SCCVSCRN)=2 D BLD^SCCVCDS1,HDR^SCCVDSP1(SCCVDA,"CST")
185 I $G(SCCVSCRN)=1 D BLD^SCCVDSP("CST")
186 ;
187CANCQ S VALMBCK="R"
188 Q
189 ;
190DONE ; Message to say complete is over
191 W *7,!!,"Conversion is complete - this function is invalid!"
192 D PAUSE^SCCVU
193 Q
194 ;
Note: See TracBrowser for help on using the repository browser.