SRODLT2 ;B'HAM ISC/ADM - REPORT OF DELAY TIME (CONT) ; 14 FEB 1992 10:45 AM
;;3.0; Surgery ;;24 Jun 93
K ^TMP("SRT",$J),SRSPEC
D HDR S SRSS=0 F S SRSS=$O(SRSP(SRSS)) Q:'SRSS!(SRSOUT) S ^TMP("SRT",$J,SRSS)="0^0",SRSPEC=">> Surgical Specialty: "_$P(^SRO(137.45,SRSS,0),"^")_" <<" D SUB,DELAY,TOTAL
K ^TMP("SRT",$J)
Q
DELAY S SRREA=0 F S SRREA=$O(^TMP("SR",$J,SRREA)) Q:'SRREA!(SRSOUT) I $D(^TMP("SR",$J,SRREA,SRSS)) S REASON=$P(^SRO(132.4,SRREA,0),"^") D PRINT
Q
PRINT ;
I $Y+5>IOSL D HDR I SRSOUT Q
S Y=^TMP("SR",$J,SRREA,SRSS),SRDLAY=$P(Y,"^"),SRDLT=$P(Y,"^",2)
S $P(^TMP("SRT",$J,SRSS),"^")=$P(^TMP("SRT",$J,SRSS),"^")+SRDLAY
S $P(^TMP("SRT",$J,SRSS),"^",2)=$P(^TMP("SRT",$J,SRSS),"^",2)+SRDLT
W !,$E(REASON,1,30),?33,$J(SRDLAY,5),?46,$J(SRDLT,5)
Q
TOTAL ; print delay reason totals
I $Y+5>IOSL D HDR I SRSOUT Q
S Y=^TMP("SRT",$J,SRSS),SRDLAY=$P(Y,"^"),SRDLT=$P(Y,"^",2)
W !!,?24,"TOTAL",?32,$J(SRDLAY,6),?45,$J(SRDLT,6)
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, or '^' to quit. " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
W:$Y @IOF W !,?(80-$L(SRINST)\2),SRINST,?72,"PAGE ",PAGE,!,?29,"Report of Delay Times"
W !,?27,"From "_SRSDT_" To "_SREDT,! I $E(IOST)="P" W "Printed: "_SRPRINT,!,?21,"Reviewed by:",?45,"Date Reviewed:",!
W !,?34,"# OF",?45,"MINUTES",!,"DELAY REASON",?33,"DELAYS",?45,"DELAYED",! F LINE=1:1:80 W "="
S (SRHDR,SRPAGE)=1,PAGE=PAGE+1 D:$D(SRSPEC) SUB1
Q
SUB ; print specialty sub-heading
I $Y+7>IOSL D HDR I SRSOUT!('SRPAGE) Q
I 'SRPAGE W !! F LINE=1:1:80 W "-"
SUB1 W !,?(80-$L(SRSPEC)\2),SRSPEC,! S SRPAGE=0
Q
SRODLT2 ;B'HAM ISC/ADM - REPORT OF DELAY TIME (CONT) ; 14 FEB 1992 10:45 AM
+1 ;;3.0; Surgery ;;24 Jun 93
+2 KILL ^TMP("SRT",$JOB),SRSPEC
+3 DO HDR
SET SRSS=0
FOR
SET SRSS=$ORDER(SRSP(SRSS))
IF 'SRSS!(SRSOUT)
QUIT
SET ^TMP("SRT",$JOB,SRSS)="0^0"
SET SRSPEC=">> Surgical Specialty: "_$PIECE(^SRO(137.45,SRSS,0),"^")_" <<"
DO SUB
DO DELAY
DO TOTAL
+4 KILL ^TMP("SRT",$JOB)
+5 QUIT
DELAY SET SRREA=0
FOR
SET SRREA=$ORDER(^TMP("SR",$JOB,SRREA))
IF 'SRREA!(SRSOUT)
QUIT
IF $DATA(^TMP("SR",$JOB,SRREA,SRSS))
SET REASON=$PIECE(^SRO(132.4,SRREA,0),"^")
DO PRINT
+1 QUIT
PRINT ;
+1 IF $Y+5>IOSL
DO HDR
IF SRSOUT
QUIT
+2 SET Y=^TMP("SR",$JOB,SRREA,SRSS)
SET SRDLAY=$PIECE(Y,"^")
SET SRDLT=$PIECE(Y,"^",2)
+3 SET $PIECE(^TMP("SRT",$JOB,SRSS),"^")=$PIECE(^TMP("SRT",$JOB,SRSS),"^")+SRDLAY
+4 SET $PIECE(^TMP("SRT",$JOB,SRSS),"^",2)=$PIECE(^TMP("SRT",$JOB,SRSS),"^",2)+SRDLT
+5 WRITE !,$EXTRACT(REASON,1,30),?33,$JUSTIFY(SRDLAY,5),?46,$JUSTIFY(SRDLT,5)
+6 QUIT
TOTAL ; print delay reason totals
+1 IF $Y+5>IOSL
DO HDR
IF SRSOUT
QUIT
+2 SET Y=^TMP("SRT",$JOB,SRSS)
SET SRDLAY=$PIECE(Y,"^")
SET SRDLT=$PIECE(Y,"^",2)
+3 WRITE !!,?24,"TOTAL",?32,$JUSTIFY(SRDLAY,6),?45,$JUSTIFY(SRDLT,6)
+4 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, or '^' to quit. "
READ X:DTIME
IF '$TEST!(X["^")
SET SRSOUT=1
QUIT
+3 IF $Y
WRITE @IOF
WRITE !,?(80-$LENGTH(SRINST)\2),SRINST,?72,"PAGE ",PAGE,!,?29,"Report of Delay Times"
+4 WRITE !,?27,"From "_SRSDT_" To "_SREDT,!
IF $EXTRACT(IOST)="P"
WRITE "Printed: "_SRPRINT,!,?21,"Reviewed by:",?45,"Date Reviewed:",!
+5 WRITE !,?34,"# OF",?45,"MINUTES",!,"DELAY REASON",?33,"DELAYS",?45,"DELAYED",!
FOR LINE=1:1:80
WRITE "="
+6 SET (SRHDR,SRPAGE)=1
SET PAGE=PAGE+1
IF $DATA(SRSPEC)
DO SUB1
+7 QUIT
SUB ; print specialty sub-heading
+1 IF $Y+7>IOSL
DO HDR
IF SRSOUT!('SRPAGE)
QUIT
+2 IF 'SRPAGE
WRITE !!
FOR LINE=1:1:80
WRITE "-"
SUB1 WRITE !,?(80-$LENGTH(SRSPEC)\2),SRSPEC,!
SET SRPAGE=0
+1 QUIT