ENWOP2 ;(WASH ISC)/DH-Count Incomplete Work Orders ;5/8/1998
;;7.0;ENGINEERING;**6,35,53**;Aug 17, 1993
N DATE S %DT="X",X="N" D ^%DT S ENTOD=Y D DD^%DT S DATE=Y,(ENPG,ENQUIT)=0
I '$D(ENSHKEY("ALL")) W:$E(IOST,1,2)="C-" @IOF D COUNT,HDR W !!,$P(^DIC(6922,ENSHKEY,0),U),": ",ENCOUNT D:$E(IOST,1,2)="C-" HOLD G EXIT
N ENSHKEY W:$E(IOST,1,2)="C-" @IOF
D HDR
F ENSHKEY=0:0 S ENSHKEY=$O(^DIC(6922,ENSHKEY)) Q:ENQUIT!(ENSHKEY'>0) D
. I IO'=IO(0) U IO(0) W "." U IO
. D COUNT I ENBY'="SHOP",ENCOUNT=0 Q
. S ENY=ENY+2
. W !!,$P(^DIC(6922,ENSHKEY,0),U),": ",ENCOUNT
. I (IOSL-ENY)'>4 D HDR Q:ENQUIT
I 'ENQUIT,$E(IOST,1,2)="C-" D HOLD
G EXIT
;
HDR I ENPG D:$E(IOST,1,2)="C-" HOLD Q:ENQUIT W @IOF
S ENPG=ENPG+1,ENY=4
W "COUNT OF INCOMPLETE ENGINEERING WORK ORDERS ",?50,DATE,?65,"Page ",ENPG
I ENBY'="SHOP" S ENY=ENY+1 D
. I ENBY="EMP" W !,"Employee: ",$S(ENEMP="":"NONE",1:$P(^ENG("EMP",ENEMP,0),U))
. I ENBY="ROOM" W !,"For a Specific Room: "_$P(^ENG("SP",ENROOM,0),U)
. I ENBY="LOC" W !,"By Location Search:"
. I ENBY="ONR" W !,"Owner/Department: ",$P(^DIC(49,ENONR,0),U)
W !,$S(ENPMINC:"(Includes ",1:"(Does not include "),"PM Work Orders)"
K X S $P(X,"-",78)="-" W !,X
Q
COUNT ;Get count for shop ENSHKEY
S ENCOUNT=0,ENDNX=""
FDAT S ENDNX=$O(^ENG(6920,"AINC",ENSHKEY,ENDNX)) Q:ENDNX="" S DA=9999999999-ENDNX G:'$D(^ENG(6920,DA,0)) FDAT I 'ENPMINC,$E(^(0),1,3)="PM-" G FDAT
Q:ENDNX=""
I $D(^ENG(6920,DA,5)),$P(^(5),U,2)]"" K ^ENG(6920,"AINC",ENSHKEY,ENDNX) G 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=-1 FDAT
I ENBY="ONR" G:'$D(^ENG(6920,DA,3)) FDAT I $P(^(3),U,4)'=ENONR G FDAT
S ENRDA=$P(^ENG(6920,DA,0),U,2)
S X1=ENTOD,X2=ENRDA D ^%DTC G:X<ENDLQ FDAT
S ENCOUNT=ENCOUNT+1
G FDAT
;
HOLD W !!,"Press <RETURN> to continue, '^' to exit..." R X:DTIME
I $E(X)="^" S ENQUIT=1
Q
;
EXIT K DA,ENDNX,ENPG,ENY,ENCOUNT,ENQUIT,ENTOD,ENRDA
W @IOF
Q
;ENWOP2
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENWOP2 2089 printed Dec 13, 2024@01:56:27 Page 2
ENWOP2 ;(WASH ISC)/DH-Count Incomplete Work Orders ;5/8/1998
+1 ;;7.0;ENGINEERING;**6,35,53**;Aug 17, 1993
+2 NEW DATE
SET %DT="X"
SET X="N"
DO ^%DT
SET ENTOD=Y
DO DD^%DT
SET DATE=Y
SET (ENPG,ENQUIT)=0
+3 IF '$DATA(ENSHKEY("ALL"))
if $EXTRACT(IOST,1,2)="C-"
WRITE @IOF
DO COUNT
DO HDR
WRITE !!,$PIECE(^DIC(6922,ENSHKEY,0),U),": ",ENCOUNT
if $EXTRACT(IOST,1,2)="C-"
DO HOLD
GOTO EXIT
+4 NEW ENSHKEY
if $EXTRACT(IOST,1,2)="C-"
WRITE @IOF
+5 DO HDR
+6 FOR ENSHKEY=0:0
SET ENSHKEY=$ORDER(^DIC(6922,ENSHKEY))
if ENQUIT!(ENSHKEY'>0)
QUIT
Begin DoDot:1
+7 IF IO'=IO(0)
USE IO(0)
WRITE "."
USE IO
+8 DO COUNT
IF ENBY'="SHOP"
IF ENCOUNT=0
QUIT
+9 SET ENY=ENY+2
+10 WRITE !!,$PIECE(^DIC(6922,ENSHKEY,0),U),": ",ENCOUNT
+11 IF (IOSL-ENY)'>4
DO HDR
if ENQUIT
QUIT
End DoDot:1
+12 IF 'ENQUIT
IF $EXTRACT(IOST,1,2)="C-"
DO HOLD
+13 GOTO EXIT
+14 ;
HDR IF ENPG
if $EXTRACT(IOST,1,2)="C-"
DO HOLD
if ENQUIT
QUIT
WRITE @IOF
+1 SET ENPG=ENPG+1
SET ENY=4
+2 WRITE "COUNT OF INCOMPLETE ENGINEERING WORK ORDERS ",?50,DATE,?65,"Page ",ENPG
+3 IF ENBY'="SHOP"
SET ENY=ENY+1
Begin DoDot:1
+4 IF ENBY="EMP"
WRITE !,"Employee: ",$SELECT(ENEMP="":"NONE",1:$PIECE(^ENG("EMP",ENEMP,0),U))
+5 IF ENBY="ROOM"
WRITE !,"For a Specific Room: "_$PIECE(^ENG("SP",ENROOM,0),U)
+6 IF ENBY="LOC"
WRITE !,"By Location Search:"
+7 IF ENBY="ONR"
WRITE !,"Owner/Department: ",$PIECE(^DIC(49,ENONR,0),U)
End DoDot:1
+8 WRITE !,$SELECT(ENPMINC:"(Includes ",1:"(Does not include "),"PM Work Orders)"
+9 KILL X
SET $PIECE(X,"-",78)="-"
WRITE !,X
+10 QUIT
COUNT ;Get count for shop ENSHKEY
+1 SET ENCOUNT=0
SET ENDNX=""
FDAT SET ENDNX=$ORDER(^ENG(6920,"AINC",ENSHKEY,ENDNX))
if ENDNX=""
QUIT
SET DA=9999999999-ENDNX
if '$DATA(^ENG(6920,DA,0))
GOTO FDAT
IF 'ENPMINC
IF $EXTRACT(^(0),1,3)="PM-"
GOTO FDAT
+1 if ENDNX=""
QUIT
+2 IF $DATA(^ENG(6920,DA,5))
IF $PIECE(^(5),U,2)]""
KILL ^ENG(6920,"AINC",ENSHKEY,ENDNX)
GOTO FDAT
+3 IF ENBY="EMP"
IF ENEMP'=$PIECE($GET(^ENG(6920,DA,2)),U,2)
GOTO FDAT
+4 IF ENBY="ROOM"
IF ENROOM'=$PIECE(^ENG(6920,DA,0),U,4)
GOTO FDAT
+5 IF ENBY="LOC"
SET SPC=$PIECE(^ENG(6920,DA,0),U,4)
if SPC=""
GOTO FDAT
SET X=$$SPACE^ENEQPMS8(SPC)
if X=-1
GOTO FDAT
+6 IF ENBY="ONR"
if '$DATA(^ENG(6920,DA,3))
GOTO FDAT
IF $PIECE(^(3),U,4)'=ENONR
GOTO FDAT
+7 SET ENRDA=$PIECE(^ENG(6920,DA,0),U,2)
+8 SET X1=ENTOD
SET X2=ENRDA
DO ^%DTC
if X<ENDLQ
GOTO FDAT
+9 SET ENCOUNT=ENCOUNT+1
+10 GOTO FDAT
+11 ;
HOLD WRITE !!,"Press <RETURN> to continue, '^' to exit..."
READ X:DTIME
+1 IF $EXTRACT(X)="^"
SET ENQUIT=1
+2 QUIT
+3 ;
EXIT KILL DA,ENDNX,ENPG,ENY,ENCOUNT,ENQUIT,ENTOD,ENRDA
+1 WRITE @IOF
+2 QUIT
+3 ;ENWOP2