Jump to content

1.6.1.17 Incorrect invoice tax details


overbags

Recommended Posts

Hello to all

I suggest that the error is on the left hand side of the invoice in "tax details" right in the invoice summary the calculation is right

how much a voucher or a discount is in the field on the left DETAIL TAX the amount of the fee is incorrect

Discount products 120.16 €

Good discount - 5.95 €

Tax Detail

Tax rate Base price Total taxes

Products 22,000% 114,21 € 26,43

Shipping 22,000% 15,50 € 3,41 €

That is, taxes are calculated on the total of products to be discounted

how can I fix it? often my customers challenge me this mistake.

Link to comment
Share on other sites

  • 2 weeks later...
  • 7 months later...
  • 4 months later...
Hi,

for those who encounter the problem of calculating VAT on a discount the problem comes from the method of calculation in the cart rules. The calculation does not take into account the VAT or no VAT of the billing address. Example if you have a non-EU customer who does not pay VAT or a customer with an INTRACOMMUNITY VAT number the calculation of the discount will be done with VAT. The bug appears only in the back office in the shopping cart or in the order and in the customer's invoice. So the customer does not see anything in the command tunnel.

Example product at 100 € without VAT with VAT at 20% and a discount of 5% in the basket rule. In France everything is ok, but for an order in DOM / TOM or EU with a VAT N ° INTRA 5% discount are calculated with VAT!

Price without tax 100 €
Discount 5% = 6 € (5 € + 20% VAT = 6 €) instead of 5 €

To fix the problem you have to modify a Prestashop core file classes/CartRules.php inf method
getContextualValue() on line 990 change:
                            $price = $product['price'];
                            if ($use_tax) {
                                $infos = Product::getTaxesInformations($product, $context);
                                $tax_rate = $infos['rate'] / 100;
                                $price *= (1 + $tax_rate);
                            }

by

                            $price = Product::getPriceStatic($product['id_product'], 
                                $use_tax, 
                                isset($product['id_product_attribute']) ? (int)$product['id_product_attribute'] : null,
                                6,
                                null,
                                false,
                                false,
                                $product['cart_quantity']);

That's all folks.

NB: as you are on a 1.6 this fix will unfortunately not be reported in the next updates, only the security and severe bugs are maintained. But the bug is still present in the 1.7 🙂 We will propose the fix.

Edited by Prestashop Addict (see edit history)
Link to comment
Share on other sites

  • 1 month later...
On 11/17/2018 at 9:38 AM, Prestashop Addict said:
Hi,

for those who encounter the problem of calculating VAT on a discount the problem comes from the method of calculation in the cart rules. The calculation does not take into account the VAT or no VAT of the billing address. Example if you have a non-EU customer who does not pay VAT or a customer with an INTRACOMMUNITY VAT number the calculation of the discount will be done with VAT. The bug appears only in the back office in the shopping cart or in the order and in the customer's invoice. So the customer does not see anything in the command tunnel.

Example product at 100 € without VAT with VAT at 20% and a discount of 5% in the basket rule. In France everything is ok, but for an order in DOM / TOM or EU with a VAT N ° INTRA 5% discount are calculated with VAT!

Price without tax 100 €
Discount 5% = 6 € (5 € + 20% VAT = 6 €) instead of 5 €

To fix the problem you have to modify a Prestashop core file classes/CartRules.php inf method
getContextualValue() on line 990 change:

                            $price = $product['price'];
                            if ($use_tax) {
                                $infos = Product::getTaxesInformations($product, $context);
                                $tax_rate = $infos['rate'] / 100;
                                $price *= (1 + $tax_rate);
                            }

by


                            $price = Product::getPriceStatic($product['id_product'], 
                                $use_tax, 
                                isset($product['id_product_attribute']) ? (int)$product['id_product_attribute'] : null,
                                6,
                                null,
                                false,
                                false,
                                $product['cart_quantity']);

That's all folks.

NB: as you are on a 1.6 this fix will unfortunately not be reported in the next updates, only the security and severe bugs are maintained. But the bug is still present in the 1.7 🙂 We will propose the fix.

