ENWOP3 ;(WASH ISC)/DLM/DH-Work Order Print ;5/8/1998
;;7.0;ENGINEERING;**26,35,42,53**;Aug 17, 1993
;
; Called by ENWOME2, ENWONEW, ENWOP
; Expects ENDNX (as inverse IEN for Space File - #6928)
;
FDAT S ENDNX=$O(^ENG(6920,"AINC",ENSHKEY,ENDNX)) I ENDNX="" S ENQUIT=1 Q
S DA=9999999999-ENDNX G:'$D(^ENG(6920,DA)) FDAT I 'ENPMINC,$E($P(^(DA,0),U,1),1,3)="PM-" G FDAT
I $D(^ENG(6920,DA,5)),$P(^(5),U,2)]"" K ^ENG(6920,"AINC",ENSHKEY,ENDNX) G FDAT
S ENRDA=$P(^ENG(6920,DA,0),U,2)
S X1=ENTOD,X2=ENRDA D ^%DTC G:X<ENDLQ FDAT
I ENBY="EMP",ENEMP'=$P($G(^ENG(6920,DA,2)),U,2) G FDAT
I ENBY="ROOM",ENROOM'=$P(^ENG(6920,DA,0),U,4) G FDAT
I ENBY="LOC" S SPC=$P(^ENG(6920,DA,0),U,4) G:SPC="" FDAT S X=$$SPACE^ENEQPMS8(SPC) G:+X<0 FDAT
I ENBY="ONR" G:'$D(^ENG(6920,DA,3)) FDAT I $P(^(3),U,4)'=ENONR G FDAT
S ENWONX=ENWONX+1,ENWONX(ENWONX)=DA
D FDAT4
Q:(IOSL-ENY)'>4
G FDAT
;
FDAT4 ; Entry point for work order autoprint (optional feature)
S ENRQR="",ENPRI="",ENTEC="",ENDPR="",ENSTAT="",ENEQ=""
I $D(ENY)#10'=1 S ENY=""
S EN=^ENG(6920,DA,0),ENWOR=$P(EN,U,1),ENRDA=$P(EN,U,2),ENLOC=$P(EN,U,4)
I ENLOC=+ENLOC,$D(^ENG("SP",ENLOC,0)) S ENLOC=$P(^(0),U)
I $D(^ENG(6920,DA,1)) S EN=^(1),ENRQR=$E($P(EN,U,3),1,15),ENDPR=$P(EN,U,2)
I $D(^ENG(6920,DA,2)) S EN=^(2),ENPRI=$P(EN,U,3),ENTEC=$E($P(EN,U,2),1,20) I IO=IO(0),$E(IOST,1,2)="C-" W:ENPRI="E"!(ENPRI="H") IOINHI
PMN I $D(^ENG(6920,DA,3)) S ENEQ=$P(^(3),U,8)
I $D(^ENG(6920,DA,4)) S ENSTAT=$P(^(4),U,3)
S:ENPRI]"" ENPRI=$E($$EXTERNAL^DILFD(6920,17,"",ENPRI),1,4)
FDAT7 ;
I ENTEC'="" I $D(^ENG("EMP",ENTEC,0))>0 S ENTEC=$P(^ENG("EMP",ENTEC,0),U,1)
WDAT D WDAT^ENWOP1
Q
;ENWOP3
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENWOP3 1675 printed Oct 16, 2024@17:57:15 Page 2
ENWOP3 ;(WASH ISC)/DLM/DH-Work Order Print ;5/8/1998
+1 ;;7.0;ENGINEERING;**26,35,42,53**;Aug 17, 1993
+2 ;
+3 ; Called by ENWOME2, ENWONEW, ENWOP
+4 ; Expects ENDNX (as inverse IEN for Space File - #6928)
+5 ;
FDAT SET ENDNX=$ORDER(^ENG(6920,"AINC",ENSHKEY,ENDNX))
IF ENDNX=""
SET ENQUIT=1
QUIT
+1 SET DA=9999999999-ENDNX
if '$DATA(^ENG(6920,DA))
GOTO FDAT
IF 'ENPMINC
IF $EXTRACT($PIECE(^(DA,0),U,1),1,3)="PM-"
GOTO FDAT
+2 IF $DATA(^ENG(6920,DA,5))
IF $PIECE(^(5),U,2)]""
KILL ^ENG(6920,"AINC",ENSHKEY,ENDNX)
GOTO FDAT
+3 SET ENRDA=$PIECE(^ENG(6920,DA,0),U,2)
+4 SET X1=ENTOD
SET X2=ENRDA
DO ^%DTC
if X<ENDLQ
GOTO FDAT
+5 IF ENBY="EMP"
IF ENEMP'=$PIECE($GET(^ENG(6920,DA,2)),U,2)
GOTO FDAT
+6 IF ENBY="ROOM"
IF ENROOM'=$PIECE(^ENG(6920,DA,0),U,4)
GOTO FDAT
+7 IF ENBY="LOC"
SET SPC=$PIECE(^ENG(6920,DA,0),U,4)
if SPC=""
GOTO FDAT
SET X=$$SPACE^ENEQPMS8(SPC)
if +X<0
GOTO FDAT
+8 IF ENBY="ONR"
if '$DATA(^ENG(6920,DA,3))
GOTO FDAT
IF $PIECE(^(3),U,4)'=ENONR
GOTO FDAT
+9 SET ENWONX=ENWONX+1
SET ENWONX(ENWONX)=DA
+10 DO FDAT4
+11 if (IOSL-ENY)'>4
QUIT
+12 GOTO FDAT
+13 ;
FDAT4 ; Entry point for work order autoprint (optional feature)
+1 SET ENRQR=""
SET ENPRI=""
SET ENTEC=""
SET ENDPR=""
SET ENSTAT=""
SET ENEQ=""
+2 IF $DATA(ENY)#10'=1
SET ENY=""
+3 SET EN=^ENG(6920,DA,0)
SET ENWOR=$PIECE(EN,U,1)
SET ENRDA=$PIECE(EN,U,2)
SET ENLOC=$PIECE(EN,U,4)
+4 IF ENLOC=+ENLOC
IF $DATA(^ENG("SP",ENLOC,0))
SET ENLOC=$PIECE(^(0),U)
+5 IF $DATA(^ENG(6920,DA,1))
SET EN=^(1)
SET ENRQR=$EXTRACT($PIECE(EN,U,3),1,15)
SET ENDPR=$PIECE(EN,U,2)
+6 IF $DATA(^ENG(6920,DA,2))
SET EN=^(2)
SET ENPRI=$PIECE(EN,U,3)
SET ENTEC=$EXTRACT($PIECE(EN,U,2),1,20)
IF IO=IO(0)
IF $EXTRACT(IOST,1,2)="C-"
if ENPRI="E"!(ENPRI="H")
WRITE IOINHI
PMN IF $DATA(^ENG(6920,DA,3))
SET ENEQ=$PIECE(^(3),U,8)
+1 IF $DATA(^ENG(6920,DA,4))
SET ENSTAT=$PIECE(^(4),U,3)
+2 if ENPRI]""
SET ENPRI=$EXTRACT($$EXTERNAL^DILFD(6920,17,"",ENPRI),1,4)
FDAT7 ;
+1 IF ENTEC'=""
IF $DATA(^ENG("EMP",ENTEC,0))>0
SET ENTEC=$PIECE(^ENG("EMP",ENTEC,0),U,1)
WDAT DO WDAT^ENWOP1
+1 QUIT
+2 ;ENWOP3