Page 1 of 1

Complete - Tax Calc Error?

PostPosted: Tue Jul 01, 2008 1:56 am
by mattfenton
Hi All,

Not sure if this is a well-known error or not, but we've just come across a potentially big problem with the calculating of discounts on invoices.

As standard, the invoices table calculates the sub total, then the tax total, then subtracts and discount and adds any shipping.

BUT - the discount is removed without taking into account the tax on that discount, so the tax (VAT in our case) amount, and therefore the total amount is wrong.

Example:
Sub total: £250 (in this case, all subject to 17.5% VAT)
Discount total £50 (in this case generated by a 20% discount rate)
Tax total: £43.75 (WRONG, should be 17.5% of £200, not 17.5% of £250)

Luckily, we noticed this before sending out too many new invoices, but could have been a bit embarrassing further down the line!

Is this just an error, or perhaps do we work out our tax amounts in a different way over here??

BTW - I've solved it so far by amending the InvTaxCalc field to subtract (discount total multiplied by the tax rate) from the tax total (We don't ship products, so I'm free to not worry about that box, which would have the same issue I would think). It seems a fairly simple solution, but I'm always worried that a simple change to a calc will trip me up later on - any thoughts?


Otherwise, excellent solution, very very impressed how easy it's been to get us up and running with the main modules whilst still developing add-ons for our own use.

Thanks, Matt

PostPosted: Tue Jul 01, 2008 5:24 am
by John Sindelar
Thanks for the note Matt: glad you're already building add-ons.

This is definitely a bug. I like your solution of subtracting the tax on the discount. We solve it a little differently, by changing the definition of the field Invoice::InvAmountTaxCalc to this...

Code: Select all
Let ( n = Sum ( InvoiceLines::InvLineAmountTaxCalc ) ;

Case (
IsEmpty ( InvDiscountAmountEntry  &  InvDiscountPercent ) ; n ;

not IsEmpty ( InvDiscountPercent ) ; n - ( InvDiscountPercent * n ) ;

not IsEmpty ( InvDiscountAmountEntry ) ; n - ( ( InvDiscountAmountEntry / InvAmountSubtotalCalc ) * n )
))


I think that might work better if you have a mix of taxable and non taxable items.

PostPosted: Thu Jul 03, 2008 4:59 am
by mattfenton
Hi John,

Thanks for the reply - think I will use your amendment - as you say, although we pretty much always charge VAT, there will come a day when there's a 0% item in there.

thanks for the quick reply as always

cheers, Matt

PostPosted: Mon Dec 15, 2008 1:24 am
by netpir
I just bought SeedCode Calender and this bug i still there. I seems that the fix above will solve the problem with discount percent but not if I use flat amount. How do I solve that.

PostPosted: Mon Dec 15, 2008 7:42 am
by John Sindelar
Hi there,

Yes, it is still there. I missed it last time we updated the build! Sorry for the inconvenience.

But the calc above does work for me for both a % discount and a flat discount amount. Depending on which fields you've recently edited you may need to click the "refresh" button next to tax (or take any other action like printing it).

Let me know if you're seeing something different and we'll work it out.