tldm-universe/CMS/BP.CLOCK/CLOCK.01.26.96
2024-09-10 15:25:06 -04:00

749 lines
15 KiB
Plaintext
Executable File

*---------------------------- *
* PROGRAM: CLOCK
* REQUIRES: CM,PROJECTS,TIMES
* BY: D.BELL
* ON: 12/24/90
* ON: 06/25/91 KJC DISPLAYS HOURLY TOTAL FOR PAY PERIOD
* ON: 02/28/95 STR DISPLAYS HOURLY TOTAL FOR WEEK ONE & TWO
*-----------------------------*
CS=@(-1) ; CR=@(-3) ; CL=@(-4) ; RV=@(-13) ; ERV=@(-14)
VM=CHAR(253) ; SVM=CHAR(252) ; AM=CHAR(254) ; BEEP=CHAR(7)
PF1='<' ; PF2='P' ; PF3='/'
PROMPT ""
PORT=OCONV('','U50BB')
PORT=FIELD(PORT," ",1)
*
OPEN 'USER' TO USER.FILE ELSE ABORT
OPEN 'PROJECT' TO PROJECT ELSE ABORT
OPEN 'CLOCKFILE' TO CLOCKFILE ELSE ABORT
OPEN 'PORTS' TO PT.FILE ELSE ABORT
*
READV PT FROM PT.FILE,PORT,1 ELSE PT=''
BEGIN CASE
CASE PT='2020'; ADDS=1
CASE PT='4000'; ADDS=2
CASE PT='2025'; ADDS=2
CASE 1 ; ADDS=0
END CASE
* IF ADDS THEN
* TA ON; TA CLEAR
* END
*
CRT CS
HELP.TBL=''; GOSUB 4000 ;* LOAD PROJECT CODES INTO ARRAY
COL=0
POS=10
PSW=0
CSW=0
OLD.TIME="0"
NEW=0
DONE=0
TOTAL.HRS = ''
*
*FLOATING MODE*
*
ANY=''
LOOP
TIME=TIME()
TODAY=DATE()
IF ADDS THEN
IF TIME = OLD.TIME AND NEW#0 ELSE
OLD.TIME=TIME
IF REM(TIME,10)=0 OR NEW='0' THEN
GOSUB 500
GOSUB 50
GOSUB 75
END
GOSUB 200
END
NEW=1
ANY=''
INPUTIF ANY,1 THEN
*TA CLEAR
GOSUB 1000
POS=10; COL=0
*TA CLEAR
NEW=0
END
END ELSE
GOSUB 1000
DONE=1
END
UNTIL DONE DO REPEAT
STOP
40 * 2020 LOGIC
TLEN=LEN(TSTRING1)
TSTRING1.TEMP=''
FOR TL=1 TO TLEN
TSTRING1.TEMP=TSTRING1.TEMP:TSTRING1[TL,1]:" "
NEXT TL
TSTRING1=TSTRING1.TEMP
RETURN
50 * DRAW BOX
CRT CS
IF ADDS THEN
CRT CHAR(23)
TSTRING1="#<<<<<<<<<<<<<<<<<<D"
TCOL=COL; TPOS=POS; GOSUB 100
TSTRING1=">"
TCOL=COL; TPOS=POS+2; GOSUB 100
TSTRING1=">"
IF ADDS=1 THEN
TCOL=COL+38; GOSUB 100
END ELSE
TCOL=COL+19; GOSUB 100
END
TSTRING1="B<<<<<<<<<<<<<<<<<<F"
TCOL=COL; TPOS=POS+4; GOSUB 100
END ELSE
TSTRING1="|~~~~~~~~~~~~~~~~~~|"
TCOL=COL+9; TPOS=POS+1; GOSUB 175
TSTRING1="| |"
TPOS=POS+2; GOSUB 175
TPOS=POS+3; GOSUB 175
TSTRING1=" ~~~~~~~~~~~~~~~~~~ "
TPOS=POS+4; GOSUB 175
END
RETURN
75 * MESSAGES
TSTRING1="TIMECLOCK"
IF ADDS=1 THEN
TCOL=COL+13; TPOS=POS-1; GOSUB 175
END ELSE
TCOL=(COL*2)+13; TPOS=POS-1; GOSUB 175
END
TSTRING1="PRESS ANY KEY"
IF ADDS=1 THEN
TCOL=COL+11; TPOS=POS+6; GOSUB 175
END ELSE
TCOL=(COL*2)+11; TPOS=POS+6; GOSUB 175
END
RETURN
100 * PRINT GRAPHICS
IF ADDS=1 THEN GOSUB 40
CRT @(TCOL,TPOS):CHAR(27):CHAR(72):CHAR(2):CHAR(27):CHAR(9):"2":TSTRING1:CHAR(27):CHAR(72):CHAR(3)
CRT @(TCOL,TPOS+1):CHAR(27):CHAR(72):CHAR(2):CHAR(27):CHAR(9):"3":TSTRING1:CHAR(27):CHAR(72):CHAR(3)
RETURN
150 * DOUBLE HIGH/WIDE
IF ADDS=1 THEN GOSUB 40
CRT @(TCOL,TPOS):CHAR(27):CHAR(9):"2":TSTRING1:
CRT @(TCOL,TPOS+1):CHAR(27):CHAR(9):"3":TSTRING1:
RETURN
175 * REGULAR PRINT
CRT @(TCOL+1,TPOS):TSTRING1
RETURN
200 * PRINT DOUBLE WIDE/DOUBLE HIGH
TSTRING1=OCONV(TIME,"MTHS")
TSTRING1=OCONV(TSTRING1,'MCL')
IF ADDS THEN
TCOL=COL+6; TPOS=POS+2; GOSUB 150
IF ADDS=1 THEN TCOL=TCOL+2
END ELSE
TCOL=COL+14; TPOS=POS+2; GOSUB 175
END
RETURN
500 * CALCULATE POS/COL
IF POS < 3 OR POS > 15 THEN PSW=PSW+1
IF COL < 1 OR COL > 17 THEN CSW=CSW+1
IF REM(PSW,2) THEN
POS=POS-1
END ELSE
POS=POS+1
END
IF REM(CSW,2) THEN
COL=COL+2
END ELSE
COL=COL-2
END
RETURN
1000 *
CRT CS
POS=0; COL=0; GOSUB 50; GOSUB 200
IF ADDS THEN
TSTRING1="Today Is"
TLEN=LEN(TSTRING1)
IF ADDS=1 THEN
TCOL=COL+60-(INT(TLEN/2)); TPOS=POS
END ELSE
TCOL=COL+30-(INT(TLEN/2)); TPOS=POS
END
GOSUB 150
TSTRING1=OCONV(TODAY,'DWA'):" "
TLEN=LEN(TSTRING1)
IF ADDS=1 THEN
TCOL=COL+60-(INT(TLEN/2)); TPOS=POS+2
IF REM(TCOL,2) THEN TCOL=TCOL+1
END ELSE
TCOL=COL+30-(INT(TLEN/2)); TPOS=POS+2
END
GOSUB 150
END ELSE
TSTRING1="Today Is"
TLEN=LEN(TSTRING1)
TCOL=COL+50-(INT(TLEN/2)); TPOS=POS+1
GOSUB 175
TSTRING1=OCONV(TODAY,'DWA'):" ":OCONV(TODAY,'D2/')
TLEN=LEN(TSTRING1)
TCOL=COL+50-(INT(TLEN/2)); TPOS=POS+2
GOSUB 175
END
IF ADDS THEN
CRT CHAR(24)
END
CRT @(COL+10,POS+6):"WELCOME TO TIMECLOCK"
*
CRT @(0,22):RV:"Enter Your 4 digit Employee Identification Number":ERV:CL
TSTRING="EMPLOYEE ID #:____"
TLEN=LEN(TSTRING)
CRT @(COL+20-(INT(TLEN/2)),POS+10):TSTRING
CRT @(COL+20-(INT(TLEN/2))+14,POS+10):
INPUT USER
IF USER='OFF' THEN STOP
IF USER='' OR USER='/' THEN
CRT @(0,22):RV:"Thank You - Goodbye!":ERV:CL:
RQM
GO 1999
END
READ UREC FROM USER.FILE,USER THEN
TSTRING=UREC<1>:" ":UREC<2>
TLEN=LEN(TSTRING)
CRT @(COL+20-(INT(TLEN/2)),POS+8):RV:TSTRING:ERV
END ELSE
CRT @(0,22):RV:BEEP:"INVALID USER CODE - Try Again!":ERV:CL
RQM
GO 1000
END
*
TRY=0
1500 * PASSWORD INPUT
POS=0; COL=0
CRT @(0,22):RV:"Please enter your Password Now - It'll be our secret!":ERV:CL
TSTRING="PASSWORD :"
TLEN=LEN(TSTRING)
CRT @(COL+20-(INT(TLEN/2)),POS+11):TSTRING
CRT @(COL+20-(INT(TLEN/2))+10,POS+11):
ECHO OFF
INPUT PSWD
ECHO ON
IF PSWD='' OR PSWD='/' THEN
CRT @(0,22):RV:"Thank You - Goodbye!":ERV:CL:
RQM
GO 1999
END
IF UREC<4> = PSWD ELSE
IF TRY THEN
CRT @(0,22):RV:BEEP:"You have TWICE entered an incorrect password - Goodbye":ERV:CL
RQM
GO 1999
END ELSE
TRY=1
CRT @(0,22):RV:BEEP:"INVALID PASSWORD - Try Again!":ERV:CL
RQM
GO 1500
END
END
PRJCT=''
CLKKEY=USER:"|":TODAY
READ CLKREC FROM CLOCKFILE,CLKKEY THEN
GOSUB 2500
END ELSE
CLKREC=''
END
GOSUB 6000
*
1750 * PROJECT CODES
POS=0; COL=0
CRT @(0,22):RV:"Enter Project # to CLOCK IN, 'OFF' to CLOCK OUT, '?'(help), 'T'(timecard)":ERV:CL:
TSTRING="PROJECT :___"
TLEN=LEN(TSTRING)
CRT @(COL+20-(INT(TLEN/2)),POS+12):TSTRING
CRT @(COL+20-(INT(TLEN/2))+TLEN-3,POS+12):
INPUT PRJCT
PRJCT=OCONV(PRJCT,"MCU")
IF PRJCT='T' THEN GOSUB 2000; GOSUB 2500; GO 1750
IF PRJCT='?' THEN PRJCT=''; GOSUB 3000; GOSUB 2500
IF PRJCT='OUT' THEN PRJCT='OFF'
IF PRJCT='OFF' THEN
GOSUB 5000
IF CLKREC # '' THEN
* GOSUB 2500
END ELSE
GO 1750
END
CRT @(0,22):RV:"Hit Return to Continue":ERV:CL:
INPUT ANY
GO 1999
END
IF PRJCT='/' THEN
CRT @(0,22):"Thank You - Goodbye!":CL:
RQM
GO 1999
END
IF PRJCT='' THEN GO 1750
LOCATE(PRJCT,HELP.TBL,1;INDX) THEN
TSTRING=HELP.TBL<2,INDX>
TLEN=LEN(TSTRING)
CRT @(COL+20-(INT(TLEN/2)),POS+14):TSTRING
GOSUB 5000 ;* UPDATE RECORD
GOSUB 2500 ;* DISPLAY TODAYS CARD
END ELSE
CRT @(0,22):RV:BEEP:"INVALID PROJECT CODE - Try Again!":ERV:CL
RQM
GO 1750
END
1999 *
PSW=0;CSW=0
RETURN
*
2000 * TIMECARD HEADER
POS=0; COL=0
TIME=TIME()
GOSUB 200
POS=6; COL=0
CRT @(COL,POS):CR
GOSUB 2225
TSTRING=" DATE"'L#9':"TIME IN"'L#9':"TIME OUT"'L#9':"PROJECT"'L#9'
CRT @(COL+2,POS):TSTRING
CRT @(COL+42,POS):TSTRING
*
EDATE=0; SDATE=0
PRDAYS=14; PRDATE=ICONV('12/23/90','D')
SDATE=TODAY-PRDATE
IF SDATE <= PRDAYS THEN
EDATE=PRDATE
END ELSE
EDATE=PRDATE+(INT(SDATE/PRDAYS)*PRDAYS)
END
*
Z=0; ZCT=0; ZPOS=0; MAX=14; SW=0; POS=6; COL=2
D=TODAY+1
TOTAL.HRS = 0
LOOP
D=D-1
UNTIL D < EDATE DO
DKEY=USER:"|":D
READ DREC FROM CLOCKFILE,DKEY THEN
ZCT=DCOUNT(DREC<1>,VM)
DAILY.HRS = 0
FOR Z=1 TO ZCT STEP 2
DATE=D
INTIME = DREC<1,Z>
OUTTIME = DREC<1,Z + 1>
IF OUTTIME = '' THEN INTIME = 0
DAILY.HRS = DAILY.HRS + (OUTTIME - INTIME)
ZPOS=ZPOS+1
IF INT(ZPOS/MAX) THEN
SW=SW+1
IF REM(SW,2) THEN
COL=42
END ELSE
COL=2
GOSUB 2100
IF ANS='B' THEN GO 2000
END
ZPOS=1
END
ZTIME=OCONV(DREC<1,Z>,"MTH")
ZTIME=OCONV(ZTIME,"MCL")
TSTRING=OCONV(DATE,"D2/")'L#9':ZTIME'L#9':SPACE(10):DREC<2,Z>'L#7'
CRT @(COL,POS+ZPOS):TSTRING
IF DREC<2,Z+1>='OFF' THEN
TSTRING=OCONV(DREC<1,Z+1>,"MTH")
TSTRING=OCONV(TSTRING,'MCL')
CRT @(COL+18,POS+ZPOS):TSTRING
END ELSE
Z=Z-1
END
NEXT Z
TOTAL.HRS = TOTAL.HRS + DAILY.HRS ;*CALCS TOTAL HRS FOR DISPLAY
ZPOS=ZPOS+1 ;* THIS WILL CAUSE THE BLANK LINE BETWEEN DAYS
END
REPEAT
*
GOSUB 2100
IF ANS='B' THEN GO 2000
COL=0; POS=6
CRT @(COL,POS):CR
PRJCT=''; INDX=''; GOSUB 2550
RETURN
*
2100 *
CRT @(54,22):"TOTAL HOURS: ":RV:OCONV(TOTAL.HRS,"MT"):ERV:
CRT @(0,22):RV:"Enter N(next page), B(back page), else RETURN ":ERV:
INPUT ANS
IF ANS='' OR ANS='/' THEN
GO 2199
END
IF ANS='B' THEN
Z=Z-(ZPOS+(MAX*6))
IF Z < 0 THEN Z=0
SW=0
END ELSE
IF ANS='N' THEN
IF Z > ZCT THEN
CRT @(0,22):"End of list!":CL
RQM
GO 2100
END
END ELSE
CRT @(0,22):BEEP:"INVALID ENTRY - Try Again!":CL:
END
END
2199 *
COL=2; POS=6
RETURN
*
2225 * DRAW BOX
IF ADDS THEN
FOR X=POS TO 21
IF X=POS THEN
TSTRING1="#"
TCOL=COL; TPOS=X; GOSUB 2275
TSTRING1="L"
TCOL=COL+39; GOSUB 2275
TSTRING1="D"
TCOL=COL+79; GOSUB 2275
END ELSE
IF X=21 THEN
TSTRING1="B":STR("<",38):"M":STR("<",39):"F"
TCOL=COL; TPOS=X; GOSUB 2275
END ELSE
TSTRING1=">"
TCOL=COL; TPOS=X; GOSUB 2275
TCOL=COL+39; GOSUB 2275
TCOL=COL+79; GOSUB 2275
END
END
NEXT X
END ELSE
FOR X=POS TO 21
IF X=POS THEN
TSTRING1="|"
TCOL=COL; TPOS=X; GOSUB 2285
TSTRING1="|"
TCOL=COL+39; GOSUB 2285
TSTRING1="|"
TCOL=COL+79; GOSUB 2285
END ELSE
IF X=21 THEN
TSTRING1=STR("~",80)
TCOL=COL; TPOS=X; GOSUB 2285
END ELSE
TSTRING1="|"
TCOL=COL; TPOS=X; GOSUB 2285
TCOL=COL+39; GOSUB 2285
TCOL=COL+79; GOSUB 2285
END
END
NEXT X
END
RETURN
2275 * PRINT GRAPHICS
CRT CHAR(27):CHAR(72):CHAR(2)
CRT @(TCOL,TPOS):TSTRING1:
CRT CHAR(27):CHAR(72):CHAR(3)
RETURN
2285 * PRINT LINE
CRT @(TCOL,TPOS):TSTRING1:
RETURN
*
2500 * TIMECARD HEADER
POS=0; COL=0
GOSUB 200 ;* UPDATE TIME IN BOX
POS=6
GOSUB 2550
GOSUB 2525
POS=6; COL=0
TSTRING="TIME IN"'L#9':"TIME OUT"'L#9':"PROJECT DESCRIPTION"
CRT @(COL+41,POS):TSTRING
*
ZPOS=0
ZCT=DCOUNT(CLKREC<1>,VM)
FOR Z=1 TO ZCT
DATE=FIELD(CLKKEY,"|",2)
IF CLKREC<2,Z>='OFF' THEN
TSTRING=OCONV(CLKREC<1,Z>,"MTH")
TSTRING=OCONV(TSTRING,'MCL')
CRT @(COL+50,POS+ZPOS):TSTRING
END ELSE
ZPOS=ZPOS+1
ZTIME=OCONV(CLKREC<1,Z>,"MTH")
ZTIME=OCONV(ZTIME,"MCL")
LOCATE(OCONV(CLKREC<2,Z>,'G0-1'),HELP.TBL,1;ZINDX) THEN
ZDESC=HELP.TBL<2,ZINDX>
END ELSE
ZDESC='UNKNOWN'
END
TSTRING=ZTIME'L#9':SPACE(9):CLKREC<2,Z>'L#7':ZDESC'L#12'
CRT @(COL+41,POS+ZPOS):TSTRING
END
NEXT Z
*
IF PRJCT='' ELSE
CRT @(0,22):RV:"Press RETURN to continue":ERV:CL:
INPUT ANY
END
RETURN
*
2525 * 1/2 DRAW BOX
COL=0; POS=6
CRT @(COL,POS):CR
GOSUB 2550
IF ADDS THEN
FOR X=POS TO 21
IF X=POS THEN
TSTRING1="#"
TCOL=COL+39; TPOS=X; GOSUB 2275
TSTRING1="D"
TCOL=COL+79; GOSUB 2275
END ELSE
IF X=21 THEN
TSTRING1="B":STR("<",39):"F"
TCOL=COL+39; TPOS=X; GOSUB 2275
END ELSE
TSTRING1=">"
TCOL=COL+39; TPOS=X; GOSUB 2275
TCOL=COL+79; GOSUB 2275
END
END
NEXT X
END ELSE
FOR X=POS TO 21
IF X=POS THEN
TSTRING1="|"
TCOL=COL+39; TPOS=X; GOSUB 2285
TCOL=COL+79; GOSUB 2285
END ELSE
IF X=21 THEN
TSTRING1=STR("~",41)
TCOL=COL+39; TPOS=X; GOSUB 2285
END ELSE
TSTRING1="|"
TCOL=COL+39; TPOS=X; GOSUB 2285
TCOL=COL+79; GOSUB 2285
END
END
NEXT X
END
RETURN
2550 * REDISPLAY USER INFORMATION
POS=6; COL=0
CRT @(COL+10,POS):"WELCOME TO TIMECLOCK"
TSTRING="EMPLOYEE ID #:":USER
TLEN=LEN(TSTRING)
CRT @(COL+20-(INT(TLEN/2)),POS+4):TSTRING
TSTRING=UREC<1>:" ":UREC<2>
TLEN=LEN(TSTRING)
CRT @(COL+20-(INT(TLEN/2)),POS+2):RV:TSTRING:ERV
TSTRING="PROJECT :":PRJCT
TLEN=LEN(TSTRING)
CRT @(COL+20-(INT(TLEN/2)),POS+6):TSTRING
IF INDX = '' OR PRJCT='OFF' OR PRJCT='' ELSE
TSTRING=HELP.TBL<2,INDX>
TLEN=LEN(TSTRING)
CRT @(COL+20-(INT(TLEN/2)),POS+8):TSTRING
END
GOSUB 6000
RETURN
*
3000 * HELP HEADER
POS=0; COL=0
TIME=TIME()
GOSUB 200
POS=6; COL=0
CRT @(COL,POS):CR
GOSUB 2225
TSTRING="PROJECT"'L#9':"DESCRIPTION"'L#27'
CRT @(COL+2,POS):TSTRING
CRT @(COL+42,POS):TSTRING
*
X=0;XX=0; MAX=14; SW=0; COL=2
XCT=DCOUNT(HELP.TBL<1>,VM)
LOOP
X=X+1
XX=XX+1
TSTRING=HELP.TBL<1,X>'L#9':HELP.TBL<2,X>[1,27]'L#27'
CRT @(COL,POS+XX):TSTRING
IF INT(XX/MAX) THEN
SW=SW+1
IF REM(SW,2) THEN
COL=42
END ELSE
COL=2
GOSUB 3100
END
XX=0
END
UNTIL PRJCT # '' DO REPEAT
IF PRJCT='/' THEN PRJCT=''
RETURN
*
3100 *
CRT @(0,22):RV:"Enter Project #, N(next page), B(back page)":ERV:CL:
INPUT ANS
IF ANS='' OR ANS='/' THEN
PRJCT='/'
GO 3199
END
IF ANS='B' THEN
X=X-(XX+(MAX*3))
IF X < 0 THEN X=0
SW=0
END ELSE
IF ANS='N' THEN
IF X > XCT THEN
CRT @(0,22):"End of list!":CL
RQM
*X=X-(MAX*2)
GO 3100
END
END ELSE
LOCATE(ANS,HELP.TBL,1;INDX) THEN
PRJCT=ANS
END ELSE
CRT @(0,22):RV:BEEP:"INVALID PROJECT CODE - Try Again!":ERV:CL:
END
END
END
3199 *
RETURN
*
4000 * LOAD PROJECT TABLE
IF HELP.TBL # '' ELSE
SELECT PROJECT
LOOP
READNEXT ID ELSE ID='EOF'
UNTIL ID='EOF' DO
READ PREC FROM PROJECT,ID THEN
LOCATE(PREC<1>,HELP.TBL,2;INDX;'AL') ELSE
HELP.TBL=INSERT(HELP.TBL,1,INDX;ID)
HELP.TBL=INSERT(HELP.TBL,2,INDX;OCONV(PREC<1>,'MCU'))
END
END
REPEAT
END
RETURN
*
5000 * HANDLE TIME DATA
*---------------------------------------*
* THIS PORTION OF LOGIC BUILDS THE TIMECLOCK ENTRIES
*
* CLOCKFILE RECORD LAYOUT AS FOLLOWS:
* <0> USER|DATE
* <1> TIME MV
* <2> PROJECT MV
*
*---------------------------------------*
CLKKEY=USER:"|":TODAY
TIME=TIME()
IF TODAY # DATE() THEN
TODAY=DATE()
CLKKEY=USER:"|":TODAY
READ CLKREC FROM CLOCKFILE,CLKKEY ELSE
CLKREC=''
END
END
IF CLKREC # '' THEN
LAST=DCOUNT(CLKREC<1>,VM)
IF PRJCT='OFF' THEN
IF CLKREC<2,LAST> = 'OFF' THEN
CRT @(0,22):BEEP:"HEY! YOU ARE ALREADY CLOCKED OUT!":CL:
RQM
END ELSE
CLKREC=INSERT(CLKREC,1,-1;TIME)
CLKREC=INSERT(CLKREC,2,-1;PRJCT)
CRT @(0,22):"You are now OFF THE CLOCK!":CL:
RQM
END
END ELSE
IF CLKREC<2,LAST> # 'OFF' THEN
CLKREC=INSERT(CLKREC,1,-1;TIME)
CLKREC=INSERT(CLKREC,2,-1;"OFF")
CLKREC=INSERT(CLKREC,1,-1;TIME)
CLKREC=INSERT(CLKREC,2,-1;PRJCT:"-00")
CRT @(0,22):"Your work Project has been Logged - Thanks!":CL:
RQM
END ELSE
CLKREC=INSERT(CLKREC,1,-1;TIME)
CLKREC=INSERT(CLKREC,2,-1;PRJCT:"-00")
CRT @(0,22):"Welcome Back! You are now ON THE CLOCK!":CL:
RQM
END
END
END ELSE
CLKREC=''
IF PRJCT='OFF' THEN
YKEY=OCONV(CLKKEY,"G0|1"):"|":OCONV(CLKKEY,"G1|1")-1
READ YREC FROM CLOCKFILE,YKEY THEN
YCT=DCOUNT(YREC<1>,VM)
IF YREC<2,YCT>#'OFF' THEN
CLKREC<1>=0
CLKREC<2>=YREC<2,YCT>
WRITE CLKREC ON CLOCKFILE,CLKKEY
YREC=INSERT(YREC,1,-1;'86400');* 11:59 PM
YREC=INSERT(YREC,2,-1;'OFF') ;* CLOCK OUT
WRITE YREC ON CLOCKFILE,YKEY
GO 5000
END
END
CRT @(0,22):BEEP:"HEY! YOU ARE ALREADY CLOCKED OUT!":CL:
RQM
GO 5999
END ELSE
CLKREC=TIME
CLKREC<2>=PRJCT:'-00'
CRT @(0,22):"You are now ON THE CLOCK! - Have a great day":CL:
RQM
END
END
WRITE CLKREC ON CLOCKFILE,CLKKEY
GOSUB 6000 ;*CALCULATES TOTAL HOURS FOR DISPLAY
5999 *
RETURN
*********************************************
6000 ;*CALCULATES TOTAL HOURS FOR DISPLAY
*
EDATE=0; SDATE=0 ; WEEK.ONE=0 ; WEEK.TWO=0
PRDAYS=14; PRDATE=ICONV('12/23/90','D')
SDATE=TODAY-PRDATE
IF SDATE <= PRDAYS THEN
EDATE=PRDATE
END ELSE
EDATE=PRDATE+(INT(SDATE/PRDAYS)*PRDAYS)
END
*
Z=0; ZCT=0
D=TODAY+1
TOTAL.HRS = 0
LOOP
D=D-1
UNTIL D < EDATE DO
DKEY=USER:"|":D
READ DREC FROM CLOCKFILE,DKEY THEN
DAILY.HRS=0
ZCT=DCOUNT(DREC<1>,VM)
FOR Z=1 TO ZCT STEP 2
DATE=D
INTIME = DREC<1,Z>
OUTTIME = DREC<1,Z + 1>
IF OUTTIME = '' THEN INTIME = 0
DAILY.HRS = DAILY.HRS + (OUTTIME - INTIME)
NEXT Z
IF D >= EDATE+7 THEN
WEEK.TWO=WEEK.TWO+DAILY.HRS
END ELSE
WEEK.ONE=WEEK.ONE+DAILY.HRS
END
TOTAL.HRS = TOTAL.HRS + DAILY.HRS
END
REPEAT
IF TOTAL.HRS > 0 THEN
CRT @(12,17):" WEEK ONE HOURS : ":OCONV(WEEK.ONE,"MT")
CRT @(12,18):" WEEK TWO HOURS : ":OCONV(WEEK.TWO,"MT")
END
CRT @(0,19):SPACE(3):" TOTAL PAY PERIOD HOURS: ":RV:OCONV(TOTAL.HRS,"MT"):ERV:
RETURN
***********************************************************
9999 * END OF PROCESS
STOP