hi,

your code does not work? Can you be more specific what exactly needs to be replaced.

Thanks.

Link to comment
Share on other sites

  • 1 year later...

Old Topic but for anyone coming here with the same problem:

To have the VAT corrrectly calculated in invoice email with voucher change in classes\PaymentModule.php:

'{total_tax_paid}' => Tools::displayPrice(($order->total_products_wt - $order->total_products) + ($order->total_shipping_tax_incl - $order->total_shipping_tax_excl), $this->context->currency, false)); 

to

'{total_tax_paid}' => Tools::displayPrice(($order->total_paid_tax_incl - $order->total_paid_tax_excl), $this->context->currency, false));

cheers

Link to comment
Share on other sites

  • 10 months later...

I've recently faced the same problem. But I've appealed to my friend, who's been working with such documents much longer than me. And he advised me to use this form https://pdfliner.com/form_w_9. I don't know whether it'll be the same way convinient for you as it's for me. But at least you can give it a try. Hope, that I've managed to help you a little 😊

Link to comment
Share on other sites

  • 3 months later...
En 17/11/2018 a las 9:38 AM, Prestashop Addict dijo:

Price without tax 100 €
Discount 5% = 6 € (5 € + 20% VAT = 6 €) instead of 5 €

To fix the problem you have to modify a Prestashop core file classes/CartRules.php inf method
getContextualValue() on line 990 change:

This is good, but if the discount is fixed, for example 5€.
How to do in this case?

thanks, and sorry for my english.

Link to comment
Share on other sites

  • 10 months later...
On 11/17/2018 at 9:38 AM, Prestashop Addict said:
Hi,

for those who encounter the problem of calculating VAT on a discount the problem comes from the method of calculation in the cart rules. The calculation does not take into account the VAT or no VAT of the billing address. Example if you have a non-EU customer who does not pay VAT or a customer with an INTRACOMMUNITY VAT number the calculation of the discount will be done with VAT. The bug appears only in the back office in the shopping cart or in the order and in the customer's invoice. So the customer does not see anything in the command tunnel.

Example product at 100 € without VAT with VAT at 20% and a discount of 5% in the basket rule. In France everything is ok, but for an order in DOM / TOM or EU with a VAT N ° INTRA 5% discount are calculated with VAT!

Price without tax 100 €
Discount 5% = 6 € (5 € + 20% VAT = 6 €) instead of 5 €

To fix the problem you have to modify a Prestashop core file classes/CartRules.php inf method
getContextualValue() on line 990 change:
                            $price = $product['price'];
                            if ($use_tax) {
                                $infos = Product::getTaxesInformations($product, $context);
                                $tax_rate = $infos['rate'] / 100;
                                $price *= (1 + $tax_rate);
                            }

by

                            $price = Product::getPriceStatic($product['id_product'], 
                                $use_tax, 
                                isset($product['id_product_attribute']) ? (int)$product['id_product_attribute'] : null,
                                6,
                                null,
                                false,
                                false,
                                $product['cart_quantity']);

That's all folks.

NB: as you are on a 1.6 this fix will unfortunately not be reported in the next updates, only the security and severe bugs are maintained. But the bug is still present in the 1.7 🙂 We will propose the fix.

 

On 1/28/2020 at 5:38 PM, Rayna Butler said:

Old Topic but for anyone coming here with the same problem:

To have the VAT corrrectly calculated in invoice email with voucher change in classes\PaymentModule.php:

'{total_tax_paid}' => Tools::displayPrice(($order->total_products_wt - $order->total_products) + ($order->total_shipping_tax_incl - $order->total_shipping_tax_excl), $this->context->currency, false)); 

to

'{total_tax_paid}' => Tools::displayPrice(($order->total_paid_tax_incl - $order->total_paid_tax_excl), $this->context->currency, false));

cheers

Sorry guys, thanks for the effort but those two haven't worked at all. No difference whatsoever.
When you apply a coupon, the separated tax calculations (depending on the product) don't show correctly.

Edit: I have 1.6.1.24, the last version of 1.6

invoice.png

Edited by NixxxoN (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...