tldm-universe/CMS/BP.CLOCK/CLOCK.ABSENT.DEPT

394 lines
11 KiB
Plaintext
Raw Normal View History

2024-09-10 19:25:06 +00:00
*-------------------------------------------------------------------------*
* CLOCK.ABSENT.DEPT
* AUTHOR : AL SURLES
* DATE : 26 AUG 91
* PURPOSE : To list individuals who where absent in
* whole or part of a day.
* COPIED : From CLOCK.ABSENT.RPT on 08-21-92 by STEVE MOFFETT.
*
* Program would not report fact of persons being absent all day, and would
* report only if worked less than 7 hours.
* Added Department Groups and Day ONE of Pay Period.
*-------------------------------------------------------------------------*
$INCLUDE GEN.COMMON
PROMPT " "
BLT=0; CHK=0; FND=0
WHO=ICONV('','U50BB')
PORT=FIELD(WHO,' ',1)
CRT CS
CRT @(0,0):"CLOCK.ABSENT.DEPT"
CRT @(0,1):RV:SPACE(80):ERV
HD="LIST PERSONNEL WHO WERE ABSENT"
HDL=(80-LEN(HD))/2
CRT @(HDL,1):RV:HD:ERV
CRT @(28,2):RV:" ALL OR PART OF THE DAY ":ERV
*-------------------------------------------------------------------------*
OPEN 'CLOCKFILE' TO CLF ELSE ABORT 201,"CLOCKFILE"
OPEN 'USER' TO USER ELSE ABORT 201,"USER"
OPEN 'ABSENT.WORKFILE,':PORT TO ABW ELSE
EXECUTE "CREATE-FILE DATA ABSENT.WORKFILE,":PORT:" 11,4"
OPEN 'ABSENT.WORKFILE,':PORT TO ABW ELSE ABORT 201,'ABSENT.WORKFILE,':PORT
END
OPEN 'ABSENT.WORKFILE,D':PORT TO ABD ELSE
EXECUTE "CREATE-FILE DATA ABSENT.WORKFILE,D":PORT:" 37,4"
OPEN 'ABSENT.WORKFILE,D':PORT TO ABD ELSE ABORT 201,'ABSENT.WORKFILE,D':PORT
END
*-------------------------------------------------------------------------*
10 *
CRT @(0,3):CR
CRT @(31,22):'Enter / to Escape'
CRT @(5,5):"ENTER Day ONE of PAY PERIOD :":
INPUT DFIRST
IF DFIRST="" OR DFIRST="/" THEN GO 999
DFIRST=ICONV(DFIRST,'D')
IF REM(8533-DFIRST,14)=0 THEN
DLAST=DFIRST+13
CRT @(46,5):OCONV(DFIRST,"D2/"):' thru ':OCONV(DLAST,"D2/")
END ELSE
CRT @(0,22):BEEP:CL:"DATE NOT VALID--ENTRY MUST BE DAY ONE OF PAY PERIOD - HIT RETURN -->":
INPUT ANY
GO 10
END
*-------------------------------------------------------------------------*
20 *
DEPTINDIV="D"
LOOP
CRT @(0,6):CR
CRT @(17,22):"Enter / to Escape or < to backup to PAY PERIOD"
CRT @(5,6):"Enter DEPT or INDIVIDUAL (D/I) :":
INPUT @(46,6):DEPTINDIV
IF DEPTINDIV="" OR DEPTINDIV="/" THEN GO 999
IF DEPTINDIV="<" THEN GO 10
UNTIL DEPTINDIV="D" OR DEPTINDIV="I" DO REPEAT
IF DEPTINDIV='D' THEN
CRT @(46,6):"DEPARTMENT"
GO 30
END ELSE
CRT @(46,6):"INDIVIDUAL"
GO 40
END
*-------------------------------------------------------------------------*
30 *
CRT @(0,7):CR
CRT @(13,7):'DEPARTMENT GROUPS'
CRT @(10,8):RV:' 1 - DON BELL '
CRT @(10,9):' 2 - AL SURLES '
CRT @(10,10):' 3 - GENE GREGG '
DEPT.RESPONSE=''
*
35 *
*
CRT @(0,16):CR
CRT @(13,22):"Enter / to Escape or < to backup to DEPT or INDIVIDUAL"
CRT @(5,16):"Enter DEPARTMENT GROUP number or 'ALL' : ":
INPUT @(46,16):DEPT.RESPONSE
IF DEPT.RESPONSE="" OR DEPT.RESPONSE="/" THEN GO 999
IF DEPT.RESPONSE="<" THEN GO 20
IF DEPT.RESPONSE='ALL' OR DEPT.RESPONSE='A' ELSE
IF DEPT.RESPONSE GE 1 AND DEPT.RESPONSE LE 7 ELSE
CRT @(0,22):CL:BEEP:'Enter a number between 1 and 7 or ALL - HIT RETURN -->':
INPUT ANY,3
GO 35
END
END
DEPT=DEPT.RESPONSE
GO 50
*-------------------------------------------------------------------------*
40 *
INDIV=''
CRT @(0,7):CR
CRT @(13,22):"Enter / to Escape or < to backup to DEPT or INDIVIDUAL"
CRT @(5,7):"Enter INDIVIDUAL USER # (EX : 9999) : ":
INPUT @(46,7):INDIV
IF INDIV="" OR INDIV="/" THEN GO 999
IF INDIV="<" THEN GO 20
READ ANY FROM USER,INDIV THEN
DISP=' ':ANY<1>:' ':ANY<2>:' '
CRT @(51,7):RV:DISP[1,28]:ERV
END ELSE
CRT @(0,22):BEEP:RV:" This is not a VALID USER # - Try Again ":ERV:
RQM; RQM
GO 40
END
GO 50
*-------------------------------------------------------------------------*
50 *
OUTPUT.RESPONSE="Y"
IF DEPTINDIV='D' THEN
CRT @(5,17):"OUTPUT TO PRINTER (Y/N) : ":
END ELSE
CRT @(5,8):"OUTPUT TO PRINTER (Y/N) : ":
END
CRT @(15,22):"Enter / to Escape or < to backup to previous field"
IF DEPTINDIV='D' THEN
INPUT @(46,17):OUTPUT.RESPONSE
END ELSE
INPUT @(46,8):OUTPUT.RESPONSE
END
IF OUTPUT.RESPONSE="" OR OUTPUT.RESPONSE="/" THEN GO 999
IF OUTPUT.RESPONSE="<" THEN
IF DEPTINDIV="D" THEN GO 35 ELSE GO 40
END
IF OUTPUT.RESPONSE='Y' OR OUTPUT.RESPONSE='N' ELSE GO 50
GOSUB 1100
*-------------------------------------------------------------------------*
IF DEPTINDIV="D" THEN
HD="PERSONNEL in DEPT '":DEPT.RESPONSE:"' that were ABSENT in WHOLE or PART"
END ELSE
HD="INDIVIDUAL # '":INDIV:"' that was ABSENT in WHOLE or PART"
END
LNG=LEN(HD)
XLNG=63-LNG
YLNG=XLNG/2
XLNG=YLNG
IF XLNG+YLNG+LNG > 80 THEN YLNG=YLNG-1 ; * IN CASE IS 1 TO LONG
HDLN1=SPACE(28):"INTERNAL DATA MANAGEMENT"
HDLN2=SPACE(24):"FROM ":OCONV(DFIRST,'D2/'):" - ":OCONV(DLAST,'D2/')
HDLN3=SPACE(60):"HOURS"
HDLN4='USER #':SPACE(4):'FULL NAME':SPACE(21):'DAY':SPACE(7):'DATE':SPACE(6):'WORKED':SPACE(3):'DEPARTMENT'
TODAY=DATE()
*-------------------------------------------------------------------------*
CLEARFILE ABW
CLEARFILE ABD
EOF=0
SELECT USER
LOOP
READNEXT ID ELSE EOF=1
UNTIL EOF DO
READ USER.REC FROM USER,ID THEN
IF DEPTINDIV='D' THEN
IF DEPT.RESPONSE[1,1] NE 'A' THEN
OK=0
CK=USER.REC<5>
BEGIN CASE
CASE DEPT.RESPONSE=1
IF CK='504' THEN OK=1
CASE DEPT.RESPONSE=2
IF CK='512' THEN OK=1
CASE DEPT.RESPONSE=3
IF CK='506' OR CK='507' OR CK='508' OR CK='513' THEN OK=1
CASE DEPT.RESPONSE=4
IF CK='500' OR CK='501' OR CK='502' OR CK='503' OR CK='505' OR CK='509' OR CK='514' OR CK='515' THEN OK=1
CASE DEPT.RESPONSE=5
* IF CK='511' OR CK='518' OR CK='524' THEN OK=1
IF CK='511' THEN OK=1
CASE DEPT.RESPONSE=6
IF CK='510' THEN OK=1
CASE DEPT.RESPONSE=7
IF CK='517' THEN OK=1
END CASE
END ELSE
OK=1;* ALL specified.
END
IF OK THEN GOSUB 3000;* Build work record.
END ELSE
IF INDIV=ID THEN GOSUB 3000;* Build work record.
END
END
REPEAT
GOSUB 1100; RQM; RQM
*-------------------------------------------------------------------------*
EOF=0
SELECT CLF
LOOP
READNEXT ID ELSE EOF=1
UNTIL EOF DO
TM=0
CHK=CHK+1
READ CLF.REC FROM CLF,ID THEN
REC.DATE=OCONV(ID,"G1|1")
KEY=OCONV(ID,"G0|1")
IF DEPTINDIV='I' THEN IF INDIV NE KEY THEN GO 100
IF REC.DATE >= DFIRST AND REC.DATE <= DLAST AND REC.DATE LT TODAY THEN
TR.CNT=DCOUNT(CLF.REC<1>,VM)
FOR B=1 TO TR.CNT
Y=B+1
FOR Z=Y TO TR.CNT
IF CLF.REC<2,Z> = "OFF" THEN
TM=TM+(CLF.REC<1,Z>-CLF.REC<1,B>)
B=Z
Z=9999
END
NEXT Z
NEXT B
KEY=OCONV(ID,"G0|1")
READ USER.REC FROM USER,KEY THEN
IF DEPTINDIV='D' THEN
IF DEPT.RESPONSE # 'ALL' THEN
CK=USER.REC<5>
BEGIN CASE
CASE DEPT.RESPONSE=1
IF CK='504' ELSE GO 100
CASE DEPT.RESPONSE=2
IF CK='512' ELSE GO 100
CASE DEPT.RESPONSE=3
IF CK='506' OR CK='507' OR CK='508' OR CK='513' ELSE GO 100
CASE DEPT.RESPONSE=4
IF CK='500' OR CK='501' OR CK='502' OR CK='503' OR CK='505' OR CK='509' OR CK='514' OR CK='515' ELSE GO 100
CASE DEPT.RESPONSE=5
IF CK='511' OR CK='518' OR CK='524' ELSE GO 100
CASE DEPT.RESPONSE=6
IF CK='510' ELSE GO 100
CASE DEPT.RESPONSE=7
IF CK='517' ELSE GO 100
CASE 1; GO 100
END CASE
END
READ WORK.REC FROM ABD,KEY THEN
LOCATE(REC.DATE,WORK.REC,1;WH) THEN
WORK.REC<3,WH>=TM
END
WRITE WORK.REC ON ABD,KEY
END
END
END
END
END
100 *
IF REM(CHK,500)=0 THEN GOSUB 1000
REPEAT
GOSUB 1000; RQM; RQM
*-------------------------------------------------------------------------*
GOSUB 1200;* REFRESH
EOF=0
SELECT ABD
LOOP
READNEXT KEY ELSE EOF=1
UNTIL EOF DO
READ ABD.REC FROM ABD,KEY THEN
READ USER.REC FROM USER,KEY THEN
DCT=DCOUNT(ABD.REC<1>,VM)
FOR I=1 TO DCT
DT=ABD.REC<1,I>
IF DT LT TODAY THEN
DAY=ABD.REC<2,I>
IF DAY='SAT' OR DAY='SUN' ELSE
TM=ABD.REC<3,I>
IF TM < 28800 THEN
WORK.REC=""
WORK.REC<1>=KEY
WORK.REC<2>=TRIM(USER.REC<1>:" ":USER.REC<2>)
WORK.REC<3>=OCONV(ABD.REC<1,I>,"DWA")
WORK.REC<4>=OCONV(ABD.REC<1,I>,"D2/")
WORK.TM=TM/60
WORK.REC<5>=WORK.TM/60
TEMP=WORK.REC<5>-INT(WORK.REC<5>)
TEMP=INT(TEMP*60)
WORK.REC<5>=INT(WORK.REC<5>): ":" : TEMP'R%2'
WORK.REC<6>=USER.REC<5>;* DEPT
WORK.REC<7>=USER.REC<2>;* LNAME
WORK.REC<8>=USER.REC<1>;* FNAME
WRITE WORK.REC ON ABW,KEY:'*':ABD.REC<1,I>
FND=FND+1
IF REM(FND,10)=0 THEN GOSUB 1200
END
END
END
NEXT I
END
END
REPEAT
GOSUB 1200
*-------------------------------------------------------------------------*
*
IF OUTPUT.RESPONSE="Y" THEN
PRINTER ON
EXECUTE 'SP-ASSIGN F6'
END
GOSUB 2000
PRINTER OFF
PRINT
PRINT @(0,22):CL:RV:" JOB COMPLETED - HIT RETURN ":ERV:
INPUT DUMMY
999 * END OF JOB
EXECUTE "DELETE-FILE DATA ABSENT.WORKFILE,":PORT
EXECUTE "DELETE-FILE DATA ABSENT.WORKFILE,D":PORT
STOP
*-------------------------------------------------------------------------*
1000 * REFRESH SCREEN
CRT @(0,19):CR
CRT @(24,19):"NUMBER OF RECORDS CHECKED :":CHK:
RETURN
*-------------------------------------------------------------------------*
1100 * REFRESH *
CRT @(0,18):CR
CRT @(24,18):"NUMBER OF WORK RECORDS BUILT:":BLT:
RETURN
*-------------------------------------------------------------------------*
1200 * REFRESH *
CRT @(0,20):CR
CRT @(24,20):"NUMBER OF RECORDS FOUND :":FND:
RETURN
*-------------------------------------------------------------------------*
2000 * PRINT ITEM
PCNT=0
STR=STR("=",79)
STR1=STR("-",79)
PGCNT=1
PGHED=0
EOF=0
DEPT.HOLD=''
EXECUTE "SSELECT ABSENT.WORKFILE,":PORT:" BY DEPT BY DATE BY LNAME BY FNAME"
LOOP
READNEXT KEY ELSE EOF=1
UNTIL EOF DO
READ ABW.REC FROM ABW,KEY THEN
IF ABW.REC<6> NE DEPT.HOLD THEN
PGHED=0; PGCNT=1; DEPT.HOLD=ABW.REC<6>
END
IF PGHED ELSE
PRINT CHAR(12)
PRINT HDLN1
PRINT
HDLN=OCONV(DATE(),"D2"):SPACE(XLNG):HD:SPACE(YLNG):"PAGE ":PGCNT'R#3'
PRINT HDLN
PRINT HDLN2
PRINT
PRINT HDLN3
PRINT HDLN4
PRINT STR
PRINT
PGCNT=PGCNT+1
PGHED=1
PCNT=0
END
PRINT ABW.REC<1>'L#10':ABW.REC<2>'L#30':ABW.REC<3>[1,3]'L#8':ABW.REC<4>'L#12':ABW.REC<5>'L#9':ABW.REC<6>'L#5'
PRINT
PRINT STR1
PCNT=PCNT+1
IF OUTPUT.RESPONSE="N" THEN
IF REM(PCNT,4)=0 THEN
CRT RV:" HIT RETURN TO CONTINUE ":ERV:
INPUT ANY
CRT CS
PGHED=0
END
END ELSE
IF REM(PCNT,17)=0 THEN
PGHED=0
END
END
END
REPEAT
RETURN
*-------------------------------------------------------------------------*
3000 * BUILD WORK RECORD *
READ WORK.REC FROM ABD,ID ELSE
WORK.REC=''
CT=1
FOR I=DFIRST TO DLAST
DT=DFIRST+CT-1;* DATE
WORK.REC<1,CT>=DT
CK=OCONV(DT,'DWA')[1,3]
IF CK='SAT' OR CK='SUN' THEN
WORK.REC<2,CT>=CK;* POST WEEKEND DAYS
END
CT=CT+1
NEXT I
WRITE WORK.REC ON ABD,ID
BLT=BLT+1
IF REM(BLT,25)=0 THEN GOSUB 1100;* REFRESH
END
RETURN
*-------------------------------------------------------------------------*