tldm-universe/CMS/BP.CLOCK/PAY.RPT

428 lines
10 KiB
Plaintext
Raw Normal View History

2024-09-10 19:25:06 +00:00
*-------------------------------*
* PAY.RPT
* BY DON BELL
* MODIFIED 7-24-91 KJC
*-------------------------------*
CS=@(-1) ; CR=@(-3) ; CL=@(-4) ; RV=@(-13) ; ERV=@(-14)
VM=CHAR(253) ; SVM=CHAR(252) ; AM=CHAR(254) ; BEEP=CHAR(7)
FF=CHAR(12)
PF1='<' ; PF2='P' ; PF3='/'
PROMPT " "
LNCNT='START'
TOTAL.HRS=0
TOTAL.MINS=0
OLD.DEPT='START'
DEPT.HRS=0
DEPT.MINS=0
PRINTER ON
*
OPEN 'CLOCKFILE' TO CLOCKFILE ELSE ABORT
OPEN 'USER' TO USER.FILE ELSE ABORT
OPEN 'JOB' TO JOB.FILE ELSE ABORT
*
5 *
EXCL.JOBS=''
SELECT JOB.FILE
LOOP
READNEXT ID ELSE ID='EOF'
UNTIL ID='EOF' DO
READV ANY FROM JOB.FILE,ID,2 THEN
IF ANY='Y' ELSE
LOCATE(ID,EXCL.JOBS,1;NDX) ELSE
EXCL.JOBS=INSERT(EXCL.JOBS,1,NDX;ID)
END
END
END
REPEAT
*
10 *
CRT CS
CRT @(0,0):"PAY.RPT"
CRT @(23,3):RV:" TIMECLOCK PAYROLL SUMMARY REPORT ":ERV
CRT @(0,22):"Enter the FIRST DATE of the Pay Period (mm/dd/yy)":CL
CRT @(28,5):CL:"FIRST DATE ":
INPUT FDATE
IF FDATE='' OR FDATE='/' THEN GO 9999
FDATE=ICONV(FDATE,'D')
IF OCONV(FDATE,'DW') # 7 THEN
CRT @(0,22):BEEP:"The FIRST DATE must be a SUNDAY!":CL
RQM
GO 10
END
CRT @(40,5):OCONV(FDATE,'D2/')
*
20 *
LDATE=FDATE+13
CRT @(28,7):CL:"LAST DATE ":
CRT @(40,7):OCONV(LDATE,'D2/')
CRT @(0,22):CL:"Is this Correct (y/n)":
INPUT ANS
IF ANS='Y' OR ANS='y' ELSE GO 10
CRT @(0,22):CL:"ENTER DEPTARTMENT NUMBER OR <CR> FOR ALL: ":
INPUT DEPT
IF DEPT='/' THEN GO 9999
*
TCL=\SSELECT CLOCKFILE WITH DATE GE "\
TCL=TCL:OCONV(FDATE,'D2/'):\"\
TCL=TCL:\ AND WITH DATE LE "\
TCL=TCL:OCONV(LDATE,'D2/')
IF DEPT # '' THEN
TCL=TCL:\" AND WITH DEPT EQ "\:DEPT:\" BY EMPNO BY DATE (R,10\
END ELSE
TCL=TCL:\" BY DEPT BY EMPNO BY DATE (R,10\
END
CRT @(20,10):"SELECTING TIMECLOCK RECORDS - PLEASE WAIT"
CRT TCL
EXECUTE TCL
*
LAST.USER=''
*
LOOP
READNEXT ID ELSE ID='EOF'
UNTIL ID='EOF' DO
USER=OCONV(ID,'G0|1')
DATE=OCONV(ID,'G1|1')
IF DATE >= FDATE AND DATE <=LDATE THEN
IF USER # LAST.USER THEN
READ USER.INFO FROM USER.FILE,USER ELSE USER.INFO=''
NEW.DEPT=USER.INFO<5>
IF NEW.DEPT # OLD.DEPT THEN
IF OLD.DEPT # 'START' THEN
DEPT.TIME=DEPT.HRS:":":DEPT.MINS'R%2'
REG.TIME=REG.TOT.HRS:":":REG.TOT.MINS'R%2'
OT.TIME=OT.TOT.HRS:":":OT.TOT.MINS'R%2'
PRINT SPACE(35):STR("-",30)
PRINT SPACE(17):"TOTAL DEPT HOURS: ":REG.TIME'R#10':OT.TIME'R#10':DEPT.TIME'R#10'
PRINT STR("=",110)
DEPT.TIME=0
DEPT.HRS=0
DEPT.MINS=0
LNCNT=LNCNT+3
END
OLD.DEPT=NEW.DEPT
REG.TOT.HRS=0
REG.TOT.MINS=0
OT.TOT.HRS=0
OT.TOT.MINS=0
END
Z=0; ZCT=0; ZPOS=0; MAX=15; SW=0; POS=6; COL=2
ZRAY=''
IRAY=''
*
* ZRAY<1>=DATES ; MV
* ZRAY<2>=TIMES ; MV
* ZRAY<3>=PRJCTS; MV
*
FOR D=LDATE TO FDATE STEP -1
DKEY=USER:"|":D
READ DREC FROM CLOCKFILE,DKEY THEN
ZCT=DCOUNT(DREC<1>,VM)
FOR Z=ZCT TO 1 STEP -1
ZRAY=INSERT(ZRAY,1,1;D)
ZRAY=INSERT(ZRAY,2,1;DREC<1,Z>)
ZRAY=INSERT(ZRAY,3,1;DREC<2,Z>)
NEXT Z
END
NEXT D
CALL CLOCK.CALC(ZRAY)
LAST.USER=USER
GOSUB 1000
END
END
REPEAT
* PRINT LAST DEPT TOTAL
REG.TIME=REG.TOT.HRS:":":REG.TOT.MINS'R%2'
OT.TIME=OT.TOT.HRS:":":OT.TOT.MINS'R%2'
DEPT.TIME=DEPT.HRS:":":DEPT.MINS'R%2'
PRINT SPACE(35):STR("-",30)
PRINT SPACE(17):"TOTAL DEPT HOURS: ":REG.TIME'R#10':OT.TIME'R#10':DEPT.TIME'R#10'
PRINT STR("=",110)
LNCNT=LNCNT+3
*
PRINT
PRINT
TOTAL.TIME=TOTAL.HRS:':':TOTAL.MINS'R%2'
LN3=SPACE(40):"GRAND TOTAL: ":TOTAL.TIME'R#12'
PRINT LN3
*
9999 * END OF PROCESS
PRINTER OFF
CRT @(0,22):CL:"HIT RETURN TO CONTINUE":
INPUT ANY
STOP
*****************************************
*ZRAY<4>=HOURS FROM CLOCK.CALC
*ZRAY<5>=FIRST WEEK HOURS; <5,1>=REGULAR HOURS,<5,2>=OT HOURS
*ZRAY<6>=SECOND WEEK HOURS; <6,1>=REG. HOURS, <6,2>=OT HOURS
*ZRAY<7>=CLIENT
*ZRAY<8>=CLIENT HOURS
*ZRAY<9>=JOBS
*ZRAY<10>=JOB HOURS
****************************************
1000 *
TOT.HRS=0
ZCT=DCOUNT(ZRAY<1>,VM)
FOR Z=2 TO ZCT STEP 2
LOCATE("?",ZRAY,4;FND) THEN ZRAY="?" ; GO 2000
IF ZRAY<1,Z> >= FDATE AND ZRAY<1,Z> <= LDATE-7 THEN
FIRST=1
CLIENT=OCONV(ZRAY<3,Z-1>,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
*-----------------------*
* CALC OVERTIME HOURS
*-----------------------*
EXCLHRS=ZRAY<5,2>
TOTHRS=ZRAY<5,1>
IF TOTHRS-EXCLHRS >144000 THEN
ZRAY<5,2>=(TOTHRS-EXCLHRS)-144000 ;* OVERTIME HOURS
ZRAY<5,1>=(TOTHRS-ZRAY<5,2>) ;* REGULAR HOURS
END ELSE
ZRAY<5,2>=0
END
EXCLHRS=ZRAY<6,2>
TOTHRS=ZRAY<6,1>
IF TOTHRS-EXCLHRS >144000 THEN
ZRAY<6,2>=(TOTHRS-EXCLHRS)-144000 ;* OVERTIME HOURS
ZRAY<6,1>=(TOTHRS-ZRAY<6,2>) ;* REGULAR HOURS
END ELSE
ZRAY<6,2>=0
END
*-----------------------*
REG.HRS=0;REG.MINS=0
OT.HRS=0;OT.MINS=0
PERIOD.HRS=0;PREIOD.MINS=0
*-----------------------*
JCT=DCOUNT(ZRAY<9>,VM)
YCT=DCOUNT(ZRAY<7>,VM)
IF JCT > YCT THEN YCT=JCT
IF YCT<2 THEN YCT=2
FOR Y=1 TO YCT STEP 1
IF Y=1 THEN
IF LNCNT # 'START' THEN
PRINT; LNCNT=LNCNT+1
END
LN=USER.INFO<6>'L#10'
NAME=USER.INFO<2>:", ":USER.INFO<1>[1,1]:"."
LN=LN:NAME'L#20'
LN=LN:USER.INFO<5>'R#4'
LN=LN:SPACE(6)
END ELSE
LN=SPACE(40)
END
BEGIN CASE
CASE Y=1
IF ZRAY<5,1> > 0 THEN
ITIME=ZRAY<5,1>
GOSUB 1100
LN=LN:OTIME'L#10'
HRS=OCONV(OTIME,'G0:1')
MINS=OCONV(OTIME,'G1:1')
REG.HRS=REG.HRS + HRS
REG.TOT.HRS=REG.TOT.HRS + HRS
REG.MINS=REG.MINS + MINS
IF REG.MINS GE 100 THEN
REG.MINS=REG.MINS - 100
REG.HRS=REG.HRS + 1
END
REG.TOT.MINS=REG.TOT.MINS + MINS
IF REG.TOT.MINS GE 100 THEN
REG.TOT.MINS=REG.TOT.MINS - 100
REG.TOT.HRS=REG.TOT.HRS + 1
END
END ELSE
LN=LN:"00:00"'L#10'
END
IF ZRAY<5,2> > 0 THEN
ITIME=ZRAY<5,2>
GOSUB 1100
LN=LN:OTIME'L#10'
HRS=OCONV(OTIME,'G0:1')
MINS=OCONV(OTIME,'G1:1')
OT.HRS=OT.HRS + HRS
OT.TOT.HRS=OT.TOT.HRS + HRS
OT.MINS=OT.MINS + MINS
IF OT.MINS GE 100 THEN
OT.MINS=OT.MINS - 100
OT.HRS=OT.HRS + 1
END
OT.TOT.MINS=OT.TOT.MINS + MINS
IF OT.TOT.MINS GE 100 THEN
OT.TOT.MINS=OT.TOT.MINS - 100
OT.TOT.HRS=OT.TOT.HRS + 1
END
END ELSE
LN=LN:"00:00"'L#10'
END
*ITIME=SUM(ZRAY<5>)+SUM(ZRAY<6>)
*GOSUB 1100
LN=LN:SPACE(10)
CASE Y=2
IF ZRAY<6,1> > 0 THEN
ITIME=ZRAY<6,1>
GOSUB 1100
LN=LN:OTIME'L#10'
HRS=OCONV(OTIME,'G0:1')
MINS=OCONV(OTIME,'G1:1')
REG.HRS=REG.HRS + HRS
REG.TOT.HRS=REG.TOT.HRS + HRS
REG.MINS=REG.MINS + MINS
IF REG.MINS GE 100 THEN
REG.MINS=REG.MINS - 100
REG.HRS=REG.HRS + 1
END
REG.TOT.MINS=REG.TOT.MINS + MINS
IF REG.TOT.MINS GE 100 THEN
REG.TOT.MINS= REG.TOT.MINS - 100
REG.TOT.HRS=REG.TOT.HRS + 1
END
END ELSE
LN=LN:"00:00"'L#10'
END
IF ZRAY<6,2> > 0 THEN
ITIME=ZRAY<6,2>
GOSUB 1100
LN=LN:OTIME'L#10'
HRS=OCONV(OTIME,'G0:1')
MINS=OCONV(OTIME,'G1:1')
OT.HRS=OT.HRS + HRS
OT.TOT.HRS=OT.TOT.HRS + HRS
OT.MINS=OT.MINS + MINS
IF OT.MINS GE 100 THEN
OT.MINS=OT.MINS - 100
OT.HRS=OT.HRS + 1
END
OT.TOT.MINS=OT.TOT.MINS + MINS
IF OT.TOT.MINS GE 100 THEN
OT.TOT.MINS=OT.TOT.MINS - 100
OT.TOT.HRS=OT.TOT.HRS + 1
END
END ELSE
LN=LN:"00:00"'L#10'
END
PERIOD.HRS=REG.HRS + OT.HRS
PERIOD.MINS=REG.MINS + OT.MINS
IF PERIOD.MINS GE 100 THEN
PERIOD.MINS=PERIOD.MINS - 100
PERIOD.HRS=PERIOD.HRS + 1
END
PERIOD.TOT=PERIOD.HRS:":":PERIOD.MINS'R%2'
LN=LN:PERIOD.TOT'L#10'
DEPT.HRS=DEPT.HRS + PERIOD.HRS
DEPT.MINS=DEPT.MINS + PERIOD.MINS
IF DEPT.MINS GE 100 THEN
DEPT.MINS=DEPT.MINS - 100
DEPT.HRS=DEPT.HRS + 1
END
TOTAL.HRS=TOTAL.HRS + PERIOD.HRS
TOTAL.MINS=TOTAL.MINS + PERIOD.MINS
IF TOTAL.MINS GE 100 THEN
TOTAL.MINS=TOTAL.MINS - 100
TOTAL.HRS=TOTAL.HRS + 1
END
CASE 1
LN=LN:SPACE(30)
END CASE
LN=LN:ZRAY<7,Y>'L#10'
IF ZRAY<8,Y> > 0 THEN
ITIME=ZRAY<8,Y>; GOSUB 1100
LN=LN:OTIME'L#10'
END ELSE
OTIME="00:00"
LN=LN:OTIME'L#10'
END
IF ZRAY<9,Y> # '' THEN
ITIME=ZRAY<10,Y> ; GOSUB 1100
LN=LN:ZRAY<9,Y>'L#3':OTIME'L#10'
END
GOSUB 2000
NEXT Y
RETURN
1100 * CALC 1/100th TIME
ITIME=OCONV(ITIME,'MT')
OTIME=OCONV(ITIME,'G0:1'):":":INT((OCONV(ITIME,'G1:1')*100)/60)'R%2'
RETURN
2000 * PRINT REPORT
IF LNCNT='START' THEN
LNCNT=100
STRNG="Internal Data Management, Inc."
SLEN=LEN(STRNG)
HL1=SPACE(40-(SLEN/2)):STRNG
STRNG="Timeclock Summary Report by Employee #"
SLEN=LEN(STRNG)
HL2=SPACE(40-(SLEN/2)):STRNG
STRNG="For the Pay Period '":OCONV(FDATE,'D2/'):"' through '":OCONV(LDATE,'D2/'):"'"
SLEN=LEN(STRNG)
HL3=SPACE(40-(SLEN/2)):STRNG
HL4="EMPLOYEE ":"EMPLOYEE"'L#20':" DEPT "'R#6':SPACE(4):"TOTAL"'L#10':"TOTAL"'L#10':"TOTAL"'L#10':"CLIENT"'L#10':"HOURS"'L#10':"JOB HOURS"
HL5=" NUMBER ":" NAME "'L#20':SPACE(10):" REG"'L#10':" OT"'L#10':"PERIOD"
END
IF LNCNT > 55 THEN
PRINT FF
PRINT HL1
PRINT HL2
PRINT HL3
PRINT
PRINT HL4
PRINT HL5
PRINT
LNCNT=7
END
IF ZRAY = '?' THEN
LN=USER.INFO<6>'L#10'
NAME=USER.INFO<2>:", ":USER.INFO<1>[1,1]:"."
LN=LN:NAME'L#20'
LN=LN:USER.INFO<5>'R#4'
LN=LN:SPACE(6)
LN=LN:"TIMECARD IS IN AN AMBIGUOUS STATE - UNABLE TO PROCESS"
PRINT
PRINT LN
END ELSE
PRINT LN
END
LNCNT=LNCNT+1
RETURN