8-Bit Software Online Conversion
CJR Shift Calculator - Listing
10DEFFNS="WorkRo2"
20MODE7
30VDU23;8202;0;0;0;
40*FX4 1
50READ W%
60DIM R$(W%,7)
70DIM D$(7)
80DIM M$(12)
90DIM MD%(12)
100PROCReadInfo
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 any of the following
formats:")
1360PROCcent(" "+STR$(SD%)+"/"+STR$(SM%
)+"/"+STR$(SY%)+" or "+STR$(SD%)+"."+STR
$(SM%)+"."+STR$(SY%)+" or "+STR$(SD%)+"
"+STR$(SM%)+" "+STR$(SY%))
1370INPUT'" ";D$
1380VDU11
1390Day%=VAL(LEFT$(D$,INSTR(D$," ./")-1
))
1400Year%=VAL(RIGHT$(D$,4))
1410Month%=VAL(MID$(D$,LEN(STR$(Day%))+
2,LEN(STR$(Year%))))
1420UNTILYear%>=SY% AND Day%>0 AND Day%
<32 AND Month%>0 AND Month%<13
1430IF 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
1440ENDPROC
1450DEFPROCcent(F$)
1460PRINTTAB(20-LEN(F$)/2);F$
1470ENDPROC
1720DATA 10
1730DATA Monday,Tuesday,Wednesday,Thurs
day,Friday,Saturday,Sunday
1740DATA 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
1760DATA 0600-1800,0700-1800,1800-0600,
1800-0600,Off,Off,Off
1770DATA Off,Off,Off,Off,Off,0600-1800,
0600-1800
1780DATA Float 1,Float 1,Float 1,Float
1,Float 1,Float 1,Float 1
1790DATA 1800-0600,1800-0600,Off,Off,18
00-0600,1800-0600,1800-0600
1800DATA Off,Off,0700-1800,0700-1800,07
00-1800,Off,Off
1810DATA 0600-1800,0700-1800,1800-0600,
1800-0600,Off,Off,Off
1820DATA Off,Off,Off,Off,Off,0600-1800,
0600-1800
1830DATA Float 2,Float 2,Float 2,Float
2,Float 2,Float 2,Float 2
1840DATA 1800-0600,1800-0600,Off,Off,18
00-0600,1800-0600,1800-0600
1850DATA Off,Off,0700-1800,0700-1800,07
00-1800,Off,Off
1860REM DAY,MONTH,YEAR 4 FIG
1870DATA 6,10,1997
1890DATA 3