ENWONEW2 ;(WASH ISC)/DH-Work Order Entry ;5.29.97
;;7.0;ENGINEERING;**1,25,35,42**;Aug 17, 1993
;
TRNIN ; Entry point to get work order for de-installation of equipment
; Expects DUZ
; Expects EQUIPMENT ID in piece 1 of WODATA, LOCATION in piece 2
; Expects that SERVICE POINTER may be in local variable PRCNSRV
; Returns work order number as ENWO and internal entry number as ENDA
I $G(DUZ),+$G(WODATA)
E Q ;Insufficient information to proceed
N SHOPKEY,NUMBER,NAME,PHONE,ITEM,LOC,SERVICE,WARD
N DIC,DIE,DIQ,DA,DR
S SHOPKEY=$P($G(^DIC(6910,1,20)),U) D:'SHOPKEY Q:'SHOPKEY
. S SHOPKEY=$P($G(^DIC(6910,1,0)),U,6) D:'SHOPKEY
.. S DIC="^DIC(6922,",DIC(0)="AEQM",DIC("S")="I Y#100>89" D ^DIC K DIC("S") S:Y>0 SHOPKEY=+Y
Q:'$D(^DIC(6922,SHOPKEY,0))
D WONUM^ENWONEW ;create work order
I NUMBER="" W !!,"Can't seem to add a new work order at this time. Suggest that you",!,"contact IRM.",*7 Q
W !,"Work Order #: ",NUMBER S ENDA=DA,ENWO=NUMBER
L +^ENG(6920,ENDA):0 I '$T W !!,"Bad news. Another user is already editing the work order that you just",!,"created. Please make a note of the work order number and advise Engineering",!,"Service of the problem."
FILL ;Fill in the work order
S DIC="^VA(200,",DR=".01;.131;.132;.133;.134;.135",DIQ="TMP",DIQ(0)="E",DA=DUZ
D EN^DIQ1
S NAME=$E(TMP(200,DA,.01,"E"),1,15)
F X=".131",".132",".133",".134",".135" S PHONE=TMP(200,DA,X,"E") Q:PHONE]""
K TMP
LOAD S DIE="^ENG(6920,",DA=ENDA,DR="1///N;.05///^S X=NUMBER;7.5////"_DUZ_";9///"_SHOPKEY_";2///C"
S DR=DR_";7///"_NAME_";17///A" S:PHONE]"" DR=DR_";8///^S X=PHONE"
S ITEM=$P(WODATA,U),LOC=$P(WODATA,U,2)
I LOC=+LOC S LOC=$P($G(^ENG("SP",LOC,0)),U)
I LOC']"" S LOC=$P($G(^ENG(6914,ITEM,3)),U,5) S:LOC=+LOC LOC=$P(^ENG("SP",LOC,0),U)
S DR=DR_";18///^S X=ITEM" I LOC]"" S DR=DR_";3///^S X=LOC"
I $G(PRCNSRV) S SERVICE=$P($G(^DIC(49,+PRCNSRV,0)),U),DR=DR_";23///^S X=SERVICE"
S DR=DR_";6///Prepare equipment for turn-in.;32///^S X=2;35///R2"
D ^DIE
S DR=$S($D(^DIE("B","ENZTIWO")):"[ENZTIWO]",$D(^DIE("B","ENTIWO")):"[ENTIWO]",1:"")
D:DR]"" ^DIE
L -^ENG(6920,ENDA)
S WARD=1 D WOPRNT^ENWONEW
Q
;
AUTODEV ;Get device from ENG SECTION (null if unsuccessful)
S DEVICE="",X=$P(^DIC(6922,SHOPKEY,0),U,3)
I X]"",$D(^%ZIS(1,X,0)) S DEVICE=$P(^(0),U) S IOP=DEVICE,%ZIS="NQ" D ^%ZIS K IOP
I WARD,DEVICE="" Q
I DEVICE="" S %ZIS="NQ" D ^%ZIS S DEVICE=$S(POP:"",IO(0)=IO:"HOME",1:ION)
I ION="NULL" D HOME^%ZIS S DEVICE=""
Q
;
;ENWONEW2
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENWONEW2 2506 printed Dec 13, 2024@01:56:23 Page 2
ENWONEW2 ;(WASH ISC)/DH-Work Order Entry ;5.29.97
+1 ;;7.0;ENGINEERING;**1,25,35,42**;Aug 17, 1993
+2 ;
TRNIN ; Entry point to get work order for de-installation of equipment
+1 ; Expects DUZ
+2 ; Expects EQUIPMENT ID in piece 1 of WODATA, LOCATION in piece 2
+3 ; Expects that SERVICE POINTER may be in local variable PRCNSRV
+4 ; Returns work order number as ENWO and internal entry number as ENDA
+5 IF $GET(DUZ)
IF +$GET(WODATA)
+6 ;Insufficient information to proceed
IF '$TEST
QUIT
+7 NEW SHOPKEY,NUMBER,NAME,PHONE,ITEM,LOC,SERVICE,WARD
+8 NEW DIC,DIE,DIQ,DA,DR
+9 SET SHOPKEY=$PIECE($GET(^DIC(6910,1,20)),U)
if 'SHOPKEY
Begin DoDot:1
+10 SET SHOPKEY=$PIECE($GET(^DIC(6910,1,0)),U,6)
if 'SHOPKEY
Begin DoDot:2
+11 SET DIC="^DIC(6922,"
SET DIC(0)="AEQM"
SET DIC("S")="I Y#100>89"
DO ^DIC
KILL DIC("S")
if Y>0
SET SHOPKEY=+Y
End DoDot:2
End DoDot:1
if 'SHOPKEY
QUIT
+12 if '$DATA(^DIC(6922,SHOPKEY,0))
QUIT
+13 ;create work order
DO WONUM^ENWONEW
+14 IF NUMBER=""
WRITE !!,"Can't seem to add a new work order at this time. Suggest that you",!,"contact IRM.",*7
QUIT
+15 WRITE !,"Work Order #: ",NUMBER
SET ENDA=DA
SET ENWO=NUMBER
+16 LOCK +^ENG(6920,ENDA):0
IF '$TEST
WRITE !!,"Bad news. Another user is already editing the work order that you just",!,"created. Please make a note of the work order number and advise Engineering",!,"Service of the problem."
FILL ;Fill in the work order
+1 SET DIC="^VA(200,"
SET DR=".01;.131;.132;.133;.134;.135"
SET DIQ="TMP"
SET DIQ(0)="E"
SET DA=DUZ
+2 DO EN^DIQ1
+3 SET NAME=$EXTRACT(TMP(200,DA,.01,"E"),1,15)
+4 FOR X=".131",".132",".133",".134",".135"
SET PHONE=TMP(200,DA,X,"E")
if PHONE]""
QUIT
+5 KILL TMP
LOAD SET DIE="^ENG(6920,"
SET DA=ENDA
SET DR="1///N;.05///^S X=NUMBER;7.5////"_DUZ_";9///"_SHOPKEY_";2///C"
+1 SET DR=DR_";7///"_NAME_";17///A"
if PHONE]""
SET DR=DR_";8///^S X=PHONE"
+2 SET ITEM=$PIECE(WODATA,U)
SET LOC=$PIECE(WODATA,U,2)
+3 IF LOC=+LOC
SET LOC=$PIECE($GET(^ENG("SP",LOC,0)),U)
+4 IF LOC']""
SET LOC=$PIECE($GET(^ENG(6914,ITEM,3)),U,5)
if LOC=+LOC
SET LOC=$PIECE(^ENG("SP",LOC,0),U)
+5 SET DR=DR_";18///^S X=ITEM"
IF LOC]""
SET DR=DR_";3///^S X=LOC"
+6 IF $GET(PRCNSRV)
SET SERVICE=$PIECE($GET(^DIC(49,+PRCNSRV,0)),U)
SET DR=DR_";23///^S X=SERVICE"
+7 SET DR=DR_";6///Prepare equipment for turn-in.;32///^S X=2;35///R2"
+8 DO ^DIE
+9 SET DR=$SELECT($DATA(^DIE("B","ENZTIWO")):"[ENZTIWO]",$DATA(^DIE("B","ENTIWO")):"[ENTIWO]",1:"")
+10 if DR]""
DO ^DIE
+11 LOCK -^ENG(6920,ENDA)
+12 SET WARD=1
DO WOPRNT^ENWONEW
+13 QUIT
+14 ;
AUTODEV ;Get device from ENG SECTION (null if unsuccessful)
+1 SET DEVICE=""
SET X=$PIECE(^DIC(6922,SHOPKEY,0),U,3)
+2 IF X]""
IF $DATA(^%ZIS(1,X,0))
SET DEVICE=$PIECE(^(0),U)
SET IOP=DEVICE
SET %ZIS="NQ"
DO ^%ZIS
KILL IOP
+3 IF WARD
IF DEVICE=""
QUIT
+4 IF DEVICE=""
SET %ZIS="NQ"
DO ^%ZIS
SET DEVICE=$SELECT(POP:"",IO(0)=IO:"HOME",1:ION)
+5 IF ION="NULL"
DO HOME^%ZIS
SET DEVICE=""
+6 QUIT
+7 ;
+8 ;ENWONEW2