source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDAUT1.m@ 1739

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

initial load of WorldVistAEHR

File size: 1.3 KB
Line 
1SDAUT1 ;MAN/GRR - AUTO REBOOK SET REQUIRED AVAILABILITY NODES ; 28 MAR 84 1:46 pm
2 ;;5.3;Scheduling;**140**;Aug 13, 1993
3 K SDXXX S MAX=$S($D(^SC(SC,"SDP")):$P(^("SDP"),"^",4),1:0)
4 Q:MAX=0 S STIME=$S($D(^SC(SC,"SDP")):$P(^("SDP"),"^",3),1:"0800"),X1=CDATE,X2=DT D ^%DTC
5 I X<10 S X1=$S(CDATE<DT:DT,1:CDATE),X2=10 D C^%DTC S SDSTRTDT=X G OVR
6 S SDSTRTDT=CDATE
7OVR S SDSOH=$S('$D(^SC(SC,"SL")):0,$P(^("SL"),"^",8)']"":0,1:1)
8 S X1=SDSTRTDT,X2=MAX D C^%DTC S ENDATE=$S('$D(SDIN):X,SDIN>SDSTRTDT&(SDIN<X):SDIN,1:X),X=SDSTRTDT
9EN1 S:$N(^SC(+SC,"T",0))>X X=$N(^(0)) D DOW S I=Y+32,SM=X,D=Y D WM
10 K J F Y=0:1:6 I $D(^SC(+SC,"T"_Y)) S J(Y)="",DA=+SC,DOW=Y D:'$D(^SC(+SC,"T"_Y,0)) TX^SDB1
11 Q:'$D(J)
12X1 Q:X>ENDATE S X1=X\100_28
13W S X=X\1 I '$D(^SC(+SC,"ST",X,1)) S Y=D#7 G L:'$D(J(Y)),H:$D(^HOLIDAY(X))&('SDSOH) S SS=$N(^SC(+SC,"T"_Y,X)) G L:SS<0,L:^(SS,1)="" S ^SC(+SC,"ST",X\1,1)=$E($P($T(DAY),U,Y+2),1,2)_" "_$E(X,6,7)_$J("",SI+SI-6)_^(1),^(0)=X\1
14 I $D(SDXXX) S SDXXX=SDXXX+1 W:'(SDXXX#100) "."
15 D WM:X>SM
16L I X>ENDATE Q
17 S X=X+1,D=D+1 G W:X'>X1 S X2=X-X1 D C^%DTC G X1
18 ;
19H S ^SC(+SC,"ST",X,1)=" "_$E(X,6,7)_" "_$P(^(X,0),U,2),^(0)=X S:'$D(^SC(+SC,"ST",0)) ^(0)="^44.005DA^^" G W
20 ;
21WM S SM=$S($E(X,4,5)[12:$E(X,1,3)+1_"01",1:$E(X,1,3)_$E(X,4,5)+1)_"00" Q
22 ;
23DOW ;
24 S Y=$$DOW^XLFDT(X,1)
25 Q
26 ;
27DAY ;;^SUN^MON^TUES^WEDNES^THURS^FRI^SATUR
Note: See TracBrowser for help on using the repository browser.