source: FOIAVistA/tag/r/SCHEDULING-SD-SC/SCMCCV1.m@ 668

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

initial load of FOIAVistA 6/30/08 version

File size: 5.6 KB
Line 
1SCMCCV1 ;ALB/JLU;PC Attending conversion;5/6/99
2 ;;5.3;Scheduling;**195**;AUG 13, 1993
3 ;
4MAIN I $$XTMP() D XTMPW G MAINQ ;is there another conversion job?
5 ;
6 N SCMCTM,SCMCPOS,SCMCSTOP,SCMCFIX,SCMCTYPE
7 S SCMCSTOP=0
8 ;
9 S SCMCFIX=$$CNTFIX ;fix or check mode?
10 I SCMCFIX=0 G MAINQ ;uparrowed out
11 ;
12 S SCMCSTOP=$$ASKQUEST ;how to sort for conversion? SETS SCMCTM, SCMCPOS
13 I SCMCSTOP G MAIN Q
14 ;
15 D SUMARIZE ; display what was selected
16 S SCMCSTOP=$$ASKCONT ;ask user if they wish to continue.
17 I SCMCSTOP G MAINQ
18 ;
19 D QOFF ;queue off the conversion job
20 ;
21MAINQ Q
22 ;
23XTMPW ;writes to the user.
24 ;
25 N VAR
26 S VAR=$O(^XTMP("SCMCATTCONV",0))
27 ;
28 W *7,!!,"A conversion job (#"_VAR_") has already been started."
29 W !,"You will not be able to start another conversion job until this one finishes.",!!
30 D PAUSE^SCMCMU1
31 Q
32 ;
33XTMP() ;checks to see if another job is running.
34 ;
35 Q $S($D(^XTMP("SCMCATTCONV")):1,1:0)
36 ;
37CNTFIX() ;ask the user if they want to FIX(Convert) or CHECK
38 ;Output F for FIX mode
39 ; C for Check mode
40 ;
41 N DIR
42 S DIR(0)="SM^C:CHECK;F:FIX"
43 S DIR("?")="Check mode will only count the entries that could or could not be converted."
44 S DIR("?",1)="Fix mode will actually convert these entries."
45 S DIR("A")="In which mode would you like to run the conversion?"
46 D ^DIR
47 Q $S($D(DIRUT):0,1:Y)
48 ;
49ASKQUEST() ;askes the user how they wish to sort or break up the conversion.
50 ;Outputs
51 ;sets up the SCMCTM and SCMCPOS arrays
52 ;returns a 1 if to stop
53 ;returns a zero to not stop
54 ;
55 N STOP
56 S STOP=0
57 S SCMCTYPE=$$TYPE() ;gets the type of selection (team, position or all)
58 I SCMCTYPE=0 S STOP=1 G ASKQSTQ
59 ;
60 I SCMCTYPE="T" D TMLP S:'$D(SCMCTM) STOP=1 ;team selection
61 ;
62 I SCMCTYPE="P" D POS S:'$D(SCMCTM)!('$D(SCMCPOS)) STOP=1 ;position selection
63 ;
64 I SCMCTYPE="A" K SCMCTM,SCMCPOS
65 ;
66ASKQSTQ Q STOP
67 ;
68 ;
69TYPE() ;askes the user how they wish to sort or select the conversion.
70 ;A for All teams and positions
71 ;T for by selecting teams. All positions for each team.
72 ;P for by selection positions. Only one team and specific positions.
73 ;
74 ;returns a zero to quit
75 ;returns a one to continue
76 ;
77 N DIR
78 S DIR(0)="SM^A:All teams and positions;T:Specific teams;P:One team, specifc positions"
79 S DIR("?",1)="Select A for a conversion of all teams and all positions on those teams."
80 S DIR("?",2)="Select T to select specific teams. All positions for each team are reviewed."
81 S DIR("?",3)="Select P to be able to select specific positions from a single team."
82 S DIR("?")=" "
83 ;
84 D ^DIR
85 Q $S($D(DIRUT):0,1:Y)
86 ;
87 ;
88TMLP ;allows the user to select which teams. Allows the selection of
89 ;multiple teams.
90 ;sets up the SCMCTM array with the teams
91 ;sets stop=1 if need to stop
92 ;
93 N SCSTOP
94 S SCSTOP=0
95 F D I SCSTOP Q
96 .N TM
97 .S TM=$$TEAM^SCMCMU(DT)
98 .I TM>0 S SCMCTM(TM)=""
99 .E S SCSTOP=1
100 .Q
101 Q
102 ;
103POSLP(TM) ;allows the user to select one team and multiple positions from that
104 ;team.
105 ;the SCMCTM and SCMCPOS arrays will be populated.
106 ;
107 N SCSTOP
108 S SCSTOP=0
109 K SCMCPOS
110 F DO I SCSTOP Q
111 .N POS
112 .S POS=$$POS^SCMCMU(TM,DT) ; get positions using today.
113 .I POS>0 S SCMCPOS(POS)=""
114 .E S SCSTOP=1
115 .Q
116 Q
117 ;
118POS ;gets the team first then calls POSLP to get the positions
119 ;populates the SCMCTM array
120 ;
121 N TTM
122 K SCMCTM
123 S TTM=$$TEAM^SCMCMU(DT)
124 I TTM>0 DO
125 .S SCMCTM(TTM)=""
126 .D POSLP(TTM)
127 .Q
128 Q
129 ;
130 ;
131SUMARIZE ;presents the selections to the user.
132 ;
133 W !!!,"You have made the following selections."
134 W !,"Please verify they are what you want:",!
135 ;
136 I SCMCTYPE="A" D TYPEA
137 I SCMCTYPE="T" D TYPET
138 I SCMCTYPE="P" D TYPEP
139 ;
140 W !!,*7,"** This job will be run in a ",$S(SCMCFIX="F":"FIX",1:"CHECK")," mode. **",!
141 Q
142 ;
143 ;
144TYPEA ;
145 W !,"You have selected to convert assignments in all teams and positions."
146 Q
147 ;
148 ;
149TYPET ;
150 N VAR
151 W !,"You have selected to convert PC Attending assignments in the following teams:"
152 ;
153 S VAR=0
154 F S VAR=$O(SCMCTM(VAR)) Q:VAR="" W !,$P(^SCTM(404.51,VAR,0),U,1)
155 ;
156 W !!,"All position assignments for each team will be reviewed."
157 Q
158 ;
159 ;
160TYPEP ;
161 N LP,VAR
162 S VAR=$O(SCMCTM(0)) Q:VAR=""
163 ;
164 W !,"You have selected to convert PC Attending assignments for team:"
165 W !,$P(^SCTM(404.51,VAR,0),U,1)
166 W !!,"The positions that were selected are:"
167 ;
168 S VAR=0
169 F S VAR=$O(SCMCPOS(VAR)) Q:VAR="" W !,$P(^SCTM(404.57,VAR,0),U,1)
170 Q
171 ;
172 ;
173ASKCONT() ;ask the user if they wish to continue.
174 ;
175 N Y,DIR
176 S DIR(0)="Y^"
177 S DIR("A")="Are these selections correct? Do you wish to continue"
178 D ^DIR
179 Q $S(Y=1:0,1:1) ; CHANGING TO MATCH STOP FORMAT.
180 ;
181 ;
182SETLOCK ; sets the global to lock out other attempted jobs
183 ;
184 S ^XTMP("SCMCATTCONV",0)=DT+1_"^"_DT
185 Q
186 ;
187 ;
188QOFF ;queue the task off to be processed in the background.
189 ;
190 N ZTRTN,ZTDESC,ZTDTH,ZTIO,ZTSAVE
191 S ZTRTN="STRTQJOB^SCMCCV2"
192 S ZTDESC="PCMM conversion of PC Attending assignments."
193 S ZTDTH=$H
194 S ZTIO=""
195 S ZTSAVE("SCMCTM(")=""
196 S ZTSAVE("SCMCPOS(")=""
197 S ZTSAVE("SCMCFIX")=""
198 S ZTSAVE("SCMCTYPE")=""
199 D ^%ZTLOAD
200 I $D(ZTSK) W !!,"Task queued. ",ZTSK D SETLOCK ;LOCKS FOR NEXT ATTEMPT
201 E W !!,"Task NOT queued."
202 K ZTSK
203 Q
204 ;
205 ;
206FUTURE ;checks if can make an assignment for today.
207 ;
208 N VARTWO
209 K ERR
210 S VARTWO=$$YSPTTPPC^SCMCTPU2(DFN,DT,1)
211 I 'VARTWO S ERR="-"_$P(VARTWO,U,2) D SETERR^SCMCCV2(ERR) Q
212 S REASSIGN=1
213 Q
214 ;
215 ;
216REOPEN ;reactivate old assignment.
217 ;
218 N DA,DR,DIE
219 S DIE="^SCPT(404.43,"
220 S DA=POSASGN
221 D NOW^%DTC
222 S DR=".04///@;.08///"_$G(DUZ,.5)_";.09///"_%
223 K X
224 D ^DIE
225 Q
226 ;
227 ;
228CHANGE(AIEN) ;the actual FM call to convert.
229 N DIE,DA,DR
230 S DIE="^SCPT(404.43,"
231 S DA=AIEN
232 S DR=".05///1"
233 D ^DIE
234 Q
235 ;
236 ;
237INIT ;set up variables
238 ;
239 S XMDUZ=.5
240 S XMY($S($G(DUZ):DUZ,1:XMDUZ))=""
241 S XMSUB="PC Attending conversion"
242 S XMTEXT="^TMP(""SCMC"",$J,""MSG"","
243 S CNTR=0
244 Q
Note: See TracBrowser for help on using the repository browser.