230 lines
5.4 KiB
Plaintext
230 lines
5.4 KiB
Plaintext
|
*---------------------------*
|
||
|
* CLOCK.EXP
|
||
|
* BY D.BELL
|
||
|
*---------------------------*
|
||
|
CS=@(-1) ; CR=@(-3) ; CL=@(-4) ; RV=@(-13) ; ERV=@(-14)
|
||
|
VM=CHAR(253) ; SVM=CHAR(252) ; AM=CHAR(254) ; BEEP=CHAR(7)
|
||
|
PF1='<' ; PF2='P' ; PF3='/'
|
||
|
PROMPT ""
|
||
|
HR.TOT=0
|
||
|
TOT.HOURS=0
|
||
|
ARAY=''
|
||
|
WCT=0
|
||
|
RCT=0
|
||
|
*
|
||
|
OPEN 'CLOCKFILE' TO CLOCKFILE ELSE ABORT
|
||
|
OPEN 'DEPT' TO DEPT.FILE ELSE ABORT
|
||
|
OPEN 'USER' TO USER.FILE ELSE ABORT
|
||
|
OPEN 'PL' TO PL ELSE ABORT
|
||
|
OPEN 'LRTES' TO LRTES ELSE ABORT
|
||
|
OPEN 'CLOCKFILE.WORK.PROJECT' TO OUTFILE THEN
|
||
|
CLEARFILE OUTFILE
|
||
|
END ELSE
|
||
|
EXECUTE \CREATE-FILE CLOCKFILE.WORK.PROJECT 1 11\
|
||
|
OPEN 'CLOCKFILE.WORK.PROJECT' TO OUTFILE ELSE ABORT
|
||
|
END
|
||
|
GOSUB 2000
|
||
|
*
|
||
|
PLREC=\PQ\
|
||
|
PLREC<2>=\HSORT CWP\
|
||
|
PLREC<3>=\H BY CLIENT\
|
||
|
PLREC<4>=\H BY DEPT\
|
||
|
PLREC<5>=\H BY DATE\
|
||
|
PLREC<6>=\H BY LNAME\
|
||
|
PLREC<7>=\H BY FNAME\
|
||
|
PLREC<8>=\H BREAK-ON CLIENT.DESC\
|
||
|
PLREC<9>=\H BREAK-ON DEPT.DESC\
|
||
|
PLREC<10>=\H PROJECT\
|
||
|
PLREC<11>=\H DATE\
|
||
|
PLREC<12>=\H LNAME\
|
||
|
PLREC<13>=\H FNAME\
|
||
|
PLREC<14>=\H TOTAL HOURS\
|
||
|
PLREC<15>=\H TOTAL LABOR\
|
||
|
PLREC<16>=\H HEADING "'C'Labor Expense by Client for \:OCONV(SDATE,'D2/'):\ thru \:OCONV(EDATE,'D2/'):\ 'L'"\
|
||
|
IF PANS='Y' THEN
|
||
|
PLREC<17>=\H (IP\
|
||
|
END ELSE
|
||
|
PLREC<17>=\H (I\
|
||
|
END
|
||
|
PLREC<18>=\PP\
|
||
|
IF PANS#'Y' THEN
|
||
|
PLREC=INSERT(PLREC,2;\HTERM 132\)
|
||
|
PLREC=INSERT(PLREC,3;\P\)
|
||
|
END
|
||
|
WRITE PLREC ON PL,"CWP.RPT"
|
||
|
*
|
||
|
PLREC=\PQ\
|
||
|
PLREC<2>=\HSORT CWP\
|
||
|
PLREC<3>=\H BY LNAME\
|
||
|
PLREC<4>=\H BY FNAME\
|
||
|
PLREC<5>=\H BY DEPT\
|
||
|
PLREC<6>=\H BY DATE\
|
||
|
PLREC<7>=\H CLIENT\
|
||
|
PLREC<8>=\C\
|
||
|
PLREC<9>=\H BREAK-ON DEPT.DESC\
|
||
|
PLREC<10>=\H PROJECT\
|
||
|
PLREC<11>=\H DATE\
|
||
|
PLREC<12>=\H LNAME\
|
||
|
PLREC<13>=\H BREAK-ON FNAME\
|
||
|
PLREC<14>=\H TOTAL HOURS\
|
||
|
PLREC<15>=\H TOTAL LABOR\
|
||
|
PLREC<16>=\H HEADING "'C'Labor Expense by Employee for \:OCONV(SDATE,'D2/'):\ thru \:OCONV(EDATE,'D2/'):\ 'L'"\
|
||
|
IF PANS='Y' THEN
|
||
|
PLREC<17>=\H (IP\
|
||
|
END ELSE
|
||
|
PLREC<17>=\H (I\
|
||
|
END
|
||
|
PLREC<18>=\PP\
|
||
|
IF PANS#'Y' THEN
|
||
|
PLREC=INSERT(PLREC,2;\HTERM 132\)
|
||
|
PLREC=INSERT(PLREC,3;\P\)
|
||
|
END
|
||
|
WRITE PLREC ON PL,"CWP.RPT2"
|
||
|
*
|
||
|
SELECT CLOCKFILE
|
||
|
LOOP
|
||
|
READNEXT ID ELSE ID='EOF'
|
||
|
UNTIL ID='EOF' DO
|
||
|
IF REM(RCT,500) ELSE
|
||
|
CRT @(0,22):CL:"RECORDS READ :":RCT:" PROCESSED :":WCT
|
||
|
END
|
||
|
RCT=RCT+1
|
||
|
DATE=OCONV(ID,"G1|1")
|
||
|
USER=OCONV(ID,"G0|1")
|
||
|
READ UREC FROM USER.FILE,USER ELSE GO 10
|
||
|
READV RATE FROM LRTES,USER,1 ELSE RATE="*****"
|
||
|
IF NOT(NUM(RATE)) THEN
|
||
|
CRT BEEP:"USER WITH NO RATE: ":USER:" - <RETURN>"
|
||
|
ANY=""; INPUT ANY
|
||
|
RATE=0
|
||
|
END
|
||
|
IF DATE >= SDATE AND DATE <= EDATE THEN
|
||
|
GOSUB 500
|
||
|
END
|
||
|
10 *
|
||
|
REPEAT
|
||
|
EXECUTE \EX CWP.RPT\
|
||
|
EXECUTE \EX CWP.RPT2\
|
||
|
STOP
|
||
|
500 * DATE IS WITHIN SELECTED RANGES
|
||
|
READ ARAY FROM CLOCKFILE,ID THEN
|
||
|
GOSUB 1000
|
||
|
END
|
||
|
RETURN
|
||
|
1000 *
|
||
|
WREC=ARAY<1>
|
||
|
WREC<2>=ARAY<2>
|
||
|
ACT=DCOUNT(ARAY<1>,VM)
|
||
|
FOR A=1 TO ACT
|
||
|
TIME=ARAY<1,A>
|
||
|
PRJCT=ARAY<2,A>
|
||
|
IF REM(A,2) THEN
|
||
|
IF PRJCT='OFF' THEN
|
||
|
CRT @(0,22):BEEP:"The TIMECARD is in an ambiguous state - Unable to process!":
|
||
|
RQM
|
||
|
TOT.HOURS=0
|
||
|
ONTIME='UNKNOWN'
|
||
|
END ELSE
|
||
|
* OPRJCT=FIELD(PRJCT,"-",1)
|
||
|
OPRJCT=PRJCT
|
||
|
ONTIME=TIME
|
||
|
END
|
||
|
END ELSE
|
||
|
IF PRJCT # 'OFF' THEN
|
||
|
CRT @(0,22):BEEP:"The TIMECARD is in an ambiguous state - Unable to process!":
|
||
|
RQM
|
||
|
TOT.HOURS=0
|
||
|
OFFTIME='UNKNOWN'
|
||
|
END ELSE
|
||
|
OFFTIME=TIME
|
||
|
END
|
||
|
IF OFFTIME='UNKNOWN' OR ONTIME='UNKNOWN' THEN
|
||
|
HOURS='?'
|
||
|
END ELSE
|
||
|
IF ONTIME > OFFTIME THEN
|
||
|
OFFTIME=OFFTIME+86400
|
||
|
END
|
||
|
HOURS=OFFTIME-ONTIME
|
||
|
END
|
||
|
LOCATE(OPRJCT,WREC,3;IDX) THEN
|
||
|
WREC<4,IDX>=WREC<4,IDX>+HOURS
|
||
|
END ELSE
|
||
|
WREC=INSERT(WREC,3,IDX;OPRJCT)
|
||
|
WREC=INSERT(WREC,4,IDX;HOURS)
|
||
|
END
|
||
|
END
|
||
|
NEXT A
|
||
|
READV WDEPT FROM USER.FILE,USER,5 ELSE WDEPT='999'
|
||
|
WCNT=DCOUNT(WREC<3>,VM)
|
||
|
FOR W=1 TO WCNT
|
||
|
WPROJECT=WREC<3,W>
|
||
|
WKEY=WDEPT:"_":WPROJECT:"_":DATE:"_":USER
|
||
|
OREC=WREC<4,W>
|
||
|
*----*
|
||
|
OREC<1>=OCONV(OREC<1>,'MT')
|
||
|
GOSUB 5050 ;* convert minutes to quarter hours
|
||
|
OREC<1>=ICONV(OREC<1>,'MT')
|
||
|
OREC<2>=OREC<1>*RATE/3600
|
||
|
*----*
|
||
|
WRITE OREC ON OUTFILE,WKEY
|
||
|
NEXT W
|
||
|
WCT=WCT+1
|
||
|
RETURN
|
||
|
*
|
||
|
2000 *
|
||
|
CRT CS
|
||
|
CRT @(0,0):"CLOCK.EXP.EXPANDED"
|
||
|
DEPT='ALL'
|
||
|
DEPT.DESC='ALL'
|
||
|
CRT @(0,2):"This process will build an analysis workfile for '":DEPT.DESC:"'"
|
||
|
CRT @(0,3):"departments and for the specified payroll period."
|
||
|
2001 *
|
||
|
CRT @(0,5):"Select the START DATE to build ":;INPUT SDATE
|
||
|
SDATE=ICONV(SDATE,'D')
|
||
|
IF NUM(SDATE) THEN
|
||
|
END ELSE
|
||
|
CRT @(0,22):"INVALID FORMAT - PRESS RETURN":;INPUT DUMMY;GO 2001
|
||
|
END
|
||
|
CRT @(0,5):"Select the START DATE to build ":OCONV(SDATE,'D2/')
|
||
|
2002 *
|
||
|
CRT @(0,6):"Select the LAST DATE to build ":;INPUT EDATE
|
||
|
EDATE=ICONV(EDATE,'D')
|
||
|
IF NUM(EDATE) THEN
|
||
|
CRT @(0,6):"Select the LAST DATE to build ":OCONV(EDATE,'D2/')
|
||
|
END ELSE
|
||
|
CRT @(0,22):"INVALID FORMAT - PRESS RETURN":;INPUT DUMMY;GO 2002
|
||
|
END
|
||
|
*
|
||
|
2003 *
|
||
|
CRT @(0,7):"Output to printer (Y/N)":
|
||
|
INPUT PANS
|
||
|
IF PANS#'Y' THEN PANS='N'
|
||
|
IF PANS='Y' THEN
|
||
|
EXECUTE \PRINTER.ASSIGNMENT.FMT\
|
||
|
END
|
||
|
CRT @(0,22):CL:BEEP:"IS THIS CORRECT (Y/N)":
|
||
|
INPUT ANS
|
||
|
IF ANS='/' THEN STOP
|
||
|
IF ANS='Y' ELSE GO 2000
|
||
|
CRT @(23,12):RV:"PLEASE WAIT FOR REPORT!!!":ERV
|
||
|
RETURN
|
||
|
*
|
||
|
5050 *----- round hours to nearest quarter hour -----------------*
|
||
|
MINTS=OCONV(OREC<1>,'G1:1')
|
||
|
OURS =OCONV(OREC<1>,'G0:1')
|
||
|
BEGIN CASE
|
||
|
CASE MINTS >= 0 AND MINTS <= 7
|
||
|
MINTS = '00'
|
||
|
CASE MINTS >= 8 AND MINTS <= 21
|
||
|
MINTS = '15'
|
||
|
CASE MINTS >= 22 AND MINTS <= 37
|
||
|
MINTS = '30'
|
||
|
CASE MINTS >= 38 AND MINTS <= 51
|
||
|
MINTS = '45'
|
||
|
CASE MINTS >= 52
|
||
|
OURS=OURS+1
|
||
|
MINTS='00'
|
||
|
END CASE
|
||
|
OREC<1>=OURS'R%2':":":MINTS
|
||
|
RETURN
|