source: FOIAVistA/trunk/r/ENGINEERING-EN/ENWO1.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 5.0 KB
Line 
1ENWO1 ;WCIOFO/DLM/DH/SAB-Process Work Order ;1/2/2001
2 ;;7.0;ENGINEERING;**35,51,59,67**;Aug 17, 1993
3ENT ;Edit work orders
4 D WO^ENWOUTL S DA=+Y G:DA'>0 EXIT L +^ENG(6920,DA):5 I '$T W !!,"This work order is being edited by another user. Please try again later.",*7,! G ENT
5 I $D(^ENG(6920,DA,5)),$P(^(5),U,2)]"" D
6 . W !,*7,"NOTE: This work order has already been closed out."
7 . I '$D(^XUSEC("ENEDCLWO",DUZ)) W !,"Security key ENEDCLWO is needed to edit closed work orders." L -^ENG(6920,DA) S DA="" Q
8 . S DIR(0)="Y",DIR("A")="Are you sure you want to edit this work order",DIR("B")="NO"
9 . D ^DIR K DIR I Y'>0 L -^ENG(6920,DA) S DA="" Q
10 . I $P($G(^ENG(6920,DA,3)),U,8)>0 D KILLHS^ENEQHS I $G(R)="^" S DA="" Q
11 . S ENWOCLOD=$P(^ENG(6920,DA,5),U,2)
12 . S $P(^ENG(6920,DA,5),U,2)="",$P(^ENG(6920,DA,4),U,3)=""
13 . D TEST^ENWOCOMP
14 . ; if PM work order then back out PM hours
15 . I $E($P($G(^ENG(6920,DA,0)),U),1,3)="PM-" D
16 . . N ENPMDT,PMTOT,X
17 . . D PMHRS^ENEQPMR4 Q:'$D(PMTOT)
18 . . S X=$P($P(^ENG(6920,DA,0),U),"-",2)
19 . . F I=1:1:$L(X) S:$E(X,I)?1N ENPMDT=$G(ENPMDT)_$E(X,I)
20 . . S ENPMDT=$E(ENPMDT,1,4)
21 . . D UNPOST^ENBCPM8
22 G:DA="" ENT
23 S DIE="^ENG(6920,",DR=$S($D(^DIE("B","ENZWOEDIT")):"[ENZWOEDIT]",1:"[ENWOEDIT]")
24 S ENDA=DA
25 D ^DIE
26 ; if PM work order closed then post PM hours
27 I $G(DA),$E($P($G(^ENG(6920,DA,0)),U),1,3)="PM-",$P($G(^(5)),U,2)]"" D
28 . N ENPMDT,PMTOT,X
29 . D PMHRS^ENEQPMR4 Q:'$D(PMTOT)
30 . S X=$P($P(^ENG(6920,DA,0),U),"-",2)
31 . F I=1:1:$L(X) S:$E(X,I)?1N ENPMDT=$G(ENPMDT)_$E(X,I)
32 . S ENPMDT=$E(ENPMDT,1,4)
33 . D COUNT^ENBCPM8
34 L -^ENG(6920,ENDA) K ENDA
35 G ENT
36 ;
37CLSOUT ;Close work order
38 D WO^ENWOUTL S DA=+Y I DA'>0 G EXIT
39 I $E(^ENG(6920,DA,0),1,3)="Y2-" W !,*7,"Please use the Y2K Equipment Management Module to close Y2K work orders." G CLSOUT
40 L +^ENG(6920,DA):5 I '$T W !!,"This work order is being edited by another user. Please try again later.",*7 G CLSOUT
41 I $D(^ENG(6920,DA,5)),$P(^(5),U,2)]"" D
42 . W !,*7,"NOTE: This work order has already been closed out."
43 . I $D(^XUSEC("ENEDCLWO",DUZ)) W !,"You may use the work order EDIT or DISPLAY option to edit this work order."
44 . L -^ENG(6920,DA) S DA=""
45 I DA="" G CLSOUT
46 S DIE="^ENG(6920,",DR=""
47 ; select template
48 D
49 . I $E(^ENG(6920,DA,0),1,3)="PM-" S DR=$S($D(^DIE("B","ENZPMCLOSE")):"[ENZPMCLOSE]",1:"[ENPMCLOSE]") Q
50 . S X=$P($G(^ENG(6920,DA,2)),U)
51 . I X>0,$P($G(^DIC(6922,X,0)),U,5) S DR=$S($D(^DIE("B","ENZWOBIOCLSE")):"[ENZWOBIOCLSE]",1:"[ENWOBIOCLSE]") Q
52 . S DR=$S($D(^DIE("B","ENZWOCLOSE")):"[ENZWOCLOSE]",1:"[ENWOCLOSE]")
53 S ENDA=DA
54 D ^DIE
55 ; if PM work order closed then post PM hours, update equip file
56 I $D(DA),$E($P($G(^ENG(6920,DA,0)),U),1,3)="PM-",$P($G(^(5)),U,2)]"" D
57 . N ENPMDT,PMTOT,X
58 . D PMHRS^ENEQPMR4,PMINV^ENEQPMR4
59 . Q:'$D(PMTOT)
60 . S X=$P($P(^ENG(6920,DA,0),U),"-",2)
61 . F I=1:1:$L(X) S:$E(X,I)?1N ENPMDT=$G(ENPMDT)_$E(X,I)
62 . S ENPMDT=$E(ENPMDT,1,4)
63 . D COUNT^ENBCPM8
64 L -^ENG(6920,ENDA) K ENDA
65 W !!
66 G CLSOUT
67 ;
68EQHIV ;EQUIPMENT HIST
69 Q ;Obsolete entry point
70 ;
71EQHI ; Equipment work order history, by entry number
72 S DIC("S")="I $D(^(3))" D GETEQ^ENUTL G:Y'>0 EXIT S ENDA=+Y
73 D NOW^%DTC S ENSTMPL="ENWOHIST"_%
74 W !,"Compiling SORT TEMPLATE ["_ENSTMPL_"]",!
75 K DD,DO S DIC="^DIBT(",DIC(0)="X",X=ENSTMPL D FILE^DICN S DA=+Y
76 I DA'>0 W !,"Process ABORTED.",*7 G EXIT
77 S ENSTMPL(0)=DA
78 S DIE="^DIBT(",DR="2///^S X=DT;4///^S X=6920;5///^S X=DUZ;15///^S X=""EQUIPMENT ID# EQUALS ""_ENDA" D ^DIE
79 F I=0:0 S I=$O(^ENG(6920,"G",ENDA,I)) Q:I'>0 S ^DIBT(DA,1,I)="" W "."
80 I '$D(^DIBT(DA,1)) W !!,"No work orders found. Nothing to report.",*7,! S DIK="^DIBT(" D ^DIK K DIK G EQHI
81 S DIC="^ENG(6914,",DA=ENDA,DIQ="ENEQ",DIQ(0)="E",DR=".01;1;4;5;53"
82 D EN^DIQ1 K DA,DIC,DIQ,DR
83 S I=0,ENCRIT="" F S I=$O(^ENG(6914,ENDA,4,I)) Q:'I D
84 . S J=$P($G(^ENG(6914,ENDA,4,I,0)),U,4) I J>ENCRIT S ENCRIT=J
85 D DEV^ENLIB G:POP EXIT
86 S IOP=ION,L="0",DIC="^ENG(6920,",FLDS=$S($D(^DIPT("B","ENZ EQ HIST")):"[ENZ EQ HIST]",1:"[EN EQ HIST]"),BY="["_ENSTMPL_"]",FR="@"
87 I $D(IO("Q")) D K ZTSK D HOME^%ZIS G EXIT
88 . S ZTIO=IOP,ZTRTN="DQHI^ENWO1",ZTDESC="Equipment History from Work Order Module"
89 . S ZTSAVE("IOP")="",ZTSAVE("EN*")="",ZTSAVE("DIC")=""
90 . S ZTSAVE("FLDS")="",ZTSAVE("BY")="",ZTSAVE("FR")="",ZTSAVE("L")=""
91 . D ^%ZTLOAD
92 S DIOEND="I IOST[""C-"" R !!,""Press <RETURN> to continue"",X:DTIME"
93DQHI ;
94 D EN1^DIP
95 S DIK="^DIBT(",DA=ENSTMPL(0) D ^DIK K DIK
96 G:'$D(ZTQUEUED) EQHI
97 G EXIT
98DSY ;Screen display work order
99 G EDIT^ENWOD
100 ;
101DEL ; Delete open work order
102 W !
103 K DA
104 S DIC("S")="I $P($G(^(5)),U,2)=""""" D WO^ENWOUTL K DIC
105 S DA=+Y G:DA'>0 EXIT
106 L +^ENG(6920,DA):5 I '$T W !!,"This work order is being edited by another user and can't be deleted.",$C(7),! G DEL
107 S DIR(0)="Y",DIR("A")="Delete work order "_$P($G(^ENG(6920,DA,0)),U)
108 D ^DIR K DIR I $D(DIRUT) G EXIT
109 I 'Y G DEL
110 S DIK="^ENG(6920," D ^DIK K DIK
111 W !," The work order has been deleted."
112 G DEL
113 ;
114INIT K DIC("S") S DIC="^DIC(6922,",DIC(0)="AEQM" D ^DIC S ENSHKEY=+Y Q
115EXIT K %IS,DIC,DIE,DA,Y,DR,N,I,J,K,O,S,X,Y,Z,ENWO
116 K ENSTMPL,L,FLDS,BY,FR,TO,ENVANO,IOP,ENDA,ENEQ,ENCRIT
117 S:$D(ZTQUEUED) ZTREQ="@"
118 Q
119 ;ENWO1
Note: See TracBrowser for help on using the repository browser.