Thanks for reading my post.
I'm working on a payroll db and stumped on understanding why I'm getting rounding errors in a totals querry that calculates total pay.
I start with a query that calculates hours worked (in minutes) from tblLaborHours. TimeStart, LunchStart, LuchEnd, TimeEnd - all are Date/Time data type fields.
All the various times are calculated for each record TotHrs: DateDiff("n",[TimeStart],[TimeEnd]) resulting in total minutes, ect.
From a totals query I get the total hours per day and determine any OT and DT.
Now I join the totals query with a MaxOfPayRate from tblPayRate ([PayRate] and [PayRateC] are currency data types)
I get no rounding errors in the calculation for regular pay calc
RegPay: IIf([RateType]=1,([TotHrs]/60)*[PayRate],IIf([RateType]=2,([TotHrs]/60)*[PayRateC],0))
I do get the rounding errors for the overtime calc - RateType 2 employees are commissioned piece workers and their rate for OT is derived by taking their commissions earned for the week / by the number of hours worked * 1.5 resulting in [PayCommOTRate]
OTPay: IIf([RateType]=1,([OTHrs]/60)*([PayRate]*1.5),IIf([RateType]=2,(([OTHrs]/60)*[qryCommOTRate].[PayCommOTRate]),),0))
Any help would be much appreciated!
I'm working on a payroll db and stumped on understanding why I'm getting rounding errors in a totals querry that calculates total pay.
I start with a query that calculates hours worked (in minutes) from tblLaborHours. TimeStart, LunchStart, LuchEnd, TimeEnd - all are Date/Time data type fields.
All the various times are calculated for each record TotHrs: DateDiff("n",[TimeStart],[TimeEnd]) resulting in total minutes, ect.
From a totals query I get the total hours per day and determine any OT and DT.
Now I join the totals query with a MaxOfPayRate from tblPayRate ([PayRate] and [PayRateC] are currency data types)
I get no rounding errors in the calculation for regular pay calc
RegPay: IIf([RateType]=1,([TotHrs]/60)*[PayRate],IIf([RateType]=2,([TotHrs]/60)*[PayRateC],0))
I do get the rounding errors for the overtime calc - RateType 2 employees are commissioned piece workers and their rate for OT is derived by taking their commissions earned for the week / by the number of hours worked * 1.5 resulting in [PayCommOTRate]
OTPay: IIf([RateType]=1,([OTHrs]/60)*([PayRate]*1.5),IIf([RateType]=2,(([OTHrs]/60)*[qryCommOTRate].[PayCommOTRate]),),0))
Any help would be much appreciated!