SUBROUTINE MSD.TIME.ACCRUAL * * AUTHOR: SCOTT REDMOND * DATE: 03/20/95 * PURPOSE: CALC HOURS WORKED AND ACCRUAL TOTALS FROM: * 1 - CLOCK FILE USER RECORDS * 2 - PROJECT FILE RECORDS * 3 - MANAGER'S RECORDS (MANUALLY ENTERED M-0-16-4) * *-------------------------------------------------------------------* * $INCLUDE GEN.COMMON $INCLUDE USER $INCLUDE SUPPORT.RECORD * *-------------------------------------------------------------------* * OPEN 'PC.CLIENT' TO PC.CLIENT ELSE ABORT 201, 'PC.CLIENT' OPEN 'USER' TO USER.FILE ELSE ABORT 201, 'USER' OPEN 'CUSTOMER.TRANS' TO CUSTOMER.TRANS ELSE ABORT 201, 'CUSTOMER.TRANS' 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 'CLOCK.GEN.KEYS' TO CLOCK.GEN.KEYS ELSE ABORT 201, 'CLOCK.GEN.KEYS' OPEN 'CM' TO CM ELSE ABORT 201, 'CM' OPEN 'HP.CONTROL' TO HP.CONTROL ELSE ABORT 201, 'HP.CONTROL' OPEN 'INFO.HIST' TO INFO.HIST ELSE ABORT 201, 'INFO.HIST' * *-------------------------------------------------------------------* * USER.ADD='' ; USER.REC='' ; TODAY=DATE() * *-------------------------------------------------------------------* 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 @(20,5):CL:RV:" STEP 1 - PROCESS CLOCKFILE RECORDS ":ERV CRT @(20,7):CL:RV:" STEP 2 - PROCESS PROJECT RECORDS ":ERV CRT @(20,9):CL:RV:" STEP 3 - PROCESS MANAGER'S RECORDS ":ERV * READ JEN.REC FROM CLOCK.GEN.KEYS,"NEXT.PAY.PERIOD" ELSE * * NOTE: IF CLOCK.GEN.KEYS ITEM "NEXT.PAY.PERIOD" IS MISSING: * 1.) FIND THE LATEST IN THE USER FILE. * 2.) ADD ONE DAY TO THAT. * 3.) EDIT THE CLOCK.GEN.KEYS ITEM AND PUT THAT DATE * IN ATTRIBUTE ONE OF THAT ITEM. * 4.) START THIS PROCESS OVER AGAIN. * CRT @(0,22):CL:BEEP:RV:" SERIOUS ERROR - CLOCK.GEN.KEYS (NEXT.PAY.PERIOD) MISSING! ":ERV: INPUT ANY,3 STOP END * READ TASK.REC FROM CLOCK.GEN.KEYS,"TASK.ASSIGNMENTS" ELSE * * NOTE: IF CLOCK.GEN.KEYS ITEM "TASK.ASSIGNMENTS" IS MISSING: * fields are multi-valued....... * <1> VACATION TASK NUMBERS * <2> SICK TASK NUMBERS * <3> HOLIDAY TASK * <4> FUNERAL/BEREAVEMENT TASK * <5> PERSONAL TIME TASK * <6> BONUS TASK (PERFECT ATTEND) * <7> WORKMANS COMP TIME TASK * <8> JURY DUTY TASK * CRT @(0,22):CL:BEEP:RV:" SERIOUS ERROR - CLOCK.GEN.KEYS (TASK.ASSIGNMENTS) MISSING! ":ERV: INPUT ANY,3 STOP END PAY.BEGIN=JEN.REC<1> PASSWORD=CHAR(73):CHAR(88):CHAR(79):CHAR(89):CHAR(69) 2010 * CRT @(20,12):CL:RV:" PAY PERIOD BEGIN DATE :":ERV:" ":OCONV(PAY.BEGIN,'D') PAY.END=PAY.BEGIN+13 CRT @(20,14):CL:RV:" PAY PERIOD ENDING DATE:":ERV:" ":OCONV(PAY.END,'D') * CRT @(0,22):CL:RV:" ENTER 'B' TO BEGIN PROCESSING :":ERV: INPUT BEGIN.ANS,5 IF BEGIN.ANS[1,1] # 'B' THEN RETURN IF PAY.END >= TODAY THEN CRT @(0,22):CL:BEEP:RV:" ACTIVE PAY PERIOD! TRY AGAIN ON ":OCONV(PAY.END+1,'D'):" :":ERV: INPUT ANY,3 GO 10 END CRT @(0,22):CL:RV:" SELECTING FILE...PLEASE WAIT! ":ERV: * GOSUB 35000 ;* verify manager records have been updated since last pay * JEN.REC<1>=PAY.END+1 WRITE JEN.REC ON CLOCK.GEN.KEYS,"NEXT.PAY.PERIOD" CRT @(60,5):CL:RV:" <===== ":ERV: * 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) ;* first day of pay period TIME.TABLE=INSERT(TIME.TABLE,2,START;X+14) ;* last day of pay period TIME.TABLE=INSERT(TIME.TABLE,3,START;START) ;* period number (ref.) TIME.TABLE=INSERT(TIME.TABLE,4,START;X+7) ;* last day of first wk. NEXT X *---- process and accrue clockfile records-----------------------* * *GO 2600 ;* TEMP CLEARFILE INFO.ACCRUAL * EOF=0 ; T=0 ; FILE.ACCESS='CLOCK FILE' SELECT CLOCKFILE LOOP READNEXT ID ELSE EOF=1 UNTIL EOF DO T=T+1 IF REM(T,2000)=0 THEN GOSUB 2900 ;* refresh totals USER.KEY =OCONV(ID,'G0|1') CLOCK.DATE=OCONV(ID,'G1|1') IF CLOCK.DATE < PAY.BEGIN OR CLOCK.DATE > PAY.END THEN GO 2300 READ CLOCK.REC FROM CLOCKFILE,ID THEN IF CLOCK.DATE=9582 THEN CLOCK.DATE=9583 ;* start date IF CLOCK.DATE < SDATE THEN GO 2300 READ USR.REC FROM USER.FILE,USER.KEY THEN IF USR.REC# 'C' THEN GO 2300 ;* time clock employee FOUND=FOUND+1 LOCATE(CLOCK.DATE,TIME.TABLE,1;WHR;"AR") THEN NULL POSITION='' 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> LAST.DAY.OF.WEEK=TIME.TABLE<4,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 ; OTHER.TOTAL=0 FUNERAL.TOTAL=0 ; JURY.TOTAL=0 ; WORKMANS.TOTAL=0 PERSONAL.TOTAL=0 ; BONUS.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'L%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='' OTHER.TOTAL=OTHER.TOTAL+VAC.TOTAL+SICK.TOTAL+HOLIDAY.TOTAL OTHER.TOTAL=OTHER.TOTAL+FUNERAL.TOTAL+PERSONAL.TOTAL+BONUS.TOTAL OTHER.TOTAL=OTHER.TOTAL+JURY.TOTAL+WORKMANS.TOTAL INFO.REC=INFO.REC+OUTPUT.HOURS ;* add hours INFO.REC=TIME.TABLE<1,POSITION> ;* beginning period date INFO.REC=TIME.TABLE<2,POSITION> ;* ending period date INFO.REC=INFO.REC+VAC.TOTAL ;* vacation hours INFO.REC=INFO.REC+SICK.TOTAL ;* sick hours used INFO.REC=INFO.REC+HOLIDAY.TOTAL ;* holiday hours INFO.REC=INFO.REC+OTHER.TOTAL ;* other hours INFO.REC=INFO.REC+FUNERAL.TOTAL ;* funeral hours INFO.REC=INFO.REC+PERSONAL.TOTAL ;* personal hours INFO.REC=INFO.REC+BONUS.TOTAL ;* bonus hours INFO.REC=INFO.REC+JURY.TOTAL ;* jury hours INFO.REC=INFO.REC+WORKMANS.TOTAL;* work comp hours *---- check for overtime in the first week --------------------* IF CLOCK.DATE <= LAST.DAY.OF.WEEK THEN IF INFO.REC-OTHER.TOTAL > 4000 THEN FIRST.WEEK.OT=(INFO.REC-OTHER.TOTAL)-4000 INFO.REC=FIRST.WEEK.OT END END *CRT @(0,8):CR: *CRT 'CLOCK DATE ':OCONV(CLOCK.DATE,'D2/') *CRT 'LAST DAY WK ':OCONV(LAST.DAY.OF.WEEK,'D2/') *CRT 'INFO.REC 1 ':INFO.REC *CRT 'OTHER TOTAL ':OTHER.TOTAL *CRT 'FIRST WK OT ':FIRST.WEEK.OT *CRT 'INFO REC 20 ':INFO.REC *INPUT ANY *--------------------------------------------------------------* WRITE INFO.REC ON INFO.ACCRUAL,USER.KEY WT=WT+1 END END 2300 * REPEAT * * 2400 *--- process project (programmers) records ---------------* CRT @(60,5):CL: CRT @(60,7):CL:RV:" <===== ":ERV: * GOSUB 40000 ;* verify tasks (vac, sick, funeral, etc.) * * EOF=0 ; T=0 ; WT=0 ; FILE.ACCESS='PROJECT' * LOCATE(PAY.BEGIN,TIME.TABLE,1;BEGIN.ATT) THEN NULL LOCATE(PAY.END,TIME.TABLE,2;END.ATT) THEN NULL * SELECT CUSTOMER.TRANS * LOOP READNEXT ID ELSE EOF=1 UNTIL EOF DO T=T+1 TASK.NO=ID IF REM(T,100)=0 THEN GOSUB 2900 ;* refresh totals READ CUST.REC FROM CUSTOMER.TRANS,ID ELSE GO 2460 TRANCT=DCOUNT(CUST.REC,VM) FOR XGG = 1 TO TRANCT ACTION.DATE=CUST.REC USER.KEY=CUST.REC[2,4] READ QREC FROM USER.FILE,USER.KEY ELSE GO 2449 IF QREC # 'P' THEN GO 2449 BILL.CODE=CUST.REC BILL.CLIENT=CUST.REC IF ACTION.DATE >= PAY.BEGIN AND ACTION.DATE <= PAY.END THEN IF CUST.REC='30' THEN MINUTES=0 MINUTES=CUST.REC IF MINUTES > 0 THEN DAILY.TIME =MINUTES/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]'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'L%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 LOCATE(ACTION.DATE,TIME.TABLE,1;WHR;"AR") THEN NULL POSITION='' IF ACTION.DATE = TIME.TABLE<1,WHR> THEN POSITION=WHR END ELSE IF ACTION.DATE <= TIME.TABLE<2,WHR> THEN POSITION=WHR-1 END END PERIOD=TIME.TABLE<3,POSITION> READ INFO.REC FROM INFO.ACCRUAL,USER.KEY ELSE INFO.REC='' BEGIN CASE CASE BILL.CODE=1 ;*---- billable client hours ------* INFO.REC=INFO.REC+OUTPUT.HOURS LOCATE(BILL.CLIENT,INFO.REC,PERIOD,16;WHRR;"AL") THEN INFO.REC=INFO.REC+OUTPUT.HOURS END ELSE INFO.REC=INSERT(INFO.REC,PERIOD,16,WHRR;BILL.CLIENT) INFO.REC=INSERT(INFO.REC,PERIOD,17,WHRR;OUTPUT.HOURS) END CASE BILL.CODE=2 ;*------ service cont. client hours--* INFO.REC=INFO.REC+OUTPUT.HOURS LOCATE(BILL.CLIENT,INFO.REC,PERIOD,16;WHRR;"AL") THEN INFO.REC=INFO.REC+OUTPUT.HOURS END ELSE INFO.REC=INSERT(INFO.REC,PERIOD,16,WHRR;BILL.CLIENT) INFO.REC=INSERT(INFO.REC,PERIOD,18,WHRR;OUTPUT.HOURS) END CASE BILL.CODE=3 ;*------ free hours-----------------* INFO.REC=INFO.REC+OUTPUT.HOURS LOCATE(BILL.CLIENT,INFO.REC,PERIOD,16;WHRR;"AL") THEN INFO.REC=INFO.REC+OUTPUT.HOURS END ELSE INFO.REC=INSERT(INFO.REC,PERIOD,16,WHRR;BILL.CLIENT) INFO.REC=INSERT(INFO.REC,PERIOD,19,WHRR;OUTPUT.HOURS) END CASE 1 ;*--- if not 1,2 or 3 then force it 3 -------* INFO.REC=INFO.REC+OUTPUT.HOURS END CASE * LOCATE(TASK.NO,TASK.REC,1;FND) THEN ;* vacation task INFO.REC=INFO.REC+OUTPUT.HOURS INFO.REC=INFO.REC+OUTPUT.HOURS END LOCATE(TASK.NO,TASK.REC,2;FND) THEN ;* sick task INFO.REC=INFO.REC+OUTPUT.HOURS INFO.REC=INFO.REC+OUTPUT.HOURS END LOCATE(TASK.NO,TASK.REC,3;FND) THEN ;* holiday task INFO.REC=INFO.REC+OUTPUT.HOURS INFO.REC=INFO.REC+OUTPUT.HOURS END LOCATE(TASK.NO,TASK.REC,4;FND) THEN ;* funeral task INFO.REC=INFO.REC+OUTPUT.HOURS INFO.REC=INFO.REC+OUTPUT.HOURS END LOCATE(TASK.NO,TASK.REC,5;FND) THEN ;* personal task INFO.REC=INFO.REC+OUTPUT.HOURS INFO.REC=INFO.REC+OUTPUT.HOURS END LOCATE(TASK.NO,TASK.REC,6;FND) THEN ;* bonus task INFO.REC=INFO.REC+OUTPUT.HOURS INFO.REC=INFO.REC+OUTPUT.HOURS END LOCATE(TASK.NO,TASK.REC,7;FND) THEN ;* workmans task INFO.REC=INFO.REC+OUTPUT.HOURS INFO.REC=INFO.REC+OUTPUT.HOURS END LOCATE(TASK.NO,TASK.REC,8;FND) THEN ;* jury task INFO.REC=INFO.REC+OUTPUT.HOURS INFO.REC=INFO.REC+OUTPUT.HOURS END INFO.REC=INFO.REC+OUTPUT.HOURS ;* add hours INFO.REC=TIME.TABLE<1,POSITION> ;* beginning period date INFO.REC=TIME.TABLE<2,POSITION> ;* ending period date WRITE INFO.REC ON INFO.ACCRUAL,USER.KEY WT=WT+1 END END END 2449 * NEXT XGG 2460 * REPEAT * 2600 *---- select file & determine hours accrued/used (non-manager)--* * EOF=0 ; T=0 ; WT=0 ; FILE.ACCESS='USER FILE' * LOCATE(PAY.BEGIN,TIME.TABLE,1;BEGIN.ATT) THEN NULL LOCATE(PAY.END,TIME.TABLE,2;END.ATT) THEN NULL * SELECT INFO.ACCRUAL LOOP READNEXT ID ELSE EOF=1 UNTIL EOF DO T=T+1 IF REM(T,25)=0 THEN GOSUB 2900 ;* refresh totals TOTAL.HOURS=0 ; VAC.HOURS=0 ; OT.HOURS=0 ; SICK.HOURS=0 HOL.HOURS=0 ; OTHER.HOURS=0 ; ACCRUAL.HOURS=0 WORKED.HOURS=0 ; BONUS.HOURS=0 ; JURY.HOURS=0 WORKMANS.HOURS=0 ; PERSONAL.HOURS=0 ; FUNERAL.HOURS=0 FIRST.WEEK.OT=0 ; SECOND.WEEK.OT=0 ; REG.OUT.HOURS=0 READ IREC FROM INFO.ACCRUAL,ID THEN FOR XTX = BEGIN.ATT TO END.ATT TOTAL.HOURS=TOTAL.HOURS+IREC VAC.HOURS =IREC ;* vacation hours used SICK.HOURS =IREC ;* sick hours used HOL.HOURS =IREC ;* holiday hours used OTHER.HOURS =IREC FUNERAL.HOURS =IREC PERSONAL.HOURS =IREC BONUS.HOURS =IREC JURY.HOURS =IREC WORKMANS.HOURS =IREC BILL.ONE =IREC BILL.TWO =IREC BILL.THREE =IREC BILL.CLIENT =IREC BILL.CLIENT.HRS =IREC SERVICE.HOURS =IREC FREE.HOURS =IREC FIRST.WEEK.OT =IREC WORKED.HOURS=TOTAL.HOURS-OTHER.HOURS IF FIRST.WEEK.OT=0 OR FIRST.WEEK.OT='' THEN IF WORKED.HOURS > 8000 THEN OT.HOURS=WORKED.HOURS-8000 END ELSE OT.HOURS=0 END END ELSE SECOND.WEEK=WORKED.HOURS-FIRST.WEEK.OT IF SECOND.WEEK > 8000 THEN SECOND.WEEK.OT=SECOND.WEEK-8000 OT.HOURS=FIRST.WEEK.OT+SECOND.WEEK.OT END ELSE OT.HOURS=FIRST.WEEK.OT END END IF WORKED.HOURS >= 8000 THEN ACCRUAL.HOURS=8000 END ELSE ACCRUAL.HOURS=WORKED.HOURS END REG.HOLD=ACCRUAL.HOURS REG.OUT.HOURS=ACCRUAL.HOURS-FIRST.WEEK.OT-SECOND.WEEK.OT ACCRUAL.HOURS=OCONV(ACCRUAL.HOURS,'MR2') READU USERX FROM USER.FILE,ID THEN * IF USERX='P' THEN * IF REG.OUT.HOURS > 8000 THEN REG.OUT.HOURS='8000' * END *---- check for probation ----------* USERX=USERX+90 *---- check for part time ----------* IF USERX='P' THEN PART.TIME=1 ELSE PART.TIME='' *---- check for managers ----------* IF USERX='M' THEN GO 2699 *---- check for inactive status-----* IF USERX#'A' THEN GO 2699 *-----------------------------------* IF TODAY <= USERX+365 THEN ;* 0-1 year USERX='3.33' END IF TODAY >= USERX+365 THEN ;* 2-9 year USERX='6.67' END IF TODAY >= USERX+3650 THEN ;* ten year USERX='10' END IF USERX='M' THEN ;* manager rate USERX='10' END IF PART.TIME THEN USERX='0' CALC.FACTOR=USERX *--- factors per John Longley 04/03/95 -------* IF CALC.FACTOR='3.33' THEN CALC.FACTOR='.020492' IF CALC.FACTOR='6.67' THEN CALC.FACTOR='.042735' IF CALC.FACTOR='10' THEN CALC.FACTOR='.066964' VAC.ACCRUAL=ACCRUAL.HOURS*CALC.FACTOR VAC.ONE=OCONV(VAC.ACCRUAL,'G0.1') VAC.TWO=OCONV(VAC.ACCRUAL,'G1.1')'L%2' VAC.ACCRUAL=VAC.ONE:VAC.TWO[1,2] IF CALC.FACTOR='.066964' THEN CALC.FACTOR='.042735' ;* max sick SIK.ACCRUAL=ACCRUAL.HOURS*CALC.FACTOR SIK.ONE=OCONV(SIK.ACCRUAL,'G0.1') SIK.TWO=OCONV(SIK.ACCRUAL,'G1.1')'L%2' SIK.ACCRUAL=SIK.ONE:SIK.TWO[1,2] * GOSUB 50000 ;* round all hours to nearest .25hr * * USERX =REG.HOLD USERX =REG.OUT.HOURS IF PART.TIME THEN ;* reduce but not accrue vac USERX =OT.HOURS USERX =0 USERX =0 USERX=0 USERX =0 USERX=0 USERX=0 USERX=VAC.HOURS USERX =0 USERX =TOTAL.HOURS USERX =OTHER.HOURS USERX =PAY.END USERX=USERX-VAC.HOURS USERX=BILL.ONE USERX=BILL.TWO USERX=BILL.THREE USERX=BILL.CLIENT USERX=BILL.CLIENT.HRS USERX=SERVICE.HOURS USERX=FREE.HOURS END ELSE USERX =OT.HOURS USERX =HOL.HOURS USERX=VAC.HOURS USERX =SICK.HOURS USERX =TOTAL.HOURS USERX =FUNERAL.HOURS USERX=PERSONAL.HOURS USERX =BONUS.HOURS USERX=WORKMANS.HOURS USERX=JURY.HOURS USERX =OTHER.HOURS USERX =PAY.END USERX=USERX+VAC.ACCRUAL-VAC.HOURS USERX=USERX+SIK.ACCRUAL-SICK.HOURS USERX=BILL.ONE USERX=BILL.TWO USERX=BILL.THREE USERX=BILL.CLIENT USERX=BILL.CLIENT.HRS USERX=SERVICE.HOURS USERX=FREE.HOURS END HIST.KEY=ID:"*":PAY.BEGIN WRITE USERX ON USER.FILE,ID ; WT=WT+1 WRITE USERX ON INFO.HIST,HIST.KEY END RELEASE USER.FILE,ID NEXT XTX END 2699 * REPEAT * * 2700 *--- calculate managers totals ---------------------------* * CRT @(60,7):CL: CRT @(60,9):CL:RV:" <===== ":ERV: * EOF=0 ; T=0 ; WT=0 ; FILE.ACCESS='MANAGER' * LOCATE(PAY.BEGIN,TIME.TABLE,1;BEGIN.ATT) THEN NULL LOCATE(PAY.END,TIME.TABLE,2;END.ATT) THEN NULL * SELECT USER.FILE LOOP READNEXT ID ELSE EOF=1 UNTIL EOF DO T=T+1 IF REM(T,25)=0 THEN GOSUB 2900 ;* refresh totals READ MAN.REC FROM USER.FILE,ID ELSE GO 2799 IF MAN.REC='M' OR MAN.REC='O' ELSE GO 2799 TOTAL.HOURS=0 ; VAC.HOURS=0 ; OT.HOURS=0 ; SICK.HOURS=0 HOL.HOURS=0 ; OTHER.HOURS=0 ; ACCRUAL.HOURS=0 WORKED.HOURS=0 ; BONUS.HOURS=0 ; JURY.HOURS=0 WORKMANS.HOURS=0 ; PERSONAL.HOURS=0 ; FUNERAL.HOURS=0 * TOTAL.HOURS=OCONV(MAN.REC,'MR2') VAC.HOURS =OCONV(MAN.REC,'MR2') SICK.HOURS =OCONV(MAN.REC,'MR2') HOL.HOURS =OCONV(MAN.REC,'MR2') OT.HOURS =OCONV(MAN.REC,'MR2') BONUS.HOURS =OCONV(MAN.REC,'MR2') JURY.HOURS =OCONV(MAN.REC,'MR2') WORKMANS.HOURS =OCONV(MAN.REC,'MR2') PERSONAL.HOURS =OCONV(MAN.REC,'MR2') FUNERAL.HOURS =OCONV(MAN.REC,'MR2') OTHER.HOURS =OCONV(MAN.REC,'MR2') * ACCRUAL.HOURS =TOTAL.HOURS-OTHER.HOURS *---- check for inactive status-----* IF MAN.REC#'A' THEN GO 2799 *-----------------------------------* IF MAN.REC # 'M' THEN GO 2799 *-----------------------------------* IF MAN.REC='M' THEN CALC.FACTOR='.066964' IF MAN.REC='O' THEN IF TODAY <= USERX+365 THEN ;* 0-1 year USERX='3.33' END IF TODAY >= USERX+365 THEN ;* 2-9 year USERX='6.67' END IF TODAY >= USERX+3650 THEN ;* ten year USERX='10' END IF USERX='M' THEN ;* manager rate USERX='10' END IF PART.TIME THEN USERX='0' CALC.FACTOR=USERX *--- factors per John Longley 04/03/95 -------* IF CALC.FACTOR='3.33' THEN CALC.FACTOR='.020492' IF CALC.FACTOR='6.67' THEN CALC.FACTOR='.042735' IF CALC.FACTOR='10' THEN CALC.FACTOR='.066964' END VAC.ACCRUAL=ACCRUAL.HOURS*CALC.FACTOR VAC.ONE=OCONV(VAC.ACCRUAL,'G0.1') VAC.TWO=OCONV(VAC.ACCRUAL,'G1.1')'L%2' VAC.ACCRUAL=VAC.ONE:VAC.TWO[1,2] IF CALC.FACTOR='.066964' THEN CALC.FACTOR='.042735' ;* max sick SIK.ACCRUAL=ACCRUAL.HOURS*CALC.FACTOR SIK.ONE=OCONV(SIK.ACCRUAL,'G0.1') SIK.TWO=OCONV(SIK.ACCRUAL,'G1.1')'L%2' SIK.ACCRUAL=SIK.ONE:SIK.TWO[1,2] MAN.REC =MAN.REC MAN.REC =MAN.REC MAN.REC =MAN.REC MAN.REC=MAN.REC MAN.REC =MAN.REC MAN.REC =MAN.REC MAN.REC =MAN.REC MAN.REC=MAN.REC MAN.REC=MAN.REC MAN.REC =MAN.REC MAN.REC=MAN.REC MAN.REC =MAN.REC MAN.REC =PAY.END MAN.REC=MAN.REC+VAC.ACCRUAL-VAC.HOURS MAN.REC =MAN.REC+SIK.ACCRUAL-SICK.HOURS *--- clear next info attributes -----* MAN.REC =0 MAN.REC =0 MAN.REC =0 MAN.REC =0 MAN.REC =0 MAN.REC =0 MAN.REC =0 MAN.REC =0 MAN.REC =0 MAN.REC =0 MAN.REC =0 MAN.REC =0 HIST.KEY=ID:"*":PAY.BEGIN WRITE MAN.REC ON USER.FILE,ID ; WT=WT+1 WRITE MAN.REC ON INFO.HIST,HIST.KEY RELEASE USER.FILE,ID 2799 * REPEAT * * CRT @(0,22):CL:RV:" PROCESS COMPLETE :":ERV: INPUT ANY,3 IF ANY='A' THEN GO 10 RETURN 2900 *--- refrsh processing totals ----------------------------* LINE='' LINE=FILE.ACCESS:" RECORDS READ :" CRT @(20,16):CR:LINE'L#25':":":T'L,' CRT @(20,17):CL:"RECORDS FOUND :":WT'L,' RETURN * 35000 *---- verify manager records have been updated since last pay ---* EOF=0 MAN.TABLE='' SELECT USER.FILE LOOP READNEXT MANAGER ELSE EOF=1 UNTIL EOF DO READ MREC FROM USER.FILE,MANAGER THEN IF MREC='M' THEN IF MREC='M' THEN IF MREC < PAY.BEGIN THEN MAN.TABLE=MAN.TABLE:" ":MREC END END END END REPEAT IF MAN.TABLE# '' THEN CRT @(0,21):CR:BEEP:RV:STR(' ',80):ERV: CRT @(2,21):RV:"Manager records have not been updated for:":ERV: CRT @(0,22):CR:BEEP:RV:STR(' ',80):ERV: CRT @(1,22):RV:MAN.TABLE<1>'L#78':ERV: INPUT ANY,2 GO 10 END RETURN * 40000 *---- load tasks into gen.keys for vac,sick,funeral etc-----* CRT @(0,22):CL:RV:" VERIFYING TASK ASSIGNMENTS...PLEASE WAIT! ":ERV: TASK.TABLE='' ; TASK.UPDATE='' TASK.TABLE='VACATION':AM:'SICK':AM:'HOLIDAY':AM:'BEREAVE' TASK.TABLE=TASK.TABLE:AM:'PERSONAL':AM:'BONUS':AM:'WORKMAN' TASK.TABLE=TASK.TABLE:AM:'JURY DUT' TASK.COUNT=DCOUNT(TASK.TABLE,AM) EOF=0 T=0 SELECT CUSTOMER.TRANS * LOOP READNEXT KEY ELSE EOF=1 UNTIL EOF DO T=T+1 IF REM(T,500)=0 THEN CRT @(0,22):CL:RV:" VERIFYING TASK ASSIGNMENTS...":T'L,':" ":ERV: END READ TRANS.REC FROM CUSTOMER.TRANS,KEY THEN STCT=DCOUNT(TRANS.REC,VM) FOR YY = 1 TO STCT STATEMENT=TRANS.REC FOR ZZ = 1 TO TASK.COUNT TRY=INDEX(STATEMENT,TASK.TABLE,1) IF TRY > 0 THEN LOCATE(KEY,TASK.REC,ZZ;WHR) ELSE TASK.REC=INSERT(TASK.REC,ZZ,1;KEY) WRITE TASK.REC ON CLOCK.GEN.KEYS,"TASK.ASSIGNMENTS" TASK.UPDATE=1 END END NEXT ZZ NEXT YY END REPEAT RETURN * * 50000 *--- round all hours to nearest quarter hour (.25)--------* TABLE=REG.OUT.HOURS:VM:TOTAL.HOURS:VM:VAC.HOURS:VM:OT.HOURS:VM:SICK.HOURS TABLE=TABLE:VM:HOL.HOURS:VM:OTHER.HOURS:VM:ACCRUAL.HOURS TABLE=TABLE:VM:WORKED.HOURS:VM:BONUS.HOURS:VM:JURY.HOURS TABLE=TABLE:VM:WORKMANS.HOURS:VM:PERSONAL.HOURS:VM:FUNERAL.HOURS * NUMCT=DCOUNT(TABLE<1>,VM) CRT @(0,8):CR: FOR KJ = 1 TO NUMCT ADJUST.TOT=TABLE<1,KJ> CRT 'ADJUST TOTAL ':ADJUST.TOT ADJUST.TOT=ADJUST.TOT'R26' CRT 'ADJUST TOTAL ':ADJUST.TOT ADJUST.ONE=OCONV(ADJUST.TOT,'G0.1') CRT 'ADJUST ONE ':ADJUST.ONE ADJUST.TWO=OCONV(ADJUST.TOT,'G1.1') CRT 'ADJUST TWO ':ADJUST.TWO IF ADJUST.TWO < 13 THEN ADJUST.TWO='00' IF ADJUST.TWO >= 13 AND ADJUST.TWO < 38 THEN ADJUST.TWO=25 IF ADJUST.TWO >= 38 AND ADJUST.TWO < 63 THEN ADJUST.TWO=50 IF ADJUST.TWO >= 63 AND ADJUST.TWO < 88 THEN ADJUST.TWO=75 IF ADJUST.TWO >= 88 AND ADJUST.TWO <= 99 THEN ADJUST.TWO='00' ADJUST.ONE=ADJUST.ONE+1 END TABLE<1,KJ>=ADJUST.ONE:ADJUST.TWO CRT 'ADJUST ONE ':ADJUST.ONE CRT 'ADJUST TWO ':ADJUST.TWO CRT 'NEW TOTAL ':TABLE<1,KJ> INPUT ANY,3 NEXT KJ REG.OUT.HOURS=TABLE<1,1> TOTAL.HOURS=TABLE<1,2> VAC.HOURS =TABLE<1,3> OT.HOURS =TABLE<1,4> SICK.HOURS =TABLE<1,5> HOL.HOURS =TABLE<1,6> OTHER.HOURS=TABLE<1,7> BONUS.HOURS=TABLE<1,10> JURY.HOURS =TABLE<1,11> WORKMANS.HOURS=TABLE<1,12> PERSONAL.HOURS=TABLE<1,13> FUNERAL.HOURS =TABLE<1,14> RETURN