14,603,916 members
Rate this:
See more:
Hello guys,

I'm thinking of building an overtime system for my company using PHP and MySQL and would like some help from you guys regarding translating the Overtime rate formula into PHP language.

The Formula looks like this :

if the worker works on range time of
6 a.m to 10p.m - the rate should be:
total claim hours = hours of working * 1.125

else
if she/he works from 10pm to 6am, - the rate should be:
total claim hours = hours of working * 1.25

example : I am using two select list of time which allow the user to choose start and
and end time.
Let say the user choose start time as 12am and end time 8am
hours of working should be = 8 hours
but the calculation need to be done in both rate
6 hours * 1.25 (this is for 12am to 6am) = 7.50
2 hours * 1.125 (this is for 6am to 8am) = 2.25

so the total hours claim should be = 7.50 + 2.25
= 9.75
can any one help me with this?
thank you .
Posted

Rate this:

## Solution 1

Here[^] would be a good place to start.