BatGo Posted January 25, 2022 Share Posted January 25, 2022 Hi, I'm creating a merchand website under 1.7.5 but I noticed that I've got a 1 cent € error between my local order software and Prestashop. After investigation : the difference is about the VAT. And it's incredible that no one talk about that on Internet. So I decided to install a new Presta (last version) to check if the problem was on my configuration or not. So not. To reproduce the problem : it's very simple. Back Office : Set the B2B and HT price (French setup / 20% VAT). Create a product (default VAT 20%) with combination. Just add 1 declination with the price of 0.70€ HT (and a large stock) Set a specific price : -25% from qtty 250 Add a delivery 12€ HT. Font Office : add 459 to your basket and check it. Here you are a product line : 0.70 * 459 * 0.75 = 240.975€ = 240.98€ HT (line round). Add 12€ HT delivery So total is 240.98 + 12 = 252.98 € HT (prestashop is okay with me). There : all is right. But not apply the VAT. 252.98 * 1.2 = 303.576 € TTC So.. 303.58€ for normal people but 303.57€ for Prestashop. What’s happened ? VAT calculator : 50.59 instaed of 50.6€ (and it's written 50.59 on the bill). The absolute only way that I found to get the same result is to calculate the VAT after everythings and to not round anywhere : (0.7*459*0.75+12)*1.2 = 303.57€ I think VAT calculation does not respect the previous round line. Thanks. Baptiste. Link to comment Share on other sites More sharing options...
BatGo Posted January 25, 2022 Author Share Posted January 25, 2022 https://support.facturation.pro/hc/fr/articles/210223943-Quelle-est-la-règle-appliquée-pour-le-calcul-de-la-TVA-#:~:text=La méthode dite de "l,enfin arrondir le résultat final. (topics in french) It's related about sum before or after rounded. Link to comment Share on other sites More sharing options...
BatGo Posted January 26, 2022 Author Share Posted January 26, 2022 html\src\Core\Cart\CartRow.php protected function applyRound() ou protected function applyRound() //selon la version { ... case self::ROUND_MODE_LINE: // round line result $tva_found = $this->initialUnitPrice->getTaxIncluded()/$this->initialUnitPrice->getTaxExcluded(); //ADD $this->finalTotalPrice = new AmountImmutable( // $tools->round($this->initialUnitPrice->getTaxIncluded() * $quantity, $this->precision), round(round($this->initialUnitPrice->getTaxExcluded() * $quantity, 2) * $tva_found, 2), //ADD $tools->round($this->initialUnitPrice->getTaxExcluded() * $quantity, $this->precision) ); break; Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now