*-------------------------------* * PAY.RPT * BY DON BELL * *-------------------------------* 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' PRINTER ON TOTAL.TIME=0 OLD.DEPT='START' DEPT.TIME=0 * 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 DEPARTMENT NUMBER OR 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=OCONV(DEPT.TIME,"MT") REG.TIME=OCONV(REG.TIME,"MT") OT.TIME=OCONV(OT.TIME,"MT") DEPT.TIME=OCONV(DEPT.TIME,'GO:1'):":":INT((OCONV(DEPT.TIME,'G1:1')*100)/60)'R%2' 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 9999 * END OF PROCESS PRINTER OFF CRT @(0,22):CL:"HIT RETURN TO CONTINUE": INPUT ANY STOP 1000 * TOT.HRS=0 ZCT=DCOUNT(ZRAY<1>,VM) FOR Z=2 TO ZCT STEP 2 LOCATE("?",ZRAY,4;FND) THEN ZRAY="?" ; GO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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 *-----------------------* 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' END ELSE LN=SPACE(30) END BEGIN CASE CASE Y=1 IF ZRAY<5,1> > 0 THEN ITIME=ZRAY<5,1>; GOSUB 1100 LN=LN:OTIME'L#10' 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' END ELSE LN=LN:"00:00"'L#10' END ITIME=SUM(ZRAY<5>)+SUM(ZRAY<6>); GOSUB 1100 LN=LN:OTIME'L#10' CASE Y=2 IF ZRAY<6,1> > 0 THEN ITIME=ZRAY<6,1>; GOSUB 1100 LN=LN:OTIME'L#10' 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' END ELSE LN=LN:"00:00"'L#10' END LN=LN:SPACE(10) 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 OTIME=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':"TOTAL"'L#10':"TOTAL"'L#10':"TOTAL"'L#10':"CLIENT"'L#10':"HOURS"'L#10':"JOB HOURS" HL5=" NUMBER ":" NAME "'L#20':" 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 LN2=USER.INFO<6>'L#10' NAME=USER.INFO<2>:", ":USER.INFO<1>[1,1]:"." LN2=LN2:NAME'L#20' LN2=LN2:SPACE(3) LN2=LN2:"TIMECARD IS IN AN AMBIGUOUS STATE - UNABLE TO PROCESS" PRINT PRINT LN2 END ELSE PRINT LN END LNCNT=LNCNT+1 RETURN