SRORHRS ;B'HAM ISC/ADM - O.R. NORMAL WORKING HOURS ; [ 09/22/98 11:36 AM ]
;;3.0; Surgery ;**77,50**;24 Jun 93
S SRSOUT=0 W @IOF,!,"Operating Room Normal Working Hours Report",!
DATE W ! K %DT S %DT="AEPX",%DT("A")="Print normal working hours starting with which date ? " D ^%DT I Y<0 S SRSOUT=1 G END
S SRSD=+Y
W ! K %DT S %DT="AEPX",%DT("A")="Print normal working hours through which date ? " D ^%DT I Y<0 S SRSOUT=1 G END
I Y<SRSD W !!,"The ending date must be more recent than the starting date." G DATE
S SRED=+Y
ROOMS ; all operating rooms ?
S SROR="ALL" W @IOF,!,"Do you want to print the Operating Room Normal Working Hours Report for all",!,"operating rooms ? YES// " R SRYN:DTIME I SRYN["^" S SRSOUT=1 G END
S SRYN=$E(SRYN) S:SRYN="" SRYN="Y"
I "YyNn"'[SRYN W !!,"Enter RETURN if you want to print the normal working hours for every operating",!,"room, or 'NO' to print the report for one particular room.",!!,"Press RETURN to continue " R X:DTIME G ROOMS
I "Yy"[SRYN G ZIS
W ! K DIC S DIC("S")="I $$ORDIV^SROUTL0(+Y,$G(SRSITE(""DIV""))),('$P(^SRS(+Y,0),U,6))",DIC="^SRS(",DIC(0)="QEAMZ",DIC("A")="Print the report for which Operating Room ? " D ^DIC I Y<0 S SRSOUT=1 G END
S SROR=+Y
ZIS W ! K IOP,%ZIS,POP,IO("Q") S %ZIS("A")="Print the report on which Device: ",%ZIS="Q" D ^%ZIS G:POP END
I $D(IO("Q")) K IO("Q") S ZTDESC="O.R. Normal Working Hours Report",ZTRTN="EN^SRORHRS",(ZTSAVE("SRSD"),ZTSAVE("SRED"),ZTSAVE("SROR"),ZTSAVE("SRSITE*"))="" D ^%ZTLOAD G END
EN ; entry when queued
N SRFRTO S Y=SRSD X ^DD("DD") S SRFRTO="FROM: "_Y_" TO: ",Y=SRED X ^DD("DD") S SRFRTO=SRFRTO_Y
D ^SRORHRS0
END I 'SRSOUT,$E(IOST)'="P" W !!,"Press RETURN to continue " R X:DTIME
W:$E(IOST)="P" @IOF I $D(ZTQUEUED) K ^TMP("SR",$J) Q:$G(ZTSTOP) S ZTREQ="@" Q
D ^%ZISC,^SRSKILL W @IOF
Q
HDR ; print heading
I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRSOUT=1 Q
I SRHDR,$E(IOST)'="P" W !!,"Press RETURN to continue " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
W:$Y @IOF W ! W:$E(IOST)="P" ?(80-$L(SRINST)\2),SRINST,?76,"PAGE",!,?31,"SURGICAL SERVICE",?78,SRPAGE,! W ?22,"OPERATING ROOM NORMAL WORKING HOURS"
W !,?(80-$L(SRFRTO)\2),SRFRTO
W !!,$S(SROR="ALL":"OPERATING ROOM",1:"DATE"),?20,"START TIME",?35,"END TIME",?62,"TOTAL TIME",! F LINE=1:1:80 W "-"
I SRHDR,SROR="ALL" W !,?31,"** "_SRDT_" **",!!
I SROR'="ALL" W !,?(80-$L("** OPERATING ROOM: "_$P(^SC($P(^SRS(SROR,0),"^"),0),"^")_" **")\2),"** OPERATING ROOM: "_$P(^SC($P(^SRS(SROR,0),"^"),0),"^")_" **",!!
S SRHDR=1,SRPAGE=SRPAGE+1
Q
SRORHRS ;B'HAM ISC/ADM - O.R. NORMAL WORKING HOURS ; [ 09/22/98 11:36 AM ]
+1 ;;3.0; Surgery ;**77,50**;24 Jun 93
+2 SET SRSOUT=0
WRITE @IOF,!,"Operating Room Normal Working Hours Report",!
DATE WRITE !
KILL %DT
SET %DT="AEPX"
SET %DT("A")="Print normal working hours starting with which date ? "
DO ^%DT
IF Y<0
SET SRSOUT=1
GOTO END
+1 SET SRSD=+Y
+2 WRITE !
KILL %DT
SET %DT="AEPX"
SET %DT("A")="Print normal working hours through which date ? "
DO ^%DT
IF Y<0
SET SRSOUT=1
GOTO END
+3 IF Y<SRSD
WRITE !!,"The ending date must be more recent than the starting date."
GOTO DATE
+4 SET SRED=+Y
ROOMS ; all operating rooms ?
+1 SET SROR="ALL"
WRITE @IOF,!,"Do you want to print the Operating Room Normal Working Hours Report for all",!,"operating rooms ? YES// "
READ SRYN:DTIME
IF SRYN["^"
SET SRSOUT=1
GOTO END
+2 SET SRYN=$EXTRACT(SRYN)
IF SRYN=""
SET SRYN="Y"
+3 IF "YyNn"'[SRYN
WRITE !!,"Enter RETURN if you want to print the normal working hours for every operating",!,"room, or 'NO' to print the report for one particular room.",!!,"Press RETURN to continue "
READ X:DTIME
GOTO ROOMS
+4 IF "Yy"[SRYN
GOTO ZIS
+5 WRITE !
KILL DIC
SET DIC("S")="I $$ORDIV^SROUTL0(+Y,$G(SRSITE(""DIV""))),('$P(^SRS(+Y,0),U,6))"
SET DIC="^SRS("
SET DIC(0)="QEAMZ"
SET DIC("A")="Print the report for which Operating Room ? "
DO ^DIC
IF Y<0
SET SRSOUT=1
GOTO END
+6 SET SROR=+Y
ZIS WRITE !
KILL IOP,%ZIS,POP,IO("Q")
SET %ZIS("A")="Print the report on which Device: "
SET %ZIS="Q"
DO ^%ZIS
IF POP
GOTO END
+1 IF $DATA(IO("Q"))
KILL IO("Q")
SET ZTDESC="O.R. Normal Working Hours Report"
SET ZTRTN="EN^SRORHRS"
SET (ZTSAVE("SRSD"),ZTSAVE("SRED"),ZTSAVE("SROR"),ZTSAVE("SRSITE*"))=""
DO ^%ZTLOAD
GOTO END
EN ; entry when queued
+1 NEW SRFRTO
SET Y=SRSD
XECUTE ^DD("DD")
SET SRFRTO="FROM: "_Y_" TO: "
SET Y=SRED
XECUTE ^DD("DD")
SET SRFRTO=SRFRTO_Y
+2 DO ^SRORHRS0
END IF 'SRSOUT
IF $EXTRACT(IOST)'="P"
WRITE !!,"Press RETURN to continue "
READ X:DTIME
+1 IF $EXTRACT(IOST)="P"
WRITE @IOF
IF $DATA(ZTQUEUED)
KILL ^TMP("SR",$JOB)
IF $GET(ZTSTOP)
QUIT
SET ZTREQ="@"
QUIT
+2 DO ^%ZISC
DO ^SRSKILL
WRITE @IOF
+3 QUIT
HDR ; print heading
+1 IF $DATA(ZTQUEUED)
DO ^SROSTOP
IF SRHALT
SET SRSOUT=1
QUIT
+2 IF SRHDR
IF $EXTRACT(IOST)'="P"
WRITE !!,"Press RETURN to continue "
READ X:DTIME
IF '$TEST!(X["^")
SET SRSOUT=1
QUIT
+3 IF $Y
WRITE @IOF
WRITE !
IF $EXTRACT(IOST)="P"
WRITE ?(80-$LENGTH(SRINST)\2),SRINST,?76,"PAGE",!,?31,"SURGICAL SERVICE",?78,SRPAGE,!
WRITE ?22,"OPERATING ROOM NORMAL WORKING HOURS"
+4 WRITE !,?(80-$LENGTH(SRFRTO)\2),SRFRTO
+5 WRITE !!,$SELECT(SROR="ALL":"OPERATING ROOM",1:"DATE"),?20,"START TIME",?35,"END TIME",?62,"TOTAL TIME",!
FOR LINE=1:1:80
WRITE "-"
+6 IF SRHDR
IF SROR="ALL"
WRITE !,?31,"** "_SRDT_" **",!!
+7 IF SROR'="ALL"
WRITE !,?(80-$LENGTH("** OPERATING ROOM: "_$PIECE(^SC($PIECE(^SRS(SROR,0),"^"),0),"^")_" **")\2),"** OPERATING ROOM: "_$PIECE(^SC($PIECE(^SRS(SROR,0),"^"),0),"^")_" **",!!
+8 SET SRHDR=1
SET SRPAGE=SRPAGE+1
+9 QUIT