Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code calculating 10 hours truck based on 8 hours of work

Status
Not open for further replies.

bailey11

Technical User
Jan 18, 2005
103
US
I have written code that takes the work time entered and distributes 10 hours of truck pay based on the hours entered. If they get truckpay it is always 10 per day no matter how many hours worked.

i.e.,
Job 1, Employee 1, ActivityCode "09000", 3 hours worked, the code puts 3 hours truckpay to "09000" then

Job 2, Employee 1, Activity Code "85000", 5 hours worked, the code puts 5 hours truck to "85000"

the problem.... I need the code to put the last 2 hours to a code (still waiting for the code number, let's say "999999"), but the employee may only have 8 hours for the day and will get paid 10 hours truck.

It will have to be code that calculates not based on the time entry so it can sum the total hours for the day and insert the difference, coorrct?

Thanks, Bailey11
 
Is this correct? [tt]
Job Employee ActivityCode Hours Truck pay
1 1 "09000" 3 3 hours to "09000"
2 1 "85000" 5 5 hours to "85000"
0 1 "99999" 2 2 hours to "99999"
[/tt]

So your 'add truck pay' button would assign truck pay to each activity in an activity cost table and to each employee in an employee pay table, is that right? I think you will need code which, as you say, adds up the hours and assigns any remainder to the holding code.

Just curious, but why is truck pay 1 and not 1.25 hours if an eight hour day is the norm?

 
How are ya bailey11 . . .

Your secnario is ambiguous as far as what the DB should do under certain circumstances. For instance an employee works [blue]3 hours[/blue] gets sick and is sent home for the rest of the day. [blue]According to the rule[/blue] he gets ten hours! . . . As far as paper work is concerned how is this normally handled? . . . how would you intend to handle this in the DB? . . .

Also, for any employee unless its known ahead of time how many jobs/hours will be worked there's no telling until the end of the day what adjustments need to be made!

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Sorry, I couldn't reply ealier. We are in the pipeline industry and the normal workday is 10 hours

I already have code that puts in the truck pay hours as time is entered. As I have thought about it, all I need is code on the form exit that would put in the remainder if the employee didn't have 10 hours that day.

The truckpay is written to the payroll table as well as the time. It is differentiated by a payid, time worked pay id is "0" or "1" based on whether it falls into overtime or not. Truck pay id is always 205.

I need to say something like......
look at each employee and if the total of all "units" (hours) with a code of 205 is less than 10, add 10-units to the time table, with a code of 01-99999.
 
Here is a thought in the shape of a query:

Code:
INSERT INTO tblTime ( EmployeeID, WorkDate, Units, PayID, Code )
SELECT A.EmployeeID, A.WorkDate, 10-[SumOfUnits] AS AddHrs, 205 AS PayID, "1-99999" AS Code
FROM [SELECT EmployeeID, WorkDate, Sum(Units) AS SumOfUnits
FROM tblTime
GROUP BY PayID,EmployeeID,WorkDate
HAVING PayID=205 AND WorkDate=Date() AND Sum(Units)<10]. AS A;

This query will append truck hours 'remainders' to tblTime. An alternative is to use a recordset (or two), and update that in the change event of the truck hours control. I think the best thing might be to run an update as the final step in setting up the weekly pay, to allow for any changes and corrections.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top