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

SRODLT0.m

Go to the documentation of this file.
SRODLT0 ;B'HAM ISC/ADM - REPORT OF DELAY TIME (CONT) ; [ 04/05/00  2:37 PM ]
 ;;3.0; Surgery ;**94**;24 Jun 93
 U IO K ^TMP("SR",$J),REASON S (SRHDR,SRSOUT,SRREA)=0,PAGE=1
 S SRSDT=$E(SRSD,4,5)_"/"_$E(SRSD,6,7)_"/"_$E(SRSD,2,3),SRSD=SRSD-.0001
 S SREDT=$E(SRED,4,5)_"/"_$E(SRED,6,7)_"/"_$E(SRED,2,3),SRED=SRED+.9999
 S SRPRINT=$E(DT,4,5)_"/"_$E(DT,6,7)_"/"_$E(DT,2,3)
 I SRDL F  S SRREA=$O(SRDL(SRREA)) Q:'SRREA  S ^TMP("SR",$J,SRREA)="0^0" I SRSP S SRSS=0 F  S SRSS=$O(SRSP(SRSS)) Q:'SRSS  S ^TMP("SR",$J,SRREA,SRSS)="0^0"
AC F  S SRSD=$O(^SRF("AC",SRSD)) Q:'SRSD!(SRSD>SRED)  S SRCASE=0 F  S SRCASE=$O(^SRF("AC",SRSD,SRCASE)) Q:'SRCASE  I $D(^SRF(SRCASE,0)),$$MANDIV^SROUTL0(SRINSTP,SRCASE) D UTIL
 D HDR I '$D(^TMP("SR",$J)) W !!,"No data for selected date range."
 S SRREA=0 F  S SRREA=$O(^TMP("SR",$J,SRREA)) Q:'SRREA!(SRSOUT)  S REASON=">> Delay Reason: "_$P(^SRO(132.4,SRREA,0),"^")_" <<" D SUB,SPEC I SRCT'=1 D:'SRSOUT TOTAL
 I 'SRSOUT,'SRDL,'SRSP D ^SRODLT1
 I 'SRSOUT,'SRDL,SRSP D ^SRODLT2
 D END Q
SPEC S SRSS="",SRCT=0 F  S SRSS=$O(^TMP("SR",$J,SRREA,SRSS)) Q:SRSS=""!(SRSOUT)  S SRSPEC=$S(SRSS:$P(^SRO(137.45,SRSS,0),"^"),1:"NO SPECIALTY ENTERED"),SRCT=SRCT+1 D PRINT
 Q
PRINT ; print specialty data
 I $Y+5>IOSL D HDR I SRSOUT Q
 S Y=^TMP("SR",$J,SRREA,SRSS),SRDLAY=$P(Y,"^"),SRDLT=$P(Y,"^",2)
 W !,$E(SRSPEC,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("SR",$J,SRREA),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",!,"SURGICAL SPECIALTY",?33,"DELAYS",?45,"DELAYED",! F LINE=1:1:80 W "="
 S (SRPAGE,SRHDR)=1,PAGE=PAGE+1 D:$D(REASON) SUB1
 Q
SUB ; print delay reason 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(REASON)\2),REASON,! S SRPAGE=0
 Q
UTIL ; set ^TMP
 Q:'$O(^SRF(SRCASE,17,0))
 Q:$P($G(^SRF(SRCASE,.2)),"^",12)=""
 S SRSS=$P(^SRF(SRCASE,0),"^",4) S:SRSS="" SRSS="ZZ" I SRSP,'$D(SRSP(SRSS)) Q
 S SRDLAY=0 F  S SRDLAY=$O(^SRF(SRCASE,17,SRDLAY)) Q:'SRDLAY  S SRREA=$P(^SRF(SRCASE,17,SRDLAY,0),"^") D SET
 Q
SET I SRDL,'$D(SRDL(SRREA)) Q
 I '$D(^TMP("SR",$J,SRREA)) S ^TMP("SR",$J,SRREA)="0^0"
 I '$D(^TMP("SR",$J,SRREA,SRSS)) S ^TMP("SR",$J,SRREA,SRSS)="0^0"
 S SRDLT=$P(^SRF(SRCASE,17,SRDLAY,0),"^",2) S:SRDLT="" SRDLT=0
 S $P(^TMP("SR",$J,SRREA),"^",2)=$P(^TMP("SR",$J,SRREA),"^",2)+SRDLT
 S $P(^TMP("SR",$J,SRREA),"^")=$P(^TMP("SR",$J,SRREA),"^")+1
 S $P(^TMP("SR",$J,SRREA,SRSS),"^",2)=$P(^TMP("SR",$J,SRREA,SRSS),"^",2)+SRDLT
 S $P(^TMP("SR",$J,SRREA,SRSS),"^")=$P(^TMP("SR",$J,SRREA,SRSS),"^")+1
 Q
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