I've created the following pull request1992
Here the description:
This is a suggestion for a possible new VAT calculation and should be verified and tested.
There is also a suggestion for an invoice report using iText7 implemented in PdfService7 but not activated yet. You can do this for testing purposes in Nop.Web.Framework\DependencyRegistrar using “builder.RegisterType<PdfService7
The main scope of this change is to implement VAT calculation as used in ERP systems to be compatible with most vat regulations.
There are still some issues that should be clarified:
1) Nop uses InclTax and ExclTax fields like OrderSubtotalInclTax, OrderSubtotalExclTax to maintain both tax settings. This will necessarily lead to rounding problems. The most used approach is to have only one tax setting per document. For instance, the document shows prices including or excluding VAT but not both. This is independent from the overall price setting (with or without VAT) and is only related to the customer setting (private person or company).
2) Nop’s ordertotal is misleading in some way. It should be named “amount to pay” as order total is always the total of all goods and services minus discounts.
3) Discounts do reduce the VAT base amount and therefore they will also reduce VAT. This is atm only the case for the subtotal discount, but this should be also the case for the total discount as implemented with the new calculation. Moreover, there is a similar issue with reward points. Earned reward points are discounts for the next order and should reduce VAT. Please note, that gift cards are different. They do reduce the payment amount and are therefore not relevant for VAT calculation. Hence, there are two distinct case: 1) amounts that do reduce the order base amount and therefore reduce also VAT (discounts, reward points) and 2) amounts that do reduce the payment amount (gift cards or reward points used for that purposes).
4) Tax setup should be enhanced by adding a vat-code. This vat-code plus the vat-rate would then be used to sum up vat. Atm sums are per vat-rate and therefore we can’t distinguish vat exemptions. For instance, there might be a vat-rate of 0% for goods and one of 0% for services. On the invoice you must show two different base amounts with vat = 0 but different VAT exemption description.
1) Added taxSummary Class for VAT calculation. This class sums up line amounts per vat-rate, applies discounts rounding accordingly and calculates VAT per vat-rate and total VAT.
2) Modified roundinghelper: added amount rounding function. It is commonly used to round prices differently from amounts. In the EU prices can be rounded to any precision but amounts have to be rounded to two decimals using midpoint rounding away from zero.
3) Added vat-rate to orderitems and shoppingcartitems.
4) Added order amount and order amount incl. vat.
5) Modified tax display per rate.