source: FOIAVistA/trunk/r/ENGINEERING-EN/ENWOME.m@ 1528

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

initial load of FOIAVistA 6/30/08 version

File size: 6.6 KB
Line 
1ENWOME ;(WASH ISC)/SAB-WORK ORDER MULTIPLE ENTRY ;1-27-97
2 ;;7.0;ENGINEERING;**35**;Aug 17, 1993
3 N NUMBER,SHOPKEY,WARD
4 K ^TMP($J)
5 S DIR("A")="Enter a new equipment work order and copy it (Y/N)"
6 S DIR(0)="Y",DIR("B")="YES" D ^DIR K DIR G:'Y!$D(DIRUT) EXIT
7 ; get first w.o.
8 D SSHOP^ENWO G:ENSHKEY'>0 EXIT
9 S SHOPKEY=ENSHKEY
10 S NUMBER="" D WONUM^ENWONEW I NUMBER="" D G EXIT
11 . W !!,*7,"Can't seem to add to Work Order File."
12 . W !,"Please try again later or contact IRM Service."
13 S ENWODA=DA L +^ENG(6920,ENWODA)
14 W !,"WORK ORDER #: ",NUMBER
15 S WARD=0 D WOFILL^ENWONEW
16EDITWO ; edit work order
17 S DR=$S($D(^DIE("B","ENZWONEW")):"[ENZWONEW]",1:"[ENWONEW]")
18 D ^DIE I $D(DTOUT) D DELWO G EXIT
19 S ENEQDA=$P($G(^ENG(6920,ENWODA,3)),U,8)
20 I ENEQDA']"" D G:Y EDITWO D DELWO G EXIT
21 . W !,"An Equipment ID # is required by this option."
22 . S DIR(0)="Y"
23 . S DIR("A")="Do you want to edit the work order (Y/N)",DIR("B")="YES"
24 . D ^DIR K DIR
25 S DIR(0)="Y",DIR("B")="NO"
26 S DIR("A")="Do you want to CLOSE this work order now (Y/N)"
27 D ^DIR K DIR D:Y I $D(DIRUT) D DELWO G EXIT
28 . S DR=$S($D(^DIE("B","ENZWONEWCLOSE")):"[ENZWONEWCLOSE]",1:"[ENWONEWCLOSE]")
29 . D ^DIE
30 S DIR(0)="Y"
31 S DIR("A")="Do you want to print this work order (Y/N)",DIR("B")="YES"
32 D ^DIR K DIR I $D(DIRUT) D DELWO G EXIT
33 I Y S DA=ENWODA D P^ENWOD
34SEL ; select equipment
35 K ^TMP($J)
36 S DIR(0)="S^1:SEARCH EQUIPMENT FILE BY CATEGORY, MANUFACTURER, OR MODEL;2:INDIVIDUALLY SELECT EQUIPMENT"
37 S DIR("A")="USE METHOD: ",DIR("B")="1"
38 S DIR("A",1)="Choose desired method to select additional equipment."
39 S DIR("?")="Enter 1 or 2 (enter '^' to abort and W.O. will be deleted)"
40 S DIR("?",1)="Additional equipment can be selected by one of the following methods."
41 S DIR("?",2)=" "
42 S DIR("?",3)="1 SEARCH EQUIPMENT FILE BY CATEGORY, MANUFACTURER, OR MODEL -"
43 S DIR("?",4)=" Enter desired value(s) in one or more of the three available search"
44 S DIR("?",5)=" criteria. Equipment Category, Manufacturer, and/or Model can be specified."
45 S DIR("?",6)=" Equipment which exactly matches all specified criteria will be selected."
46 S DIR("?",7)=" If a value is not entered then the corresponding search criteria will not"
47 S DIR("?",8)=" be used. Equipment with a disposition date will not be included."
48 S DIR("?",9)=" "
49 S DIR("?",10)="2 INDIVIDUALLY SELECT EQUIPMENT - Individually choose each equipment item."
50 S DIR("?",11)=" "
51 D ^DIR K DIR S ENMETH=Y I $D(DIRUT) D DELWO G EXIT
52 S ENC("EQ")=0
53 I ENMETH=1 D I $D(DTOUT)!$D(DUOUT) D DELWO G EXIT
54 . S (ENEQCAT,ENMANF,ENMODEL)="" K DA
55 . S DIR(0)="6914,6",DIR("A")="Select items with EQUIPMENT CATEGORY"
56 . D ^DIR K DIR Q:$D(DTOUT)!$D(DUOUT) S:Y>0 ENEQCAT=+Y
57 . S DIR(0)="6914,1",DIR("A")="Select items with MANUFACTURER"
58 . D ^DIR K DIR Q:$D(DTOUT)!$D(DUOUT) S:Y>0 ENMANF=+Y
59 . S DIR(0)="6914,4",DIR("A")="Select items with MODEL"
60 . D ^DIR K DIR Q:$D(DTOUT)!$D(DUOUT) S ENMODEL=Y
61 . I ENEQCAT']"",ENMANF']"",ENMODEL']"" W !,"No criteria entered" Q
62 . S ENXREF=$S(ENMODEL]"":"E",ENMANF]"":"K",1:"G")
63 . S ENXREFV=$S(ENXREF="E":ENMODEL,ENXREF="K":ENMANF,1:ENEQCAT)
64 . S ENI=0 F S ENI=$O(^ENG(6914,ENXREF,ENXREFV,ENI)) Q:'ENI D
65 . . S ENY1=$G(^ENG(6914,ENI,1))
66 . . I ENEQCAT]"",$P(ENY1,U,1)'=ENEQCAT Q
67 . . I ENMANF]"",$P(ENY1,U,4)'=ENMANF Q
68 . . I ENMODEL]"",$P(ENY1,U,2)'=ENMODEL Q
69 . . I $P($G(^ENG(6914,ENI,3)),U,11)]"" Q ; disposition date exists
70 . . I ENI'=ENEQDA S ^TMP($J,ENI)="",ENC("EQ")=ENC("EQ")+1
71 I ENMETH=2 D K DIC
72 . S DIC="^ENG(6914,",DIC(0)="AQEM"
73 . F D ^DIC Q:Y'>0 I Y'=ENEQDA,'$D(^TMP($J,+Y)) S ^(+Y)="",ENC("EQ")=ENC("EQ")+1
74 I 'ENC("EQ") W !,"No equipment items were selected" G SEL
75CONF ; confirm
76 W !!,"Work Orders will be copied for ",ENC("EQ")," items of equipment"
77 S DIR("A")="OK to Proceed"
78 S DIR("?")="Enter Y, N, or L (enter '^' to exit and delete work order)"
79 S DIR("?",1)="Select appropriate action"
80 S DIR("?",2)="YES to create work orders for selected equipment"
81 S DIR("?",3)="NO to select different equipment"
82 S DIR("?",4)="LIST to list currently selected equipment"
83 S DIR("?",5)="^ to exit and delete original work order"
84 S DIR(0)="SMB^Y:YES;N:NO;L:LIST" D ^DIR K DIR I $D(DIRUT) D DELWO G EXIT
85 I Y="N" G SEL
86 I Y="L" D LST^ENWOME1 G CONF
87ASKPRT ; print new work orders?
88 S DIR(0)="Y"
89 S DIR("?")="Enter Yes or No"
90 S DIR("?",1)="Enter Yes to print all new work orders to a selected"
91 S DIR("?",2)="device. The appropriate format (LONG or SHORT) will be"
92 S DIR("?",3)="obtained from the AUTO PRINT NEW W.O. software option."
93 S DIR("?",4)=" "
94 S DIR("A")="Should all new work orders be printed? (Y/N)",DIR("B")="NO"
95 D ^DIR K DIR S ENPRT=Y I $D(DIRUT) D DELWO G EXIT
96 D:ENPRT I $D(DTOUT)!$D(DUOUT) D DELWO G EXIT
97 . ; get output device (with default for shop)
98 . S DIC=6922,DR="2",DA=ENSHKEY,DIQ="ENDIQ",DIQ(0)="E"
99 . D EN^DIQ1 K DIQ
100 . S DIC=3.5,DIC(0)="AQEMZ",DIC("B")=ENDIQ(6922,ENSHKEY,2,"E")
101 . K ENDIQ
102 . D ^DIC K DIC S:Y>0 ENPRT("DEV")=$P(Y(0),U)
103COPYWO ;
104 W !,"Copying work order for selected equipment"
105 S ENFATAL=0
106 S ENI=0 F S ENI=$O(^TMP($J,ENI)) Q:'ENI D Q:ENFATAL
107 . ; get new w.o. number
108 . S NUMBER="" D WONUM^ENWONEW
109 . I NUMBER="" D I NUMBER="" S ENFATAL=1 Q
110 . . W !,"Couldn't obtain a new Work Order #. Retrying..."
111 . . D WONUM^ENWONEW
112 . . I NUMBER="" W !,"Still couldn't get a new Work Order #"
113 . S ENWODAY=DA
114 . ; copy data
115 . L +^ENG(6920,ENWODAY)
116 . S %X="^ENG(6920,ENWODA,",%Y="^ENG(6920,ENWODAY," D %XY^%RCR
117 . ; set specific data for .01, .05, LOCATION, EQUIPMENT ID #
118 . S ENY0=$G(^ENG(6920,ENWODAY,0))
119 . S $P(ENY0,U,1)=NUMBER
120 . S $P(ENY0,U,6)=NUMBER
121 . S $P(ENY0,U,4)=$P($G(^ENG(6914,ENI,3)),U,5) ; location from equip
122 . S ^ENG(6920,ENWODAY,0)=ENY0
123 . S $P(^ENG(6920,ENWODAY,3),U,8)=ENI ; will trigger remaining fields
124 . ; index new entry
125 . S DA=ENWODAY,DIK="^ENG(6920," D IX^DIK K DIK
126 . ; save w.o. number in ^tmp
127 . S ^TMP($J,ENI)=ENWODAY_U_NUMBER
128 . L -^ENG(6920,ENWODAY)
129 . W "."
130 I ENFATAL D DELWO G EXIT
131 I ENPRT D QUETSK^ENWOME2
132 W !,"All work orders created"
133 W !,"Select output device for list or enter '^' to suppress report"
134 S ENCOPY=1 D LST^ENWOME1
135EXIT ;
136 I $D(ENWODA) L -^ENG(6920,ENWODA)
137 K ^TMP($J)
138 K %X,%Y,DA,DIK,DIROUT,DIRUT,DR,DTOUT,DUOUT,X,Y
139 K ENBARCD,ENC,ENCOPY,ENDA,ENEQCAT,ENEQDA,ENFATAL,ENI
140 K ENMANF,ENMODEL,ENMETH,ENPRT,ENSHKEY,ENWOCLOD
141 K ENWODA,ENWODAY,ENXREF,ENXREFV,ENY0,ENY1
142 Q
143DELWO ; delete work orders (master and any copied)
144 W !,"Process Terminated - Deleting any created work orders"
145 K DA S DA=ENWODA
146 S ENWOCLOD=$P($G(^ENG(6920,ENWODA,5)),U,2)
147 I ENWOCLOD]"" D KILLHS^ENEQHS
148 S DA=ENWODA,DIK="^ENG(6920," D ^DIK K DIK W "."
149 S ENI=0 F S ENI=$O(^TMP($J,ENI)) Q:'ENI S ENDA=$P($G(^(ENI)),U) D:ENDA
150 . I ENWOCLOD]"" S DA=ENDA D KILLHS^ENEQHS
151 . S DA=ENDA,DIK="^ENG(6920," D ^DIK K DIK
152 . W "."
153 Q
154 ;ENWOME
Note: See TracBrowser for help on using the repository browser.