ENSA5 ;(WASH ISC)/DH-Post MedTester PMI ;4.27.99
;;7.0;ENGINEERING;**14,35,48,54**;Aug 17, 1993
POST1 ; No existing PM work order - Post directly to equip hist
I '$D(ENSHKEY) S DIC="^DIC(6922,",DIC(0)="X",X="BIOMEDICAL" D ^DIC Q:Y'>0 S ENSHKEY=+Y
FAIL I ENFAIL D Q
. N PROBLEM S PROBLEM=$S($L(ENWP)>13:ENWP,1:"Device failed MedTester Inspection")
. S ENMSG="Equipment Entry # "_ENEQ_" FAILED INSPECTION. Corrective action required.",ENMSG(0,1)="MedTester upload."
. S ^TMP($J,"FAIL",ENEQ)=""
. D NEWWO^ENSA9 ; XCPTN^ENSA2 called from ENSA9
PASS S ^TMP($J,"PASS",ENEQ)=""
N ENW,ENCOST,PMTOT,ENPMDT S (ENW,ENCOST)=""
I ENWP="" S ENWP="MedTester Electrical Safety Analysis "_ENTEST
I ENTEC>0,ENTIME>0 D D ^ENBCPM8
. S PMTOT(ENSHKEY,ENTEC)=ENTIME,ENPMDT=$S($D(ENSTDT):$E(ENSTDT,2,5),1:$E(DT,2,5))
. I $D(^ENG("EMP",ENTEC,0)) S ENW=$P(^(0),U,3)
. I ENW="",$D(^DIC(6910,1,0)) S ENW=$P(^(0),U,4)
. Q:ENW=""
. S X=ENW*ENTIME,X(0)=2 D ROUND^ENLIB S ENCOST=+Y
S:$L(ENWP)>140 ENWP=$E(ENWP,1,140) S ENDTCP=$S($G(ENSTDT):ENSTDT,1:DT),ENH=ENDTCP_"-E1"_U_ENPMWO_U_"P"_U_ENTIME_U_ENCOST_"^^^"_ENEMP_U_ENWP,ENINV=ENEQ
I $D(^ENG(6914,ENEQ,6)) F J=0:0 S J=$O(^ENG(6914,ENEQ,6,J)) Q:J'>0 I $P(^(J,0),"-")=ENDTCP,$P(^(0),U,9)["MedTester" K ENINV S:$P(^(0),U,2)]"" ENPMWO(0)=$P(^(0),U,2) Q
I '$D(ENINV) S ENMSG="MedTester Inspection already posted for Equip ID# "_ENEQ_".",ENMSG(0,1)="No action taken.",ENMSG(0,2)="MedTester REC # "_ENREC S:$D(ENPMWO(0)) ENMSG(0,2)=ENMSG(0,2)_" Work Order Ref: "_ENPMWO(0) D XCPTN^ENSA2
D:$D(ENINV) EXT^ENEQHS
Q
;ENSA5
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENSA5 1585 printed Dec 13, 2024@01:55:33 Page 2
ENSA5 ;(WASH ISC)/DH-Post MedTester PMI ;4.27.99
+1 ;;7.0;ENGINEERING;**14,35,48,54**;Aug 17, 1993
POST1 ; No existing PM work order - Post directly to equip hist
+1 IF '$DATA(ENSHKEY)
SET DIC="^DIC(6922,"
SET DIC(0)="X"
SET X="BIOMEDICAL"
DO ^DIC
if Y'>0
QUIT
SET ENSHKEY=+Y
FAIL IF ENFAIL
Begin DoDot:1
+1 NEW PROBLEM
SET PROBLEM=$SELECT($LENGTH(ENWP)>13:ENWP,1:"Device failed MedTester Inspection")
+2 SET ENMSG="Equipment Entry # "_ENEQ_" FAILED INSPECTION. Corrective action required."
SET ENMSG(0,1)="MedTester upload."
+3 SET ^TMP($JOB,"FAIL",ENEQ)=""
+4 ; XCPTN^ENSA2 called from ENSA9
DO NEWWO^ENSA9
End DoDot:1
QUIT
PASS SET ^TMP($JOB,"PASS",ENEQ)=""
+1 NEW ENW,ENCOST,PMTOT,ENPMDT
SET (ENW,ENCOST)=""
+2 IF ENWP=""
SET ENWP="MedTester Electrical Safety Analysis "_ENTEST
+3 IF ENTEC>0
IF ENTIME>0
Begin DoDot:1
+4 SET PMTOT(ENSHKEY,ENTEC)=ENTIME
SET ENPMDT=$SELECT($DATA(ENSTDT):$EXTRACT(ENSTDT,2,5),1:$EXTRACT(DT,2,5))
+5 IF $DATA(^ENG("EMP",ENTEC,0))
SET ENW=$PIECE(^(0),U,3)
+6 IF ENW=""
IF $DATA(^DIC(6910,1,0))
SET ENW=$PIECE(^(0),U,4)
+7 if ENW=""
QUIT
+8 SET X=ENW*ENTIME
SET X(0)=2
DO ROUND^ENLIB
SET ENCOST=+Y
End DoDot:1
DO ^ENBCPM8
+9 if $LENGTH(ENWP)>140
SET ENWP=$EXTRACT(ENWP,1,140)
SET ENDTCP=$SELECT($GET(ENSTDT):ENSTDT,1:DT)
SET ENH=ENDTCP_"-E1"_U_ENPMWO_U_"P"_U_ENTIME_U_ENCOST_"^^^"_ENEMP_U_ENWP
SET ENINV=ENEQ
+10 IF $DATA(^ENG(6914,ENEQ,6))
FOR J=0:0
SET J=$ORDER(^ENG(6914,ENEQ,6,J))
if J'>0
QUIT
IF $PIECE(^(J,0),"-")=ENDTCP
IF $PIECE(^(0),U,9)["MedTester"
KILL ENINV
if $PIECE(^(0),U,2)]""
SET ENPMWO(0)=$PIECE(^(0),U,2)
QUIT
+11 IF '$DATA(ENINV)
SET ENMSG="MedTester Inspection already posted for Equip ID# "_ENEQ_"."
SET ENMSG(0,1)="No action taken."
SET ENMSG(0,2)="MedTester REC # "_ENREC
if $DATA(ENPMWO(0))
SET ENMSG(0,2)=ENMSG(0,2)_" Work Order Ref: "_ENPMWO(0)
DO XCPTN^ENSA2
+12 if $DATA(ENINV)
DO EXT^ENEQHS
+13 QUIT
+14 ;ENSA5