[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ic] Negative Sales Tax Problem


Last week we encountered a problem where IC (ver 5.4) allowed several customers to check out with a negative sales-tax value and a positive grand total. Investigation showed that this situation occurred when:
   (a) All the merchandise in the cart was non-taxable, and
   (b) an entire-order discount was in place.

We fixed the immediate problem by adjusting sub taxable_amount in Interpolate.pm. We changed only the last line of the routine as follows:
   --- return $taxable;
   +++ return ($taxable > 0) ? $taxable : 0;

But ours was an edge case. Imagine instead a cart with a mix of taxable and non-taxable merchandise, where the discount exceeds the value of the taxable merchandise. The current code will return a negative value, and our patch above would return a value of zero as the taxable subototal. But should the discount discount wipe out _all_ the tax in this case? Should we perhaps compute the reduction of the taxable subtotal proportionally as per the lines below?

# $taxable contains taxable amount summed from item loop as per current code
   return $taxable unless $::Discounts->{ENTIRE_ORDER};

# this can be computed more efficiently by accumulating the item-subtotal's in the item loop earlier in the code
   my $grand = subtotal() + $::Discounts->{ENTIRE_ORDER};
   return 0 unless $grand;

   $taxable -= $discount * ($taxable / $grand);
   return sprintf("%0.2f",$taxable);

Or is there a better way still?

Thanks!

_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.