crater-invoice/crater

Discount must be calculated before taxes

Seb33300 opened this issue · 1 comments

Describe the bug
The way discount works is wrong.
The discount should be applied before taxes calculation.

My config:

  • tax at item level (tax per item enabled)
  • global discount at invoice level (discount per item disabled)

Example invoice with the actual version:

  • Items subtotal (without taxes) = 110 EUR
  • Total taxes (10%) = 11 EUR
  • Discount = 10 EUR
  • Total to pay = 111 EUR

=> This is wrong because the invoice show a tax total = 11 EUR
=> This means the total without tax = 100 EUR
=> This means tax rate is 11% and not 10% as displayed...

Expected behavior

  • Items subtotal (without taxes) = 110 EUR
  • Discount = 10 EUR
  • Total taxes (10%) = 10 EUR
  • Total to pay = 110 EUR

This is how all invoicing softwares work.

See: https://www.zoho.com/ae/books/vat/faq/supply-vat/vat-with-discounts.html#:~:text=VAT%20is%20calculated%20on%20the%20discounted%20price%20of%20the%20product%2e

Same issue if I enable both tax per product & discount per product options:

image