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

SRORHRS0.m

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