10DEFFNS="WorkRot"
20MODE7
30VDU23;8202;0;0;0;
40*FX4 1
50READ W%:REM WEEKS IN ROTA
60DIM R$(W%,7):REM ROTA
70DIM D$(7):REM DAY OF WEEK
80DIM M$(12):REM MONTHS
90DIM MD%(12):REM DAYS IN MONTH
100PROCReadInfo
110PRINT''
120PROCcent("
130PROCcent("
140PRINT''
150PROCcent("
170*FX21
180REPEAT
190A$=GET$
200UNTILINSTR("YyNn",A$)
210IF INSTR("Yy",A$)PROCinfo
220REPEAT
230PROCGetDate
240PROCGetShift
250VDU28,0,24,39,15
260A$="."
270REPEAT
280VDU12
290PROCDispWeek
300PROCAgain
310UNTILINSTR("AaEe",A$)
320VDU26
330UNTILINSTR("Ee",A$)
340END
350DEFPROCAgain
360PRINT'" > < (A)nother (P)rint/(C)o
nt (E)nd";
370*FX21
380REPEAT
390A$=GET$
400IF INSTR("Cc",A$)PROCcont
410IF INSTR("Pp",A$)PROCPrintOut
420UNTILINSTR(",<.>AaEe",A$)
430ENDPROC
440DEFPROCcont
450ONERRORRUN
460PROCPrintOut
470REPEAT
480CLS
490PROCDispWeek
500PRINT'TAB(11);" ESCAPE TO FINISH";
510PROCPrintOut
520UNTILFALSE
530ENDPROC
540DEFPROCPrintOut
550FORL%=&7E80 TO &7F97 STEP 40
560FORI%=0 TO 39
570A%=?(L%+I%)
580IF A%<32 OR A%>127 A%=32
590VDU2,1,A%,3
600NEXT
610VDU2,1,13,3
620NEXT
630ENDPROC
640DEFPROCDispWeek
650PRINTTAB(9,0);" Date ";TAB(26,
0)" Duty "
660FORL%=0TO6
670IF L%=0:IF INSTR("<,",A$):PROCDecDa
y
680Y$=LEFT$(STR$(Y%)+"00",4)
690PRINT" ";D$(DOW%);TAB(11);STR$(D%);
TAB(14);M$(M%);" ";Y$;TAB(29)" ";R$(S%,D
OW%)
700PROCIncDay
710NEXT
720ENDPROC
730DEFPROCGetShift
740PROCcent(" Calculating "+STR$(Day
%)+" "+M$(Month%)+" "+STR$(Year%)+" ")
750D%=SD%
760M%=SM%
770Y%=SY%
780S%=SS%
790DOW%=1
800IF D%=Day% AND M%=Month% AND Y%=Yea
r% ENDPROC
810REPEAT
820PROCIncDay
830UNTILD%=Day% AND M%=Month% AND Y%=Y
ear%
840ENDPROC
850DEFPROCIncDay
860D%=D%+1:DOW%=DOW%+1:IF DOW%=8 DOW%=
1:S%=S%+1:IF S%>W% S%=1
870IF D%>MD%(M%):PROCchange
880ENDPROC
890DEFPROCDecDay
900FOR I%=1TO14
910D%=D%-1:DOW%=DOW%-1:IF DOW%=0 DOW%=
7:S%=S%-1:IF S%=0 S%=W%
920IF D%=0:PROCchangeDown
930NEXT
940ENDPROC
950DEFPROCchange
960D%=1
970M%=M%+1
980IF M%=13:M%=1:Y%=Y%+1
990IF Y% MOD 4=0 MD%(2)=29 ELSE MD%(2)
=28
1000ENDPROC
1010DEFPROCchangeDown
1020IF Y% MOD 4=0 MD%(2)=29 ELSE MD%(2)
=28
1030M%=M%-1
1040IF M%=0:M%=12:Y%=Y%-1
1050D%=MD%(M%)
1060IF Y% MOD 4=0 MD%(2)=29 ELSE MD%(2)
=28
1070ENDPROC
1080DEFPROCReadInfo
1090FORL%=1TO7
1100READD$(L%)
1110NEXT
1120FORL%=1TO12
1130READM$(L%),MD%(L%)
1140NEXT
1150FORL%=1 TO W%
1160FORI%=1 TO 7
1170READR$(L%,I%):REM READ IN ROTA
1180NEXT,
1190READ SD%,SM%,SY%,SS%
1200ENDPROC
1210DEFPROCGetDate
1220*FX21
1230REPEAT
1240CLS
1250PROCcent("
1260PROCcent("
1270PRINT
1280PROCcent(" When to Ring 8BS on 01
482 896868. ")
1290PRINT
1300PROCcent(" Enter Date to Search F
or. ")
1310PRINT''
1320PROCcent(" (Use the format "+STR$(S
D%)+"."+STR$(SM%)+"."+STR$(SY%)+")")
1330INPUT'" ";D$
1340VDU11
1350Day%=VAL(LEFT$(D$,INSTR(D$,".")-1))
1360Year%=VAL(RIGHT$(D$,4))
1370Month%=VAL(MID$(D$,LEN(STR$(Day%))+
2,LEN(STR$(Year%))))
1380UNTILYear%>=SY% AND Day%>0 AND Day%
<32 AND Month%>0 AND Month%<13
1390IF Year%>SY%+4 OR Year%<SY% PROCcen
t(" This calculation is going to be wron
g!"):PROCcent(" I may not be on this shi
ft pattern."):PRINT
1400ENDPROC
1410DEFPROCcent(F$)
1420PRINTTAB(20-LEN(F$)/2);F$
1430ENDPROC
1440DEFPROCinfo
1450CLS
1460PRINT'" This program will calculate
what shift"'" I am on so you know when
to ring me."
1470PRINT'" Simply enter the date you w
ish to see"'" what shift I am on. 7 days
from"'" that day will be displayed."
1480PRINT'" You can then continue to se
e what"'" shift I am on for the followin
g or"'" previous 7 days or enter another
date."
1490PRINT'" It is also possible to send
the"'" output to printer (P). Or print
out"'" continuously (C)."
1500PRINT'" The program is easily adapt
able."
1510PRINT'" To change the DATA statemen
ts to"'" your own shift pattern, first o
f all"'" enter the number of weeks in yo
ur"'" rota in the indicated DATA line."
1520*FX21
1530PRINT'"PRESS A KEY FOR MORE INFO."
1540REPEATUNTILGET
1550PRINT'" If your week starts on a da
y other"'" than a Monday, alter the list
of"'" days accordingly with day one of
your"'" week the first day in the list."
1560PRINT'" You do not need to alter th
e list of"'" months and days in each mon
th."
1570PRINT'" Enter your shift rota into
the DATA"'" lines following the list of
months"'" and days in each month. Enter
one"'" week per line for clarity. Keep e
ach"'" statement no longer than 9"'" cha
racters, this should be enough."
1580*FX21
1590PRINT'"PRESS A KEY FOR MORE INFO."
1600REPEATUNTILGET
1610PRINT'" Enter the first day of the
rota in"'" the next DATA statement in th
e"'" format Day,Month,Year (4fig)."
1620PRINT'" In the last DATA line enter
the shift"'" number that you are on on
that date."
1630PRINT'" You may wish to alter the l
ine"'" containing: IF Year%>SY%. This li
ne"'" prints a warning that the"'" calcu
lation may be incorrect due to"'" possib
le rota changes."
1640PRINT'"PRESS A KEY FOR MAIN PROGRAM
."
1650REPEATUNTILGET
1660ENDPROC
1670REM Weeks In Rota
1680DATA 10
1690DATA Monday,Tuesday,Wednesday,Thurs
day,Friday,Saturday,Sunday
1700DATA January,31,February,28,March,3
1,April,30,May,31,June,30,July,31,August
,31,September,30,October,31,November,30,
December,31
1710REM ROTA
1720DATA OFF,OFF,OFF,1800-0600,1800-060
0,1800-0600,1800-0600
1730DATA OFF,OFF,0600-1800,0600-1800,06
00-1800,OFF,OFF
1740DATA FLOAT 1,FLOAT 1,FLOAT 1,FLOAT
1,FLOAT 1,FLOAT 1,FLOAT 1
1750DATA 1800-0600,1800-0600,1800-0600,
OFF,OFF,0600-1800,0600-1800
1760DATA 0600-1800,0600-1800,OFF,OFF,OF
F,OFF,OFF
1770DATA OFF,OFF,OFF,1800-0600,1800-060
0,1800-0600,1800-0600
1780DATA OFF,OFF,0600-1800,0600-1800,06
00-1800,OFF,OFF
1790DATA FLOAT 2,FLOAT 2,FLOAT 2,FLOAT
2,FLOAT 2,FLOAT 2,FLOAT 2
1800DATA 1800-0600,1800-0600,1800-0600,
OFF,OFF,0600-1800,0600-1800
1810DATA 0600-1800,0600-1800,OFF,OFF,OF
F,OFF,OFF
1820REM DAY,MONTH,YEAR 4 FIG
1830DATA 1,1,1996
1840REM START SHIFT ON THE ABOVE DATE
1850DATA 2