* MSD.CLOCK.PERFECT * * SCOTT REDMOND * 06/27/94 * * PURPOSE: GENERATE PERFECT ATTENDENCE REPORT FOR PAYROLL * *---------------------------------------------------------------------* * OPEN 'CLOCKFILE' TO CLOCKFILE ELSE ABORT 201, 'CLOCKFILE' OPEN 'CM' TO CM ELSE ABORT 201, 'CM' OPEN 'PERFECT.WORK' TO PERFECT.WORK ELSE ABORT 201, 'PERFECT.WORK' OPEN 'USER' TO USER ELSE ABORT 201, 'USER' * * *----------------* * $INCLUDE GEN.COMMON * *----------------* * T=0 PERF=0 WT=0 OLD.WEEK=0 EOF=0 WEEK=0 PERFECT.SW=0 UTABLE='' REPORT=0 * CRT CS HDG='PERFECT ATTENDENCE REPORT' HDL=(80-(LEN(HDG))) / 2 CRT @(0,0):RV:STR(" ",80):ERV CRT @(HDL,0):RV:HDG:ERV CRT @(0,1):'MSD.CLOCK.PERFECT' * THIS.YEAR=OCONV(DATE(),'DY') DAY=OCONV(DATE(),'DJ') IF DAY <= 182 THEN REPORT=1 END ELSE REPORT=2 END * 100 * CRT @(0,22):CL:RV:" ENTER REPORT YEAR ELSE FOR CURRENT YEAR ":ERV CRT @(23,5):CL:RV:" YEAR OF REPORT :":ERV:" ":THIS.YEAR CRT @(40,5): INPUT YEAR,5 IF YEAR=PF3 THEN GOTO 9000 IF NOT(NUM(YEAR)) THEN GOTO 100 IF YEAR='' THEN YEAR = THIS.YEAR IF LEN(YEAR)=2 THEN YEAR=THIS.YEAR[1,2]:YEAR END CRT @(41,5):CL:YEAR * 200 * CRT @(0,22):CL:RV:" ENTER THE REPORT NUMBER ":ERV CRT @(23,8):CL:RV:" #1 01/01/":YEAR[3,2]:" thru 06/30/":YEAR[3,2]:" ":ERV CRT @(23,10):CL:RV:" #2 07/01/":YEAR[3,2]:" thru 12/31/":YEAR[3,2]:" ":ERV CRT @(23,12):CL:RV:" SELECT REPORT # :":ERV:REPORT CRT @(41,12): INPUT IN.REPORT,4 IF IN.REPORT=PF3 THEN GOTO 9000 IF IN.REPORT='' THEN IN.REPORT=REPORT IF IN.REPORT < 1 OR IN.REPORT > 2 THEN CRT @(0,22):CL:RV:" SELECT REPORT #1 OR REPORT #2 :": INPUT DUMMY GOTO 200 END REPORT=IN.REPORT CRT @(0,5):CR CRT @(22,5):CL:RV:" PERFECT ATTENDENCE REPORT FOR ":YEAR:" ":ERV IF REPORT=1 THEN NDG=" 01/01/":YEAR[3,2]:" thru 06/30/":YEAR[3,2]:" " NDL=(80-(LEN(NDG))) / 2 CRT @(0,8):CL CRT @(NDL,8):RV:NDG:ERV REPORT.ONE.DATE='01/01/':YEAR[3,2] REPORT.TWO.DATE='06/30/':YEAR[3,2] REPORT.ONE=ICONV(REPORT.ONE.DATE,'D') REPORT.TWO=ICONV(REPORT.TWO.DATE,'D') END ELSE NDG=" 07/01/":YEAR[3,2]:" thru 12/31/":YEAR[3,2]:" " NDL=(80-(LEN(NDG))) / 2 CRT @(0,8):CL CRT @(NDL,8):RV:NDG:ERV REPORT.ONE.DATE='07/01/':YEAR[3,2] REPORT.TWO.DATE='12/31/':YEAR[3,2] REPORT.ONE=ICONV(REPORT.ONE.DATE,'D') REPORT.TWO=ICONV(REPORT.TWO.DATE,'D') END * CRT @(23,16):CL:"SEND REPORT TO THE PRINTER (Y/N) :": INPUT PRINT.ANS,15 IF PRINT.ANS = 'Y' THEN PRINT.SW=1 EXECUTE "EX PRINTER" END ELSE PRINT.SW = 0 END * CLEARFILE PERFECT.WORK * *----- time table ----------------------------------------------* CRT @(0,11):CR: * <1>=sunday - first day of week * <2>=saturday - last day of week * ATT.ONE=0 ; ATT.TWO=0 ; TIME.TABLE='' FOR GG = REPORT.ONE TO REPORT.TWO IF OCONV(GG,'DWA')='SUNDAY' THEN ATT.ONE=ATT.ONE+1 TIME.TABLE<1,ATT.ONE>=GG END IF OCONV(GG,'DWA')='SATURDAY' THEN ATT.TWO=ATT.TWO+1 TIME.TABLE<2,ATT.TWO>=GG END NEXT GG * SELECT CLOCKFILE LOOP READNEXT CKEY ELSE EOF=1 UNTIL EOF DO T=T+1 IF REM(T,100)=0 THEN GOSUB 5000 ;* refresh totals CDATE=OCONV(CKEY,'G1|1') CUSER=OCONV(CKEY,'G0|1') IF CDATE >= REPORT.ONE AND CDATE <= REPORT.TWO THEN READ USER.REC FROM USER,CUSER ELSE GO 4999 CU.KEY=CUSER:"*":USER.REC<1>:".":USER.REC<2> READ OUT.REC FROM PERFECT.WORK,CU.KEY ELSE OUT.REC='' LOCATE(CDATE,TIME.TABLE,1;POSITION;"AR") ELSE NULL IF CDATE=TIME.TABLE<1,POSITION> ELSE POSITION=POSITION-1 IF CDATE <= TIME.TABLE<2,POSITION> THEN READ CLOCK.REC FROM CLOCKFILE,CKEY THEN PERIOD=TIME.TABLE<3,POSITION> *----- initialize totals with each user, each day -----* OUT.TIME=0 ; IN.TIME=0 ; DAILY.TIME=0 VAC.TOTAL=0 ; SICK.TOTAL=0 ; HOLIDAY.TOTAL=0 FUNERAL.TOTAL=0 ; JURY.TOTAL=0 ; WORKMANS.TOTAL=0 PERSONAL.TOTAL=0 ; BONUS.TOTAL=0 ; OTHER.TOTAL=0 * TIMCT=DCOUNT(CLOCK.REC<1>,VM) FOR TIM = 1 TO TIMCT ;* calc daily time IF CLOCK.REC<2,TIM>='OFF' THEN OUT.TIME=CLOCK.REC<1,TIM> DAILY.TIME=DAILY.TIME+(OUT.TIME-IN.TIME) END ELSE JOB='' JOB=OCONV(CLOCK.REC<2,TIM>,'G1-1') JOB.TWO=JOB[2,2]'L%3' IF JOB[1,1]='V' THEN ;* compute vacation VAC.TOTAL=VAC.TOTAL+JOB.TWO END IF JOB[1,1]='S' THEN ;* compute sick SICK.TOTAL=SICK.TOTAL+JOB.TWO END IF JOB[1,1]='H' THEN ;* compute holiday HOLIDAY.TOTAL=HOLIDAY.TOTAL+JOB.TWO END IF JOB[1,1]='P' THEN ;* personal PERSONAL.TOTAL=PERSONAL.TOTAL+JOB.TWO END IF JOB[1,1]='F' THEN ;* funeral FUNERAL.TOTAL=FUNERAL.TOTAL+JOB.TWO END IF JOB[1,1]='W' THEN ;* workmans comp. WORKMANS.TOTAL=WORKMANS.TOTAL+JOB.TWO END IF JOB[1,1]='B' THEN ;* bonus day BONUS.TOTAL=BONUS.TOTAL+JOB.TWO END IF JOB[1,1]='J' THEN ;* jury duty JURY.TOTAL=JURY.TOTAL+JOB.TWO END IN.TIME=CLOCK.REC<1,TIM> END NEXT TIM DAILY.TIME =(DAILY.TIME/60)/60 ;* convert seconds to hours DAILY.HOURS=INT(DAILY.TIME) DAILY.DECI =OCONV(DAILY.TIME,'G1.1')[1,3] TWO.DECI =DAILY.DECI[1,2]'L%2' EXTRA.DECI =DAILY.DECI[3,1] IF EXTRA.DECI >= 5 THEN IF TWO.DECI=99 THEN TWO.DECI='00' DAILY.HOURS=DAILY.HOURS+1 END ELSE TWO.DECI=TWO.DECI+1'R%2' END END ELSE IF TWO.DECI=99 THEN TWO.DECI='00' DAILY.HOURS=DAILY.HOURS+1 END END END OTHER.TOTAL =SICK.TOTAL+PERSONAL.TOTAL+WORKMANS.TOTAL OUTPUT.HOURS =DAILY.HOURS:TWO.DECI OUTPUT.HOURS =OUTPUT.HOURS GOOD.HOURS =(OUTPUT.HOURS-OTHER.TOTAL)'R%4' OUT.REC=(OUT.REC+GOOD.HOURS)'R%4' OUT.REC=OCONV(TIME.TABLE<1,POSITION>,'D2/') WRITE OUT.REC ON PERFECT.WORK,CU.KEY WT=WT+1 END END 4999 * REPEAT GOSUB 5000 9000 * STOP * 5000 *--- refresh totals ------------------------------------* CRT @(NDL,14):CL:"ITEMS PROCESSED :":T'L,' CRT @(NDL,15):CL:"ITEMS FOUND :":WT'L,' RETURN