* * AUTHOR: SCOTT REDMOND * PURPOSE: UTILITY TO MAINTAIN VACATION/SICK ACCRUAL FOR EMPLOYEES * DATE: 03/28/95 * *-------------------------------------------------------------------* * $INCLUDE GEN.COMMON $INCLUDE USER * *-------------------------------------------------------------------* * OPEN 'USER' TO USER.FILE ELSE ABORT 201, 'USER' OPEN 'PROJECT' TO PROJECT ELSE ABORT 201, 'PROJECT' OPEN 'INFO.ACCRUAL' TO INFO.ACCRUAL ELSE ABORT 201, 'INFO.ACCRUAL' OPEN 'PT' TO PT.FILE ELSE ABORT 201, 'PT' OPEN 'CLOCKFILE' TO CLOCKFILE ELSE ABORT 201, 'CLOCKFILE' OPEN 'CM' TO CM ELSE ABORT 201, 'CM' * *-------------------------------------------------------------------* * USER.ADD='' ; USER.REC='' ; TODAY=DATE() ; WT=0 ; FOUND=0 SDATE=ICONV('03/26/94','D') * *-------------------------------------------------------------------* TIME.TABLE='' START=0 FOR X = SDATE TO TODAY STEP 14 START=START+1 TIME.TABLE=INSERT(TIME.TABLE,1,START;X+1) TIME.TABLE=INSERT(TIME.TABLE,2,START;X+14) TIME.TABLE=INSERT(TIME.TABLE,3,START;START) NEXT X * 10 * CRT CS HDG='MICAHTEK & IDM VACATION/SICK TIME ACCRUAL UTILITY' HDL=(80 - LEN(HDG)) / 2 CRT @(0,0):CL:RV:STR(' ',80):ERV CRT @(HDL,0):RV:HDG:ERV: * CRT @(0,22):CL:RV:" ENTER 'B' TO BEGIN PROCESSING :":ERV: INPUT BEGIN.ANS,5 IF BEGIN.ANS[1,1] # 'B' THEN RETURN * CRT @(0,13):CR: EXECUTE "EX PRINTER" CRT @(0,10):CR: * CLEARFILE INFO.ACCRUAL * EOF=0 T=0 SELECT CLOCKFILE LOOP READNEXT ID ELSE EOF=1 UNTIL EOF DO T=T+1 IF REM(T,250)=0 THEN GOSUB 5000 READ CLOCK.REC FROM CLOCKFILE,ID THEN USER.KEY =OCONV(ID,'G0|1') CLOCK.DATE=OCONV(ID,'G1|1') IF CLOCK.DATE=9582 THEN CLOCK.DATE=9583 ;* start date IF CLOCK.DATE < SDATE THEN GO 2000 READ USR.REC FROM USER.FILE,USER.KEY THEN FOUND=FOUND+1 LOCATE(CLOCK.DATE,TIME.TABLE,1;WHR;"AR") THEN NULL POSITON='' IF CLOCK.DATE = TIME.TABLE<1,WHR> THEN POSITION=WHR END ELSE IF CLOCK.DATE <= TIME.TABLE<2,WHR> THEN POSITION=WHR-1 END END PERIOD=TIME.TABLE<3,POSITION> OUT.TIME=0 ; IN.TIME=0 ; DAILY.TIME=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 IN.TIME=CLOCK.REC<1,TIM> END NEXT TIM DAILY.TIME =(DAILY.TIME/60)/60 ;* convert minutes to hours DAILY.HOURS=INT(DAILY.TIME) DAILY.DECI =OCONV(DAILY.TIME,'G1.1')[1,3] TWO.DECI =DAILY.DECI[1,2]'R%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 OUTPUT.HOURS=DAILY.HOURS:TWO.DECI READ INFO.REC FROM INFO.ACCRUAL,USER.KEY ELSE INFO.REC='' IF NOT(NUM(OUTPUT.HOURS)) THEN DEBUG INFO.REC=INFO.REC+OUTPUT.HOURS WRITE INFO.REC ON INFO.ACCRUAL,USER.KEY WT=WT+1 END END 2000 * REPEAT * GOSUB 5000 * 9999 * CRT @(0,22):CL:RV:" COMPLETE :":ERV: INPUT ANY STOP * * 5000 * CRT @(0,10):CL:"RECORDS READ :":T CRT @(0,11):CL:"RECORDS FOUND :":FOUND CRT @(0,12):CL:"RECORDS WRITTEN :":WT RETURN