Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ENWARD2

ENWARD2.m

Go to the documentation of this file.
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