SRSTIME ;B'HAM ISC/MAM - SET SCHEDULE TIMES ; 15 NOV 1991 1:20 PM
;;3.0; Surgery ;**5,15,34,36,37**;24 Jun 93
TIMES ; sets starting and ending times for reservations
W ! K DIR S DIR("A")="Reserve from what time ? (NEAREST 15 MIN): ",DIR(0)="FOA^1:30",DIR("?",1)="Please enter a starting time to the nearest 15 minutes, for example,"
S DIR("?")="7:00, 7:15, 7:30, 7:45. Enter the time only with no date."
D ^DIR K DIR I $D(DIRUT) S SRSOUT=1 K SRSST1,SRSET1 Q
S Z=Y D CHK G:Z=-1 TIMES S Z(0)=$P(Z,".",2),Z(0)=Z(0)_"0000",Z(0)=$E(Z(0),1,4),Z(1)=$E(Z(0),1,2),Z(2)=$E(Z(0),3,4) I "00,15,30,45"'[Z(2) S Z(2)=$S(Z(2)<15:"00",Z(2)<30:15,Z(2)<45:30,1:45)
S (Z,SRT,SRSST1)=Z(1)_":"_Z(2),SRSDT1=+(SRSDATE_"."_Z(1)_Z(2)) W " ("_Z_")"
;
TIMES2 ; ending time
S SRSOUT=0 W ! K DIR S DIR("A")="Reserve to what time ? (NEAREST 15 MIN): ",DIR(0)="FOA^1:30",DIR("?",1)="Please enter an ending time to the nearest 15 minutes, for example,"
S DIR("?")="7:00, 7:15, 7:30, 7:45. Enter the time only with no date."
D ^DIR K DIR I $D(DIRUT) S SRSOUT=1 K SRSST1,SRSET1 Q
S Z=Y D CHK G:Z=-1 TIMES2 S Z(0)=$P(Z,".",2),Z(0)=Z(0)_"0000",Z(0)=$E(Z(0),1,4),Z(1)=$E(Z(0),1,2),Z(2)=$E(Z(0),3,4) I "00,15,30,45"'[Z(2) S Z(2)=$S(Z(2)<15:"00",Z(2)<30:15,Z(2)<45:30,1:45)
S Z=Z(1)_":"_Z(2) W " ("_Z_")" I Z=SRT W !!,"The ending time must be after the starting time." G TIMES2
S SRSDT2=+(SRSDATE_"."_Z(1)_Z(2)) I SRSDT2<SRSDT1 D TOMM I '$D(SRSDT2)!(SRSOUT) G TIMES2
S SRSTIME=SRT_"^"_Z,SRSET1=Z
Q
TOMM ; next day end time
S X1=SRSDATE,X2=1 D C^%DTC S SRSDT3=X S Y=X D D^DIQ S SRSDTT=Y
W !!,"You have entered an ending time which is earlier than the starting time.",! I $D(SRSBANG) S SRSOUT=1 Q
ASK K DIR S DIR("A",1)="Do you want to schedule this case to end on the following day, "_SRSDTT,DIR("A")="at "_Z_" ? ",DIR("B")="NO",DIR(0)="YA"
S DIR("?",1)="Enter 'YES' if you want this case to end at "_Z_" of the following day.",DIR("?")="Otherwise, enter 'NO'." D ^DIR K DIR I $D(DTOUT)!$D(DUOUT)!'Y K SRSDT2 Q
S SRSDT2=+(SRSDT3_"."_$P(Z,":")_$P(Z,":",2))
Q
CHK K %DT S %DT="FR",X=SRSDATE_"@"_Z,%DT(0)=SRSDATE D ^%DT S Z=Y
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSRSTIME 2139 printed Oct 16, 2024@18:48:25 Page 2
SRSTIME ;B'HAM ISC/MAM - SET SCHEDULE TIMES ; 15 NOV 1991 1:20 PM
+1 ;;3.0; Surgery ;**5,15,34,36,37**;24 Jun 93
TIMES ; sets starting and ending times for reservations
+1 WRITE !
KILL DIR
SET DIR("A")="Reserve from what time ? (NEAREST 15 MIN): "
SET DIR(0)="FOA^1:30"
SET DIR("?",1)="Please enter a starting time to the nearest 15 minutes, for example,"
+2 SET DIR("?")="7:00, 7:15, 7:30, 7:45. Enter the time only with no date."
+3 DO ^DIR
KILL DIR
IF $DATA(DIRUT)
SET SRSOUT=1
KILL SRSST1,SRSET1
QUIT
+4 SET Z=Y
DO CHK
if Z=-1
GOTO TIMES
SET Z(0)=$PIECE(Z,".",2)
SET Z(0)=Z(0)_"0000"
SET Z(0)=$EXTRACT(Z(0),1,4)
SET Z(1)=$EXTRACT(Z(0),1,2)
SET Z(2)=$EXTRACT(Z(0),3,4)
IF "00,15,30,45"'[Z(2)
SET Z(2)=$SELECT(Z(2)<15:"00",Z(2)<30:15,Z(2)<45:30,1:45)
+5 SET (Z,SRT,SRSST1)=Z(1)_":"_Z(2)
SET SRSDT1=+(SRSDATE_"."_Z(1)_Z(2))
WRITE " ("_Z_")"
+6 ;
TIMES2 ; ending time
+1 SET SRSOUT=0
WRITE !
KILL DIR
SET DIR("A")="Reserve to what time ? (NEAREST 15 MIN): "
SET DIR(0)="FOA^1:30"
SET DIR("?",1)="Please enter an ending time to the nearest 15 minutes, for example,"
+2 SET DIR("?")="7:00, 7:15, 7:30, 7:45. Enter the time only with no date."
+3 DO ^DIR
KILL DIR
IF $DATA(DIRUT)
SET SRSOUT=1
KILL SRSST1,SRSET1
QUIT
+4 SET Z=Y
DO CHK
if Z=-1
GOTO TIMES2
SET Z(0)=$PIECE(Z,".",2)
SET Z(0)=Z(0)_"0000"
SET Z(0)=$EXTRACT(Z(0),1,4)
SET Z(1)=$EXTRACT(Z(0),1,2)
SET Z(2)=$EXTRACT(Z(0),3,4)
IF "00,15,30,45"'[Z(2)
SET Z(2)=$SELECT(Z(2)<15:"00",Z(2)<30:15,Z(2)<45:30,1:45)
+5 SET Z=Z(1)_":"_Z(2)
WRITE " ("_Z_")"
IF Z=SRT
WRITE !!,"The ending time must be after the starting time."
GOTO TIMES2
+6 SET SRSDT2=+(SRSDATE_"."_Z(1)_Z(2))
IF SRSDT2<SRSDT1
DO TOMM
IF '$DATA(SRSDT2)!(SRSOUT)
GOTO TIMES2
+7 SET SRSTIME=SRT_"^"_Z
SET SRSET1=Z
+8 QUIT
TOMM ; next day end time
+1 SET X1=SRSDATE
SET X2=1
DO C^%DTC
SET SRSDT3=X
SET Y=X
DO D^DIQ
SET SRSDTT=Y
+2 WRITE !!,"You have entered an ending time which is earlier than the starting time.",!
IF $DATA(SRSBANG)
SET SRSOUT=1
QUIT
ASK KILL DIR
SET DIR("A",1)="Do you want to schedule this case to end on the following day, "_SRSDTT
SET DIR("A")="at "_Z_" ? "
SET DIR("B")="NO"
SET DIR(0)="YA"
+1 SET DIR("?",1)="Enter 'YES' if you want this case to end at "_Z_" of the following day."
SET DIR("?")="Otherwise, enter 'NO'."
DO ^DIR
KILL DIR
IF $DATA(DTOUT)!$DATA(DUOUT)!'Y
KILL SRSDT2
QUIT
+2 SET SRSDT2=+(SRSDT3_"."_$PIECE(Z,":")_$PIECE(Z,":",2))
+3 QUIT
CHK KILL %DT
SET %DT="FR"
SET X=SRSDATE_"@"_Z
SET %DT(0)=SRSDATE
DO ^%DT
SET Z=Y
+1 QUIT