1 | ENSA4 ;(WASH ISC)/DH-Post MedTester PMI ;5.26.99
|
---|
2 | ;;7.0;ENGINEERING;**9,14,35,54**;Aug 17, 1993
|
---|
3 | POST ;Post PMI to Equip Hist
|
---|
4 | CHK1 I ENFAIL,'$D(^TMP($J,"FAIL",ENEQ)),$D(^TMP($J,"PASS",ENEQ)) D Q
|
---|
5 | . S ENMSG="Equipment Entry # "_ENEQ_" FAILED INSPECTION but passed a prior MedTester exam."
|
---|
6 | . S ENMSG(0,1)="The first test was posted to the equipment history, which means that you should"
|
---|
7 | . S ENMSG(0,2)="manually enter a corrective work order for the failure." I ENTEST]"" S ENMSG(0,2)=ENMSG(0,2)_" Test failed: "_ENTEST
|
---|
8 | . D XCPTN^ENSA2
|
---|
9 | CHK2 I ENFAIL,$D(^TMP($J,"FAIL",ENEQ)) Q ; already failed
|
---|
10 | I ENPMWO="" G POST1^ENSA5 ; not processing worklist
|
---|
11 | S ENWOX=0 D WOCHK^ENSA6 ; maybe work already posted
|
---|
12 | Q:ENWOX ; WO has been closed ; MedTester time & labor cost added
|
---|
13 | F DA=0:0 S DA=$O(^ENG(6920,"G",ENEQ,DA)) Q:DA'>0 I $P(^ENG(6920,DA,0),U,1)[ENPMWO D POST1 Q
|
---|
14 | D:DA'>0 POST1^ENSA5
|
---|
15 | Q
|
---|
16 | POST1 ;PM work order to be closed
|
---|
17 | S ENTEC(0)=$P($G(^ENG(6920,DA,2)),U,2)
|
---|
18 | I ENTEC'=ENTEC(0)!(ENTIME>0) D
|
---|
19 | . I ENTEC]"",ENTEC'=ENTEC(0) D
|
---|
20 | .. S $P(^ENG(6920,DA,2),U,2)=ENTEC
|
---|
21 | .. S:'$D(^ENG(6920,DA,7,0)) ^ENG(6920,DA,7,0)="^6920.02PA^1^1"
|
---|
22 | .. S ^ENG(6920,DA,7,1,0)=ENTEC_U_$P($G(^ENG(6920,DA,5)),U,3)_U_ENSHKEY
|
---|
23 | .. I ENTIME'>0 D
|
---|
24 | ... S ENH=$P(^ENG(6920,DA,7,1,0),U,2) Q:ENH=""
|
---|
25 | ... S ENW="" I $D(^ENG("EMP",ENTEC,0)) S ENW=$P(^(0),U,3)
|
---|
26 | ... I ENW="",$D(^DIC(6910,1,0)) S ENW=$P(^(0),U,4)
|
---|
27 | ... I ENW>0 S X=ENH*ENW,X(0)=2 D ROUND^ENLIB S $P(^ENG(6920,DA,5),U,6)=+Y
|
---|
28 | . I ENTIME>0 D
|
---|
29 | .. S $P(^ENG(6920,DA,5),U,3)=ENTIME I $D(^ENG(6920,DA,7,1,0)) S $P(^(0),U,2)=ENTIME
|
---|
30 | .. S ENW="" I ENTEC>0,$D(^ENG("EMP",ENTEC,0)) S ENW=$P(^(0),U,3)
|
---|
31 | .. I ENW="",$D(^DIC(6910,1,0)) S ENW=$P(^(0),U,4)
|
---|
32 | .. I ENW>0 S X=ENTIME*ENW,X(0)=2 D ROUND^ENLIB S $P(^ENG(6920,DA,5),U,6)=+Y
|
---|
33 | I ENFAIL S ^TMP($J,"FAIL",ENEQ)="" G POST13^ENSA8
|
---|
34 | S ^TMP($J,"PASS",ENEQ)=""
|
---|
35 | D:$D(^ENG(6914,ENEQ,6)) PRVPST
|
---|
36 | S:ENSTDT="" ENSTDT=DT
|
---|
37 | S DIE="^ENG(6920,",DR="35.2///P;36////^S X=ENSTDT;32///^S X=""COMPLETED"""
|
---|
38 | I $D(^ENG(6920,DA,5)) S ENWP(0)=$P(^(5),U,7) S:ENWP(0)]"" ENWP(0)=ENWP(0)_"; " S ENWP(0)=ENWP(0)_ENWP S:ENTEST]"" ENWP(0)=ENWP(0)_" "_ENTEST S $P(^(5),U,7)=$E(ENWP(0),1,140)
|
---|
39 | K ENWP D ^DIE
|
---|
40 | I ENTEC>0 S:ENTIME'>0 ENTIME=$P($G(^ENG(6920,DA,5)),U,3) I ENTIME>0 S PMTOT(ENSHKEY,ENTEC)=$G(PMTOT(ENSHKEY,ENTEC))+ENTIME
|
---|
41 | I ENDEL="Y",$E(^ENG(6920,DA,0),1,3)="PM-" S DIK="^ENG(6920," D ^DIK
|
---|
42 | K EN
|
---|
43 | Q
|
---|
44 | ;
|
---|
45 | PRVPST ;Check for previous (and direct) posting
|
---|
46 | L +^ENG(6914,ENEQ,6):5 Q:'$T
|
---|
47 | F I=0:0 S I=$O(^ENG(6914,ENEQ,6,I)) Q:I'>0 S ENSA2=$P(^ENG(6914,ENEQ,6,I,0),U,1) I $E(ENSA2,1,6)=$E(ENSTDT,2,7),$P(^(0),U,9)["MedTester" K ^ENG(6914,ENEQ,6,I,0) Q
|
---|
48 | I I'>0 L -^ENG(6914,ENEQ,6) Q
|
---|
49 | S J=0,I1="" F I=0:0 S I=$O(^ENG(6914,ENEQ,6,I)) Q:I'>0 S I1=I,J=J+1
|
---|
50 | S:J=0 J="" S ^ENG(6914,ENEQ,6,0)=$P(^ENG(6914,ENEQ,6,0),U,1,2)_U_I1_U_J
|
---|
51 | L -^ENG(6914,ENEQ,6)
|
---|
52 | Q
|
---|
53 | ;ENSA4
|
---|