source: FOIAVistA/trunk/r/SURGERY-SR/SRORHRS0.m@ 635

Last change on this file since 635 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 2.0 KB
Line 
1SRORHRS0 ;B'HAM ISC/ADM - O.R. HOURS OF ACTIVITY (CONTINUED) ; [ 07/27/98 2:33 PM ]
2 ;;3.0; Surgery ;**50**;24 Jun 93
3 U IO K ^TMP("SR",$J) S SRINST=SRSITE("SITE"),(SRSOUT,SRHDR)=0,SRPAGE=1,SRSD1=SRSD-.0001
4 F S SRSD1=$O(^SRU(SRSD1)) Q:'SRSD1!(SRSD1>SRED)!(SRSOUT) D OR
5 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
6 Q
7OR 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
8 I SROR'="ALL",$D(^SRU(SRSD1,1,SROR,0)) S SROOM=SROR D SET
9 Q
10SET ; set ^TMP("SR",$J)
11 S SRNM=$E($P(^SC($P(^SRS(SROOM,0),"^"),0),"^"),1,18)
12 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:"")
13 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:"")
14 S SRACT=$S($P(^SRU(SRSD1,1,SROOM,0),"^",4)="Y":1,1:0) I SRACT S (SRT,SRT1)=0
15 S X=SRT,X1=SRT1 D MIN S SRTIME=X
16 S ^TMP("SR",$J,SRSD1,SROOM)=SRNM_"^"_SRST_"^"_SRET_"^"_SRACT_"^"_SRTIME
17 Q
18PRINT ;
19 I $Y+5>IOSL D HDR^SRORHRS Q:SRSOUT
20 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)
21 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
22 W $S(SROR="ALL":SRNM,1:SRDT) I SRACT W ?33,"** INACTIVE **",! Q
23 I 'SRACT W ?22,SRST,?37,SRET,?59,TIME,!
24 Q
25DATE I $Y+8>IOSL D HDR^SRORHRS Q
26 W !,?31,"** "_SRDT_" **",!!
27 Q
28TIMES ; put hrs and mins in readable format
29 I +HOUR,'+MIN S TIME=" "_HOUR Q
30 I +HOUR S TIME=HOUR_" and "_MIN Q
31 I +MIN S TIME=" "_MIN Q
32 S TIME=" -"
33 Q
34MIN ; minutes between two times
35 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
36 Q
Note: See TracBrowser for help on using the repository browser.