[ic] Issue with taxable_amount / total_cost calculating incorrect totals when Discount ENTIRE_ORDER is used

Ron Phipps ron at endpoint.com
Wed Feb 3 01:19:59 UTC 2010


I found this issue while working with a build of 5.5.0 from 2007, and in 
reviewing Interpolate.pm from git HEAD it appears to be the same.

This is more to ask if there is a scenario where taxable_amount should 
be returning negative amounts and what that scenario might look like. 
If we cannot come up with the scenario it might make sense to fix the issue.

Here is the situation, we have a $6 discount in use on a $100 subtotal 
order.  There is $6.00 in shipping and the tax is %9.

If the items in the cart are marked nontaxable the results are as follows:

Subtotal:	100
Ship:		6
SalesTax:	-0.54
Discount:	-6
Total:		$99.46

The problem is that when total_cost calls salestax which in turn calls 
taxable_amount $cost is calculated as -6.00 (the amount of the discount 
since no items are taxed), and this -6.00 is returned to salestax which 
then calculates the tax as -0.54 and is figured into the total cost.

I patched my local copy by adding:

         if ($cost < 0) {
             $cost = 0;
         }

prior to:

	$taxable = $cost;

Thanks,

-- 
Ron Phipps
End Point Corporation
ron at endpoint.com




More information about the interchange-users mailing list