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