1 | ORXTABS1 ; SLC/PKS - Edit tab parameters preferences. [9/11/00 1:40pm]
|
---|
2 | ;;3.0;ORDER ENTRY/RESULTS REPORTING;**9,47,84**;Dec 17, 1997
|
---|
3 | ;
|
---|
4 | ; Additional control code for Tab Preferences Editing - works in
|
---|
5 | ; conjunction with the main routine, ORXTABS.
|
---|
6 | ;
|
---|
7 | ; NOTE: Most ORX* variables used herein NEW'd in calling routine.
|
---|
8 | ;
|
---|
9 | Q
|
---|
10 | ;
|
---|
11 | EDIT ; Display list of this tab's parameter values, allow edit selection.
|
---|
12 | ;
|
---|
13 | ; Variables used herein:
|
---|
14 | ;
|
---|
15 | ; ORXCNT2 = Loop counter for concantenated user input.
|
---|
16 | ; ORXHI = High end of hyphenated entry.
|
---|
17 | ; ORXINPUT = Input string (DIR's Y var) from user's entry.
|
---|
18 | ; ORXLO = Low end of hyphenated entry.
|
---|
19 | ; ORXNUM2 = Number of pieces in concantenated user input.
|
---|
20 | ; ORXTEMP = Temporary value holder.
|
---|
21 | ; ORXTOT = Total holder.
|
---|
22 | ;
|
---|
23 | N ORXCNT2,ORXHI,ORXINPUT,ORXLO,ORXNUM2,ORXTEMP,ORXTOT
|
---|
24 | ;
|
---|
25 | ; Create overall control loop:
|
---|
26 | K ORXPCS ; Clear each time.
|
---|
27 | S ORXANY=0 ; Set to check for changes.
|
---|
28 | F Q:ORXSTOP D
|
---|
29 | .;
|
---|
30 | .; Get matching prompt strings:
|
---|
31 | .K ORXPSTR,ORXPRO,ORXPDIS ; Prompts variables.
|
---|
32 | .S ORXTAG="PROMPTS+"_ORXTCNT_"^ORXTABS" ; Data tag for prompts.
|
---|
33 | .S ORXPSTR=$P($T(@ORXTAG),";;",2) ; Current prompts line.
|
---|
34 | .S ORXPDIR=$P(ORXPSTR,U) ; Get first prompt piece.
|
---|
35 | .I ORXPDIR'=ORXTNM D Q ; Check for mismatch.
|
---|
36 | ..W !!," Problem reading PROMPTS data!" ; On error, leave message.
|
---|
37 | ..S ORXSTOP=1 ; Set flag for abort.
|
---|
38 | .S ORXPSTR=$P(ORXPSTR,U,2) ; Get prompts list string.
|
---|
39 | .S ORXPCS=$P($G(ORXPARS(ORXTCNT)),U,3) ; Get "pieces" map string.
|
---|
40 | .;
|
---|
41 | .; Clear, reset DIR variables:
|
---|
42 | .K DIR,X,Y
|
---|
43 | .S DIR("T")=120 ; Two minute maximum timeout for response.
|
---|
44 | .S DIR("A")=" Select "_ORXPDIR_" value to edit"
|
---|
45 | .S DIR("?")=" Enter individual item number or comma-delimited string (within ranges listed)"
|
---|
46 | .;
|
---|
47 | .; Assign individual DIR display array items:
|
---|
48 | .S ORXVAL=""
|
---|
49 | .S ORXNUM=$L(ORXSETS,";") ; # pieces = loop end counter.
|
---|
50 | .F ORXCNT=1:1:ORXNUM D ; Each piece of param setting.
|
---|
51 | ..S ORXVAL=$P($G(ORXSETS),";",ORXCNT) ; Each setting.
|
---|
52 | ..S ORXVAL=$$LJ^XLFSTR(ORXVAL,9) ; Format for 9 characters.
|
---|
53 | ..S ORXPRO=$P(ORXPSTR,";",ORXCNT) ; Prompt for this piece.
|
---|
54 | ..S ORXPRO=$$LJ^XLFSTR(ORXPRO,24) ; Format for 24 characters.
|
---|
55 | ..;
|
---|
56 | ..; Assign DIR display values:
|
---|
57 | ..S ORXCDIS=ORXCNT ; Set display counter to same.
|
---|
58 | ..S ORXCDIS=$$RJ^XLFSTR(ORXCDIS,2) ; Right justify to 2 places.
|
---|
59 | ..S DIR("A",ORXCNT)=" "_ORXCDIS_" "_ORXVAL_" "_ORXPRO
|
---|
60 | .;
|
---|
61 | .; Add one additional choice for editing "ALL" items:
|
---|
62 | .I (ORXCNT>1) D
|
---|
63 | ..S ORXCNT=ORXCNT+1 ; Increment counter.
|
---|
64 | ..S ORXNUM=ORXCNT ; Keep totaller up to date.
|
---|
65 | ..S ORXCDIS=ORXCNT ; Set display counter to match.
|
---|
66 | ..S ORXCDIS=$$RJ^XLFSTR(ORXCDIS,2) ; Right justify to 2 places.
|
---|
67 | ..S DIR("A",ORXCNT)=" "_ORXCDIS_" ALL "_" Edit All Above Items"
|
---|
68 | .;
|
---|
69 | .; Define DIR input requirements:
|
---|
70 | .S DIR(0)="LO^1:"_ORXNUM ; List, from 1 to max choices.
|
---|
71 | .;
|
---|
72 | .; Call DIR for user choice:
|
---|
73 | .W !! ; Spacing for screen display.
|
---|
74 | .I ORXPDIR="REPORTS" D ; Special note for reports.
|
---|
75 | ..W !," NOTE: At present, the following settings affect only the list of"
|
---|
76 | ..W !," Imaging report selections shown under Reports:"
|
---|
77 | ..W !," ---------------------------------------------"
|
---|
78 | .D ^DIR
|
---|
79 | .;
|
---|
80 | .; Check user response:
|
---|
81 | .I '$L($G(Y)) S ORXSTOP=1 Q ; Punt if Y isn't assigned.
|
---|
82 | .I Y="" S ORXSTOP=1 Q ; Punt if Y is null.
|
---|
83 | .I Y="^" S ORXSTOP=1 Q ; Punt if Y is "^" character.
|
---|
84 | .;
|
---|
85 | .; Entry valid - assign ORXINPUT variable to user entry:
|
---|
86 | .K ORXINPUT ; Clean up each time through.
|
---|
87 | .S ORXINPUT=Y ; Now holds input string.
|
---|
88 | .K DIR,X,Y ; Clean up after call to DIR.
|
---|
89 | .;
|
---|
90 | .; If user made a concantenated entry, deal with it:
|
---|
91 | .I (($L($P(ORXINPUT,",",2)))!($L($P(ORXINPUT,"-",2)))) D Q
|
---|
92 | ..;
|
---|
93 | ..; Deal with an entry string:
|
---|
94 | ..S ORXTOT=1 ; Initial setting.
|
---|
95 | ..S ORXNUM2=($L(ORXINPUT,",")-1) ; Total pieces entered.
|
---|
96 | ..;
|
---|
97 | ..; Establish loop to tear the string apart:
|
---|
98 | ..F ORXCNT=1:1:ORXNUM2 D ; Each piece in entry.
|
---|
99 | ...I ORXCNT>ORXTOT S ORXTOT=ORXCNT ; Reset higher?
|
---|
100 | ...S ORXTEMP=$P(ORXINPUT,",",ORXCNT) ; Get each entry piece.
|
---|
101 | ...;
|
---|
102 | ...; Check for a hyphenated entry:
|
---|
103 | ...I $L($P(ORXTEMP,"-",2)) D Q ; To next piece after.
|
---|
104 | ....S ORXLO=$P(ORXTEMP,"-") ; Lower number.
|
---|
105 | ....S ORXHI=$P(ORXTEMP,"-",2) ; Higher number.
|
---|
106 | ....S ORXHI=+ORXHI ; Eliminate comma.
|
---|
107 | ....I ORXHI>ORXTOT S ORXTOT=ORXHI ; Reset higher?
|
---|
108 | ....;
|
---|
109 | ....; Use another loop to assign the range of hyphenated elements:
|
---|
110 | ....F ORXCNT2=ORXLO:1:ORXHI D
|
---|
111 | .....S ORXINPUT(ORXCNT2)=ORXCNT2 ; ORXCNT2 is default #.
|
---|
112 | ...;
|
---|
113 | ...; If piece isn't hyphenated, use it directly:
|
---|
114 | ...S ORXINPUT(+ORXTEMP)=+ORXTEMP
|
---|
115 | ...I +ORXTEMP>ORXTOT S ORXTOT=+ORXTEMP ; Reset higher?
|
---|
116 | ..;
|
---|
117 | ..; Check and eliminate "ALL" selection if necessary:
|
---|
118 | ..I ORXTOT=ORXNUM K ORXINPUT(ORXTOT) S ORXTOT=ORXTOT-1
|
---|
119 | ..;
|
---|
120 | ..; ORXTOT should now equal the highest-numbered user selection.
|
---|
121 | ..; Each assigned ORXINPUT(xx) element should resemble:
|
---|
122 | ..; ORXINPUT(5)=5
|
---|
123 | ..;
|
---|
124 | ..; Call tag to process the entries:
|
---|
125 | ..D SOME
|
---|
126 | .;
|
---|
127 | .; No more than one entry, so assign ORXCNT and proceed:
|
---|
128 | .S ORXCNT=+ORXINPUT
|
---|
129 | .;
|
---|
130 | .; Unless "ALL" was selected, assign current value variables:
|
---|
131 | .I ORXCNT<ORXNUM D
|
---|
132 | ..S ORXNOW=$P($G(ORXCUR),";",$P($G(ORXPCS),";",ORXCNT))
|
---|
133 | ..S ORXPDIS=$P(ORXPSTR,";",ORXCNT) ; Display prompt, this piece.
|
---|
134 | .;
|
---|
135 | .; Deal with "ALL" choice:
|
---|
136 | .I ORXCNT=ORXNUM S ORXSTOP=1 D ALL Q ; "ALL" choice.
|
---|
137 | .;
|
---|
138 | .; Process individual selections:
|
---|
139 | .S ORXVAL=$P($G(ORXSETS),";",ORXCNT) ; Any of individual choices.
|
---|
140 | .D EACH
|
---|
141 | ;
|
---|
142 | Q
|
---|
143 | ;
|
---|
144 | ALL ; Process each value (piece) of selected parameter in turn.
|
---|
145 | ;
|
---|
146 | S ORXNEW="" ; Reset.
|
---|
147 | ;
|
---|
148 | ; Establish control loop:
|
---|
149 | F ORXCNT=1:1:(ORXNUM-1) Q:ORXNEW="^" D
|
---|
150 | .;
|
---|
151 | .; Set tag to match each value:
|
---|
152 | .S ORXVAL=$P($G(ORXSETS),";",ORXCNT)
|
---|
153 | .;
|
---|
154 | .; Assign current value and prompt variables each time:
|
---|
155 | .S ORXNOW=$P($G(ORXCUR),";",$P($G(ORXPCS),";",ORXCNT))
|
---|
156 | .S ORXPDIS=$P(ORXPSTR,";",ORXCNT)
|
---|
157 | .;
|
---|
158 | .; Process each value:
|
---|
159 | .W !!," (Entry of ^ will cancel entry process.)"
|
---|
160 | .D EACH
|
---|
161 | ;
|
---|
162 | Q
|
---|
163 | ;
|
---|
164 | SOME ; Process specific values of selected parameter in turn.
|
---|
165 | ;
|
---|
166 | S ORXNEW="" ; Reset.
|
---|
167 | ;
|
---|
168 | ; Establish control loop:
|
---|
169 | S ORXCNT=0 ; Initialize.
|
---|
170 | F Q:((ORXCNT>(ORXTOT))!(ORXNEW="^")) D
|
---|
171 | .S ORXCNT=ORXCNT+1 ; Increment each time.
|
---|
172 | .I '$D(ORXINPUT(ORXCNT)) Q ; Non-existant entries.
|
---|
173 | .;
|
---|
174 | .; Set tag to match each value:
|
---|
175 | .S ORXVAL=$P($G(ORXSETS),";",ORXCNT) ; ORXCNT is # by default.
|
---|
176 | .;
|
---|
177 | .; Assign current value and prompt variables each time:
|
---|
178 | .S ORXNOW=$P($G(ORXCUR),";",$P($G(ORXPCS),";",ORXCNT))
|
---|
179 | .S ORXPDIS=$P(ORXPSTR,";",ORXCNT)
|
---|
180 | .;
|
---|
181 | .; Process each value:
|
---|
182 | .W !!," (Entry of ^ will cancel entry process.)"
|
---|
183 | .D EACH
|
---|
184 | ;
|
---|
185 | Q
|
---|
186 | ;
|
---|
187 | EACH ; Process and update an edited value.
|
---|
188 | ;
|
---|
189 | ; Get tag name in ORXTABS2 to process the user's entry:
|
---|
190 | K DIR,X,Y
|
---|
191 | S ORXANY=ORXANY+1
|
---|
192 | ;
|
---|
193 | ; Assign command string with passed variable for execution:
|
---|
194 | S ORXNEW="S ORXNEW=$$"_ORXVAL_"^ORXTABS2("_""""_ORXNOW_""""_")"
|
---|
195 | ;
|
---|
196 | X ORXNEW ; Execute call to tag.
|
---|
197 | ;
|
---|
198 | ; Don't update value if user opted out with "^" entry:
|
---|
199 | I ORXNEW="^" S ORXANY=ORXANY-1 Q
|
---|
200 | ;
|
---|
201 | ; Stuff new value into current value string:
|
---|
202 | S $P(ORXCUR,";",$P($G(ORXPCS),";",ORXCNT))=ORXNEW
|
---|
203 | ;
|
---|
204 | Q
|
---|
205 | ;
|
---|
206 | SAVE ; Obtain user input, then save or discard changes.
|
---|
207 | ;
|
---|
208 | S ORXANY=$$CONFIRM ; Re-use ORXANY variable.
|
---|
209 | I 'ORXANY W !!," No changes saved...." Q
|
---|
210 | ;
|
---|
211 | ; Write changes back to parameters file:
|
---|
212 | K ORXERR
|
---|
213 | D PUT^XPAR(DUZ_";VA(200,",ORXPNAM,,ORXCUR,.ORXERR)
|
---|
214 | ;
|
---|
215 | ; Check for an error in the write process:
|
---|
216 | I (+ORXERR'=0) D Q
|
---|
217 | .W !," ERROR: Parameter not updated!" ; Notify user of error.
|
---|
218 | .W !," ("_$P(ORXERR,U,2)_")" ; Display error message.
|
---|
219 | ;
|
---|
220 | W !!,"Tab parameter setting(s) updated/saved."
|
---|
221 | W !,"(GUI Users must close, re-start application to activate changes.)",!
|
---|
222 | ;
|
---|
223 | Q
|
---|
224 | ;
|
---|
225 | CONFIRM() ; Confirm to save changes.
|
---|
226 | ;
|
---|
227 | ; Clear, reset DIR variables:
|
---|
228 | K DIR,X,Y
|
---|
229 | S DIR("T")=120 ; Two minute maximum timeout for response.
|
---|
230 | S DIR("A")=" Save changes"
|
---|
231 | S DIR("?")=" Write changes to parameter file? (Y/N)"
|
---|
232 | S DIR("A",1)=" YES"
|
---|
233 | S DIR("A",2)=" NO"
|
---|
234 | S DIR("B")="YES"
|
---|
235 | ;
|
---|
236 | ; Define DIR input requirements:
|
---|
237 | S DIR(0)="YO^1:2:0"
|
---|
238 | ;
|
---|
239 | ; Call DIR for user choice:
|
---|
240 | W !! ; Spacing for screen display.
|
---|
241 | D ^DIR
|
---|
242 | ;
|
---|
243 | ; Check user response:
|
---|
244 | I '$L($G(Y)) Q 0 ; Skip if Y isn't assigned.
|
---|
245 | I Y="" Q 0 ; Skip if Y is null.
|
---|
246 | I Y="^" Q 0 ; Skip if Y is "^" character.
|
---|
247 | I Y<1 Q 0 ; Skip if Y is less than one.
|
---|
248 | I Y>2 Q 0 ; "No" choice.
|
---|
249 | I Y=1 Q 1 ; "Yes" choice.
|
---|
250 | ;
|
---|
251 | Q 0 ; Default return of "No."
|
---|
252 | ;
|
---|