xpfilms Posted February 3, 2007 Posted February 3, 2007 I need to change the formula used to calculate or round up/down taxes. I have a problem: Here is the deal: During checkout OS makes the following calculation: Item Price: 18.95 Shipping : 3.35 Subtotal: 22.30 Tax (8% Applied to both item and shipping in my state): 1.79 Total: 24.09 BUT the tax should be 1.78. It seems that OS is either: 1. incorrectly rounding up (22.30 x .08 = 1.784 which should be 1.78) 2. or incorrectly rounding the tax of each item first and then adding them (18.95 x.08 = 1.516 rounded to 1.52 PLUS 3.35 x .08 = 0.268 rounded to .27 Equals 1.79. Anyone know where is the problem or a possible fix? I spend about 2 hours searching but the rounding issues people seem to have are related to other modifications. Could someone tell me in what file is tax calculated? I want to try to find where the error is. Thanks. xp. Quote
Terra Posted February 3, 2007 Posted February 3, 2007 I need to change the formula used to calculate or round up/down taxes. I have a problem: Here is the deal: During checkout OS makes the following calculation: Item Price: 18.95 Shipping : 3.35 Subtotal: 22.30 Tax (8% Applied to both item and shipping in my state): 1.79 Total: 24.09 BUT the tax should be 1.78. It seems that OS is either: 1. incorrectly rounding up (22.30 x .08 = 1.784 which should be 1.78) 2. or incorrectly rounding the tax of each item first and then adding them (18.95 x.08 = 1.516 rounded to 1.52 PLUS 3.35 x .08 = 0.268 rounded to .27 Equals 1.79. Anyone know where is the problem or a possible fix? I spend about 2 hours searching but the rounding issues people seem to have are related to other modifications. Could someone tell me in what file is tax calculated? I want to try to find where the error is. Thanks. xp. The rounding bug is an old (and stubborn) osCom bug which is related to the number of digits used to store prices in the db & the functions used to handle prices (currency, tax) calculations. Your second assumption (that the item is rounded first) is correct. It's not a problem related to any contrib but a generic osCom issue .. most shop owners have taken the pragmatic approach that customers won't bail out of a purchase because of a 0.01 difference. more info in these threads: http://www.oscommerce.com/forums/index.php?sho...c=80953&hl= http://www.oscommerce.com/forums/index.php?sho...=currency+round all the best - Terra Quote My code for combining PayPal IPN with ** QTPro 4.25 ** osC Affiliate ** CCGV(trad) and how to solve the invoice already paid error General info: Allow customer to delete order comment ** FTP Programs & Text Editors ** Amending order email **
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.