source: FOIAVistA/trunk/r/ENGINEERING-EN/ENTIUTL2.m@ 1611

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

initial load of FOIAVistA 6/30/08 version

File size: 7.3 KB
Line 
1ENTIUTL2 ;WOIFO/SAB - Find and Sort Equipment Utilities ;2/14/2008
2 ;;7.0;ENGINEERING;**87**;Aug 17, 1993;Build 16
3 ;
4ASKEQSM(ENAML,ENDM) ; Ask Equipment Selection Method
5 ; input
6 ; ENAML = allowed method list, may contain the following characters
7 ; A = all equipment
8 ; E = by Entry #
9 ; C = by CMR
10 ; U = by using service
11 ; L = by location
12 ; S = by service of location
13 ; example "ECULS"
14 ; ENDM = (optional) default method
15 ; returns null if no method selected or
16 ; piece 1 = A, E, C, U, L, or S if a method was selected
17 ; piece 2 = specified value when method is C, U, L, or S
18 ; e.g. "C^12" for CMR with internal entry number = 12
19 ;
20 N DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,ENRET,ENVAL,X,Y
21 S ENRET="",ENVAL=""
22 ;
23 ; ask method
24 S DIR(0)="S^"
25 I ENAML["A" S DIR(0)=DIR(0)_"A:ALL TRACKED IT EQUIPMENT;"
26 I ENAML["E" S DIR(0)=DIR(0)_"E:ENTRY #;"
27 I ENAML["C" S DIR(0)=DIR(0)_"C:CMR;"
28 I ENAML["U" S DIR(0)=DIR(0)_"U:USING SERVICE;"
29 I ENAML["L" S DIR(0)=DIR(0)_"L:LOCATION;"
30 I ENAML["S" S DIR(0)=DIR(0)_"S:SERVICE OF LOCATION;"
31 Q:DIR(0)="S^" ENRET
32 ; remove trailing ;
33 I $E(DIR(0),$L(DIR(0)))=";" S DIR(0)=$E(DIR(0),1,$L(DIR(0))-1)
34 S DIR("A")="Specify method to select equipment by"
35 I $G(ENDM)]"" S DIR("B")=ENDM
36 S DIR("?")="Enter a code from the list."
37 S DIR("?",1)="The system considers tracked IT equipment to be"
38 S DIR("?",2)="equipment that is on a CMR with IT TRACKING = YES."
39 S DIR("?",3)=" "
40 D ^DIR
41 I '$D(DIRUT) S ENRET=Y
42 ;
43 ; ask a value for applicable methods
44 ;
45 ; method C - by CMR
46 I ENRET="C" D
47 . ; ask CMR
48 . S DIC("S")="I $P($G(^(0)),U,9)=1" ; screen IT TRACKING = YES
49 . S DIC="^ENG(6914.1,"
50 . S DIC(0)="AQEM"
51 . D ^DIC K DIC I Y<1 S ENRET="" Q
52 . S ENVAL=+Y
53 ;
54 ; method U - by using service
55 I ENRET="U" D
56 . ; ask USING SERVICE
57 . S DIC("S")="I $D(^ENG(6914,""AC"",+Y))" ; screen services with equip
58 . S DIC="^DIC(49,"
59 . S DIC(0)="AQEM"
60 . D ^DIC K DIC I Y<1 S ENRET="" Q
61 . S ENVAL=+Y
62 ;
63 ; method L - by location
64 I ENRET="L" D
65 . ; ask LOCATION
66 . S DIC("S")="I $D(^ENG(6914,""D"",+Y))" ; screen locations with equip
67 . S DIC="^ENG(""SP"","
68 . S DIC(0)="AQEM"
69 . D ^DIC K DIC I Y<1 S ENRET="" Q
70 . S ENVAL=+Y
71 ;
72 ; method S - by service of location
73 I ENRET="S" D
74 . ; ask SERVICE
75 . S DIC("S")="I $D(^ENG(""SP"",""D"",+Y))" ; screen services with space
76 . S DIC="^DIC(49,"
77 . S DIC(0)="AQEM"
78 . D ^DIC K DIC I Y<1 S ENRET="" Q
79 . S ENVAL=+Y
80 ;
81 I ENVAL]"" S ENRET=ENRET_"^"_ENVAL
82 Q ENRET
83 ;
84ASKIAEQ() ; Ask Include Assigned Equipment
85 ;
86 ; returns null if time-out or uparrorw
87 ; 1 if assigned equipment should be included
88 ; 0 if not
89 ;
90 N DIR,DIROUT,DIRUT,DTOUT,DUOUT,ENRET,X,Y
91 S ENRET=""
92 S DIR(0)="Y"
93 S DIR("A")="Include equipment with an existing active assignment"
94 S DIR("B")="NO"
95 D ^DIR
96 I '$D(DIRUT) S ENRET=Y
97 Q ENRET
98 ;
99ASKEQSRT(ENSM,ENDM) ; Ask Equipment Sort
100 ; input ENSM = (optional) selection method
101 ; if method is E then sort is set to E
102 ; ENDM = (optional) default sort method
103 ;
104 ; returns null if no sort selected
105 ; E, C, U, L, or S if a sort was selected
106 ;
107 N DIR,DIROUT,DIRUT,DTOUT,DUOUT,ENRET,X,Y
108 S ENRET=""
109 I $G(ENSM)="E" S ENRET="E"
110 E D
111 . S DIR(0)="S^E:ENTRY #;C:CMR;U:USING SERVICE;L:LOCATION;S:SERVICE OF LOCATION"
112 . S DIR("A")="Sort equipment by"
113 . I $G(ENDM)]"" S DIR("B")=ENDM
114 . D ^DIR K DIR
115 . I '$D(DIRUT) S ENRET=Y
116 Q ENRET
117 ;
118GETEQ(ENSM,ENVAL,ENSRT,ENIA) ; Get Equipment
119 ; input ENSM = selection method (A, E, C, U, L, or S)
120 ; NOTE: E method is interactive, while the others are not
121 ; ENVAL = value when method is C, U, L, or S (e.g. ien of CMR)
122 ; ENSRT = sort by (E, C, U, L, or S) - must be E for method E
123 ; ENIA = 1 (include) or 0 (don't include) equip w/active assign
124 ; this does not apply to method E
125 ; optional, default = 1
126 ; output
127 ; ^TMP($J,"ENITEQ",0)=count^method^specified value^sort
128 ; ^TMP($J,"ENITEQ",sort value,equip ien)="" list of equipment
129 ;
130 N ENCMR,ENCNT,END,ENDA
131 K ^TMP($J,"ENITEQ")
132 S ENVAL=$G(ENVAL)
133 S ENSRT=$G(ENSRT,"E")
134 S ENIA=$G(ENIA,1)
135 S ENCNT=0,END=0
136 ;
137 ; method A - all tracked equipment
138 I ENSM="A" D
139 . ; loop thru CMRs with IT TRACKING = YES
140 . S ENCMR=0 F S ENCMR=$O(^ENG(6914.1,"AIT",1,ENCMR)) Q:'ENCMR D
141 . . ; loop thru equipment on CMR
142 . . S ENDA=0 F S ENDA=$O(^ENG(6914,"AD",ENCMR,ENDA)) Q:'ENDA D
143 . . . I 'ENIA,$D(^ENG(6916.3,"AEA",ENDA)) Q ; chose to excl. assigned
144 . . . D SETTMP
145 ;
146 ; method E - by individual equipment (interactive)
147 I ENSM="E" D
148 . N DA,DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,ENSCR,X,Y
149 . ; screen by CMR:IT TRACKING
150 . S ENSCR="N ENCMR S ENCMR=$P($G(^(2)),U,9) I ENCMR,$D(^ENG(6914.1,""AIT"",1,ENCMR))"
151 . ; ask equipment in loop
152 . F S DIC("S")=ENSCR D GETEQ^ENUTL Q:Y<1 D Q:END
153 . . S ENDA=+Y
154 . . ; display equip
155 . . W @(IOF)
156 . . D DISEQ^ENTIUTL(ENDA)
157 . . W !
158 . . D DISASGN^ENTIUTL(ENDA)
159 . . ;
160 . . ; check if already selected (sort is always "E" for this method)
161 . . I $D(^TMP($J,"ENITEQ","NA",ENDA)) D Q
162 . . . W !!,"This equipment item has already been selected."
163 . . . W !,"If all desired equipment has been selected then press RETURN"
164 . . . W !,"at the equipment selection prompt."
165 . . ;
166 . . ; ask confirmation
167 . . W !
168 . . S DIR(0)="Y",DIR("A")="Do you want to select this item"
169 . . D ^DIR I $D(DIRUT) S END=1 Q
170 . . I 'Y Q
171 . . ;
172 . . ; user confirmed
173 . . D SETTMP
174 ;
175 ; method C - by CMR
176 I ENSM="C" D
177 . ; loop thru equipment on the CMR
178 . S ENDA=0 F S ENDA=$O(^ENG(6914,"AD",ENVAL,ENDA)) Q:'ENDA D
179 . . I 'ENIA,$D(^ENG(6916.3,"AEA",ENDA)) Q ; chose to exclude assigned
180 . . D SETTMP
181 ;
182 ; method U - by using service
183 I ENSM="U" D
184 . ; loop thru equipment with this using service
185 . S ENDA=0 F S ENDA=$O(^ENG(6914,"AC",ENVAL,ENDA)) Q:'ENDA D
186 . . S ENCMR=$P($G(^ENG(6914,ENDA,2)),U,9)
187 . . Q:'ENCMR ; not on a cmr
188 . . Q:$P($G(^ENG(6914.1,ENCMR,0)),U,9)'=1 ; IT tracking not yes
189 . . I 'ENIA,$D(^ENG(6916.3,"AEA",ENDA)) Q ; chose to exclude assigned
190 . . D SETTMP
191 ;
192 ; method L - by location
193 I ENSM="L" D
194 . ; loop thru equipment in this location
195 . S ENDA=0 F S ENDA=$O(^ENG(6914,"D",ENVAL,ENDA)) Q:'ENDA D
196 . . S ENCMR=$P($G(^ENG(6914,ENDA,2)),U,9)
197 . . Q:'ENCMR ; not on a cmr
198 . . Q:$P($G(^ENG(6914.1,ENCMR,0)),U,9)'=1 ; IT tracking not yes
199 . . I 'ENIA,$D(^ENG(6916.3,"AEA",ENDA)) Q ; chose to exclude assigned
200 . . D SETTMP
201 ;
202 ; method S - by service of location
203 I ENSM="S" D
204 . N ENSP
205 . ; loop thru locations with this service
206 . S ENSP=0 F S ENSP=$O(^ENG("SP","D",ENVAL,ENSP)) Q:'ENSP D
207 . . ; loop thru equipment with this location
208 . . S ENDA=0 F S ENDA=$O(^ENG(6914,"D",ENSP,ENDA)) Q:'ENDA D
209 . . . S ENCMR=$P($G(^ENG(6914,ENDA,2)),U,9)
210 . . . Q:'ENCMR ; not on a cmr
211 . . . Q:$P($G(^ENG(6914.1,ENCMR,0)),U,9)'=1 ; IT tracking not yes
212 . . . I 'ENIA,$D(^ENG(6916.3,"AEA",ENDA)) Q ; chose to exclude assigned
213 . . . D SETTMP
214 ;
215 ; set output header node
216 S ^TMP($J,"ENITEQ",0)=ENCNT_U_ENSM_U_ENVAL_ENSRT
217 ;
218 Q
219 ;
220SETTMP ; save equipment in sorted TMP global
221 N ENSRTV
222 S ENSRTV=""
223 I ENSRT="E" S ENSRTV="NA"
224 I ENSRT="C" S ENSRTV=$$GET1^DIQ(6914,ENDA,19) ; cmr
225 I ENSRT="U" S ENSRTV=$$GET1^DIQ(6914,ENDA,21) ; service
226 I ENSRT="L" S ENSRTV=$$GET1^DIQ(6914,ENDA,24) ; location
227 I ENSRT="S" S ENSRTV=$$GET1^DIQ(6914,ENDA,"24:1.5") ; svc of loc
228 I ENSRTV="" S ENSRTV=" <null>"
229 S ^TMP($J,"ENITEQ",ENSRTV,ENDA)=""
230 S ENCNT=ENCNT+1
231 Q
232 ;
233 ;ENTIUTL2
Note: See TracBrowser for help on using the repository browser.