89 lines
1.7 KiB
Plaintext
89 lines
1.7 KiB
Plaintext
|
SUBROUTINE CLOCK.CALC(ZRAY)
|
||
|
*---------------------------*
|
||
|
* CLOCK.CALC
|
||
|
* BY D.BELL
|
||
|
* 3/22/91
|
||
|
*
|
||
|
* THIS SUBROUTINE CALCULATES HOURS WORKED BY PASSING AN ARRAY CALLED
|
||
|
* ZRAY.
|
||
|
* ZRAY<1>=DATE
|
||
|
* ZRAY<2>=TIMES
|
||
|
* ZRAY<3>=PROJECTS
|
||
|
*---------------------------*
|
||
|
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 " "
|
||
|
HR.TOT=0
|
||
|
TOT.HOURS=0
|
||
|
ARAY=''
|
||
|
*
|
||
|
ZCT=DCOUNT(ZRAY<1>,VM)
|
||
|
ZDATE=0
|
||
|
FOR Z=1 TO ZCT
|
||
|
IF Z > 1 AND ZRAY<1,Z> # ZDATE THEN
|
||
|
GOSUB 1000
|
||
|
ARAY<1>=ZRAY<1,Z>
|
||
|
ARAY<2>=ZRAY<2,Z>
|
||
|
ARAY<3>=ZRAY<3,Z>
|
||
|
ARAY<4>=Z
|
||
|
END ELSE
|
||
|
ARAY=INSERT(ARAY,1,-1;ZRAY<1,Z>)
|
||
|
ARAY=INSERT(ARAY,2,-1;ZRAY<2,Z>)
|
||
|
ARAY=INSERT(ARAY,3,-1;ZRAY<3,Z>)
|
||
|
ARAY=INSERT(ARAY,4,-1;Z)
|
||
|
END
|
||
|
ZDATE=ZRAY<1,Z>
|
||
|
NEXT Z
|
||
|
GOSUB 1000
|
||
|
GO 9999
|
||
|
1000 *
|
||
|
ACT=DCOUNT(ARAY<1>,VM)
|
||
|
FOR A=1 TO ACT
|
||
|
NEW.DATE=ARAY<1,A>
|
||
|
TIME=ARAY<2,A>
|
||
|
PRJCT=ARAY<3,A>
|
||
|
IF NEW.DATE # DATE() THEN
|
||
|
IF REM(ACT,2) THEN
|
||
|
CRT @(0,22):BEEP:"TIMECARD is in an ambiguous state - unable to process!":
|
||
|
RQM
|
||
|
TOT.HOURS=0
|
||
|
ZRAY<4,Z>='?'
|
||
|
GO 100
|
||
|
END
|
||
|
END
|
||
|
IF REM(A,2) THEN
|
||
|
IF PRJCT='OFF' THEN
|
||
|
CRT @(0,22):BEEP:"The TIMECARD is in an ambiguous state - Unable to process!":
|
||
|
RQM
|
||
|
TOT.HOURS=0
|
||
|
ONTIME='UNKNOWN'
|
||
|
ZRAY<4,ARAY<4,A>>='?'
|
||
|
END ELSE
|
||
|
ONTIME=TIME
|
||
|
END
|
||
|
END ELSE
|
||
|
IF PRJCT # 'OFF' THEN
|
||
|
CRT @(0,22):BEEP:"The TIMECARD is in an ambiguous state - Unable to process!":
|
||
|
RQM
|
||
|
TOT.HOURS=0
|
||
|
OFFTIME='UNKNOWN'
|
||
|
END ELSE
|
||
|
OFFTIME=TIME
|
||
|
END
|
||
|
IF OFFTIME='UNKNOWN' OR ONTIME='UNKNOWN' THEN
|
||
|
ZRAY<4,ARAY<4,A>>='?'
|
||
|
END ELSE
|
||
|
IF ONTIME > OFFTIME THEN
|
||
|
OFFTIME=OFFTIME+86400
|
||
|
END
|
||
|
HOURS=OFFTIME-ONTIME
|
||
|
ZRAY<4,ARAY<4,A>>=HOURS
|
||
|
END
|
||
|
END
|
||
|
NEXT A
|
||
|
100
|
||
|
RETURN
|
||
|
9999
|
||
|
RETURN
|