2.16 DIY Script-Overtime Pay Rate
There 2 results computed by different way of writing the script:
Example,
Salary = 1500.00
Working Day Per Month = 26
Working Hour Per Day = 8
Result with different formula:
1) Set the PayRate formula into V (declared as Double).
Var V: Double;
begin
if OTAmount > 1000 then begin
V := 1000 / WorkingDayPerMonth / WorkingHourPerDay;
PayRate := V;
end else
PayRate := 8;
Final Result = 4.00 Result has been truncated to 4.00 (instead of 4.81) .
=============================================================================================================================
2) Set the PayRate formula into V (declared as Double), but leave 1000 as 1000.00 (with 2 decimals).
Var V: Double;
begin
if OTAmount > 1000 then begin
V := 1000.00 / WorkingDayPerMonth / WorkingHourPerDay;
PayRate := V;
end else
PayRate := 8;
Final Result = 4.80769231
==============================================================================================================================
3) Set the PayRate formula after declare the 1000 as double.
Var V: Double;
begin
if OTAmount > 1000 then begin
V := 1000;
PayRate := V / WorkingDayPerMonth / WorkingHourPerDay;
end else
PayRate := 8;
Final Result = 4.80769231