*-------------------------------------------------------------------------* * CLOCK.HOURS.DEPT * * HOURLY REPORT FOR A TIME PERIOD BY DEPARTMENT FOR A DEPARTMENT GROUP. * * COPIED FROM CLOCK.HOURS ON 08-18-92 BY STEVE MOFFETT. *-------------------------------------------------------------------------* $INCLUDE GEN.COM2 * OPEN 'CLOCKFILE' TO CLOCKFILE ELSE ABORT 201,"NO CLOCKFILE FILE" OPEN 'USER' TO USER ELSE ABORT 201, "NO USER FILE" * EQU TC$TIMES TO 1 * EQU US$FNAME TO 1 EQU US$LNAME TO 2 EQU US$DEPT TO 5 EQU US$EMPNO TO 6 *-------------------------------------------------------------------------* PROMPT "" CRT CS CRT @(0,0):'CLOCK.HOURS.DEPT' CRT @(0,1):RV:SPACE(80):ERV HD="HOURLY RECORDS for a PAY PERIOD for a DEPARTMENT GROUP" HDL=(80-LEN(HD))/2 CRT @(HDL,1):RV:HD:ERV *-------------------------------------------------------------------------* CRT @(13,4):'DEPARTMENT GROUPS' CRT @(10,5):RV:' 1 - M I S ' CRT @(10,6):' 2 - OPERATIONS ' CRT @(10,7):' 3 - WAREHOUSE-LETTERSHOP ' CRT @(10,8):' 4 - WORD OF FAITH ' CRT @(10,9):' 5 - SPECIAL ACCOUNTS ' CRT @(10,10):' 6 - PAYROLL ' CRT @(10,11):' 7 - SUPPORT STAFF ':ERV *-------------------------------------------------------------------------* 10 * CRT @(0,14):CR CRT @(32,22):'Enter / to Escape' CRT @(5,14):'Enter DEPARTMENT GROUP number : ': INPUT DEPTG IF DEPTG='/' THEN STOP IF DEPTG GE 1 AND DEPTG LE 7 ELSE CRT @(0,22):BEEP:CL:'INVALID DEPARTMENT GROUP NUMBER ENTERED - HIT RETURN -->': INPUT ANY GO 10 END *-------------------------------------------------------------------------* 20 * CRT @(0,16):CR CRT @(15,22):'Enter / to Escape or < to backup to DEPARTMENT GROUP' CRT @(5,16):"ENTER Day ONE of PAY PERIOD : ": INPUT DFIRST IF DFIRST='' THEN GO 20 IF DFIRST='/' THEN STOP IF DFIRST='<' THEN GO 10 DFIRST=ICONV(DFIRST,'D') IF REM(8533-DFIRST,14)=0 THEN CRT @(37,16):OCONV(DFIRST,"D2/") END ELSE CRT @(0,22):BEEP:CL:"DATE NOT VALID--ENTRY MUST BE DAY ONE OF PAY PERIOD - HIT RETURN -->": INPUT ANY GO 20 END *-------------------------------------------------------------------------* 30 * CRT @(0,18):CR CRT @(15,22):'Enter / to Escape or < to backup to PAY PERIOD' DLAST=DFIRST + 13 CRT @(46,16):'thru ':OCONV(DLAST,"D2/") CRT @(5,18):'IS THIS CORRECT (Y/N) : ': INPUT YORN IF YORN='N' THEN GO 10 IF YORN='/' THEN STOP IF YORN='<' THEN GO 20 IF YORN='Y' THEN GO 40 GO 30 *-------------------------------------------------------------------------* 40 * CRT @(0,19):CR EXECUTE 'SP-ASSIGN HS' PRINTER ON MAXCT=60 LNCT=0 DEPT.HOLD='START' * TLN=OCONV(DATE(),"D2/") H1="INTERNAL DATA MANAGEMENT" HDLEN=LEN(H1) X=(40-(HDLEN/2))-8 TLN=TLN:SPACE(X) TLN=TLN:H1 TLN=TLN:SPACE(X) TLN=TLN:OCONV(TIME(),"MTH") * H2="HOURLY RECORD BY PAY PERIOD: ":OCONV(DFIRST,"D2/") H2=H2:" THROUGH ":OCONV(DLAST,"D2/") H2LEN=LEN(H2) X=(40-(H2LEN/2)) H2=SPACE(X):H2 * LN2='DEPT EMPLOYEE # USER # NAME HOURS' * LN3=STR("*",80) *-------------------------------------------------------------------------* CRT @(5,19):'Working': LDFIRST=OCONV(DFIRST,'D2/') LDLAST=OCONV(DLAST,'D2/') LINE=\SSELECT CLOCKFILE WITH DATE GE "\ LINE=LINE:LDFIRST LINE=LINE:\" AND WITH DATE LE "\ LINE=LINE:LDLAST LINE=LINE:'" AND WITH DEPT ' BEGIN CASE CASE DEPTG=1 LINE=LINE:'"504"' CASE DEPTG=2 LINE=LINE:'"512"' CASE DEPTG=3 LINE=LINE:'"506""507""508""513"' CASE DEPTG=4 LINE=LINE:'"500""501""502""503""505""509""514""515"' CASE DEPTG=5 LINE=LINE:'"511""518""524"' CASE DEPTG=6 LINE=LINE:'"510"' CASE DEPTG=7 LINE=LINE:'"517"' END CASE LINE=LINE:\ BY DEPT BY LNAME BY FNAME\ EXECUTE LINE LAST.KEY='' GRAND=0 DEPT.GRAND='' GRAND.GRAND='' GOSUB 2000 *-------------------------------------------------------------------------* 100 READNEXT CLOCKFILE.KEY ELSE DEPT.HOLD='END'; GO 3000 READ CLOCK.REC FROM CLOCKFILE,CLOCKFILE.KEY ELSE GO 100 USER.KEY=FIELD(CLOCKFILE.KEY,'|',1) IF USER.KEY#LAST.KEY AND LAST.KEY # '' THEN GOSUB 200 GRAND=0 END IF GRAND="INVALID" THEN GO 100 * LAST.KEY=USER.KEY * ENTRY.CT=0 ENTRY.CT=DCOUNT(CLOCK.REC,VM) * *--- DO I HAVE A PROBLEM? ---* IF REM(ENTRY.CT,2)#0 THEN GRAND='INVALID' GO 100 END * FOR X=1 TO ENTRY.CT STEP 2 INTIME=CLOCK.REC<1,X> OUTTIME=CLOCK.REC<1,X+1> IF NOT(OUTTIME MATCHES "0N") THEN CRT 'ERROR : ':OUTTIME:' RETURN: ': ; INPUT D GRAND=GRAND + (OUTTIME - INTIME) NEXT X GO 100 *-------------------------------------------------------------------------* 200 * READ USER.REC FROM USER,LAST.KEY ELSE USER.REC='' DEPT=USER.REC IF DEPT NE DEPT.HOLD THEN GOSUB 5000 LN=DEPT'L#4' LN=LN:SPACE(1) LN=LN:USER.REC'L#10' LN=LN:SPACE(5) LN=LN:LAST.KEY'L#5' LN=LN:SPACE(8) NAME=USER.REC:",":USER.REC[1,1]:"." LN=LN:NAME'L#25' LN=LN:SPACE(3) * IF GRAND='INVALID' THEN LN=LN:"INVALID TOTAL" END ELSE LN=LN:OCONV(GRAND,'MT')'R#6' GOSUB 6000;* Dept Grand Total END * PRINT LN LNCT=LNCT+1 LN='' IF LNCT GE MAXCT THEN GOSUB 2000 RETURN *-------------------------------------------------------------------------* 2000 * HOF RTN * PRINT CHAR(12) PRINT TLN PRINT H2 PRINT LN2 PRINT LN3 LNCT=4 RETURN *-------------------------------------------------------------------------* 3000 * GOSUB 200 GOSUB 5500 4000 * EXECUTE 'SP-ASSIGN' CRT @(0,23):CL:"PROCESS COMPLETE - IT'S BEEN A PLEASURE - HIT RETURN:": INPUT DUMMY PRINTER OFF STOP *-------------------------------------------------------------------------* 5000 * DEPT BREAK * IF DEPT.HOLD='START' OR DEPT.HOLD='END' ELSE IF LNCT > 59 THEN GOSUB 2000 TL=SPACE(56):'------------' PRINT TL DISP.DEPT=DEPT.GRAND<1>:':':DEPT.GRAND<2>'R%2' TL='DEPT TOT'"R#55":DISP.DEPT'R#12' PRINT TL GOSUB 2000 DEPT.GRAND='' END DEPT.HOLD=DEPT RETURN *-------------------------------------------------------------------------* 5500 * DEPT & GRAND BREAK * IF LNCT > 59 THEN GOSUB 2000 TL=SPACE(56):'------------' PRINT TL DISP.DEPT=DEPT.GRAND<1>:':':DEPT.GRAND<2>'R%2' TL='DEPT TOT'"R#55":DISP.DEPT'R#12' PRINT TL IF LNCT > 58 THEN GOSUB 2000 PRINT TL=SPACE(56):'------------' PRINT TL DISP.GRAND=GRAND.GRAND<1>:':':GRAND.GRAND<2>'R%2' TL='GRAND TOT'"R#55":DISP.GRAND'R#12' PRINT TL RETURN *-------------------------------------------------------------------------* 6000 * DEPT & GRAND TOTAL ACCUMULATION * WGRAND=OCONV(GRAND,'MT') WHRS=FIELD(WGRAND,':',1) WMINS=FIELD(WGRAND,':',2) DEPT.GRAND<1>=DEPT.GRAND<1>+WHRS DEPT.GRAND<2>=DEPT.GRAND<2>+WMINS GRAND.GRAND<1>=GRAND.GRAND<1>+WHRS GRAND.GRAND<2>=GRAND.GRAND<2>+WMINS WMINS=DEPT.GRAND<2> IF WMINS > 60 THEN WHRS=INT(WMINS/60) WMIN1=WMINS-(WHRS*60) DEPT.GRAND<1>=DEPT.GRAND<1>+WHRS DEPT.GRAND<2>=WMIN1 GRAND.GRAND<1>=GRAND.GRAND<1>+WHRS GRAND.GRAND<2>=WMIN1 END RETURN *-------------------------------------------------------------------------*