356 lines
7.7 KiB
Plaintext
Executable File
356 lines
7.7 KiB
Plaintext
Executable File
* CM.TIMECARD.RPT
|
|
*
|
|
* TWH: 1.4.95
|
|
* TIMECARD REPORT
|
|
*
|
|
$INCLUDE GEN.COMMON
|
|
*
|
|
EQU TRUE TO 1
|
|
EQU FALSE TO 0
|
|
PDATE = DATE()
|
|
LINECNTR = 99
|
|
PAGECNTR = 0
|
|
LASER.PRINTER = 'Y'
|
|
CRT CS
|
|
*
|
|
OPEN 'CLOCKFILE' TO CLOCKFILE ELSE ABORT
|
|
OPEN 'USER' TO USERS ELSE ABORT
|
|
OPEN 'TIMECARD.WORK' TO TIMECARD.WORK THEN
|
|
CRT @(0,2):CL:"CLEARING WORK FILE - PLEASE WAIT"
|
|
CRT @(0,3):CL
|
|
EXECUTE "CLEAR-FILE DATA TIMECARD.WORK"
|
|
END ELSE
|
|
ABORT
|
|
END
|
|
*
|
|
CRT @(0,2):CL:"CM.TIMECARD.RPT TIMECARD REPORT"
|
|
*
|
|
* GET PRINTER STATUS
|
|
100
|
|
CRT @(0,4):CL:"OUTPUT TO THE PRINTER (Y/N OR / to QUIT): ":
|
|
PTRFLAG = ''
|
|
INPUT PTRFLAG
|
|
IF PTRFLAG = PF3 THEN STOP
|
|
IF PTRFLAG = 'Y' ELSE PTRFLAG = 'N'
|
|
IF PTRFLAG = '/' THEN STOP
|
|
CRT @(0,3):''
|
|
PAGESKIP = 23
|
|
CHANNEL.SKIP = @(-1)
|
|
IF PTRFLAG = 'Y' THEN
|
|
EXECUTE "SETPTR 0,80,60,0,0,1,PRINTER mtk4si,FORM 6,INFORM,BRIEF"
|
|
* EXECUTE "SETPTR 0,132,60,0,0,1,PRINTER wof3si,FORM 8,INFORM,BRIEF"
|
|
PRINTER ON
|
|
END
|
|
*
|
|
* GET START DATE
|
|
200
|
|
CRT @(0,6):CL:"INPUT START DATE(mm/dd/yy): ":
|
|
STARTDATE = ''
|
|
INPUT STARTDATE
|
|
IF STARTDATE = '/' THEN GO 100
|
|
INTSTARTDATE = ICONV(STARTDATE,"DJ")
|
|
*
|
|
* GET END DATE
|
|
300
|
|
CRT @(0,8):CL:"INPUT END DATE(mm/dd/yy): ":
|
|
ENDDATE = ''
|
|
INPUT ENDDATE
|
|
IF ENDDATE = '/' THEN GO 200
|
|
INTENDDATE = ICONV(ENDDATE,"DJ")
|
|
IF INTENDDATE < INTSTARTDATE THEN
|
|
CRT @(0,8):CL:"END DATE LESS THAN START DATE - PLEASE REENTER"
|
|
SLEEP 2
|
|
GO 300
|
|
END
|
|
*
|
|
* GET DEPT NUMBER
|
|
400
|
|
CRT @(0,10):CL:"ENTER DEPTARTMENT # OR ALL: ":
|
|
DEPTCODE = ''
|
|
INPUT DEPTCODE
|
|
IF DEPTCODE = '/' THEN GO 300
|
|
*
|
|
* BUILD WORK FILE
|
|
500
|
|
SELECT CLOCKFILE
|
|
EOF = FALSE
|
|
USERSAVE = ''
|
|
CRT @(0,13):CL
|
|
CRT @(0,12):CL:"WRITING TO WORK FILE - PLEASE WAIT: ":
|
|
LOOP
|
|
READNEXT @ID ELSE EOF = TRUE
|
|
UNTIL EOF DO
|
|
READ CLOCKREC FROM CLOCKFILE,@ID THEN
|
|
TIMECNTR = DCOUNT(CLOCKREC<1>,VM)
|
|
FOR I = 1 TO TIMECNTR
|
|
TEMPUSER = FIELD(@ID,"|",1)
|
|
TEMPDATE = FIELD(@ID,"|",2)
|
|
READ USERREC FROM USERS,TEMPUSER THEN
|
|
DEPTNUM = TRIM(USERREC<5>)
|
|
FULLNAME = TRIM(USERREC<1>):" ":TRIM(USERREC<2>)
|
|
END ELSE
|
|
DEPTNUM = 0
|
|
FULLNAME = ''
|
|
END
|
|
IF DEPTNUM = DEPTCODE OR DEPTCODE = "ALL" THEN
|
|
IF TEMPDATE >= INTSTARTDATE AND TEMPDATE <= INTENDDATE THEN
|
|
GOSUB 600
|
|
END
|
|
END
|
|
NEXT I
|
|
END
|
|
REPEAT
|
|
GOSUB 700
|
|
GO 9999
|
|
STOP
|
|
*
|
|
* WRITE TO WORK FILE
|
|
600
|
|
KEY = ''
|
|
KEY = TEMPUSER:"|":TEMPDATE:"|":DEPTNUM
|
|
READ WORKREC FROM TIMECARD.WORK,KEY ELSE
|
|
WORKREC = ''
|
|
WORKREC<7> = 0
|
|
END
|
|
WORKREC<1> = TEMPUSER
|
|
WORKREC<2> = FULLNAME
|
|
WORKREC<3> = TRIM(USERREC<6>)
|
|
WORKREC<4> = DEPTNUM
|
|
WORKREC<5> = TEMPDATE
|
|
WORKREC = INSERT(WORKREC,6,1;CLOCKREC<2,I>)
|
|
WORKREC = INSERT(WORKREC,7,1;CLOCKREC<1,I>)
|
|
IF CLOCKREC<2,I> = "OFF" THEN
|
|
WORKREC<8> = WORKREC<8> + (CLOCKREC<1,I> - CLOCKREC<1,I-1>)
|
|
END
|
|
WRITE WORKREC ON TIMECARD.WORK,KEY
|
|
RETURN
|
|
*
|
|
* WRITE THE REPORT
|
|
700
|
|
*IF PTRFLAG # "Y" THEN
|
|
*EXECUTE "T132"
|
|
*END
|
|
*IF LASER.PRINTER = "Y" THEN
|
|
* GOSUB 10000
|
|
*END
|
|
CRT @(0,13):CL
|
|
CRT @(0,12):CL:"SORTING PRINT FILE - PLEASE WAIT: ":
|
|
COMMANDLINE = \SSELECT TIMECARD.WORK \
|
|
COMMANDLINE = COMMANDLINE:\BY DATE BY-DSND DEPT BY EMPNO\
|
|
EXECUTE COMMANDLINE
|
|
EOF = FALSE
|
|
PRINTDATE = OCONV(PDATE,"D2/")
|
|
GRANDTDEPT = 0
|
|
GRANDTEMP = 0
|
|
GRANDTDATE = 0
|
|
DEPTSAVE = ''
|
|
DATESAVE = ''
|
|
EMPSAVE = ''
|
|
LOOP
|
|
READNEXT @ID ELSE EOF = TRUE
|
|
UNTIL EOF
|
|
READ PRINTREC FROM TIMECARD.WORK,@ID THEN
|
|
PPCOUNT = DCOUNT(PRINTREC<6>,VM)
|
|
INVALIDTIMES = FALSE
|
|
TIMESCHECK = REM(PPCOUNT,2)
|
|
IF TIMESCHECK # 0 THEN
|
|
INVALIDTIMES = TRUE
|
|
END
|
|
PCOUNTER = DCOUNT(PRINTREC<7>,VM)
|
|
FOR II = 1 TO PCOUNTER
|
|
IF EMPSAVE # PRINTREC<3> THEN
|
|
IF EMPSAVE # '' THEN
|
|
GOSUB 810
|
|
END
|
|
EMPSAVE = PRINTREC<3>
|
|
END
|
|
IF DATESAVE # PRINTREC<5> THEN
|
|
IF DATESAVE # '' THEN
|
|
GOSUB 820
|
|
END
|
|
DATESAVE = PRINTREC<5>
|
|
END
|
|
IF DEPTSAVE # PRINTREC<4> THEN
|
|
IF DEPTSAVE # '' THEN
|
|
GOSUB 830
|
|
END
|
|
DEPTSAVE = PRINTREC<4>
|
|
END
|
|
GOSUB 800
|
|
NEXT II
|
|
END
|
|
REPEAT
|
|
GOSUB 810
|
|
GOSUB 820
|
|
GOSUB 830
|
|
*IF LASER.PRINTER = "Y" THEN
|
|
* GOSUB 11000
|
|
*END
|
|
RETURN
|
|
*
|
|
* PRINT DETAIL LINE
|
|
800
|
|
GOSUB 910
|
|
PL = ''
|
|
BEGIN CASE
|
|
CASE II = 1 OR NAMELINE = TRUE
|
|
PRINT
|
|
LINECNTR = LINECNTR + 1
|
|
PL = PRINTREC<1>'R%4':" "
|
|
PL = PL:PRINTREC<2>'L#20':" "
|
|
PL = PL:PRINTREC<3>'R#6':" "
|
|
PL = PL:PRINTREC<4>'R#6':" "
|
|
PLDATE = OCONV(PRINTREC<5>,"D2/")
|
|
PL = PL:PLDATE'R#8':" "
|
|
PL = PL:PRINTREC<6,II>'R#7':" "
|
|
INTIME = PRINTREC<7,II>
|
|
GOSUB 1000
|
|
PL = PL:INTIME'L%10'
|
|
PRINT PL
|
|
CASE II = PCOUNTER
|
|
GRANDTDEPT = GRANDTDEPT + PRINTREC<8>
|
|
GRANDTEMP = GRANDTEMP + PRINTREC<8>
|
|
GRANDTDATE = GRANDTDATE + PRINTREC<8>
|
|
* INTIME = PRINTREC<8>
|
|
* GOSUB 1000
|
|
* PL = SPACE(65):INTIME'L%10'
|
|
* PRINT PL
|
|
CASE 1
|
|
INTIME = PRINTREC<7,II>
|
|
GOSUB 1000
|
|
PL = SPACE(56):PRINTREC<6,II>'R#7':" ":INTIME'L%10'
|
|
PRINT PL
|
|
END CASE
|
|
LINECNTR = LINECNTR + 1
|
|
RETURN
|
|
*
|
|
* PRINT EMPLOYEE GRAND TOTAL LINE
|
|
810
|
|
GOSUB 910
|
|
PRINT
|
|
INTIME = GRANDTEMP
|
|
GRDATE = OCONV(DATESAVE,"D2/")
|
|
GOSUB 1000
|
|
EL = ''
|
|
EL = "* GRAND TOTAL FOR EMPLOYEE ":EMPSAVE:" ON ":GRDATE:" IS ":INTIME
|
|
PRINT EL
|
|
IF INVALIDTIMES = TRUE THEN
|
|
EL = ''
|
|
EL = "* WARNING - INCOMPLETE RECORD FOR EMPLOYEE ":EMPSAVE
|
|
PRINT EL
|
|
LINECNTR = LINECNTR + 1
|
|
END
|
|
* PRINT
|
|
LINECNTR = LINECNTR + 2
|
|
GRANDTEMP = 0
|
|
RETURN
|
|
*
|
|
* PRINT DATE GRAND TOTAL LINE
|
|
820
|
|
GOSUB 910
|
|
PRINT
|
|
INTIME = GRANDTDATE
|
|
GRDATE = OCONV(DATESAVE,"D2/")
|
|
GOSUB 1000
|
|
EL = ''
|
|
EL = "** GRAND TOTAL FOR ":GRDATE:" IS ":INTIME
|
|
PRINT EL
|
|
* PRINT
|
|
LINECNTR = LINECNTR + 2
|
|
GRANDTDATE = 0
|
|
RETURN
|
|
*
|
|
* PRINT DEPARTMENT GRAND TOTAL LINE
|
|
830
|
|
GOSUB 910
|
|
PRINT
|
|
INTIME = GRANDTDEPT
|
|
GRDATE = OCONV(DATESAVE,"D2/")
|
|
GOSUB 1000
|
|
GL = ''
|
|
GL = "*** GRAND TOTAL FOR DEPT ":DEPTSAVE:" IS ":INTIME
|
|
PRINT GL
|
|
PRINT
|
|
LINECNTR = LINECNTR + 3
|
|
GRANDTDEPT = 0
|
|
RETURN
|
|
*
|
|
* PRINT HEADER
|
|
900
|
|
PAGECNTR = PAGECNTR + 1
|
|
H1 = "PAGE: ":PAGECNTR:SPACE(15):"DEPARTMENT EMPLOYEES TIME CARD REPORT":SPACE(10):PRINTDATE
|
|
H2 = "USER NAME EMPLOYEE DEPT DATE"
|
|
H2 = H2:" PROJECT TIME"
|
|
H3 = "---- -------------------- -------- ------ ----"
|
|
H3 = H3:"---- ------- ----------"
|
|
PRINT H1
|
|
PRINT
|
|
PRINT H2
|
|
PRINT
|
|
PRINT H3
|
|
LINECNTR = 5
|
|
RETURN
|
|
*
|
|
* CHECK PRINT FOR HEADER
|
|
910
|
|
NAMELINE = FALSE
|
|
IF PTRFLAG # "Y" THEN
|
|
IF LINECNTR > PAGESKIP OR LINECNTR = 99 THEN
|
|
IF PAGECNTR # 0 THEN
|
|
CRT @(0,22):CL:"PRESS RETURN TO CONTINUE: ":
|
|
INPUT DUMMY
|
|
END
|
|
GOSUB 900
|
|
NAMELINE = TRUE
|
|
END
|
|
END ELSE
|
|
IF LINECNTR = 99 THEN
|
|
GOSUB 900
|
|
NAMELINE = TRUE
|
|
END
|
|
IF LINECNTR >= 60 THEN
|
|
PRINT CHAR(12)
|
|
GOSUB 900
|
|
NAMELINE = TRUE
|
|
END
|
|
END
|
|
RETURN
|
|
*
|
|
* CONVERT SECONDS TO HOURS:MINUTES.SECONDS
|
|
1000
|
|
OUTHOUR = 0
|
|
OUTMIN = 0
|
|
OUTSEC = 0
|
|
OUTHOUR = INT(INTIME / 3600)
|
|
OUTMIN = INTIME - (OUTHOUR * 3600)
|
|
OUTMIN = INT(OUTMIN / 60)
|
|
OUTSEC = INTIME - ((OUTHOUR * 3600) + (OUTMIN * 60))
|
|
INTIME = ''
|
|
INTIME = OUTHOUR'R#4':":":OUTMIN'R%2':":":OUTSEC'R%2'
|
|
RETURN
|
|
*
|
|
10000
|
|
OPEN 'HP.CONTROL' TO HP.CONTROL THEN
|
|
READ REC132 FROM HP.CONTROL,"16.PITCH" THEN
|
|
PRINT REC132
|
|
END
|
|
END
|
|
RETURN
|
|
*
|
|
11000
|
|
OPEN 'HP.CONTROL' TO HP.CONTROL THEN
|
|
READ REC80 FROM HP.CONTROL,"10.PITCH" THEN
|
|
PRINT REC80
|
|
END
|
|
END
|
|
RETURN
|
|
*
|
|
9999
|
|
CRT @(0,22):CL:"REPORT COMPLETE - PRESS RETURN: ":
|
|
*IF PTRFLAG # "Y" THEN
|
|
*EXECUTE "T80"
|
|
*END
|
|
PRINTER OFF
|
|
INPUT DUMMY
|
|
*
|