source: FOIAVistA/trunk/r/ENGINEERING-EN/ENWOD.m@ 1163

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

initial load of FOIAVistA 6/30/08 version

File size: 4.5 KB
Line 
1ENWOD ;(WIRMFO)/DLM/DH/SAB-Formatted Work Order Display ;5/11/2000
2 ;;7.0;ENGINEERING;**35,43,65**;Aug 17, 1993
3EDIT ; Work order display/edit (screen) option
4 D WO^ENWOUTL G:Y'>0 EXIT S DA=+Y
5 D EDIT1
6 G EDIT
7 ;
8EDIT1 ; display/edit one work order
9 ; input DA (ien of work order), DUZ (user number)
10 N ENBARCD,ENDSTAT,ENEDIT,ENINV,ENJ,ENREOPEN,ENWO,ENWOCLOD,ENX
11 S ENEDIT=0 ; flag, true if user edited work order
12 S ENREOPEN=0 ; flag, true if closed work order reopened for edit
13 D D F D READ Q:ENX="" D ACTION Q:$P($G(^ENG(6920,DA,5)),U,2)]""&ENEDIT
14 I ENEDIT D
15 . ; work order edited by user
16 . N DIE,DR
17 . S DIE="^ENG(6920,"
18 . I ENREOPEN,$P($G(^ENG(6920,DA,5)),U,2)']"" S DR="36//^S X=ENWOCLOD" D ^DIE
19 . I $P($G(^ENG(6920,DA,5)),U,2)]"" D
20 . . ; work order was closed
21 . . I "^5^6^"'[(U_$P($G(^ENG(6920,DA,4)),U,3)_U) D
22 . . . ; status was not set to Completed or Disapproved
23 . . . S DR="32///^S X=""COMPLETED""" D ^DIE
24 . . I $E($P($G(^ENG(6920,DA,0)),U),1,3)="PM-" D
25 . . . ; post PM hours for PM work order
26 . . . N ENPMDT,PMTOT,X
27 . . . D PMHRS^ENEQPMR4 Q:'$D(PMTOT)
28 . . . S X=$P($P(^ENG(6920,DA,0),U),"-",2)
29 . . . F I=1:1:$L(X) S:$E(X,I)?1N ENPMDT=$G(ENPMDT)_$E(X,I)
30 . . . S ENPMDT=$E(ENPMDT,1,4)
31 . . . D COUNT^ENBCPM8
32 . ; unlock
33 . L -^ENG(6920,DA)
34 Q
35 ;
36READ ;User interaction
37 D HOME^%ZIS W !,"ENTER/EDIT (1-33), D(DISPLAY), AC(ACCOUNT), P(PRINT)): EXIT// " R ENX:DTIME
38 I ENX=10 W !,"Uneditable field.",*7 G READ
39 I ENX=11 W !,"A transfer option must be used to change SHOP.",*7 G READ
40 I $E(ENX)="^"!($E(ENX)="E") S ENX=""
41 Q:ENX="" I ENX?1.2N S ENX=+ENX I ENX<1!(ENX>33) W " ??",*7 G READ
42 Q:ENX?1.2N S ENX=$TR(ENX,"dap","DAP") I "DAP"'[$E(ENX) W " ??",*7 G READ
43 Q
44 ;
45ACTION ;Edit or display
46 I ENX'?1.2N N TAG S TAG=$E(ENX) D @TAG Q
47 ; try to prepare work order for editing (if not already done)
48 I 'ENEDIT D I 'ENEDIT L -^ENG(6920,DA) Q
49 . L +^ENG(6920,DA):5 I '$T W !,"This work order is being edited by another user. Please try again later." Q
50 . I $P($G(^ENG(6920,DA,5)),U,2)]"" D I 'ENREOPEN Q
51 . . W $C(7),!,"NOTE: This work order has been closed."
52 . . I '$D(^XUSEC("ENEDCLWO",DUZ)) W !,"Security key ENEDCLWO is needed to edit closed work orders." Q
53 . . S DIR("A")="Are you sure you want to edit this work order",DIR(0)="Y",DIR("B")="NO"
54 . . D ^DIR K DIR Q:Y'>0
55 . . I $P($G(^ENG(6920,DA,3)),U,8)>0 D KILLHS^ENEQHS Q:$G(R)="^"
56 . . S ENWOCLOD=$P(^ENG(6920,DA,5),U,2)
57 . . S $P(^ENG(6920,DA,5),U,2)="" D TEST^ENWOCOMP
58 . . I $E($P($G(^ENG(6920,DA,0)),U),1,3)="PM-" D
59 . . . ; since reopening PM work order we must back out the PM hours
60 . . . N ENPMDT,PMTOT,X
61 . . . D PMHRS^ENEQPMR4 Q:'$D(PMTOT)
62 . . . S X=$P($P(^ENG(6920,DA,0),U),"-",2)
63 . . . F I=1:1:$L(X) S:$E(X,I)?1N ENPMDT=$G(ENPMDT)_$E(X,I)
64 . . . S ENPMDT=$E(ENPMDT,1,4)
65 . . . D UNPOST^ENBCPM8
66 . . S ENREOPEN=1 ; reopen of closed work order completed
67 . S ENEDIT=1 ; work order ready for editing
68 N DIE,DR,ENDA
69 S DR=$P("16^1^2^3^4^STAT^6^7^8^^9^10^17^18^19^21^EQ53^21.9^22.3^22.5^23^20^31^35^35.5^37^38^37.5^47^16.5^36^39^40",U,ENX) S:DR="STAT" DR=ENDSTAT
70 I $E(DR,1,2)="EQ" S ENDA=DA D S DA=ENDA Q
71 . S DIE="^ENG(6914,",DR=$E(DR,3,99),DA=$P($G(^ENG(6920,DA,3)),U,8)
72 . I DA D
73 . . L +^ENG(6914,DA):5 I '$T W $C(7),!,"Another user is editing this equipment. Try editing the condition later." Q
74 . . D ^DIE
75 . . L -^ENG(6914,DA)
76 S DIE="^ENG(6920,"
77 I DR=36 D
78 . W !!,"Entry of a date will close this work order. Do this last."
79 . I $D(ENWOCLOD) S DR="36//^S X=ENWOCLOD"
80 D ^DIE
81 Q
82 ;
83D ;Display WO to CRT
84 W:$E(IOST,1,2)="C-" @IOF D ST^ENWOD1,TOP^ENWOD2
85 Q
86 ;
87A ;Display Accounting Data
88 S X="PRCSP13" X ^%ZOSF("TEST") I $T D
89 . S ENFLG=0 I $D(^ENG(6920,DA,4)),$P(^(4),U,2)]"" D
90 . . S ENWOACN=$P(^ENG(6920,DA,4),U,2),ENFLG=1
91 . . I $D(^PRCS(410,ENWOACN,0)) D
92 . . . S ENWOOR=DA,DA=ENWOACN
93 . . . D ^PRCSP13
94 . . . S DA=ENWOOR K ENWOOR
95 . . K ENWOACN
96 . W:'ENFLG !,"No procurement request on file for this work order."
97 . K ENFLG
98 Q
99 ;
100P ;Print work order
101 I '$D(ENBARCD) S ENBARCD=0 I $D(^ENG(6910.2,"B","PRINT BAR CODES ON W.O.")) S I=$O(^("PRINT BAR CODES ON W.O.",0)) I I>0,$P(^ENG(6910.2,I,0),U,2)="Y" S ENBARCD=1
102 D DEV^ENLIB Q:POP I $D(IO("Q")) N X S ZTRTN="PRT1^ENWOD",ZTSAVE("EN*")="",ZTSAVE("DA")="",ZTDESC="Print Work Order" D ^%ZTLOAD K ZTSK D HOME^%ZIS Q
103PRT1 U IO W:$E(IOST,1,2)="C-" @IOF
104 D:$E(IOST,1,2)'="C-" PSET^%ZISP
105 D ST^ENWOD1,TOP^ENWOD2
106 D:ENBARCD BAR
107 I $E(IOST,1,2)'="C-" W @IOF D PKILL^%ZISP
108 N DA ; to protect DA when W.O. printed to P-MESSAGE
109 D ^%ZISC
110 Q
111 ;
112BAR ; print barcode of w.o. #
113 I $G(IOBARON)]"",$G(IOBAROFF)]"" W !,@IOBARON W ENWO W @IOBAROFF W !
114 Q
115EXIT ;
116 Q
117 ;ENWOD
Note: See TracBrowser for help on using the repository browser.