source: FOIAVistA/trunk/r/ENGINEERING-EN/ENWONEW3.m@ 1726

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

initial load of FOIAVistA 6/30/08 version

File size: 5.2 KB
Line 
1ENWONEW3 ;WIRMFO/SAB-Incoming Inspection Work Order ;12.18.97
2 ;;7.0;ENGINEERING;**35,47**;Aug 17, 1993
3 ;
4IIWO(ENEQ) ; Generate Incoming Inspection Work Order
5 ; called from ENEQ1, ENEQ3
6 ; In
7 ; ENEQ - equipment entry #
8 ; ENMA("IIWO") - (optional) flag; true when multi equip entry
9 ; ENMA("IIWO","DA") - (optional) w.o. ien generated for 1st equip
10 ; ENMA("IIWO","ION") - (optional) device ion used with 1st equip w.o.
11 ; ENMA("IIWO","QDT") - (optional) queued date/time of 1st w.o. print
12 ; Out
13 ; ENDA - work order ien
14 ; ENWO - work order number
15 ; also when $G(ENMA("IIWO")) true and device selected for output
16 ; ENION - device ion used for (auto)print
17 ; ENQDT - queued date/time when output queued
18 ;
19 N AUTOPRT,DA,DIC,DIE,DR,ENEDPM,ENI,ENJ,ENTEC,ENX
20 N NUMBER,SHOPDEV,SHOPKEY,WARD
21 K ENION,ENQDT S (ENDA,ENWO)=""
22 ; determine user privileges
23 S ENEDPM=$D(^XUSEC("ENEDPM",DUZ))
24 ; determine shop of work order
25 I $G(ENMA("IIWO","DA")) S SHOPKEY=$P($G(^ENG(6920,ENMA("IIWO","DA"),2)),U)
26 E D
27 . S SHOPKEY=$P(^DIC(6910,1,0),U,13) ; incoming inspection section
28 . I SHOPKEY="" D ; or responsible shop
29 . . S ENI=$O(^ENG(6914,ENEQ,4,0))
30 . . I ENI S SHOPKEY=$P(^ENG(6914,ENEQ,4,ENI,0),U)
31 . I SHOPKEY="" S SHOPKEY=$P(^DIC(6910,1,0),U,6) ; or temp w.o. section
32 . ; ask shop if blank or user holds key
33 . I SHOPKEY=""!ENEDPM F D Q:SHOPKEY]""
34 . . S DIC="^DIC(6922,",DIC(0)="AQEM"
35 . . I SHOPKEY S DIC("B")=$P($G(^DIC(6922,SHOPKEY,0)),U)
36 . . I 'ENEDPM S DIC("S")="I Y#100>89" ; restrict to receiving areas
37 . . D ^DIC K DIC
38 . . I $D(DTOUT)!$D(DUOUT) S SHOPKEY="^" Q
39 . . I Y>0 S SHOPKEY=+Y Q
40 . . W !,"Shop required. Enter '^' if you don't want to create a W.O.",!
41 I SHOPKEY'>0 W !,"Unspecified Shop. Work Order was NOT created." G EXIT
42 ;
43 ; create work order
44 D WONUM^ENWONEW I NUMBER="" D G EXIT
45 . W $C(7),!,"Can't seem to add to Work Order File."
46 . W !,"You will need to manually create the incoming inspection W.O."
47 S ENDA=DA,ENWO=NUMBER
48 W !,"WORK ORDER #: ",NUMBER
49 ; lock work order
50 L +^ENG(6920,DA):5 I '$T D G EXIT
51 . W $C(7),!,"Can't lock the new work order. Please contact IRM."
52 ; populate work order
53 ; with standard data for an electronic work order
54 S WARD=1 D WOFILL^ENWONEW S WARD=0
55 ; with data for an incoming inspection work order
56 S DIE="^ENG(6920,"
57 S DR="6///Incoming Inspection"
58 S DR=DR_";17///AVERAGE"
59 S DR=DR_";32///"_$S(SHOPKEY#100>89:"PENDING",1:"IN PROGRESS")
60 I SHOPKEY#100>89 S DR=DR_";10///TODAY"
61 D ^DIE
62 K ENFDA S ENFDA(6920.035,"+2,"_DA_",",.01)="I1"
63 D UPDATE^DIE("E","ENFDA")
64 ; with equipment related data
65 S DIE="^ENG(6920,"
66 S DR="18///"_ENEQ
67 S ENX=$$GET1^DIQ(6914,ENEQ,24) I ENX]"" S DR=DR_";3///"_ENX
68 D ^DIE
69 ; with user specified data
70 S DIE="^ENG(6920,",DR=""
71 I $G(ENMA("IIWO","DA")) D
72 . ; copy comments from 1st work order
73 . I $D(^ENG(6920,ENMA("IIWO","DA"),6)) D
74 . . D WP^DIE(6920,DA_",",40,"","^ENG(6920,ENMA(""IIWO"",""DA""),6)")
75 . ; copy other user editable fields from 1st work order into DR
76 . S ENX=$P($G(^ENG(6920,ENMA("IIWO","DA"),2)),U,2) ; tech
77 . I ENX]"" S DR=DR_";16////"_ENX
78 . S ENX=$P($G(^ENG(6920,ENMA("IIWO","DA"),1)),U,3) ; contact
79 . I ENX]"" S DR=DR_";7////"_ENX
80 . S ENX=$P($G(^ENG(6920,ENMA("IIWO","DA"),1)),U,4) ; phone
81 . I ENX]"" S DR=DR_";8////"_ENX
82 I '$G(ENMA("IIWO","DA")) D
83 . ; build DR string for user editable fields
84 . ; determine responsible technician (if any)
85 . S ENI=$O(^ENG(6914,ENEQ,4,0))
86 . S ENJ=$S(ENI:$P(^ENG(6914,ENEQ,4,ENI,0),U,2),1:"")
87 . S ENTEC=$S(ENJ:$P($G(^ENG("EMP",ENJ,0)),U),1:"")
88 . I ENTEC]""!ENEDPM D
89 . . S DR=DR_";16"
90 . . I ENTEC]"" S DR=DR_"//"_$S(ENEDPM:"",1:"/")_ENTEC ; resp. tech
91 . S DR=DR_";7;8;40"
92 I $E(DR)=";" S DR=$E(DR,2,245)
93 D ^DIE
94PRT ; print work order?
95 S ENI=$O(^ENG(6910.2,"B","AUTO PRINT NEW W.O.",0))
96 S AUTOPRT=$S(ENI:$P(^ENG(6910.2,ENI,0),U,2),1:"")
97 S SHOPDEV=$$GET1^DIQ(6922,SHOPKEY,2)
98 ; if no user interaction required then call woprnt
99 I "^L^S^"[(U_AUTOPRT_U),SHOPDEV]"" S WARD=0 D WOPRNT^ENWONEW G PRTX
100 ; if not autoprinted and shop is receiving area then skip
101 I SHOPKEY#100>89 G PRTX
102 ; if subsequent equipment of multiple then use previous device (if any)
103 I $G(ENMA("IIWO","DA")) D G PRTX
104 . S IOP=$G(ENMA("IIWO","ION"))
105 . I IOP]"" S %ZIS="Q" D ^%ZIS Q:POP D PRTL
106 ; if not autoprinted, not receiving area, and not subsequent then ask
107 S DIR(0)="Y",DIR("A")="Print this work order",DIR("B")="YES"
108 D ^DIR K DIR Q:Y'>0
109 D DEV^ENLIB I POP D HOME^%ZIS G PRTX
110 I $G(ENMA("IIWO")) S ENION=$S($D(IO("Q")):"Q;"_ION,1:ION)
111 D PRTL
112PRTX ;
113 ; unlock work order
114 L -^ENG(6920,DA)
115EXIT ;
116 Q
117 ;
118PRTL ; Print W.O. Long Format
119 ; determine required variables
120 N ENBARCD,ENWO
121 S ENBARCD=0
122 S ENI=$O(^ENG(6910.2,"B","PRINT BAR CODES ON W.O."))
123 I ENI,$P(^ENG(6910.2,ENI,0),U,2)="Y" S ENBARCD=1
124 S ENWO=$P(^ENG(6920,DA,0),U)
125 ;
126 I $D(IO("Q")) D Q
127 . S ZTRTN="PRT1^ENWOD",ZTDESC="Enginering Work Order"
128 . S ZTIO=ION
129 . ; when subsequent entry during multiple use date/time of 1st for task
130 . I +$G(ENMA("IIWO","QDT")) S ZTDTH=ENMA("IIWO","QDT")
131 . F ENX="DA","ENBARCD","ENWO" S ZTSAVE(ENX)=""
132 . D ^%ZTLOAD
133 . ; when 1st of multiple entry return date/time queued
134 . I $G(ENMA("IIWO")),$G(ENION)]"" S ENQDT=$G(ZTSK("D"))
135 . D HOME^%ZIS K ZTSK
136 ;
137 D PRT1^ENWOD
138 I $E(IOST,1,2)="C-" D HOLD^ENWOD2
139 K ENDSTAT,ENX,ENINV
140 Q
141 ;
142 ;ENWONEW3
Note: See TracBrowser for help on using the repository browser.