I have a tax calculation of 8 brackets for each employee based on Advanced Percent (Tax Bracket Alternate) calculation type.
The problem is if the amount(gross) is equal to the minimum wage, it results in wrong value and doubles the deduction. If the amount is not equal to min. wage, the result is accurate.
Example:
Amount(gross) = 7,500
Percent: 15%
Min. wage = 7,500
Max. wage = 9,167
Annual Fixed Amount: 104.17
Results doubles:
Withholding Tax: 104.13
Withholding Tax: 104.17
That totals to 208.3 for a YTD amount in a single payperiod!
The result should be 104.17 by this calculation if I understood correctly the Advanced Percent (Tax Bracket Alt.):
Tax = ((Amount - min. wage) * Percent) + Annual Fixed Amount.
Tax = ((0)*15%)+104.17
Tax = ( zero ) + 104.17
Tax = 104.17
Am I doing something wrong here, or there is a problem in the calculation "Advanced Percent (Tax Bracket Alt.)?
Thank you...
Allan E. Registos
Bug in Advanced Percent (Tax Bracket Alternate)?
-
- Posts: 41
- Joined: Wed Oct 21, 2009 11:56 pm
- Location: Philippines
- Contact:
Re: Bug in Advanced Percent (Tax Bracket Alternate)?
What version of TimeTrex are you using?
How many pay periods do you have in a year?
How many pay periods do you have in a year?
-
- Posts: 41
- Joined: Wed Oct 21, 2009 11:56 pm
- Location: Philippines
- Contact:
Re: Bug in Advanced Percent (Tax Bracket Alternate)?
I am using TimeTrex Standard version 3.0.5.shaunw wrote:What version of TimeTrex are you using?
How many pay periods do you have in a year?
I have semi-monthly pay periods, i.e., 24 pay periods per year.
I look at the code, and it seems it is this file: classes/modules/users/UserDeductionFactory.class.php.
The exact code I think is this:
Code: Select all
if ( $amount >= $min_wage AND $amount <= $max_wage ) {
$retval = bcadd( bcmul( bcsub( $amount, $min_wage ) , bcdiv($percent, 100) ), $annual_fixed_amount);
}
Re: Bug in Advanced Percent (Tax Bracket Alternate)?
I'm not sure I follow, the code you quoted looks pretty much identical to the formula you specified. Where do you think the error in the formula is?
-
- Posts: 41
- Joined: Wed Oct 21, 2009 11:56 pm
- Location: Philippines
- Contact:
Re: Bug in Advanced Percent (Tax Bracket Alternate)?
Yes, it is the same, and I really don't know where in the code, even if I modified the code to look this way, to make sure that if this condition is true -> ($amount = $min_wage) thenshaunw wrote:I'm not sure I follow, the code you quoted looks pretty much identical to the formula you specified. Where do you think the error in the formula is?
return value must be set to $retval = $annual_fixed_amount,
Code: Select all
if ( $amount >= $min_wage AND $amount <= $max_wage ) {
$retval = bcadd( bcmul( bcsub( $amount, $min_wage ) , bcdiv($percent, 100) ), $annual_fixed_amount);
}
if ($amount == $min_wage){
$retval = $annual_fixed_amount;
}
It is easy to reproduce this same scenario in a fresh installation that I will try later.
-
- Posts: 41
- Joined: Wed Oct 21, 2009 11:56 pm
- Location: Philippines
- Contact:
Re: Bug in Advanced Percent (Tax Bracket Alternate)?
I installed a fresh 3.0.6 version, setup tax brackets:
Just for ME1/S1 this time. I created two sample employees, then put a gross amount of 8958 and 13542.
This doubles the result:
Note that I have two tax deductions, which is supposedly one only. For more information, please see attached PDF paystub.
Code: Select all
Exemption 0.00 0.00 20.83 104.17 354.17 937.50 2083.33 5208.33
status 0% 5% 10% 15% 20% 25% 30% 32% =( + percent over)
1. ME1/S1 1 3,125 3,542 4,375 6,042 8,958 13,542 23,958
Just for ME1/S1 this time. I created two sample employees, then put a gross amount of 8958 and 13542.
This doubles the result:
Code: Select all
Total Gross 13,542.00
Deductions Amount YTD Amount | Deductions Amount YTD Amount
Withholding Tax 2,083.33 4,166.83 | Withholding Tax 2,083.50 0.00
Total Deductions 4,166.83 4,166.83
- Attachments
-
- PayStubList.pdf
- (1.1 MiB) Downloaded 548 times
Re: Bug in Advanced Percent (Tax Bracket Alternate)?
I don't follow you at all, in your first post the bracket was 7500-9500, now you are talking 8,958 and 13,542.
In order to figure out whats going on, you should disable/delete all brackets except one and start there. You will also need to provide a screenshot of your one bracket (Edit Tax/Deduction page), and a screenshot of the resulting pay stub, and what you feel the result should be. Only then can we begin to make progress.
Just a note, you do realize the Tax/Deduction values are annual amounts correct? When you create a single pay stub with a gross of 8958, this is multiplied by the number of pay periods in a year before its compared to the tax brackets. So if you want to test a tax bracket of 7500-9500 you need to take 7500/<total pay payperiods/year> = Total Gross for one pay period.
7500/26PPs (bi-weekly) = $288.46 Gross Pay in a single pay period. This also makes it extremely difficult to have an employee actually earn the exact amount necessary to match the bracket exactly due to rounding (288.46*26 = 7499.96, so this amount would actually not have any taxes taken off). The last thing is that since the brackets all compare with >= and <=, you're brackets must have not matching values, ie:
Incorrect Way:
7500-9500
9500-12000
12000-15000
Correct Way:
7500-9500
9501-12000
12001-15000
In order to figure out whats going on, you should disable/delete all brackets except one and start there. You will also need to provide a screenshot of your one bracket (Edit Tax/Deduction page), and a screenshot of the resulting pay stub, and what you feel the result should be. Only then can we begin to make progress.
Just a note, you do realize the Tax/Deduction values are annual amounts correct? When you create a single pay stub with a gross of 8958, this is multiplied by the number of pay periods in a year before its compared to the tax brackets. So if you want to test a tax bracket of 7500-9500 you need to take 7500/<total pay payperiods/year> = Total Gross for one pay period.
7500/26PPs (bi-weekly) = $288.46 Gross Pay in a single pay period. This also makes it extremely difficult to have an employee actually earn the exact amount necessary to match the bracket exactly due to rounding (288.46*26 = 7499.96, so this amount would actually not have any taxes taken off). The last thing is that since the brackets all compare with >= and <=, you're brackets must have not matching values, ie:
Incorrect Way:
7500-9500
9500-12000
12000-15000
Correct Way:
7500-9500
9501-12000
12001-15000
-
- Posts: 41
- Joined: Wed Oct 21, 2009 11:56 pm
- Location: Philippines
- Contact:
Re: Bug in Advanced Percent (Tax Bracket Alternate)?
The 7500-9500 range is one example. I have just tested a different value with the same $amount=$min_wage.shaunw wrote:I don't follow you at all, in your first post the bracket was 7500-9500, now you are talking 8,958 and 13,542.
Yes, I did this, except the screenshot.shaunw wrote: In order to figure out whats going on, you should disable/delete all brackets except one and start there. You will also need to provide a screenshot of your one bracket (Edit Tax/Deduction page), and a screenshot of the resulting pay stub, and what you feel the result should be. Only then can we begin to make progress.
Shaunw, I think you just have found my problem, I am making the brackets in the incorrect way! My bad! Thanks a lot for helping us out!shaunw wrote: Just a note, you do realize the Tax/Deduction values are annual amounts correct? When you create a single pay stub with a gross of 8958, this is multiplied by the number of pay periods in a year before its compared to the tax brackets. So if you want to test a tax bracket of 7500-9500 you need to take 7500/<total pay payperiods/year> = Total Gross for one pay period.
7500/26PPs (bi-weekly) = $288.46 Gross Pay in a single pay period. This also makes it extremely difficult to have an employee actually earn the exact amount necessary to match the bracket exactly due to rounding (288.46*26 = 7499.96, so this amount would actually not have any taxes taken off). The last thing is that since the brackets all compare with >= and <=, you're brackets must have not matching values, ie:
Incorrect Way:
7500-9500
9500-12000
12000-15000
Correct Way:
7500-9500
9501-12000
12001-15000