*HOURLY.REPORT *BY KEVIN CONNERS *HOURLY REPORT BY TIME PERIOD *5/22/91 *MODIFIED:7/18/91 * $INCLUDE GEN.COMMON * OPEN 'CLOCKFILE' TO CLOCKFILE ELSE ABORT 201,"NO CLOCKFILE FILE" OPEN 'USER' TO USER ELSE ABORT 201, "NO USER FILE" * EQU TC$KEY TO 0 EQU TC$TIMES TO 1 EQU TC$PROJECT TO 2 EQU US$KEY TO 0 EQU US$FNAME TO 1 EQU US$LNAME TO 2 EQU US$PASSWORD TO 4 EQU US$EMPNO TO 6 EQU US$DEPT TO 5 * CRT CS ***************************************************************** TLN=OCONV(DATE(),"D2/") HD="INTERNAL DATA MANAGEMENT" HDLEN=LEN(HD) X=(40-(HDLEN/2))-8 TLN=TLN:SPACE(X) TLN=TLN:HD TLN=TLN:SPACE(X) TLN=TLN:OCONV(TIME(),"MTH") CRT@(0,0):TLN * H1="HOURLY RECORD BY PAY PERIOD:" H1LEN=LEN(H1) X=(40-(H1LEN/2)) H1=SPACE(X):RV:H1:ERV CRT@(0,1):H1 * *************************************************************** 10* CRT@(0,5):CR CRT@(0,5):"ENTER FIRST DATE:": INPUT DFIRST IF DFIRST='' OR DFIRST=PF3 THEN GO 4000 DFIRST=ICONV(DFIRST,'D') IF REM(8533-DFIRST,14)=0 THEN CRT@(0,5):CL:"ENTER FIRST DATE:":SPACE(14):RV:OCONV(DFIRST,"D2/"):ERV END ELSE CRT @(0,7):"DATE NOT VALID--ENTRY MUST BE DAY ONE OF PAY PERIOD" SLEEP2 GO 10 END *CRT@(0,5):"ENTER FIRST DATE:":OCONV(DFIRST,"D2/") 20* * DLAST=DFIRST + 13 CRT @(0,7):"ENDING DATE OF TIME PERIOD IS :":RV:OCONV(DLAST,"D2/"):ERV CRT@(0,9):"IS THIS DATE CORRECT(Y OR N)?": INPUT ANSWER, 1 IF ANSWER = 'N' THEN GO 10 ************************** LND="WOULD YOU LIKE REPORT FOR 1ST WEEK(1),2ND WEEK(2)," LND=LND:"OR FULL PAY PERIOD ?" CRT @(0,11):LND: INPUT ANS.REP IF ANS.REP = '' THEN CRT @(0,11):CR:"REQUESTED DATE RANGE IS: ":RV:OCONV(DFIRST,"D2/"):" TO ":OCONV(DLAST,"D2/"):ERV: END IF ANS.REP = '1' THEN DLAST = DLAST - 7 CRT @(0,11):CR:"REQUESTED DATE RANGE IS: ":RV:OCONV(DFIRST,"D2/"):" TO ":OCONV(DLAST,"D2/"):ERV: END IF ANS.REP = '2' THEN DFIRST = DFIRST + 7 CRT @(0,11):CR:"REQUESTED DATE RANGE IS: ":RV:OCONV(DFIRST,"D2/"):" TO ":OCONV(DLAST,"D2/"):ERV: END * CRT @(0,13):"OUTPUT TO PRINTER (Y OR N)?": INPUT PRINT.ANS, 1 IF PRINT.ANS = "Y" THEN PRINTER ON MAXCT=60 LNCT=65 END ELSE MAXCT=16 LNCT=3 END CRT@(0,4):CR ****************************************************************** H2="HOURLY REPORT BY PAY PERIOD: ":OCONV(DFIRST,"D2/") H2=H2:" THROUGH ":OCONV(DLAST,"D2/") H2LEN=LEN(H2) X=(40-(H2LEN/2)) IF PRINT.ANS = "Y" THEN H2=SPACE(X):H2 END ELSE H2=SPACE(X):RV:H2:ERV END CRT@(0,1):H2 * LN2=SPACE(4) LN2=LN2:"EMPLOYEE #"'L#10' LN2=LN2:SPACE(5) LN2=LN2:"USER # "'L#6' LN2=LN2:SPACE(9) LN2=LN2:"NAME"'L#18' LN2=LN2:SPACE(4) LN2=LN2:"DEPT."'L#4' LN2=LN2:SPACE(7) LN2=LN2:"HOURS"'L#5' LN2=LN2:SPACE(2) CRT@(0,2):LN2 * LN3=STR("*",80) CRT@(0,3):LN3 ******************************************************************** 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:\" BY DEPT BY EMPNO BY DATE (R,20\ EXECUTE LINE * ;*EXECUTE\GET-LIST KCC\ ;*FOR TEST PURPOSES CRT @(0,4):CR LAST.KEY='' GRAND=0 OLD.DEPT = '' NEW.DEPT = OLD.DEPT * 100 READNEXT CLOCKFILE.KEY ELSE GO 3000 READ CLOCK.REC FROM CLOCKFILE,CLOCKFILE.KEY ELSE GO 100 USER.KEY=FIELD(CLOCKFILE.KEY,'|',1) DATE=FIELD(CLOCKFILE.KEY,'|',2) IF DATE < DFIRST OR DATE > DLAST THEN GO 100 * IF USER.KEY#LAST.KEY AND LAST.KEY # '' THEN GOSUB 200 GRAND=0 END IF GRAND="INVALID" THEN GO 100 * 150* * LAST.KEY=USER.KEY * ENTRY.CT=0 ENTRY.CT=DCOUNT(CLOCK.REC,VM) * *--- DO I HAVE A PROBLEM? ---* IF REM(ENTRY.CT,2)#0 AND DATE # DATE() 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 OUTTIME='' THEN OUTTIME=0 GRAND = GRAND + (OUTTIME - INTIME) NEXT X GO 100 * 200 * READ USER.REC FROM USER,LAST.KEY ELSE USER.REC='' NEW.DEPT = USER.REC *********************************************************** LN=SPACE(5) LN=LN:USER.REC'L#12' LN=LN:SPACE(2) LN=LN:LAST.KEY'L#10' LN=LN:SPACE(3) NAME=USER.REC:",":USER.REC[1,1]:"." LN=LN:NAME'L#22' LN=LN:SPACE(2) LN=LN:USER.REC'R#4' IF NEW.DEPT # OLD.DEPT THEN IF OLD.DEPT # '' THEN PRINT SPACE(5):STR("-",67) END OLD.DEPT = NEW.DEPT END LN=LN:SPACE(4) * IF GRAND='INVALID' THEN LN=LN:"INVALID TOTAL" LN=LN:SPACE(2) END ELSE LN=LN:OCONV(GRAND,'MT')'R#8' LN=LN:SPACE(2) END *GOSUB 8000 *RETURN *********************************************************** *8000 * IF LNCT > MAXCT THEN IF PRINT.ANS # 'Y' THEN CRT@(0,22):"HIT RETURN TO CONTINUE": INPUT DUMMY END PRINT CHAR(12) PRINT TLN PRINT H2 PRINT LN2 PRINT LN3 LNCT=4 END PRINT LN LNCT=LNCT+1 LN='' RETURN * 3000 * GOSUB 200 4000 * CRT@(0,23)CL:"PROCESS COMPLETE - IT'S BEEN A PLEASURE - HIT RETURN:": INPUT DUMMY IF PRINT.ANS = 'Y' THEN PRINTER OFF END STOP