ENETRAN1 ;(WASH ISC)/DH-Display Pending Work Orders ;12.12.97
;;7.0;ENGINEERING;**35,47**;Aug 17, 1993
EN S ENPG=1 I ENCNT'>0 W !!,"Nothing to process in ",ENSHOP D HLD G EXIT
S I=0 F DA=0:0 S DA=$O(^TMP($J,DA)) Q:DA'>0 S I=I+1 D BLDARAY
; Screens here
S ENFR=1,ENCNT(0)=ENCNT
SCRN G:ENFR>ENCNT(0) EXIT S ENY=12,ENTO=1 F K=ENFR:1 Q:ENY>(IOSL-5)!($O(^TMP($J,"ENEWO",K))="") I $D(^TMP($J,"ENEWO",K)) S ENTO=ENTO+1,ENY=ENY+3,ENDA=$P(^TMP($J,"ENEWO",K),U,5) I ENDA]"" D EQUIP
S ENTO(0)=ENTO+1,ENTO=ENFR+ENTO
SCRN1 S (I,ENEX4)=0 F K=ENFR:1:ENTO I $D(^TMP($J,"ENEWO",K)) S I=1 Q
I 'I S ENFR=ENTO+1,ENPG=ENPG+1 G SCRN
D HDR S I=0 F K=ENFR:1:ENTO S I=I+1 D:$D(^TMP($J,"ENEWO",K)) LNDSP
WAIT S X="" W !,"TRANSFER NUMBERS? (Separate with ;)(Use : for Range)('ALL' for all ",ENCNT,")",!,?18,"('^' to EXIT)(RETURN to Continue) "
R X:DTIME I X="" S ENFR=ENTO+1,ENPG=ENPG+1 G SCRN
I X="^" G EXIT
I $E(X)="A"!($E(X)="a") D ALL G EXIT
I X?.N,X>0,X'>I S ENERN=ENFR+(X-1) I $D(^TMP($J,"ENEWO",ENERN)) S DA=$P(^TMP($J,"ENEWO",ENERN),U,1) D EN^ENETRAN2 G:ENEX4 EXIT G SCRN1
I X?.NP,X[";",$P(X,";")?1.N,$P(X,";",2)?1.N,$P(X,";",3)="" S ENEX=X D MULT G SCRN1
I X?.NP,X[":",$P(X,":")?1.N,$P(X,":",2)?1.N,$P(X,":",3)="",$D(^TMP($J,"ENEWO",$P(X,":",2))) S ENEX=X D RANGE G SCRN1
W " ?",*7,"?",*7 H 3
G SCRN1
;
LNDSP S ENEWO=^TMP($J,"ENEWO",K),ENPRI=$P(ENEWO,U,6) I $E(ENPRI,1,4)="HIGH"!($E(ENPRI,1,4)="EMER") W IOINHI
W !,I," =>",?5,$P(ENEWO,U,2),?19,$P(ENEWO,U,3),?32,$P(ENEWO,U,4),?49,$P(ENEWO,U,5),?61,$P(ENEWO,U,6) S DA=$P(ENEWO,U,1) W ?73,$S($O(^ENG(6920,DA,6,0))]"":"YES",1:"NO")
W !,?2,$E($P(ENEWO,U,7),1,42),?45,$E($P(ENEWO,U,8),1,15),?61,$E($P(ENEWO,U,9),1,15)
S ENDA=$P(ENEWO,U,5) I ENDA]"",$D(^ENG(6914,ENDA,0)) S ENMAN=$P(^(0),U,2) S ENCAT=$S($D(^(1)):$P(^(1),U,1),1:"") I ENMAN]""!(ENCAT]"") W !,?2,"Name: ",$E(ENMAN,1,30),?45,"Cat: " I ENCAT]"" D CATEGRY
W !,IOINLOW
Q
;
MULT F ENEX1=1:1 S X=$P(ENEX,";",ENEX1) Q:X=""!(ENEX4) I X?1.2N,X'>ENTO(0) S ENERN=ENFR+(X-1) I $D(^TMP($J,"ENEWO",ENERN)) S DA=$P(^TMP($J,"ENEWO",ENERN),U) D EN^ENETRAN2
Q
;
RANGE S ENEX2=$P(ENEX,":",1),ENEX3=$P(ENEX,":",2) Q:ENEX2>ENEX3 F ENERN=(ENFR+(ENEX2-1)):1:(ENFR+(ENEX3-1)) Q:ENEX4 I $D(^TMP($J,"ENEWO",ENERN)) S DA=$P(^(ENERN),U) D EN^ENETRAN2
Q
;
ALL S ENERN="ALL" F DA=0:0 S DA=$O(^TMP($J,DA)) Q:DA'>0!(ENEX4) D EN^ENETRAN2
Q
;
BLDARAY ;Build global array
S 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:"")
S ENRDT="",Y=$P($P(EN(0),U,2),".") I Y>0 X ^DD("DD") S ENRDT=Y
S ENLOC=$P(EN(0),U,4) I ENLOC=+ENLOC,$D(^ENG("SP",ENLOC,0)) S ENLOC=$P(^(0),U)
S ENBY=$P(EN(1),U) I ENBY]"",$D(^VA(200,ENBY,0)) S ENBY=$E($P(^(0),U),1,18)
S ENPRI=$P(EN(2),U,3) S:ENPRI]"" ENPRI=$$EXTERNAL^DILFD(6920,17,"",ENPRI)
S ^TMP($J,"ENEWO",I)=DA_U_$P(EN(0),U,1)_U_ENRDT_U_ENLOC_U_$P(EN(3),U,8)_U_ENPRI_U_$P(EN(1),U,2)_U_$P(EN(1),U,3)_U_ENBY
Q
;
HDR ;Screen header
W @IOF,"Pending Elect Work Orders ("_ENCNT_" in "_$E(ENSHOP,1,18)_") "_ENDATE_" Page "_ENPG
W !,?5,"Work Order #",?19,"Req Date",?32,"Location",?49,"Equip ID",?61,"Priority",?73,"Cmnts"
W !,?5,"Task Description",?45,"Contact Person",?61,"Entered by"
K X S $P(X,"-",78)="" W !,X
Q
;
EQUIP S (ENMAN,ENCAT)="" S:$D(^ENG(6914,ENDA,0)) ENMAN=$P(^(0),U,2) S:$D(^(1)) ENCAT=$P(^(1),U) I ENMAN]""!(ENCAT]"") S ENY=ENY+1
Q
;
CATEGRY W $S($D(^ENG(6911,ENCAT,0)):$P(^(0),U,1),1:ENCAT)
Q
;
HLD S X="" W !,"Press RETURN to continue, '^' to escape..." R X:DTIME Q
;
EXIT ;Return to ENETRAN
Q
;ENETRAN1
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENETRAN1 3583 printed Dec 13, 2024@01:53:10 Page 2
ENETRAN1 ;(WASH ISC)/DH-Display Pending Work Orders ;12.12.97
+1 ;;7.0;ENGINEERING;**35,47**;Aug 17, 1993
EN SET ENPG=1
IF ENCNT'>0
WRITE !!,"Nothing to process in ",ENSHOP
DO HLD
GOTO EXIT
+1 SET I=0
FOR DA=0:0
SET DA=$ORDER(^TMP($JOB,DA))
if DA'>0
QUIT
SET I=I+1
DO BLDARAY
+2 ; Screens here
+3 SET ENFR=1
SET ENCNT(0)=ENCNT
SCRN if ENFR>ENCNT(0)
GOTO EXIT
SET ENY=12
SET ENTO=1
FOR K=ENFR:1
if ENY>(IOSL-5)!($ORDER(^TMP($JOB,"ENEWO",K))="")
QUIT
IF $DATA(^TMP($JOB,"ENEWO",K))
SET ENTO=ENTO+1
SET ENY=ENY+3
SET ENDA=$PIECE(^TMP($JOB,"ENEWO",K),U,5)
IF ENDA]""
DO EQUIP
+1 SET ENTO(0)=ENTO+1
SET ENTO=ENFR+ENTO
SCRN1 SET (I,ENEX4)=0
FOR K=ENFR:1:ENTO
IF $DATA(^TMP($JOB,"ENEWO",K))
SET I=1
QUIT
+1 IF 'I
SET ENFR=ENTO+1
SET ENPG=ENPG+1
GOTO SCRN
+2 DO HDR
SET I=0
FOR K=ENFR:1:ENTO
SET I=I+1
if $DATA(^TMP($JOB,"ENEWO",K))
DO LNDSP
WAIT SET X=""
WRITE !,"TRANSFER NUMBERS? (Separate with ;)(Use : for Range)('ALL' for all ",ENCNT,")",!,?18,"('^' to EXIT)(RETURN to Continue) "
+1 READ X:DTIME
IF X=""
SET ENFR=ENTO+1
SET ENPG=ENPG+1
GOTO SCRN
+2 IF X="^"
GOTO EXIT
+3 IF $EXTRACT(X)="A"!($EXTRACT(X)="a")
DO ALL
GOTO EXIT
+4 IF X?.N
IF X>0
IF X'>I
SET ENERN=ENFR+(X-1)
IF $DATA(^TMP($JOB,"ENEWO",ENERN))
SET DA=$PIECE(^TMP($JOB,"ENEWO",ENERN),U,1)
DO EN^ENETRAN2
if ENEX4
GOTO EXIT
GOTO SCRN1
+5 IF X?.NP
IF X[";"
IF $PIECE(X,";")?1.N
IF $PIECE(X,";",2)?1.N
IF $PIECE(X,";",3)=""
SET ENEX=X
DO MULT
GOTO SCRN1
+6 IF X?.NP
IF X[":"
IF $PIECE(X,":")?1.N
IF $PIECE(X,":",2)?1.N
IF $PIECE(X,":",3)=""
IF $DATA(^TMP($JOB,"ENEWO",$PIECE(X,":",2)))
SET ENEX=X
DO RANGE
GOTO SCRN1
+7 WRITE " ?",*7,"?",*7
HANG 3
+8 GOTO SCRN1
+9 ;
LNDSP SET ENEWO=^TMP($JOB,"ENEWO",K)
SET ENPRI=$PIECE(ENEWO,U,6)
IF $EXTRACT(ENPRI,1,4)="HIGH"!($EXTRACT(ENPRI,1,4)="EMER")
WRITE IOINHI
+1 WRITE !,I," =>",?5,$PIECE(ENEWO,U,2),?19,$PIECE(ENEWO,U,3),?32,$PIECE(ENEWO,U,4),?49,$PIECE(ENEWO,U,5),?61,$PIECE(ENEWO,U,6)
SET DA=$PIECE(ENEWO,U,1)
WRITE ?73,$SELECT($ORDER(^ENG(6920,DA,6,0))]"":"YES",1:"NO")
+2 WRITE !,?2,$EXTRACT($PIECE(ENEWO,U,7),1,42),?45,$EXTRACT($PIECE(ENEWO,U,8),1,15),?61,$EXTRACT($PIECE(ENEWO,U,9),1,15)
+3 SET ENDA=$PIECE(ENEWO,U,5)
IF ENDA]""
IF $DATA(^ENG(6914,ENDA,0))
SET ENMAN=$PIECE(^(0),U,2)
SET ENCAT=$SELECT($DATA(^(1)):$PIECE(^(1),U,1),1:"")
IF ENMAN]""!(ENCAT]"")
WRITE !,?2,"Name: ",$EXTRACT(ENMAN,1,30),?45,"Cat: "
IF ENCAT]""
DO CATEGRY
+4 WRITE !,IOINLOW
+5 QUIT
+6 ;
MULT FOR ENEX1=1:1
SET X=$PIECE(ENEX,";",ENEX1)
if X=""!(ENEX4)
QUIT
IF X?1.2N
IF X'>ENTO(0)
SET ENERN=ENFR+(X-1)
IF $DATA(^TMP($JOB,"ENEWO",ENERN))
SET DA=$PIECE(^TMP($JOB,"ENEWO",ENERN),U)
DO EN^ENETRAN2
+1 QUIT
+2 ;
RANGE SET ENEX2=$PIECE(ENEX,":",1)
SET ENEX3=$PIECE(ENEX,":",2)
if ENEX2>ENEX3
QUIT
FOR ENERN=(ENFR+(ENEX2-1)):1:(ENFR+(ENEX3-1))
if ENEX4
QUIT
IF $DATA(^TMP($JOB,"ENEWO",ENERN))
SET DA=$PIECE(^(ENERN),U)
DO EN^ENETRAN2
+1 QUIT
+2 ;
ALL SET ENERN="ALL"
FOR DA=0:0
SET DA=$ORDER(^TMP($JOB,DA))
if DA'>0!(ENEX4)
QUIT
DO EN^ENETRAN2
+1 QUIT
+2 ;
BLDARAY ;Build global array
+1 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:"")
+2 SET ENRDT=""
SET Y=$PIECE($PIECE(EN(0),U,2),".")
IF Y>0
XECUTE ^DD("DD")
SET ENRDT=Y
+3 SET ENLOC=$PIECE(EN(0),U,4)
IF ENLOC=+ENLOC
IF $DATA(^ENG("SP",ENLOC,0))
SET ENLOC=$PIECE(^(0),U)
+4 SET ENBY=$PIECE(EN(1),U)
IF ENBY]""
IF $DATA(^VA(200,ENBY,0))
SET ENBY=$EXTRACT($PIECE(^(0),U),1,18)
+5 SET ENPRI=$PIECE(EN(2),U,3)
if ENPRI]""
SET ENPRI=$$EXTERNAL^DILFD(6920,17,"",ENPRI)
+6 SET ^TMP($JOB,"ENEWO",I)=DA_U_$PIECE(EN(0),U,1)_U_ENRDT_U_ENLOC_U_$PIECE(EN(3),U,8)_U_ENPRI_U_$PIECE(EN(1),U,2)_U_$PIECE(EN(1),U,3)_U_ENBY
+7 QUIT
+8 ;
HDR ;Screen header
+1 WRITE @IOF,"Pending Elect Work Orders ("_ENCNT_" in "_$EXTRACT(ENSHOP,1,18)_") "_ENDATE_" Page "_ENPG
+2 WRITE !,?5,"Work Order #",?19,"Req Date",?32,"Location",?49,"Equip ID",?61,"Priority",?73,"Cmnts"
+3 WRITE !,?5,"Task Description",?45,"Contact Person",?61,"Entered by"
+4 KILL X
SET $PIECE(X,"-",78)=""
WRITE !,X
+5 QUIT
+6 ;
EQUIP SET (ENMAN,ENCAT)=""
if $DATA(^ENG(6914,ENDA,0))
SET ENMAN=$PIECE(^(0),U,2)
if $DATA(^(1))
SET ENCAT=$PIECE(^(1),U)
IF ENMAN]""!(ENCAT]"")
SET ENY=ENY+1
+1 QUIT
+2 ;
CATEGRY WRITE $SELECT($DATA(^ENG(6911,ENCAT,0)):$PIECE(^(0),U,1),1:ENCAT)
+1 QUIT
+2 ;
HLD SET X=""
WRITE !,"Press RETURN to continue, '^' to escape..."
READ X:DTIME
QUIT
+1 ;
EXIT ;Return to ENETRAN
+1 QUIT
+2 ;ENETRAN1