212 lines
5.1 KiB
Plaintext
212 lines
5.1 KiB
Plaintext
|
*KC.CLIENT.HOURS
|
||
|
*KJC:12-11-91
|
||
|
*PURPOSE:TO CREATE SUMMARY REPORT DETAILING HOURS WORKED BY EMPLOYEE FOR
|
||
|
* A GIVEN CLIENT DURING A GIVEN PAY PERIOD
|
||
|
*
|
||
|
$INCLUDE GEN.COMMON
|
||
|
*
|
||
|
OPEN 'CLOCKFILE' TO CLOCKFILE ELSE ABORT 201,"CLOCKFILE"
|
||
|
OPEN 'USER' TO USER.FILE ELSE ABORT 201,"USER"
|
||
|
OPEN 'PROJECT' TO PROJECT.FILE ELSE ABORT 201,"PROJECT"
|
||
|
*******************INTITIALIZE VARIABLES************************
|
||
|
LAST.KEY=''
|
||
|
HOURS=0
|
||
|
MAXCT=0
|
||
|
LNCT=0
|
||
|
RECORDS=0
|
||
|
PROJECT=''
|
||
|
TOTAL.HRS=0
|
||
|
DEPT.HRS=0
|
||
|
*
|
||
|
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
|
||
|
*
|
||
|
HDL1="REPORT OF CLIENT HOURS BY EMPLOYEE BY PAY PERIOD"
|
||
|
HDLEN=LEN(HDL1)
|
||
|
Y=(40-(HDLEN/2))
|
||
|
HDL1=SPACE(Y):HDL1
|
||
|
CRT@(0,1):HDL1
|
||
|
*
|
||
|
HDL2=STR("*",80)
|
||
|
CRT@(0,3):HDL2
|
||
|
*
|
||
|
CRT@(0,5):CR
|
||
|
CRT@(0,5):
|
||
|
10 *
|
||
|
CRT @(0,8):CR
|
||
|
CRT @(10,7):"Enter the FIRST DATE of the Pay Period (mm/dd/yy)":CL
|
||
|
CRT @(28,8):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
|
||
|
IF REM(8533 - FDATE,14)=0 THEN
|
||
|
CRT @(40,8):RV:OCONV(FDATE,'D2/'):ERV
|
||
|
END ELSE
|
||
|
CRT @(0,22):RV:"DATE NOT VALID - ENTRY MUST BE DAY ONE OF PAY PERIOD":ERV
|
||
|
SLEEP2
|
||
|
GO 10
|
||
|
END
|
||
|
*
|
||
|
LDATE=FDATE+13
|
||
|
CRT @(28,9):CL:"LAST DATE :":
|
||
|
CRT @(40,9):RV:OCONV(LDATE,'D2/'):ERV
|
||
|
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
|
||
|
CRT @(28,10):"REQUESTED DEPARTMENT IS :":RV:DEPT:ERV
|
||
|
20
|
||
|
CRT @(0,11):CR
|
||
|
CRT@(0,22):CL:"INPUT CLIENT NAME TO BE USED FOR REPORT, USE DESIGNATED ABREVIATION ":
|
||
|
INPUT CLIENT.NAME
|
||
|
IF CLIENT.NAME = '' OR CLIENT.NAME = "/" THEN GO 10
|
||
|
CRT @(28,11):CR:"REQUESTED CLIENT IS :":RV:CLIENT.NAME:ERV
|
||
|
READ CLIENT.CHK FROM PROJECT.FILE,CLIENT.NAME ELSE
|
||
|
CRT@(0,22):CL:RV:" THIS IS NOT A VALID CLIENT OR ABREVIATION ":ERV
|
||
|
SLEEP2
|
||
|
GO 20
|
||
|
END
|
||
|
CRT@(0,22):CL:"WOULD YOU LIKE THIS TO GO TO THE PRINTER OR TO YOUR SCREEN? (P OR T)":
|
||
|
INPUT PRINT.ANS
|
||
|
IF PRINT.ANS = "T" THEN
|
||
|
MAXCT = 18
|
||
|
LNCT = 5
|
||
|
END ELSE
|
||
|
MAXCT = 59
|
||
|
LNCT = 61
|
||
|
PRINTER ON
|
||
|
EXECUTE "SP-ASSIGN F97"
|
||
|
END
|
||
|
******************************************************
|
||
|
CRT @(O,4):CR
|
||
|
*HEADER LINE 4
|
||
|
HDL4="REQUESTED PAY PERIOD IS ":OCONV(FDATE,'D2/'):" TO ":OCONV(LDATE,'D2/'):"; CLIENT IS ":CLIENT.NAME:"; DEPT IS ":DEPT
|
||
|
CRT @(4,2):RV:HDL4:ERV
|
||
|
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
|
||
|
*CRT @(0,5):CR
|
||
|
*
|
||
|
100
|
||
|
LOOP
|
||
|
READNEXT ID ELSE ID='EOF'
|
||
|
UNTIL ID='EOF' DO
|
||
|
USER=OCONV(ID,'G0|1')
|
||
|
DATE=OCONV(ID,'G1|1')
|
||
|
DAY=OCONV(DATE,"DWA")
|
||
|
READ CLOCK.REC FROM CLOCKFILE,ID THEN
|
||
|
IF DATE < FDATE OR DATE > LDATE THEN GO 100
|
||
|
IF USER # LAST.KEY AND LAST.KEY # '' THEN
|
||
|
* IF TOTAL.HRS = 0 THEN GO 100
|
||
|
LN=SPACE(49):STR("_",29)
|
||
|
GOSUB 200
|
||
|
LN=SPACE(49):"TOTAL EMPLOYEE HOURS : ":OCONV(TOTAL.HRS,"MT")
|
||
|
GOSUB 200
|
||
|
PRINT
|
||
|
LN=''
|
||
|
TOTAL.HRS=0
|
||
|
RECORDS=0
|
||
|
END
|
||
|
LAST.KEY=USER
|
||
|
* IF TOTAL.HRS = "INVALID" THEN GO 100
|
||
|
ENTRY.CT=0
|
||
|
ENTRY.CT=DCOUNT(CLOCK.REC<1>,VM)
|
||
|
IF REM(ENTRY.CT,2) # 0 THEN
|
||
|
TOTAL.HRS="INVALID"
|
||
|
GO 100
|
||
|
END
|
||
|
FOR X=1 TO ENTRY.CT STEP 2
|
||
|
PROJECT = OCONV(CLOCK.REC<2,X>,"G0-1")
|
||
|
IF PROJECT = CLIENT.NAME THEN
|
||
|
INTIME=CLOCK.REC<1,X>
|
||
|
OUTTIME=CLOCK.REC<1,X+1>
|
||
|
HOURS=HOURS + (OUTTIME-INTIME)
|
||
|
END
|
||
|
NEXT X
|
||
|
* IF HOURS = 0 THEN GO 100
|
||
|
RECORDS=RECORDS + 1
|
||
|
TOTAL.HRS=TOTAL.HRS + HOURS
|
||
|
DEPT.HRS=DEPT.HRS + TOTAL.HRS
|
||
|
READ USER.REC FROM USER.FILE,LAST.KEY ELSE USER.REC=''
|
||
|
IF RECORDS = 1 THEN
|
||
|
NAME=USER.REC<2>:",":USER.REC<1>
|
||
|
LN=SPACE(2)
|
||
|
LN=LN:CLIENT.NAME'L#8'
|
||
|
LN=LN:NAME'L#24'
|
||
|
LN=LN:LAST.KEY'L#8'
|
||
|
LN=LN:USER.REC<5>'L#8' ;*DEPT
|
||
|
LN=LN:OCONV(DATE,"D2-"):"/":DAY'L#14'
|
||
|
LN=LN:OCONV(HOURS,"MT")
|
||
|
GOSUB 200
|
||
|
HOURS=0
|
||
|
END ELSE
|
||
|
LN=SPACE(50):OCONV(DATE,"D2-"):"/":DAY'L#14'
|
||
|
LN=LN:OCONV(HOURS,"MT")
|
||
|
GOSUB 200
|
||
|
HOURS=0
|
||
|
END
|
||
|
END
|
||
|
REPEAT
|
||
|
******************************************************
|
||
|
IF ID = 'EOF' THEN
|
||
|
LN=SPACE(49):STR("_",29)
|
||
|
GOSUB 200
|
||
|
LN=SPACE(49):"TOTAL EMPLOYEE HOURS : ":OCONV(TOTAL.HRS,"MT")
|
||
|
GOSUB 200
|
||
|
PRINT
|
||
|
LN=SPACE(39):"TOTAL HOURS FOR ":CLIENT.NAME:" IN DEPT ":DEPT:":":OCONV(DEPT.HRS,"MT")
|
||
|
GOSUB 200
|
||
|
END
|
||
|
9999
|
||
|
CRT@(0,23):CL:"PROCESS COMPLETE - HIT RETURN:":
|
||
|
INPUT DUMMY
|
||
|
IF PRINT.ANS = "P" THEN
|
||
|
PRINTER OFF
|
||
|
END
|
||
|
STOP
|
||
|
******************************************************
|
||
|
200*
|
||
|
IF LNCT > MAXCT THEN
|
||
|
IF PRINT.ANS # "P" THEN
|
||
|
CRT@(0,22):"HIT RETURN TO CONTINUE":
|
||
|
INPUT ANY
|
||
|
END
|
||
|
PRINT CHAR(12)
|
||
|
PRINT TLN
|
||
|
PRINT HDL1
|
||
|
PRINT HDL2
|
||
|
*PRINT HDL3
|
||
|
PRINT
|
||
|
LNCT=5
|
||
|
END
|
||
|
PRINT LN
|
||
|
LNCT=LNCT + 1
|
||
|
LN=''
|
||
|
RETURN
|
||
|
******************************************************
|