ENWARD2 ;(WASH ISC)/DH-Incomplete Work Orders for End Users ;2.18.97
;;7.0;ENGINEERING;**35**;Aug 17, 1993
EN N TAG,SPC,IOINLOW,IOINHI D ZIS^ENUTL S ENLP=1,ENPG=0
S %DT="X",X="T" D ^%DT X ^DD("DD") S ENTOD=Y
K ^TMP("ENEQ",$J) S ENCNT=0
I ENBY="R" D G EXIT
. S DA=0 F S DA=$O(^ENG(6920,"C",ENROOM,DA)) Q:DA'>0 D
.. I $D(^ENG(6920,DA,0)),$P($G(^(5)),U,2)="",$E($P(^(0),U),1,3)'="PM-" S ^TMP("ENEQ",$J,DA)="",ENCNT=ENCNT+1
.. I $E(IOST,1,2)="C-" W "."
. D PRNTWO
F ENSHKEY=0:0 S ENSHKEY=$O(^ENG(6920,"AINC",ENSHKEY)) Q:ENSHKEY="" D FINDWO
I $E(IOST,1,2)="C-" W !
D PRNTWO
G EXIT
FINDWO F DNX=0:0 S DNX=$O(^ENG(6920,"AINC",ENSHKEY,DNX)) Q:DNX="" D
. S DA=9999999999-DNX
. I $E(IOST,1,2)="C-",'(DA#20) W "."
. I $D(^ENG(6920,DA,0)),$E(^(0),1,3)'="PM-" D CHECK
Q
CHECK I ENBY="E",$D(^ENG(6920,DA,1)),$P(^(1),U,1)=ENEB S ^TMP("ENEQ",$J,DA)="",ENCNT=ENCNT+1 Q
I ENBY="L" S SPC=$P($G(^ENG(6920,DA,0)),U,4) Q:SPC="" S X=$$SPACE^ENEQPMS8(SPC) Q:X=-1 S ^TMP("ENEQ",$J,DA)="",ENCNT=ENCNT+1 Q
I ENBY="S",$D(^ENG(6920,DA,3)),$P(^(3),U,4)=ENSRVC S ^TMP("ENEQ",$J,DA)="",ENCNT=ENCNT+1 Q
Q
PRNTWO ;Print from TMP global
U IO S DA=0 I $O(^TMP("ENEQ",$J,DA))="" S ENWONX=0 G WAIT
TOP I $D(DA),DA]"",$O(^TMP("ENEQ",$J,DA))="" G WAIT
I $E(IOST,1,2)="C-"!(ENPG) W @IOF
S ENPG=ENPG+1,ENY=5
W "Incmplt Work Orders (",$S(ENBY="E":"Entered by => "_$E($P(^VA(200,ENEB,0),U),1,25),ENBY="S":"Service/Section => "_$E($P(^DIC(49,ENSRVC,0),U),1,25),ENBY="R":"Room => "_$P(^ENG("SP",ENROOM,0),U),1:"") W:ENBY'="L" ")"
I ENBY="L" W "By Locations)"
W ?60,ENTOD_" Pg: "_ENPG
W !,"ORIG WO # CURRENT WO # REQ DATE STATUS",?66,"PRIORITY"
W !,?1,"LOCATION",?19,"EQUIP ID#",?31,"TASK DESCRIPTION",?66,"Count: ",ENCNT
K X S $P(X,"-",78)="-" W !,X
K X S ENWONX=0,ENOWONX=DA
FDAT S DA=$O(^TMP("ENEQ",$J,DA)) G:DA="" WAIT
I IO'=IO(0),'(DA#5) U IO(0) W "." U IO
I $D(^ENG(6920,DA,4)),$P(^(4),U,3)=5 G FDAT
S ENLP=0,EN(0)=^ENG(6920,DA,0),EN(1)=$S($D(^(1)):^(1),1:""),EN(2)=$S($D(^(2)):^(2),1:""),EN(3)=$S($D(^(3)):^(3),1:""),EN(4)=$S($D(^(4)):^(4),1:"")
FDAT4 ;
S (ENORIG,ENWOR,ENRDA,ENLOC,ENSTAT,ENPRI,ENDESC,ENEQ)=""
S ENORIG=$P(EN(0),U,6),ENWOR=$P(EN(0),U),ENRDA=$P(EN(0),U,2),ENLOC=$P(EN(0),U,4),ENSTAT=$P(EN(4),U,3),ENPRI=$P(EN(2),U,3),ENDESC=$P(EN(1),U,2),ENEQ=$P(EN(3),U,8)
I $D(ENDLQ),ENDLQ>0 S X1=ENTOD,X2=ENRDA D ^%DTC G:X<ENDLQ FDAT
I ENLOC=+ENLOC,$D(^ENG("SP",ENLOC,0)) S ENLOC=$P(^(0),U)
S ENWONX=ENWONX+1,ENWONX(ENWONX)=DA
I $E(IOST,1,2)="C-" W:ENPRI="E"!(ENPRI="H") IOINHI
I ENPRI]"" S ENPRI=$E($$EXTERNAL^DILFD(6920,17,"",ENPRI),1,4)
FDAT7 K X
I ENRDA]"" S %DT="X",X=$P(ENRDA,".",1) D ^%DT X ^DD("DD") S ENRDA=Y
I ENSTAT]"" S ENSTAT=$$EXTERNAL^DILFD(6920,32,"",ENSTAT)
WDAT W !,ENORIG,?18,ENWOR,?35,ENRDA,?49,ENSTAT,?68,ENPRI
W !,?1,ENLOC,?19,ENEQ,?31,$E(ENDESC,1,48)
S ENY=ENY+2
NEXT I $E(IOST,1,2)="C-" W IOINLOW
D CLEAN I $E(IOST,1,2)'="C-",(IOSL-ENY>3) W ! G FDAT
I $E(IOST,1,2)'="C-" G TOP
I IOSL-ENY>3 G FDAT
W !,"PRESS '^' TO EXIT; OR PRESS 1 TO ",ENWONX," FOR EXPANDED DISPLAY: /MORE//=> " R A:DTIME
I A?1.2N,$D(ENWONX(A)) S DA=ENWONX(A) I $D(^ENG(6920,DA,0))>0 D EXPAND G TOP
I A="^" G EXIT
K ENWONX G TOP
WAIT G:'$D(ENWONX) EXIT
I ENWONX=0,ENLP D I $E(IOST,1,2)="C-" D HOLD G EXIT
. W !!,"No incomplete work orders found for ",$S(ENBY="E":$P(^VA(200,ENEB,0),U),ENBY="L":"specified locations",ENBY="R":$P(^ENG("SP",ENROOM,0),U),ENBY="S":$P(^DIC(49,ENSRVC,0),U),1:"??"),"."
I $E(IOST,1,2)'="C-" W ! G EXIT
W !,"PRESS RETURN FOR MENU; OR PRESS 1 TO ",ENWONX," FOR EXPANDED DISPLAY: /EXIT//=> " R A:DTIME
I A?1.2N,$D(ENWONX(A)) S DA=ENWONX(A) I $D(^ENG(6920,DA,0))>0 D EXPAND G:ENOWONX=9999999999 EXIT G TOP
G EXIT
EXPAND ;Screen display work order
D D^ENEWOD F D READ^ENEWOD Q:ENX="" S TAG=ENX_"^ENEWOD" D @TAG
S DA=ENOWONX,ENPG=ENPG-1
Q
;
HOLD W !!,"Press <RETURN> to continue..." R A:DTIME
Q
;
EXIT K DNX,ENWO,ENOWONX,ENWONX,ENLP,ENTOD,ENST,ENBY,ENEB,ENSRVC,ENPG,ENDESC,EN,DA,ENSHKEY,ENDSTAT,ENTOD,ENCNT,ENX,ENY,ENA,ENB,ENNX,ENSRT
W @IOF
I $E(IOST,1,2)="P-",'$D(ZTQUEUED) D ^%ZISC
K ^TMP("ENEQ",$J)
S:$D(ZTQUEUED) ZTREQ="@"
CLEAN K ENWOR,ENRDA,ENLOC,ENPRI,ENORIG,ENSTAT,ENEQ
K ENAC,Y,Y1,A
Q
;ENWARD2
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENWARD2 4263 printed Nov 22, 2024@17:06:17 Page 2
ENWARD2 ;(WASH ISC)/DH-Incomplete Work Orders for End Users ;2.18.97
+1 ;;7.0;ENGINEERING;**35**;Aug 17, 1993
EN NEW TAG,SPC,IOINLOW,IOINHI
DO ZIS^ENUTL
SET ENLP=1
SET ENPG=0
+1 SET %DT="X"
SET X="T"
DO ^%DT
XECUTE ^DD("DD")
SET ENTOD=Y
+2 KILL ^TMP("ENEQ",$JOB)
SET ENCNT=0
+3 IF ENBY="R"
Begin DoDot:1
+4 SET DA=0
FOR
SET DA=$ORDER(^ENG(6920,"C",ENROOM,DA))
if DA'>0
QUIT
Begin DoDot:2
+5 IF $DATA(^ENG(6920,DA,0))
IF $PIECE($GET(^(5)),U,2)=""
IF $EXTRACT($PIECE(^(0),U),1,3)'="PM-"
SET ^TMP("ENEQ",$JOB,DA)=""
SET ENCNT=ENCNT+1
+6 IF $EXTRACT(IOST,1,2)="C-"
WRITE "."
End DoDot:2
+7 DO PRNTWO
End DoDot:1
GOTO EXIT
+8 FOR ENSHKEY=0:0
SET ENSHKEY=$ORDER(^ENG(6920,"AINC",ENSHKEY))
if ENSHKEY=""
QUIT
DO FINDWO
+9 IF $EXTRACT(IOST,1,2)="C-"
WRITE !
+10 DO PRNTWO
+11 GOTO EXIT
FINDWO FOR DNX=0:0
SET DNX=$ORDER(^ENG(6920,"AINC",ENSHKEY,DNX))
if DNX=""
QUIT
Begin DoDot:1
+1 SET DA=9999999999-DNX
+2 IF $EXTRACT(IOST,1,2)="C-"
IF '(DA#20)
WRITE "."
+3 IF $DATA(^ENG(6920,DA,0))
IF $EXTRACT(^(0),1,3)'="PM-"
DO CHECK
End DoDot:1
+4 QUIT
CHECK IF ENBY="E"
IF $DATA(^ENG(6920,DA,1))
IF $PIECE(^(1),U,1)=ENEB
SET ^TMP("ENEQ",$JOB,DA)=""
SET ENCNT=ENCNT+1
QUIT
+1 IF ENBY="L"
SET SPC=$PIECE($GET(^ENG(6920,DA,0)),U,4)
if SPC=""
QUIT
SET X=$$SPACE^ENEQPMS8(SPC)
if X=-1
QUIT
SET ^TMP("ENEQ",$JOB,DA)=""
SET ENCNT=ENCNT+1
QUIT
+2 IF ENBY="S"
IF $DATA(^ENG(6920,DA,3))
IF $PIECE(^(3),U,4)=ENSRVC
SET ^TMP("ENEQ",$JOB,DA)=""
SET ENCNT=ENCNT+1
QUIT
+3 QUIT
PRNTWO ;Print from TMP global
+1 USE IO
SET DA=0
IF $ORDER(^TMP("ENEQ",$JOB,DA))=""
SET ENWONX=0
GOTO WAIT
TOP IF $DATA(DA)
IF DA]""
IF $ORDER(^TMP("ENEQ",$JOB,DA))=""
GOTO WAIT
+1 IF $EXTRACT(IOST,1,2)="C-"!(ENPG)
WRITE @IOF
+2 SET ENPG=ENPG+1
SET ENY=5
+3 WRITE "Incmplt Work Orders (",$SELECT(ENBY="E":"Entered by => "_$EXTRACT($PIECE(^VA(200,ENEB,0),U),1,25),ENBY="S":"Service/Section => "_$EXTRACT($PIECE(^DIC(49,ENSRVC,0),U),1,25),ENBY="R":"Room => "_$PIECE(^ENG("SP",ENROOM,0),U),1:"")
if ENBY'="L"
WRITE ")"
+4 IF ENBY="L"
WRITE "By Locations)"
+5 WRITE ?60,ENTOD_" Pg: "_ENPG
+6 WRITE !,"ORIG WO # CURRENT WO # REQ DATE STATUS",?66,"PRIORITY"
+7 WRITE !,?1,"LOCATION",?19,"EQUIP ID#",?31,"TASK DESCRIPTION",?66,"Count: ",ENCNT
+8 KILL X
SET $PIECE(X,"-",78)="-"
WRITE !,X
+9 KILL X
SET ENWONX=0
SET ENOWONX=DA
FDAT SET DA=$ORDER(^TMP("ENEQ",$JOB,DA))
if DA=""
GOTO WAIT
+1 IF IO'=IO(0)
IF '(DA#5)
USE IO(0)
WRITE "."
USE IO
+2 IF $DATA(^ENG(6920,DA,4))
IF $PIECE(^(4),U,3)=5
GOTO FDAT
+3 SET ENLP=0
SET EN(0)=^ENG(6920,DA,0)
SET EN(1)=$SELECT($DATA(^(1)):^(1),1:"")
SET EN(2)=$SELECT($DATA(^(2)):^(2),1:"")
SET EN(3)=$SELECT($DATA(^(3)):^(3),1:"")
SET EN(4)=$SELECT($DATA(^(4)):^(4),1:"")
FDAT4 ;
+1 SET (ENORIG,ENWOR,ENRDA,ENLOC,ENSTAT,ENPRI,ENDESC,ENEQ)=""
+2 SET ENORIG=$PIECE(EN(0),U,6)
SET ENWOR=$PIECE(EN(0),U)
SET ENRDA=$PIECE(EN(0),U,2)
SET ENLOC=$PIECE(EN(0),U,4)
SET ENSTAT=$PIECE(EN(4),U,3)
SET ENPRI=$PIECE(EN(2),U,3)
SET ENDESC=$PIECE(EN(1),U,2)
SET ENEQ=$PIECE(EN(3),U,8)
+3 IF $DATA(ENDLQ)
IF ENDLQ>0
SET X1=ENTOD
SET X2=ENRDA
DO ^%DTC
if X<ENDLQ
GOTO FDAT
+4 IF ENLOC=+ENLOC
IF $DATA(^ENG("SP",ENLOC,0))
SET ENLOC=$PIECE(^(0),U)
+5 SET ENWONX=ENWONX+1
SET ENWONX(ENWONX)=DA
+6 IF $EXTRACT(IOST,1,2)="C-"
if ENPRI="E"!(ENPRI="H")
WRITE IOINHI
+7 IF ENPRI]""
SET ENPRI=$EXTRACT($$EXTERNAL^DILFD(6920,17,"",ENPRI),1,4)
FDAT7 KILL X
+1 IF ENRDA]""
SET %DT="X"
SET X=$PIECE(ENRDA,".",1)
DO ^%DT
XECUTE ^DD("DD")
SET ENRDA=Y
+2 IF ENSTAT]""
SET ENSTAT=$$EXTERNAL^DILFD(6920,32,"",ENSTAT)
WDAT WRITE !,ENORIG,?18,ENWOR,?35,ENRDA,?49,ENSTAT,?68,ENPRI
+1 WRITE !,?1,ENLOC,?19,ENEQ,?31,$EXTRACT(ENDESC,1,48)
+2 SET ENY=ENY+2
NEXT IF $EXTRACT(IOST,1,2)="C-"
WRITE IOINLOW
+1 DO CLEAN
IF $EXTRACT(IOST,1,2)'="C-"
IF (IOSL-ENY>3)
WRITE !
GOTO FDAT
+2 IF $EXTRACT(IOST,1,2)'="C-"
GOTO TOP
+3 IF IOSL-ENY>3
GOTO FDAT
+4 WRITE !,"PRESS '^' TO EXIT; OR PRESS 1 TO ",ENWONX," FOR EXPANDED DISPLAY: /MORE//=> "
READ A:DTIME
+5 IF A?1.2N
IF $DATA(ENWONX(A))
SET DA=ENWONX(A)
IF $DATA(^ENG(6920,DA,0))>0
DO EXPAND
GOTO TOP
+6 IF A="^"
GOTO EXIT
+7 KILL ENWONX
GOTO TOP
WAIT if '$DATA(ENWONX)
GOTO EXIT
+1 IF ENWONX=0
IF ENLP
Begin DoDot:1
+2 WRITE !!,"No incomplete work orders found for ",$SELECT(ENBY="E":$PIECE(^VA(200,ENEB,0),U),ENBY="L":"specified locations",ENBY="R":$PIECE(^ENG("SP",ENROOM,0),U),ENBY="S":$PIECE(^DIC(49,ENSRVC,0),U),1:"??"),"."
End DoDot:1
IF $EXTRACT(IOST,1,2)="C-"
DO HOLD
GOTO EXIT
+3 IF $EXTRACT(IOST,1,2)'="C-"
WRITE !
GOTO EXIT
+4 WRITE !,"PRESS RETURN FOR MENU; OR PRESS 1 TO ",ENWONX," FOR EXPANDED DISPLAY: /EXIT//=> "
READ A:DTIME
+5 IF A?1.2N
IF $DATA(ENWONX(A))
SET DA=ENWONX(A)
IF $DATA(^ENG(6920,DA,0))>0
DO EXPAND
if ENOWONX=9999999999
GOTO EXIT
GOTO TOP
+6 GOTO EXIT
EXPAND ;Screen display work order
+1 DO D^ENEWOD
FOR
DO READ^ENEWOD
if ENX=""
QUIT
SET TAG=ENX_"^ENEWOD"
DO @TAG
+2 SET DA=ENOWONX
SET ENPG=ENPG-1
+3 QUIT
+4 ;
HOLD WRITE !!,"Press <RETURN> to continue..."
READ A:DTIME
+1 QUIT
+2 ;
EXIT KILL DNX,ENWO,ENOWONX,ENWONX,ENLP,ENTOD,ENST,ENBY,ENEB,ENSRVC,ENPG,ENDESC,EN,DA,ENSHKEY,ENDSTAT,ENTOD,ENCNT,ENX,ENY,ENA,ENB,ENNX,ENSRT
+1 WRITE @IOF
+2 IF $EXTRACT(IOST,1,2)="P-"
IF '$DATA(ZTQUEUED)
DO ^%ZISC
+3 KILL ^TMP("ENEQ",$JOB)
+4 if $DATA(ZTQUEUED)
SET ZTREQ="@"
CLEAN KILL ENWOR,ENRDA,ENLOC,ENPRI,ENORIG,ENSTAT,ENEQ
+1 KILL ENAC,Y,Y1,A
+2 QUIT
+3 ;ENWARD2