SRORHRS0 ;B'HAM ISC/ADM - O.R. HOURS OF ACTIVITY (CONTINUED) ; [ 07/27/98 2:33 PM ]
;;3.0; Surgery ;**50**;24 Jun 93
U IO K ^TMP("SR",$J) S SRINST=SRSITE("SITE"),(SRSOUT,SRHDR)=0,SRPAGE=1,SRSD1=SRSD-.0001
F S SRSD1=$O(^SRU(SRSD1)) Q:'SRSD1!(SRSD1>SRED)!(SRSOUT) D OR
D HDR^SRORHRS S SRSD1=0 F S SRSD1=$O(^TMP("SR",$J,SRSD1)) Q:'SRSD1!(SRSOUT) S Y=SRSD1 D D^DIQ S SRDT=Y D:SROR="ALL" DATE S SROOM=0 F S SROOM=$O(^TMP("SR",$J,SRSD1,SROOM)) Q:'SROOM!(SRSOUT) D PRINT
Q
OR I SROR="ALL" S SROOM=0 F S SROOM=$O(^SRU(SRSD1,1,SROOM)) Q:'SROOM!(SRSOUT) D:$$ORDIV^SROUTL0($P(^SRU(SRSD1,1,SROOM,0),U),$G(SRSITE("DIV"))) SET
I SROR'="ALL",$D(^SRU(SRSD1,1,SROR,0)) S SROOM=SROR D SET
Q
SET ; set ^TMP("SR",$J)
S SRNM=$E($P(^SC($P(^SRS(SROOM,0),"^"),0),"^"),1,18)
S (SRT,Y)=$P(^SRU(SRSD1,1,SROOM,0),"^",2) D D^DIQ S SRFIND=$F(Y,":"),SRST=$S(SRFIND:$E(Y,SRFIND-3,SRFIND+1),1:"")
S (SRT1,Y)=$P(^SRU(SRSD1,1,SROOM,0),"^",3) D D^DIQ S SRFIND=$F(Y,":"),SRET=$S(SRFIND:$E(Y,SRFIND-3,SRFIND+1),1:"")
S SRACT=$S($P(^SRU(SRSD1,1,SROOM,0),"^",4)="Y":1,1:0) I SRACT S (SRT,SRT1)=0
S X=SRT,X1=SRT1 D MIN S SRTIME=X
S ^TMP("SR",$J,SRSD1,SROOM)=SRNM_"^"_SRST_"^"_SRET_"^"_SRACT_"^"_SRTIME
Q
PRINT ;
I $Y+5>IOSL D HDR^SRORHRS Q:SRSOUT
S SRUTL=^TMP("SR",$J,SRSD1,SROOM),SRNM=$P(SRUTL,"^"),SRST=$P(SRUTL,"^",2),SRET=$P(SRUTL,"^",3),SRACT=$P(SRUTL,"^",4),SRTIME=$P(SRUTL,"^",5)
S HOUR=SRTIME\60,MIN=SRTIME#60,HOUR=$S(HOUR>1:HOUR_" hrs",HOUR=1:HOUR_" hr",1:""),MIN=$S(MIN>1:MIN_" mins",MIN=1:MIN_" min",1:"") D TIMES
W $S(SROR="ALL":SRNM,1:SRDT) I SRACT W ?33,"** INACTIVE **",! Q
I 'SRACT W ?22,SRST,?37,SRET,?59,TIME,!
Q
DATE I $Y+8>IOSL D HDR^SRORHRS Q
W !,?31,"** "_SRDT_" **",!!
Q
TIMES ; put hrs and mins in readable format
I +HOUR,'+MIN S TIME=" "_HOUR Q
I +HOUR S TIME=HOUR_" and "_MIN Q
I +MIN S TIME=" "_MIN Q
S TIME=" -"
Q
MIN ; minutes between two times
S Y=$E(X1_"000",9,10)-$E(X_"000",9,10)*60+$E(X1_"00000",11,12)-$E(X_"00000",11,12),X2=X,X=$P(X,".")'=$P(X1,".") D ^%DTC:X S X=X*1440+Y
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSRORHRS0 2056 printed Oct 16, 2024@18:46:32 Page 2
SRORHRS0 ;B'HAM ISC/ADM - O.R. HOURS OF ACTIVITY (CONTINUED) ; [ 07/27/98 2:33 PM ]
+1 ;;3.0; Surgery ;**50**;24 Jun 93
+2 USE IO
KILL ^TMP("SR",$JOB)
SET SRINST=SRSITE("SITE")
SET (SRSOUT,SRHDR)=0
SET SRPAGE=1
SET SRSD1=SRSD-.0001
+3 FOR
SET SRSD1=$ORDER(^SRU(SRSD1))
if 'SRSD1!(SRSD1>SRED)!(SRSOUT)
QUIT
DO OR
+4 DO HDR^SRORHRS
SET SRSD1=0
FOR
SET SRSD1=$ORDER(^TMP("SR",$JOB,SRSD1))
if 'SRSD1!(SRSOUT)
QUIT
SET Y=SRSD1
DO D^DIQ
SET SRDT=Y
if SROR="ALL"
DO DATE
SET SROOM=0
FOR
SET SROOM=$ORDER(^TMP("SR",$JOB,SRSD1,SROOM))
if 'SROOM!(SRSOUT)
QUIT
DO PRINT
+5 QUIT
OR IF SROR="ALL"
SET SROOM=0
FOR
SET SROOM=$ORDER(^SRU(SRSD1,1,SROOM))
if 'SROOM!(SRSOUT)
QUIT
if $$ORDIV^SROUTL0($PIECE(^SRU(SRSD1,1,SROOM,0),U),$GET(SRSITE("DIV")))
DO SET
+1 IF SROR'="ALL"
IF $DATA(^SRU(SRSD1,1,SROR,0))
SET SROOM=SROR
DO SET
+2 QUIT
SET ; set ^TMP("SR",$J)
+1 SET SRNM=$EXTRACT($PIECE(^SC($PIECE(^SRS(SROOM,0),"^"),0),"^"),1,18)
+2 SET (SRT,Y)=$PIECE(^SRU(SRSD1,1,SROOM,0),"^",2)
DO D^DIQ
SET SRFIND=$FIND(Y,":")
SET SRST=$SELECT(SRFIND:$EXTRACT(Y,SRFIND-3,SRFIND+1),1:"")
+3 SET (SRT1,Y)=$PIECE(^SRU(SRSD1,1,SROOM,0),"^",3)
DO D^DIQ
SET SRFIND=$FIND(Y,":")
SET SRET=$SELECT(SRFIND:$EXTRACT(Y,SRFIND-3,SRFIND+1),1:"")
+4 SET SRACT=$SELECT($PIECE(^SRU(SRSD1,1,SROOM,0),"^",4)="Y":1,1:0)
IF SRACT
SET (SRT,SRT1)=0
+5 SET X=SRT
SET X1=SRT1
DO MIN
SET SRTIME=X
+6 SET ^TMP("SR",$JOB,SRSD1,SROOM)=SRNM_"^"_SRST_"^"_SRET_"^"_SRACT_"^"_SRTIME
+7 QUIT
PRINT ;
+1 IF $Y+5>IOSL
DO HDR^SRORHRS
if SRSOUT
QUIT
+2 SET SRUTL=^TMP("SR",$JOB,SRSD1,SROOM)
SET SRNM=$PIECE(SRUTL,"^")
SET SRST=$PIECE(SRUTL,"^",2)
SET SRET=$PIECE(SRUTL,"^",3)
SET SRACT=$PIECE(SRUTL,"^",4)
SET SRTIME=$PIECE(SRUTL,"^",5)
+3 SET HOUR=SRTIME\60
SET MIN=SRTIME#60
SET HOUR=$SELECT(HOUR>1:HOUR_" hrs",HOUR=1:HOUR_" hr",1:"")
SET MIN=$SELECT(MIN>1:MIN_" mins",MIN=1:MIN_" min",1:"")
DO TIMES
+4 WRITE $SELECT(SROR="ALL":SRNM,1:SRDT)
IF SRACT
WRITE ?33,"** INACTIVE **",!
QUIT
+5 IF 'SRACT
WRITE ?22,SRST,?37,SRET,?59,TIME,!
+6 QUIT
DATE IF $Y+8>IOSL
DO HDR^SRORHRS
QUIT
+1 WRITE !,?31,"** "_SRDT_" **",!!
+2 QUIT
TIMES ; put hrs and mins in readable format
+1 IF +HOUR
IF '+MIN
SET TIME=" "_HOUR
QUIT
+2 IF +HOUR
SET TIME=HOUR_" and "_MIN
QUIT
+3 IF +MIN
SET TIME=" "_MIN
QUIT
+4 SET TIME=" -"
+5 QUIT
MIN ; minutes between two times
+1 SET Y=$EXTRACT(X1_"000",9,10)-$EXTRACT(X_"000",9,10)*60+$EXTRACT(X1_"00000",11,12)-$EXTRACT(X_"00000",11,12)
SET X2=X
SET X=$PIECE(X,".")'=$PIECE(X1,".")
if X
DO ^%DTC
SET X=X*1440+Y
+2 QUIT