From 540f15f82a921a0660799bc6a3eb4cec43da396c Mon Sep 17 00:00:00 2001
From: Henning Leutz <leutz@pcsg.de>
Date: Tue, 26 Nov 2024 12:50:06 +0100
Subject: [PATCH] fix: check vat -> wrong quantity calc check

---
 src/QUI/ERP/Accounting/Calc.php | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/QUI/ERP/Accounting/Calc.php b/src/QUI/ERP/Accounting/Calc.php
index 1b94a49..8a3f3ea 100644
--- a/src/QUI/ERP/Accounting/Calc.php
+++ b/src/QUI/ERP/Accounting/Calc.php
@@ -597,9 +597,7 @@ public function calcArticlePrice(Article $Article, $callback = false)
             // korrektur rechnung / 1 cent problem
             $checkBrutto = $nettoPriceNotRounded * ($vat / 100 + 1);
             $checkBrutto = round($checkBrutto, $Currency->getPrecision());
-
             $checkVat = $checkBrutto - $nettoPriceNotRounded;
-            $checkVat = round($checkVat * $Article->getQuantity(), $Currency->getPrecision());
 
             if ($nettoPrice + $checkVat !== $checkBrutto) {
                 $diff = round(
@@ -611,6 +609,7 @@ public function calcArticlePrice(Article $Article, $callback = false)
             }
 
             // sum
+            $checkVat = round($checkVat * $Article->getQuantity(), $Currency->getPrecision());
             $nettoSum = $this->round($nettoPrice * $Article->getQuantity());
             $vatSum = $nettoSum * ($vat / 100);
 
-- 
GitLab