"gllincoln" <
[email protected]> escribió en el mensaje de noticias:
[email protected]...
Hi Gunther,
The question is kind of difficult to follow.
If 40 hours is the basic calculation then you would sum the hours worked for the week (37+4) = 41 so it might be 36 hours regular + 5 hours overtime.
It depends on the nature of the 4 hours overtime - how did that come about? Were all of the hours worked within a single work week?
Here is one scenario; some states (CA for one) have a rule that an employer must pay overtime for any work performed over 8 hours in a day/ and/or over 40 hours in a week.
If the person worked 12 hours on Monday, that would be 8 hrs reg, and 4 hrs overtime. If the person worked 29 hours more that week, say 7, 7, 7, 8 then the last hour worked would also be overtime so the total regular pay hours would be 36 and the overtime hours would be 5.
On the other hand, if the 4 hours overtime was from a previous work period and hadn't been submitted to payroll in a timely manner, then they would not count towards current period hours worked and the payroll calculation would be 37 reg, 4 overtime as stated.
The only way to know how to do the calculation, you have to know the rules that govern the reg time vs. overtime, and also how holidays worked are handled (typically paid double-time) but that calculation is usually made by including the clock time as reg time and adding a holiday pay equal to 8 hours. The rules to be considered include state, federal, and any collective bargaining contract terms. The rules that apply (for the most part) are always interpreted as being those most favorable to the employee, providing the most compensation for the employee.
So the answer to your question is probably
TotalHoursWeek = Reg + Overtime
41 = 37 + 4
if TotalHoursWeek > 40 then Overtime = Overtime + (TotalHoursWeek - 40)
41> 40 so 4=4+(41-40)
Overtime=5
Regular = TotalHoursWeek - Overtime
36 = 41-5
You can code the hours using a system something like one I used for a specific application:
1: Regular Hours
2:Overtime Hours
3
ouble Time Hours
4: Other Hours
5: Other Overtime Hours
6: Other Doubletime Hours
Other Hours include make up time and certain bonus pay based on receiving a certain percentage of hours worked as extra hours of pay for meeting certain productivity goals.
Other Overtime would be make up time that qualified as overtime against the previous pay period. Other hours are coded that way on the timesheet and entered that way by the payroll clerk. All current period work hours are entered as regular time.
Query the time sheet transactions for the given period fields needed to generate the payroll. Then filter this query by employee and sort by date and transaction id ascending. The sum of reg hours worked is determined by stepping through the recordset and adding them up. If the result is equal or less than 40, and no holiday in the period, that is the end of the processing for that employee's pay period. Post to the summary period payroll table and move to the next employee.
The tricky part of this may be that employees might be listed on a timesheet more than once, and on more than one timesheet for a given day. The boundary between regular time and overtime might (and usually does) land in the middle of a particular row of data.
In other words the accumulating time might be 38, the next row found might be 4 hours, now we have part regular and part overtime in the same row of data.
At the end of period, when you are sure no more timesheets are going to be entered for the period, the processing code can split the 'bubble' point.
The code can clone the record where the 4 hours took place (in our example) that put the employee into overtime status, drop the current row to 2 hours, create a new identically cost coded row with 2 hours marked overtime. Then moving through the rest of the recordset for the employee, any additional time would be bumped from code 1 (regular) to code 2 (overtime). The actual calculation at that point is made by subtracting the total accumulated hours worked from 40, if you get a positive value, then perform the split so that the regular time sums up to exactly 40 and any additional time you find in the recordset will be overtime.
There were more checks and considerations involved but these involve elements specific to the locale, the particular set of labor regulations, and the employer's policies.
Hope this helps...
Gordon