source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENEQPMR1.m@ 923

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

initial load of WorldVistAEHR

File size: 4.0 KB
Line 
1ENEQPMR1 ;(WASH ISC)/DH-Regular PMI Close Out ;1/2/2001
2 ;;7.0;ENGINEERING;**1,15,35,42,54,67**;Aug 17, 1993
3CO ;Close out Pm worklist
4 S ENDEL="" I $D(^DIC(6910,1,0)) S ENDEL=$P(^(0),U,5)
5 N PMTOT
6 I ENDEL']"" R !!,"Should PM work orders be deleted after close out? YES//",X:DTIME G:X="^" EXIT S X=$$UP^XLFSTR(X) S:X=""!(X["Y") ENDEL="Y" I ENDEL'="Y",$E(X)'="N" D COBH1^ENEQPMR4 G CO
7COF S DIC="^ENG(6920,",DIC(0)="AEQM",DIC("A")="Please enter first PM work order to be closed: ",DIC("S")="I $P(^(0),U,1)[""PM-""" D ^DIC K DIC("S") G:Y'>0 EXIT S DA=+Y,ENPMWO=$P(^ENG(6920,DA,0),U,1)
8 S DIE="^ENG(6920,",DR=$S($D(^DIE("B","ENZPMCLOSE")):"[ENZPMCLOSE]",1:"[ENPMCLOSE]")
9 S ENSHKEY=$S($D(^ENG(6920,DA,2)):$P(^(2),U),1:"") G:ENSHKEY="" EXIT
10 I $D(^ENG(6920,DA,5)),$P(^(5),U,2)]"" W *7,!!,"This work order has already been closed out and posted. If you wish to change",!,"the data, please use the EDIT WORK ORDER option." G CO1
11 D ^DIE G:$D(Y) EXIT
12 I $D(DA),$P($G(^ENG(6920,DA,5)),U,2)]"",$E(^ENG(6920,DA,0),1,3)="PM-" D
13 . I $P(^ENG(6920,DA,5),U,8)="C" D REGLR
14 . D PMHRS^ENEQPMR4,PMINV^ENEQPMR4
15 . I ENDEL="Y" S DIK="^ENG(6920," D ^DIK K DIK
16CO1 S ENPMWO(1)=$O(^ENG(6920,"B",ENPMWO)) G:$P(ENPMWO(1),"-",2)'=$P(ENPMWO,"-",2) EXIT
17CO2 W !!,"Next work order (or sequential portion), '^' to quit: "_ENPMWO(1)_"// " R X:DTIME G:X="^" EXIT I X?1.N S:$L(X)<3 X=$S($L(X)=1:"00"_X,1:"0"_X) S X=$P(ENPMWO,"-",1,2)_"-"_X W !,?10," ("_X_")"
18 I X="" S X=ENPMWO(1)
19 I $E(X,1,3)'="PM-" D COH2^ENEQPMR4 G CO2
20 S ENPMWO=X,DIC="^ENG(6920,",DIC(0)="X",DIC("S")="I $D(^(2)),$P(^(2),U)=ENSHKEY,$E(^(0),1,3)=""PM-""" D ^DIC K DIC("S") I Y'>0 W "??",*7 D COH2^ENEQPMR4 G CO2
21 S DA=+Y I $D(^ENG(6920,DA,5)),$P(^(5),U,2)]"" W !!,*7,"This work order has already been closed out and posted. If you need to change",!,"the data, please use the EDIT WORK ORDER option." G CO1
22 S DIE="^ENG(6920," D ^DIE G:$D(Y) EXIT
23 I $D(DA),$P($G(^ENG(6920,DA,5)),U,2)]"",$E(^ENG(6920,DA,0),1,3)="PM-" D
24 . I $P(^ENG(6920,DA,5),U,8)="C" D REGLR
25 . D PMHRS^ENEQPMR4,PMINV^ENEQPMR4
26 . I ENDEL="Y" S DIK="^ENG(6920," D ^DIK K DIK
27 G CO1
28 ;
29EXIT K ENPM,ENPMMN,ENPMWK,ENDEL,ENSHABR,ENSHOP,DIC,DIE,DIK,DA,DR,ENY,EN1,ENLOC
30 I $D(ENPMWO) D
31 . S X=$P(ENPMWO,"-",2),ENPMDT=""
32 . F I=1:1:$L(X) S:$E(X,I)?1N ENPMDT=ENPMDT_$E(X,I)
33 . S ENPMDT=$E(ENPMDT,1,4)
34 . I $D(PMTOT) D COUNT^ENBCPM8
35 K ENPMWO,ENPMDT,ENSHKEY
36 Q
37 ;
38HOLD I $E(IOST,1,2)="C-" R !,"<cr> to continue, '^' to quit...",X:DTIME
39 S ENY=1
40 Q
41 ;
42REGLR ;Failed PM
43 Q:'$D(^ENG(6920,DA,3)) N ENEQ,SHOPKEY,X,EN,DIE,DR,WARD,ADDWO
44 S ENEQ=$P(^ENG(6920,DA,3),U,8) Q:ENEQ="" Q:'$D(^ENG(6914,ENEQ,0))
45 Q:'$D(^ENG(6920,DA,2)) S SHOPKEY=$P(^(2),U) Q:SHOPKEY=""
46 S ADDWO=0
47 F EN1=0:0 S EN1=$O(^ENG(6920,"G",ENEQ,EN1)) Q:EN1'>0 I $D(^ENG(6920,EN1,2)),$P(^(2),U)=SHOPKEY,$E($P(^(0),U),1,3)'="PM-",$E($P(^(0),U),1,3)'="Y2-" Q:'$D(^(5)) Q:$P(^(5),U,2)=""
48 I EN1>0 D Q:'ADDWO
49 . W !!,"Work Order ",$P(^ENG(6920,EN1,0),U)," is open."
50 . I $D(^ENG(6920,EN1,1)) W !,$P(^(1),U,2)
51 . S DIR(0)="Y",DIR("A")="Would you like to edit it",DIR("B")="YES"
52 . D ^DIR K DIR I 'Y S:Y=0 ADDWO=1 Q
53 . N DA
54 . S DIE="^ENG(6920,",DA=EN1
55 . S DR="6" D ^DIE Q:$D(DTOUT)
56 . S DR=$S($D(^DIE("B","ENZWOEDIT")):"[ENZWOEDIT]",1:"[ENWOEDIT]") D ^DIE
57 . S X=$O(^ENG(6914,ENEQ,6,0))
58 . I X>0 D
59 .. S EN=^ENG(6914,ENEQ,6,X,0) Q:$P(EN,U,2)'=ENPMWO
60 .. S $P(^ENG(6914,ENEQ,6,X,0),U,9)=$P(EN,U,9)_" cf: "_$P(^ENG(6920,EN1,0),U)
61 S DIR(0)="Y",DIR("A")="Would you like to generate a regular work order"
62 D ^DIR K DIR Q:Y'>0
63 N CODE,NUMBER,DA
64 D WONUM^ENWONEW Q:NUMBER=""
65 S X=$O(^ENG(6914,ENEQ,6,0))
66 I X>0 D
67 . S EN=^ENG(6914,ENEQ,6,X,0) Q:$P(EN,U,2)'=ENPMWO
68 . S $P(^ENG(6914,ENEQ,6,X,0),U,9)=$P(EN,U,9)_" cf: "_NUMBER
69 S ENLOC=""
70 I $D(^ENG(6914,ENEQ,3)) S X=$P(^(3),U,5) I X=+X,$D(^ENG("SP",X,0)) S ENLOC=$P(^(0),U)
71 S DIE="^ENG(6920,",DR=".05///^S X=NUMBER;1///^S X=DT;2///^S X=""C"";7.5////^S X=DUZ;9////^S X=SHOPKEY;17///^S X=""A"";18///^S X=ENEQ;32///^S X=""IN PROGRESS"";3///^S X=ENLOC;6//^S X=""Failed PMI"""
72 D ^DIE Q:$D(DTOUT)
73 S DR=$S($D(^DIE("B","ENZWOEDIT")):"[ENZWOEDIT]",1:"[ENWOEDIT]")
74 S WARD=0
75 D ^DIE,WOPRNT^ENWONEW
76 Q
77 ;ENEQPMR1
Note: See TracBrowser for help on using the repository browser.