source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENWOD2.m@ 699

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

initial load of WorldVistAEHR

File size: 6.1 KB
Line 
1ENWOD2 ;(WASH ISC)/DLM/DH-Formatted Work Order Display ;12.10.97
2 ;;7.0;ENGINEERING;**15,35,42,43,47**;Aug 17, 1993
3 ; write the information
4TOP N I,I1,J,K,X,ENPG
5 N IOINLOW,IOINHI,IOINORM D ZIS^ENUTL
6 S X="ENZWO1" X ^%ZOSF("TEST") I $T D ^ENZWO1
7 S ENX("WP")=$S($L(EN(31))>120:3,$L(EN(31))>70:2,EN(31)]"":1,1:0),ENPG=0
8 S ENX("AT")=0,I=100 F S I=$O(EN(I)) Q:'I S ENX("AT")=ENX("AT")+1
9 S ENORIG=$P(^ENG(6920,DA,0),U,6) S ENORIG("P")=0 I ENORIG]"",ENORIG'=ENWO S ENORIG("P")=1
10 S $X=1,$Y=0 W ?$S(ENORIG("P"):10,1:21) D W("WORK ORDER # "_ENWO)
11 W:ENORIG("P") " (Original #: "_ENORIG_")"
12 W ! D W(" 1) ") W "PRIMARY EMPL: " I EN(1)]"",$D(^ENG("EMP",EN(1),0)) D W($P(^(0),U))
13 W ?39 D W(" 2) ") W "REQ DATE: " S X=EN(2) D PDT
14 W ! D W(" 3) ") W "REQ MODE: " D W(EN(3)) W ?39 D W(" 4) ") W "LOCATION: " D:EN(4)]"" W(EN(4))
15 W ! D W(" 5) ") W "BED #: " D:EN(5)]"" W(EN(5))
16 W ?39 D W(" 6) ") W $S(ENDSTAT=35.2:"PM STATUS: ",1:"STATUS: ") D W($E(EN(6),1,18))
17 W ! D W(" 7) ") W "TASK DESC: " D W(EN(7))
18TOP4 D TOP4^ENWOD3
19TOP15 W ! D W("25) ") W "WORK CTR: " D:EN(25)]"" W(EN(25))
20 W ! D W("26) ") W "TOTAL HOURS: " D:EN(26)]"" W(EN(26))
21 W ?39 D W("27) ") W "TOTAL MATERIAL COST: " D:EN(27)]"" W(EN(27))
22 W ! D W("28) ") W "TOTAL LABOR COST: " D:EN(28)]"" W(EN(28))
23 W ?39 D W("29) ") W "VENDOR SERVICE COST: " D:EN(29)]"" W(EN(29))
24 W ! D W("30) ") W "*ASSIGNED TECH*" W ?39 D W("31) ") W "DATE COMPLETE: " S X=EN(31) D PDT
25 I 'ENX("AT") G WP
26 F I=101:1:(ENJ-1) D WRTEC I I=105,$D(EN(106)) D G:ENX="^" KILL
27 . S ENX="" I $E(IOST,1,2)="C-" D HOLD W ! D W("30) ") W "*ASSIGNED TECH*"
28 ;
29WP I 'ENPG,((ENX("AT")+ENX("WP"))>5),($E(IOST,1,2)="C-") D HOLD Q:ENX="^"
30 W ! D W("32) ") W "WORK PERFORMED: "
31 I EN(32)]"" D
32 . I $L(EN(32))<60 D W(EN(32)) Q
33 . K ^UTILITY($J,"W") S X=EN(32),DIWL=1,DIWR=59,DIWF="" D ^DIWP
34 . S J=0 F S J=$O(^UTILITY($J,"W",1,J)) Q:'J W:J>1 !,?20 D W(^(J,0))
35 I $D(^ENG(6920,DA,6)),'ENPG,$E(IOST,1,2)="C-" D HOLD G:ENX="^" KILL
36 W ! D W("33) ") W "COMMENTS: "
37WCO S (ENX,X)="" I $D(^ENG(6920,DA,6)) S DIWL=5,DIWR=(IOM-5),DIWF="|" K ^UTILITY($J,"W") D G:ENX="^" KILL
38 . S ENNX=0 F S ENNX=$O(^ENG(6920,DA,6,ENNX)) Q:'ENNX S X=^(ENNX,0) D ^DIWP
39 . W IOINHI S ENNX=0 F S ENNX=$O(^UTILITY($J,"W",DIWL,ENNX)) Q:'ENNX W !,?DIWL,^UTILITY($J,"W",DIWL,ENNX,0) I (IOSL-$Y)'>2 D Q:ENX="^"
40 .. W IOINLOW D HOLD
41 .. W:ENX'="^" IOINHI
42 . W IOINLOW
43 I EN(14)]"",$D(^ENG(6914,EN(14),0)) K ENX S EQDA=EN(14) D NOTES(EQDA) D ; Look for flags
44 . I $G(ENX("T"))>0 D
45 .. I (IOSL-$Y)'>4 D HOLD Q:ENX="^"
46 .. I ENX(1)]"" D
47 ... W !,"WARRANTY EXPIRATION: ",IOINHI W:ENX(1)>DT "**" W $E(ENX(1),4,5),"/",$E(ENX(1),6,7),"/",$E(ENX(1),2,3) W:ENX(1)>DT "**" W IOINLOW
48 ... I ENX(9)]"" W ?49 D W("JCAHO=YES")
49 ... I ENX(4)]"" W !,"Last PMI was DEFERRED."
50 .. I ENX(1)="",(ENX(4)]""!(ENX(9)]"")) D
51 ... W ! W:ENX(4)]"" "Last PMI was DEFERRED." I ENX(9)]"" W ?49 D W("JCAHO=YES")
52 .. I ENX(3) W ! D W("NOTE: Equipment must be isolated and rendered inoperative prior to service.")
53 .. I ENX(7)]"" W !,"EQUIPMENT USE STATUS LISTED AS " D W(ENX(7)) W "."
54 . I $D(ENX("WO")) D
55 .. I (IOSL-$Y)'>5 D HOLD Q:ENX="^"
56 .. W !!," [OTHER OPEN WORK ORDERS FOR THIS EQUIPMENT]"
57 .. W !," Work Order #",?18,"Task Description"
58 .. S SHOP=0 I $D(ENX("WO","HAZ")) D
59 ... F S SHOP=$O(ENX("WO","HAZ",SHOP)) Q:SHOP'>0 S J=9999999999 D
60 .... F S J=$O(ENX("WO","HAZ",SHOP,J),-1) Q:J'>0 W !,?2 D W($P(^ENG(6920,J,0),U)) W ?18 D W($E($P($G(^ENG(6920,J,1)),U,2),1,52)_" (Hazard)")
61 .. S SHOP=0 I $D(ENX("WO","PM")) D
62 ... F S SHOP=$O(ENX("WO","PM",SHOP)) Q:SHOP'>0 S J=$O(ENX("WO","PM",SHOP,0)) W !,?2,$P(^ENG(6920,J,0),U),?18,$P($G(^ENG(6920,J,5)),U,7)
63 .. S J=9999999999,K=0
64 .. F S J=$O(ENX("WO",J),-1),K=K+1 Q:J'>0!(K>9) W !,?2,$P(^ENG(6920,J,0),U),?18,$S($E(^(0),1,3)'="PM-":$P($G(^(1)),U,2),1:$P($G(^(5)),U,7)) I (IOSL-$Y)'>2 D HOLD Q:ENX="^"
65 .. I K>9 W !,?2,"There are more..."
66 S X="ENZWO2" X ^%ZOSF("TEST") I $T D ^ENZWO2
67 I $O(^DIPT("B","ENZWO.LOCAL",0))>0 D
68 . S L=0,DIC="^ENG(6920,",FLDS="[ENZWO.LOCAL]",BY=".01",(FR,TO)=ENWO,DHD="@@",IOP=ION,DISUPNO=1,ENX("DA")=DA
69 . I (IOSL-$Y)'>5 D HOLD Q:ENX="^"
70 . D EN1^DIP
71 . S DA=ENX("DA")
72KILL K EN,ENLTH,ENORD,ENNU,ENNX,DIWL,DIWR,DIWF,ENA,ENB,ENTNX,ENORIG,ENJ,ENDATA,EQDA,ENX
73 Q
74 ;
75PDT ;Display date in external format
76 I X]"" S Y=X X ^DD("DD") D W(Y)
77 Q
78 ;
79WRTEC ;Print assigned techs
80 W !," #",I-100,": " I EN(I)]"",$D(^ENG("EMP",EN(I),0)) D W($P(^(0),U)) W " HRS: " D W(EN(I,1)) W " SHOP: " D W(EN(I,2))
81 Q
82 ;
83HOLD S ENX="" S:$G(ENPG)]"" ENPG=ENPG+1 I $E(IOST,1,2)="C-" D Q
84 . W !,"Press <RETURN> to continue, '^' to escape..."
85 . R ENX:DTIME
86 . S $Y=0
87 W @IOF,"(Work Order: "_ENWO_")"
88 Q
89 ;
90NOTES(EQDA) ; Check for flagging situations, counted in loc var ENX("T")
91 ; EQDA contains IEN for file 6914
92 ; Expects ENWO as IEN of work order in question
93 ; Flagging situations noted in loc array ENX
94 ;
95 N HAZCODE,SHOP
96 S HAZCODE=$O(^ENG(6920.1,"B","HAZARD ALERT (Equipment)",0))
97 S I1=1,ENX("T")=0 F I=1:1:9 S ENX(I)=""
98 S ENX(1)=$P($G(^ENG(6914,EQDA,2)),U,5) ;Warranty expiration
99 S ENX(2)=$$GET1^DIQ(6914,EQDA,53) ;Condition code
100 S ENX(3)=$P(^ENG(6914,EQDA,0),U,5) ;Lockout/Tagout
101 S I=0 F S I=$O(^ENG(6914,EQDA,6,I)) Q:'I I $E($P(^(I,0),U,2),1,3)="PM-" Q:$P(^(0),U,3)'["D" S ENX(4)=$P(^(0),U,3) Q ;Deferred PM work order
102 I $D(ENWO),$E(ENWO,1,3)'="PM-" D
103 . S I=0,J=999999999999 F Q:I>30 S J=$O(^ENG(6920,"G",EQDA,J),-1) Q:J'>0 S I=I+1 D:$P($G(^ENG(6920,J,5)),U,2)=""
104 .. I '$D(^ENG(6920,J,0)) K ^ENG(6920,"G",EQDA,J) Q
105 .. I ENWO=$P(^ENG(6920,J,0),U) Q
106 .. S K=0,SHOP=$P($G(^ENG(6920,J,2)),U) Q:SHOP'>0 I $E(^ENG(6920,J,0),1,3)="PM-",'$D(ENX("WO","PM",SHOP)) S ENX("WO","PM",SHOP,J)="" Q ;Open PM
107 .. F S K=$O(^ENG(6920,J,8,K)) Q:K'>0 I ^(K,0)=HAZCODE S ENX("WO","HAZ",SHOP,J)="" Q ;Open Hazard Alert
108 .. S:'$D(ENX("WO","HAZ",SHOP,J)) ENX("WO",J)=""
109 S ENX(7)=$$GET1^DIQ(6914,EQDA,20) I ENX(7)]"","TURNED IN^LOST OR STOLEN"'[ENX(7) S ENX(7)=""
110 S ENX(9)=$$GET1^DIQ(6914,EQDA,27) I ENX(9)'="YES" S ENX(9)="" ;jcaho
111 S ENX("T")=(ENX(1)]"")+(ENX(4)]"")+(ENX(9)]"") I ENX("T")>1 S ENX("T")=ENX("T")-1
112 S ENX("T")=ENX("T")+(ENX(3)]"")+(ENX(7)]"")
113 Q
114 ;
115W(ENDATA) ;Bold ENDATA
116 N X
117 S X=$X W IOINHI S $X=X W ENDATA
118 S X=$X W IOINLOW S $X=X
119 Q
120 ;ENWOD2
Note: See TracBrowser for help on using the repository browser.