source: FOIAVistA/trunk/r/ENGINEERING-EN/ENWOUTL.m@ 1751

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

initial load of FOIAVistA 6/30/08 version

File size: 3.4 KB
Line 
1ENWOUTL ;(WCIOFO)/SAB-Work Order Utilities ;10/21/1998
2 ;;7.0;ENGINEERING;**35,42,48,59**;Aug 17, 1993
3 Q
4 ;
5ASKCC(ENWODA) ; Ask Condition Code Extrinsic Function
6 ; Input ENWODA - ien of work order
7 ; Output - 0 (don't ask) or 1 (ask) condition code
8 N ENASK,ENEQDA,ENSHKEY,ENSHPAR
9 S ENASK=0
10 I $G(ENWODA) S ENEQDA=$P($G(^ENG(6920,ENWODA,3)),U,8) D:ENEQDA
11 . S ENSHKEY=$P($G(^ENG(6920,ENWODA,2)),U) Q:'ENSHKEY
12 . S ENSHPAR=+$P($G(^DIC(6922,ENSHKEY,0)),U,4)
13 . S ENASK=$S(ENSHPAR=0:0,ENSHPAR=2:1,$P($G(^ENG(6914,ENEQDA,2)),U,3)>4999.99:1,1:0)
14 Q ENASK
15 ;
16WO ; select work order entry point
17 ; called from various places where work orders are selected
18 ; Input
19 ; DIC("S") - (optional and not returned)
20 ; Output
21 ; Y - "ien^.01 value" or "-1" if unsuccessful
22 N D,ENX,X
23 S DIC="^ENG(6920,"
24WOA ; ask user
25 R !,"Select WORK ORDER #: ",ENX:DTIME I ENX=""!(ENX["^")!'$T S Y=-1 G WOX
26 I $E(ENX,2,2)="." D I D]"" S X=$E(ENX,3,99),DIC(0)="QE" D IX^DIC G WOR
27 . S D=""
28 . I $E(ENX)="E" S D="G" Q ; equipment id#
29 . I $E(ENX)="L" S D="C" Q ; location
30 I ENX="?" D
31 . W !," Use 'E.value' to list W.O.s whose EQUIPMENT ID# equals 'value'"
32 . W !," Use 'L.value' to list W.O.s whose LOCATION starts with 'value'"
33 S X=ENX,DIC(0)="QEM" D ^DIC
34WOR ; Result of DIC call
35 I Y'>0 G WOA
36WOX ; Exit
37 K DIC
38 Q
39 ;
40CDATE(Y) ; Check on COMPLETION DATE (field 36, file 6920)
41 ;
42 ; Expects: Y as COMPLETION DATE (internal format)
43 ; DA as IEN in Work Order File (returned)
44 ;
45 ; COMPLETION DATE may not preceed REQUEST DATE for unscheduled w.o.
46 ; For PM work orders, COMPLETION DATE may not preceed nominal date of
47 ; PM w.o. - where century is inferred
48 ;
49 ; Returns X as "^" if no date
50 ; "^1" NOMINAL DATE > COMPLETE DATE (PM)
51 ; "^2" REQUEST DATE > COMPLETE DATE (unscheduled)
52 ; Y if acceptable
53 ;
54 I Y'>0 S X="^",EN("BAD COMPLETION DATE")="" D EN^DDIOL("Inappropriate COMPLETION DATE.") Q X
55 N REQDATE,X S REQDATE=$P($P(^ENG(6920,DA,0),U,2),".")
56 I REQDATE'>Y S X=Y Q X
57 I $E($P(^ENG(6920,DA,0),U),1,3)="PM-" D Q X
58 . N DELYR,NOMDATE
59 . S NOMDATE=$E($TR($P(^ENG(6920,DA,0),U),"ABCDEFGHIJKLMNOPQRSTUVWXYZ-",""),1,4)
60 . S DELYR=$E(DT,2,3)-$E(NOMDATE,1,2),NOMDATE=$E(DT)+$S(DELYR>79:1,DELYR<-20:-1,1:0)_NOMDATE_"00"
61 . I NOMDATE'>Y S X=Y,$P(^ENG(6920,DA,0),U,2)=NOMDATE Q
62 . S X="^1",EN("BAD COMPLETION DATE")="" D EN^DDIOL("COMPLETION DATE may not precede nominal PM date.")
63 S X="^2" D EN^DDIOL("COMPLETION DATE may not precede REQUEST DATE (unscheduled).")
64 Q X
65 ;
66LBRCST(ENFLAG) ; Calculate work order TOTAL HOURS and the TOTAL LABOR COST
67 ; based on the TECHNICIANS ASSIGNED multiple in file 6920
68 ; Called by MUMPS X-REFs in file 6920, fields .01 and 1 in multiple
69 ; Input ENFLAG (1 for SET LOGIC or 2 for KILL LOGIC)
70 ; Expects DA(1) as work order IEN
71 ; DA as ASSIGNED TECH IEN [within DA(1)]
72 ;
73 N HOURS,WAGE,COST,X
74 S (HOURS,WAGE,COST,X)=0
75 F S X=$O(^ENG(6920,DA(1),7,X)) Q:X'>0 D
76 . I ENFLAG=2,X=DA Q ; don't include hours of the deleted tech
77 . S HOURS(X)=$P(^ENG(6920,DA(1),7,X,0),U,2)
78 . S X(0)=$P(^ENG(6920,DA(1),7,X,0),U)
79 . S WAGE(X)=$P($G(^ENG("EMP",X(0),0)),U,3)
80 . I WAGE(X)'>0,$E(^ENG(6920,DA(1),0),1,3)="PM-" S WAGE(X)=$P($G(^DIC(6910,1,0)),U,4)
81 . S COST(X)=HOURS(X)*WAGE(X)
82 S X=0
83 F S X=$O(HOURS(X)) Q:X'>0 S HOURS=HOURS+HOURS(X),COST=COST+COST(X)
84 S COST=$J(COST,0,2)
85 S $P(^ENG(6920,DA(1),5),U,3)=HOURS,$P(^(5),U,6)=COST
86 Q
87 ;ENWOUTL
Note: See TracBrowser for help on using the repository browser.