source: WorldVistAEHR/trunk/r/SURGERY-SR/SRSUTIN.m@ 1800

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

initial load of WorldVistAEHR

File size: 1.5 KB
RevLine 
[613]1SRSUTIN ;B'HAM ISC/MAM - INITIALIZE ^TMP FOR UTILIZATION ; 16 MAY 1990 10:55 AM
2 ;;3.0; Surgery ;;24 Jun 93
3ALL ; all Surgical Specialties
4 S SRSS=0 F I=0:0 S SRSS=$O(^SRO(137.45,SRSS)) Q:'SRSS S SRSP=$P(^SRO(137.45,SRSS,0),"^"),(SRSDATE,X)=SRSD D H^%DTC S SRD=%Y D ONE
5 Q
6ONE ; one surgical specialty
7 D DAY F I=0:0 S SRSDATE=SRSDATE+1 Q:'SRSDATE!(SRSDATE>SRED1) D DAY
8 Q
9DAY ; check for correct date
10 S SRDOW=$S(SRD=0:"Sunday",SRD=1:"Monday",SRD=2:"Tuesday",SRD=3:"Wednesday",SRD=4:"Thursday",SRD=5:"Friday",SRD=6:"Saturday")
11 I $E(SRSDATE,6,7)>28 S X=SRSDATE,%DT="" D ^%DT I Y<0 D DATE
12 I $P($G(^SRU(SRSDATE,2,SRSS,0)),"^",4)["Y" S SRTIME=0,(SRSPST,SRSPEND)=SRSDATE D SET Q
13 S TIMES=^SRU(SRSDATE,2,SRSS,0),SRSPST=$P(TIMES,"^",2),SRSPEND=$P(TIMES,"^",3)
14 S X=SRSPST,X1=SRSPEND D MIN S SRTIME=X
15SET S ^TMP("SR",$J,SRSDATE,SRSP)="0^0^"_SRTIME_"^0^"_SRSPST_"^"_SRSPEND
16 I '($D(^TMP("SR",$J,"SP",SRSP))#2) S ^TMP("SR",$J,"SP",SRSP)="0^0^0^0"
17 I '($D(^TMP("SR",$J))#2) S ^TMP("SR",$J)="0^0^0^0"
18 S X=$P(^TMP("SR",$J,"SP",SRSP),"^",3),$P(^(SRSP),"^",3)=X+SRTIME
19 S X=$P(^TMP("SR",$J),"^",3),$P(^($J),"^",3)=X+SRTIME
20 S SRD=$S(SRD=6:0,1:SRD+1)
21 Q
22MIN ; minutes between two times
23 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,".",1)'=$P(X1,".",1) D ^%DTC:X S X=X*1440+Y
24 Q
25DATE ; correct date
26 I $E(SRSDATE,4,5)=12 S SRSDATE=$E(SRSDATE,1,3)_"0101"+10000 Q
27 S SRNEWM=$E(SRSDATE,4,5)+1 S:$L(SRNEWM)=1 SRNEWM="0"_SRNEWM S SRNEWM=SRNEWM_"01",SRSDATE=$E(SRSDATE,1,3)_SRNEWM
28 Q
Note: See TracBrowser for help on using the repository browser.