source: cprs/branches/tmg-cprs/m_files/TMGNDF4A.m@ 1727

Last change on this file since 1727 was 796, checked in by Kevin Toppenberg, 14 years ago

Initial upload

File size: 19.8 KB
Line 
1TMGNDF4A ;TMG/kst/FDA Import: Create POI's from DRUGs ;03/25/06
2 ;;1.0;TMG-LIB;**1**;11/21/06
3
4 ;" FDA - NATIONAL DRUG FILES COMPILING FUNCTIONS
5 ;" Creation of records in file 50.7 (PHARMACY ORDERABLE ITEM file)
6 ;" from all records stored in file 50 (DRUG file)
7 ;"Kevin Toppenberg MD
8 ;"GNU General Public License (GPL) applies
9 ;"11-21-2006
10
11 ;"=======================================================================
12 ;" API -- Public Functions.
13 ;"=======================================================================
14 ;"Menu
15
16 ;"=======================================================================
17 ;" Private Functions.
18 ;"=======================================================================
19 ;"InactivatePOIs -- inactivate all POI (entries in PHARMACY ORDERABLE ITEMS)
20 ;"ActivatePOI(IEN50d7) -- remove the inactivation date that is automatically added
21 ;"HandlePOIErr -- error handler for ActivatePOI
22
23 ;"SyncAllTMG -- Add all relevent TMG entries into POI
24 ;"AddFromTMG(IEN) -- Add/Update ONE entry in POI file
25 ;"Do1POI(DrugNAF,IEN50,IEN50d606,IEN51d2) -- add/refresh one POI entry.
26
27 ;"=============================================================================
28 ;"=============================================================================
29
30Menu
31 new Menu,UsrSlct
32 set Menu(0)="Pick Option to Sync to PHARMACY ORDERABLE ITEMS (4A)"
33 set Menu(1)="Sync Non-Skipped Imports to PHARMACY ORDERABLE ITEMS."_$char(9)_"SyncDRUGs"
34 ;"set Menu(2)="Activate all PHARMACY ORDERABLE ITEMS (do after syncing)"_$char(9)_"ActivateAll"
35 set Menu(3)="Kill all previous PHARMACY ORDERABLE ITEMS (only if needed!)"_$char(9)_"KillAll"
36 set Menu("P")="Prev Stage"_$char(9)_"Prev"
37 set Menu("N")="Next Stage"_$char(9)_"Next"
38
39M1 write #
40 set UsrSlct=$$Menu^TMGUSRIF(.Menu,"^")
41
42 if UsrSlct="SyncDRUGs" do SyncAllTMG goto M1
43 ;"if UsrSlct="ActivateAll" do ActivAll goto M1
44 if UsrSlct="KillAll" do KillPOIs goto M1
45 if UsrSlct="Prev" goto Menu^TMGNDF3E ;"quit can occur from there...
46 if UsrSlct="Next" goto Menu^TMGNDF4B ;"quit can occur from there...
47 if UsrSlct="^" goto MenuDone
48 goto M1
49
50MenuDone
51 quit
52
53
54 ;"=============================================================================
55 ;"File 50.7 (PHARMACY ORDERABLE ITEM):
56 ;"
57 ;" **A record in 50.7 should be created first.
58 ;" .01 field should be the generic name of the drug.
59 ;" When the record is created, an entry in fle 101.43 (ORDERABLE ITEM) will automatically be made.
60 ;" Also, a record in in ORDER QUICK VIEW will also be created (but it is incomplete--see below.)
61 ;" Note: new drugs may not be added unless PSEDITNM>0. So to setup a drug in fileman,
62 ;" set PSEDITNM=1 from the command-line, then DO D^DI to get into Fileman with vars intact.
63 ;" In the MED ROUTE field, the input transform does not allow an input of "ORAL". (If left
64 ;" blank ORAL will be shown in CPRS)
65 ;" This file can hold the synonyms of a drug etc.
66 ;" When this record is created, for some reason it is automatically given the current
67 ;" date in the INACTIVE DAT
68 ;"Purpose: to Ask E field--meaning it is created in an inactive state. One must
69 ;" go back and edit the record a second time to remove the entry from this field.
70 ;" File 101.43 (ORDERABLE ITEM), field ID holds a text pointer to this file, e.g.
71 ;" '10;99PSP' <---- 10 is IEN in file #50.7
72 ;" There is no pointer field from file 50.7 up to file 50. The link is FROM file #50
73 ;" TO #50.7 (via file #50's field 2.1(PHARMACY ORDERABLE ITEM)). HOWEVER, File #50.7's
74 ;" "ASP" cross-reference for the field "PHARMACY ORDERABLE ITEM (#2.1) i.e.
75 ;" ^PSDRUG("ASP",+ID,*), contains list of linked records in file #50
76
77 ;"=================================================================
78
79SyncAllTMG
80 ;"Purpose: Sync/Add all relevent TMG entries into POI
81 ;"Input:none
82 ;"results: none
83
84 new IEN,Itr
85 new abort set abort=0
86 new result set result=0
87 new repeatNeeded set repeatNeeded=0
88
89SATL1 set IEN=$$ItrInit^TMGITR(22706.9,.Itr)
90 do PrepProgress^TMGITR(.Itr,20,0,"IEN")
91 if IEN'="" for do quit:($$ItrNext^TMGITR(.Itr,.IEN)'>0)!(abort=1)
92 . if $$UserAborted^TMGUSRIF set abort=1 quit
93 . new Option
94 . set Option("CUR MODE")="TRADE"
95 . set result=$$POIFromTMG(IEN,.Option) ;"screen for skip will occur in function
96 . if result=-1 set repeatNeeded=1
97 . set Option("CUR MODE")="GENERIC"
98 . set result=$$POIFromTMG(IEN,.Option) ;"screen for skip will occur in function
99 . if result=-1 set repeatNeeded=1
100
101 new % set %=2
102 if repeatNeeded do
103 . write !,"Error found and repeat scan needed.",!
104 . write "Repeat scan now" do YN^DICN write !
105 else do
106 . write !
107 . do PressToCont^TMGUSRIF
108 if %=1 goto SATL1
109
110 quit
111
112
113POIFromTMG(IEN22706d9,Option)
114 ;"Purpose: to Add/Update/(or delete) ONE entry in POI (50.7) file
115 ;"Input: IEN22706d9 -- IEN in 22706.9
116 ;" Option -- NON-OPTIONAL part. Format:
117 ;" Option("CUR MODE")="TRADE" or "GENERIC"
118 ;" Option -- OPTIONAL. Format:
119 ;" Option("FIX CHAIN")=1 <--- changes will be propigate forward
120 ;" to file POI, OI, OQV etc.
121 ;" OPTION("FIX CHAIN","IEN22706d9")=Source IEN
122 ;" Option("IEN50","TRADE")=IEN50 for Trade Name
123 ;" Option("IEN50","GENERIC")=IEN50 for Generic Name
124 ;" Option("CUR MODE")="TRADE" or "GENERIC"
125 ;" Option("QUIET")=1 <-- supress text output
126 ;" Option("DELETING")=1 <-- deleting chain (not IEN22706d9)
127
128 ;"NOTE: This function does DOES screen for skipped entries, and skips
129 ;" proccessing. BUT, if Deleting, then it is NOT skipped
130 ;"Output: POI records will be added or refreshed (or deleted)
131 ;"Result: 1=OK, 0=Error, -1 process repeat requested
132
133 new result set result=1
134 new repeatNeeded set repeatNeeded=0
135 new TMGA,TMGMSG
136 new IEN50d606,IEN51d2,IEN50d7
137
138 if $get(Option("DELETING"))'=1,$piece($get(^TMG(22706.9,IEN22706d9,1)),"^",4)=1 goto AFTMGDone ;"1=SKIP
139 if +$get(IEN22706d9)=0 goto AFTMGDone
140
141 new mode set mode=$get(Option("CUR MODE"))
142 if mode="" set result=0 goto AFTMGDone
143 new field,node,pce
144 if mode="GENERIC" set field=5.71,node=8,pce=4 ;"5.71= POI ptr Generic
145 else if mode="TRADE" set field=5.61,node=8,pce=3 ;"5.61 = POI ptr Trade
146
147 do LoadOption^TMGNDF4C(IEN22706d9,.Option)
148
149 set IEN50d606=$piece($get(^TMG(22706.9,IEN22706d9,0)),"^",7)
150 set IEN51d2=$piece($get(^TMG(22706.9,IEN22706d9,7)),"^",7)
151 new IEN50 set IEN50=+$get(Option("IEN50",mode))
152 if IEN50=0 set result=0 goto AFTM2
153
154 new DrugNAF set DrugNAF=$get(Option("DRUG NAME AND FORM",mode))
155 if (DrugNAF="<DUPLICATE>")!(DrugNAF="") goto AFTM2 ;"skip these...
156
157 set IEN50d7=+$get(Option("IEN50.7",mode))
158
159 if $get(Option("DELETING"))=1 do goto AFTMGDone
160 . do KillPOI^TMGNDFUT(IEN50d7)
161 . set Option("IEN50.7",mode)=""
162
163 if IEN50d7=0 set IEN50d7=$$FindPOI^TMGNDFUT(DrugNAF)
164 if IEN50d7=0 do if IEN50d7=0 set result=0 goto AFTM2
165 . new TMGFDA,TMGIEN,TMGMSG
166 . new PSEDITNM set PSEDITNM=1 ;"a key to allow editing data
167 . set TMGFDA(50.7,"+1,",.01)=DrugNAF
168 . set TMGFDA(50.7,"+1,",.02)=IEN50d606
169 . set TMGFDA(50.7,"+1,",.06)=IEN51d2
170 . set TMGFDA(50.7,"+1,",.07)="R"
171 . do UPDATE^DIE("","TMGFDA","TMGIEN","TMGMSG")
172 . if $data(TMGMSG("DIERR")) do
173 . . set result=0
174 . . do ShowIfDIERR^TMGDEBUG(.TMGMSG)
175 . else set IEN50d7=+$get(TMGIEN(1))
176 else do
177 . new TMGFDA,TMGIEN,TMGMSG
178 . new PSEDITNM set PSEDITNM=1 ;"a key to allow editing data
179 . set TMGFDA(50.7,IEN50d7_",",.01)=DrugNAF
180 . set TMGFDA(50.7,IEN50d7_",",.02)=IEN50d606
181 . set TMGFDA(50.7,IEN50d7_",",.06)=IEN51d2
182 . set TMGFDA(50.7,IEN50d7_",",.07)="R"
183 . new temp set temp=$$TrimFDA^TMGDBAPI(.TMGFDA)
184 . if $data(TMGFDA)=0 quit
185 . do FILE^DIE("S","TMGFDA","TMGMSG")
186 . if $data(TMGMSG("DIERR")) do
187 . . set result=0
188 . . do ShowIfDIERR^TMGDEBUG(.TMGMSG)
189 . . if $get(TMGMSG("DIERR",1))=601 do ;"601 --> [record doesn't exist]
190 . . . write "Dangling pointer found & removed. ** RUN ENTIRE PROCESS AGAIN **",!
191 . . . set IEN50d7=0
192 . . . new TMGFDA,TMGMSG
193 . . . set TMGFDA(22706.9,IEN22706d9_",",field)="@"
194 . . . do FILE^DIE("S","TMGFDA","TMGMSG")
195 . . . do ShowIfDIERR^TMGDEBUG(.TMGMSG)
196 . . . kill TMGFDA,TMGMSG
197 . . . set TMGFDA(50,IEN50_",",2.1)="@"
198 . . . do FILE^DIE("S","TMGFDA","TMGMSG")
199 . . . set repeatNeeded=1
200 . . . set result=-1
201 . . . if $data(TMGMSG("DIERR")) do
202 . . . . if $data(TMGMSG("DIERR","E",120))>0 set result="" quit ;"ignore error if #120 (hook) present.
203 . . . . do ShowIfDIERR^TMGDEBUG(.TMGMSG)
204
205 set Option("IEN50.7",mode)=IEN50d7
206
207 ;"Ensure pointer to POI stored in TMG IMPORT COMPILED
208 if +$piece($get(^TMG(22706.9,IEN22706d9,node)),"^",pce)'=IEN50d7 do
209 . new TMGFDA,TMGMSG
210 . set TMGFDA(22706.9,IEN22706d9_",",field)=IEN50d7
211 . do FILE^DIE("","TMGFDA","TMGMSG")
212 . do ShowIfDIERR^TMGDEBUG(.TMGMSG)
213 . set Option("IEN50.7",mode)=IEN50d7
214
215 ;"Ensure pointer to POI stored in DRUG file, field 2.1
216 if +$piece($get(^PSDRUG(IEN50,2)),"^",1)'=IEN50d7 do
217 . new TMGFDA,TMGMSG
218 . set TMGFDA(50,IEN50_",",2.1)=IEN50d7
219 . do FILE^DIE("S","TMGFDA","TMGMSG")
220 . set result=0
221 . if $data(TMGMSG("DIERR")) do
222 . . if $data(TMGMSG("DIERR","E",120))>0 set result="" quit ;"ignore error if #120 (hook) present.
223 . . do ShowIfDIERR^TMGDEBUG(.TMGMSG)
224
225AFTM2
226 if $get(Option("FIX CHAIN"))=1 do ;"pass message forward for fix
227 . do Activ1TMG^TMGNDF4B(IEN22706d9)
228 . new temp set temp=$$OIFromTMG^TMGNDF4C(IEN22706d9,.Option) ;" <-- more chaining from this
229 . ;"if $get(Option("DELETING"))=1 do
230 . ;". new IEN50 set IEN50=+$get(Option("IEN50",mode))
231 . ;". if IEN50=0 write "?? 1 -- In POIFromTMG^TMGNDF4A.",! quit
232 . ;". new IEN50d7 set IEN50d7=+$get(Option("IEN50d7",mode))
233 . ;". if IEN50d7=0 set IEN50d7=+$piece(^PSDRUG(IEN50,2),"^",1) ;"try a second way
234 . ;". if IEN50d7=0 write "?? 2 -- In POIFromTMG^TMGNDF4A.",! quit
235 . ;". new numRef set numRef=$$ListCt^TMGMISC($name(^PSDRUG("ASP",IEN50d7)))
236 . ;". if numRef>1 quit ;"don't kill POI if another drug in 50 points to it
237 . ;". new TMGFDA,TMGMSG,TMGIEN
238 . ;". new PSEDITNM set PSEDITNM=1 ;"a key to allow editing data
239 . ;". set TMGFDA(50.7,IEN50d7_",",.01)="@" ;"delete pointer from file 50
240 . ;". do FILE^DIE("EK","TMGFDA","TMGMSG")
241 . ;". if $$ShowIfError^TMGDBAPI(.TMGMSG) quit
242 . ;". ;"Now delete from TMG IMPORT COMPILED
243 . ;". new field
244 . ;". if mode="GENERIC" set field=5.71
245 . ;". else if mode="TRADE" set field=5.61
246 . ;". else write "Can't delete pointer to 50.7 from 22706.9.",!,"Can't determine if GENERIC or TRADE mode.",! quit
247 . ;". set TMGFDA(22706.9,IEN22706d9_",",field)="@" ;"delete pointer from TMG IMPORT COMPILED
248 . ;". do FILE^DIE("EK","TMGFDA","TMGMSG")
249 . ;". if $$ShowIfError^TMGDBAPI(.TMGMSG) quit
250
251AFTMGDone
252 if repeatNeeded=1 set result=-1
253 quit result
254
255 ;" === Do1POI is old -- delete later...
256Do1POI(IEN22706d9,IEN50d606,IEN51d2,Option)
257 ;"Purpose: add/refresh one PHARMACY ORDERABLE ITEM (POI) entry.
258 ;"Input: IEN22706d9 -- IEN in 22706.9
259 ;" IEN50d606 -- IEN in 50.606
260 ;" IEN51d2 -- IEN in 51.2
261 ;" Option -- NON-OPTIONAL PART. Format:
262 ;" Option("CUR MODE")="TRADE" or "GENERIC"
263 ;" Option("IEN50.7","TRADE")=IEN50.7 for Trade Name
264 ;" Option("IEN50.7","GENERIC")=IEN50.7 for Generic Name
265 ;" Option("DRUG NAME AND FORM","TRADE")=Trade Name and Form
266 ;" Option("DRUG NAME AND FORM","GENERIC")=Generic Name and Form
267 ;" Option("IEN50","TRADE")=IEN50 for Trade Name
268 ;" Option("IEN50","GENERIC")=IEN50 for Generic Name
269 ;" Option -- OPTIONAL. Format:
270 ;" Option("FIX CHAIN")=1 <--- changes will be propigate forward
271 ;" to file POI, OI, OQV etc.
272 ;" OPTION("FIX CHAIN","IEN22706d9")=Source IEN
273 ;" Option("QUIET")=1 <-- supress text output
274 ;" Option("DELETING")=1 <-- deleting chain (not IEN22706d9)
275 ;"Result: IEN50d7 if OK, -1 =Error, -2 process repeat requested
276
277 new result set result="" ;"default to null
278 new TMGA,TMGMSG
279 new IEN50d7 set IEN50d7=-1 ;"default to error
280 new mode set mode=$get(Option("CUR MODE"))
281 if mode="" write "ERROR: in Do1POI^TMGNDF4A. Mode not supplied.",! goto D1PDone
282 new DrugNAF set DrugNAF=$get(Option("DRUG NAME AND FORM",mode))
283 if (DrugNAF="<DUPLICATE>")!(DrugNAF="") goto D1PDone ;"skip these...
284 new IEN50 set IEN50=+$get(Option("IEN50",mode)) if IEN50=0 set result=-1 goto D1PDone
285 new IEN50d7 set IEN50d7=+$get(Option("IEN50.7",mode))
286 new field,node,pce
287 if mode="GENERIC" set field=5.71,node=8,pce=4 ;"5.71= POI ptr Generic
288 else if mode="TRADE" set field=5.61,node=8,pce=3 ;"5.61 = POI ptr Trade
289
290 if IEN50d7=0 set IEN50d7=$$FindPOI^TMGNDFUT(DrugNAF)
291 if IEN50d7=0 do
292 . new TMGFDA,TMGIEN,TMGMSG
293 . new PSEDITNM set PSEDITNM=1 ;"a key to allow editing data
294 . set TMGFDA(50.7,"+1,",.01)=DrugNAF
295 . set TMGFDA(50.7,"+1,",.02)=IEN50d606
296 . set TMGFDA(50.7,"+1,",.06)=IEN51d2
297 . set TMGFDA(50.7,"+1,",.07)="R"
298 . do UPDATE^DIE("","TMGFDA","TMGIEN","TMGMSG")
299 . if $data(TMGMSG("DIERR")) do
300 . . set result=-1
301 . . do ShowIfDIERR^TMGDEBUG(.TMGMSG)
302 . else set IEN50d7=+$get(TMGIEN(1))
303 else do
304 . new TMGFDA,TMGIEN,TMGMSG
305 . new PSEDITNM set PSEDITNM=1 ;"a key to allow editing data
306 . set TMGFDA(50.7,IEN50d7_",",.01)=DrugNAF
307 . set TMGFDA(50.7,IEN50d7_",",.02)=IEN50d606
308 . set TMGFDA(50.7,IEN50d7_",",.06)=IEN51d2
309 . set TMGFDA(50.7,IEN50d7_",",.07)="R"
310 . new temp set temp=$$TrimFDA^TMGDBAPI(.TMGFDA)
311 . if $data(TMGFDA)=0 quit
312 . do FILE^DIE("S","TMGFDA","TMGMSG")
313 . if $data(TMGMSG("DIERR")) do
314 . . set result=-1
315 . . do ShowIfDIERR^TMGDEBUG(.TMGMSG)
316 . . if $get(TMGMSG("DIERR",1))=601 do ;"601 --> [record doesn't exist]
317 . . . write "Dangling pointer found & removed. ** RUN ENTIRE PROCESS AGAIN **",!
318 . . . set IEN50d7=0
319 . . . new TMGFDA,TMGMSG
320 . . . set TMGFDA(22706.9,IEN22706d9_",",field)="@"
321 . . . do FILE^DIE("S","TMGFDA","TMGMSG")
322 . . . do ShowIfDIERR^TMGDEBUG(.TMGMSG)
323 . . . kill TMGFDA,TMGMSG
324 . . . set TMGFDA(50,IEN50_",",2.1)="@"
325 . . . do FILE^DIE("S","TMGFDA","TMGMSG")
326 . . . set result=-1
327 . . . if $data(TMGMSG("DIERR")) do
328 . . . . if $data(TMGMSG("DIERR","E",120))>0 set result="" quit ;"ignore error if #120 (hook) present.
329 . . . . do ShowIfDIERR^TMGDEBUG(.TMGMSG)
330
331 if +IEN50d7=0 set result=-1 goto D1PDone
332
333 ;"if +$get(Option("IEN50.7",mode))=0 do
334 ;". new TMGFDA,TMGMSG
335 ;". set TMGFDA(22706.9,IEN22706d9_",",field)=IEN50d7
336 ;". do FILE^DIE("S","TMGFDA","TMGMSG")
337 ;". do ShowIfDIERR^TMGDEBUG(.TMGMSG)
338 ;". set Option("IEN50.7",mode)=IEN50d7
339
340 ;"Store pointer to POI in TMG IMPORT COMPILED
341 if +$piece($get(^TMG(22706.9,IEN22706d9,node)),"^",pce)'=IEN50d7 do
342 . new TMGFDA,TMGMSG
343 . set TMGFDA(22706.9,IEN22706d9_",",field)=IEN50d7
344 . do FILE^DIE("","TMGFDA","TMGMSG")
345 . do ShowIfDIERR^TMGDEBUG(.TMGMSG)
346 . set Option("IEN50.7",mode)=IEN50d7
347
348 if +$piece($get(^PSDRUG(IEN50,2)),"^",1)'=IEN50d7 do
349 . new TMGFDA,TMGMSG
350 . set TMGFDA(50,IEN50_",",2.1)=IEN50d7
351 . do FILE^DIE("S","TMGFDA","TMGMSG")
352 . set result=-1
353 . if $data(TMGMSG("DIERR")) do
354 . . if $data(TMGMSG("DIERR","E",120))>0 set result="" quit ;"ignore error if #120 (hook) present.
355 . . do ShowIfDIERR^TMGDEBUG(.TMGMSG)
356
357D1PDone
358 if result="" set result=IEN50d7
359 quit result
360
361 ;"=================================================================
362 ;"=================================================================
363
364
365InactivatePOIs
366 ;"Purpose: To inactivate all POI (entries in PHARMACY ORDERABLE ITEMS)
367 ;" This will prevent left-over entries from a prior run to cause problems
368
369 new Itr,IEN
370 new abort set abort=0
371 write "Inactivating all prior PHARMACY ORDERABLE ITEMS...",!
372 set IEN=$$ItrInit^TMGITR(50.7,.Itr)
373 do PrepProgress^TMGITR(.Itr,20,0,"IEN")
374 if IEN'="" for do quit:($$ItrNext^TMGITR(.Itr,.IEN)'>0)!abort
375 . if $$UserAborted^TMGUSRIF set abort=1 quit
376 . new TMGFDA,TMGMSG
377 . set TMGFDA(50.7,IEN_",",.04)="NOW"
378 . do FILE^DIE("KE","TMGFDA","TMGMSG")
379 . do ShowIfDIERR^TMGDEBUG(.TMGMSG)
380 do ProgressDone^TMGITR(.Itr)
381
382 quit
383
384
385ActivAll
386 ;"DISABLED... THIS SHOULD BE DONE IN TMENDF4B...
387
388 ;"Purpose: to activate all POI's
389
390 new Itr,IEN
391 new abort set abort=0
392 set IEN=$$ItrInit^TMGITR(50.7,.Itr)
393 do PrepProgress^TMGITR(.Itr,20,0,"IEN")
394 if IEN'="" for do quit:(+$$ItrNext^TMGITR(.Itr,.IEN)'>0)!abort
395 . if $$UserAborted^TMGUSRIF set abort=1 quit
396 . new temp
397 . set temp=$$ActivatePOI(IEN)
398 do ProgressDone^TMGITR(.Itr)
399
400 quit
401
402
403
404ActivatePOI(IEN50d7)
405 ;"Purpose: to remove the inactivation date that is automatically
406 ;" added with editing of the POI record
407 ;"result: 1 = OK, 0=error
408
409 new result set result=1
410
411 new TMGFDA,TMGMSG
412 set TMGFDA(50.7,IEN50d7_",",.04)="@" ;"delete inactivation date field value
413 do
414 . new $etrap set $etrap="do HandlePOIErr^TMGNDF4A quit"
415 . do FILE^DIE("ES","TMGFDA","TMGMSG")
416 if $data(TMGMSG("DIERR"))'=0 do goto APOIDone
417 . do ShowDIERR^TMGDEBUG(.TMGMSG,.PriorErrorFound)
418 . set result=0
419 . write "Error occurred in function ActivatePOI",!
420 . zwr TMGFDA
421APOIDone
422 quit result
423
424
425HandlePOIErr
426 ;"Purpose: An error handler for ActivatePOI
427 set $ECODE=""
428 if result=0 quit
429 set result=0
430 write "Error encountered activating Pharmacy Orderable Item: "
431 write $piece($get(^PS(50.7,IEN50d7,0)),"^",1)," (#",IEN50d7,")",!
432 ;"Note: below won't set needed xrefs etc.
433 ;"set $piece(^PS(50.7,IEN50d7,0),"^",4)=""
434 ;"write "Fixed with low-level removal of inactivation date.",!
435 quit
436
437
438
439KillPOIs
440 ;"Purpose: to kill all POI's, do allow fresh start (after errors)
441
442 new % set %=2
443 write "Are you sure you want to perminantly KILL all PHARMACY ORDERABLE ITEMS"
444 do YN^DICN
445 if %'=1 goto KPOIDone
446
447 new Itr,IEN50d7
448 new abort set abort=0
449 set IEN50d7=$$ItrInit^TMGITR(50.7,.Itr)
450 do PrepProgress^TMGITR(.Itr,2,0,"IEN50d7")
451 if IEN50d7'="" for do quit:(+$$ItrNext^TMGITR(.Itr,.IEN50d7)'>0)!abort
452 . if $$UserAborted^TMGUSRIF set abort=1 quit
453 . do KillPOI^TMGNDFUT(IEN50d7)
454 do ProgressDone^TMGITR(.Itr)
455
456KPOIDone
457 quit
Note: See TracBrowser for help on using the repository browser.