Skip to content
Code-Schnipsel Gruppen Projekte
Commit 1cc42fd1 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

Merge branch 'next-3.x' into 'main'

fix: brutto calc 1 cent problem

See merge request !146
Übergeordnete 129ea23b 6f75d31b
No related branches found
Tags 3.7.2
2 Merge Requests!146fix: brutto calc 1 cent problem,!140Update 'next-4.x' with latest changes from 'main'
Pipeline #11980 mit Warnungen bestanden mit Phase
in 1 Minute und 6 Sekunden
......@@ -22,6 +22,14 @@
function ($price, $formatted, $vat) {
$price = QUI\ERP\Money\Price::validatePrice($price);
if (empty($price)) {
if (isset($formatted) && $formatted) {
return QUI\ERP\Defaults::getCurrency()->format(0);
}
return 0;
}
if (empty($vat) && !is_numeric($vat)) {
$Area = QUI\ERP\Defaults::getArea();
......
......@@ -459,7 +459,7 @@ public function calcArticleList(ArticleList $List, $callback = false): ArticleLi
// counterbalance - gegenrechnung
// works only for one vat entry
if (count($vatArray) === 1) {
if (count($vatArray) === 1 && $isNetto) {
$vat = key($vatArray);
$netto = $bruttoSum / ((float)$vat / 100 + 1);
......@@ -585,6 +585,15 @@ public function calcArticlePrice(Article $Article, $callback = false)
$checkVat = $checkBrutto - $nettoPriceNotRounded;
$checkVat = round($checkVat * $Article->getQuantity(), $Currency->getPrecision());
if ($nettoPrice + $checkVat !== $checkBrutto) {
$diff = round(
$nettoPrice + $checkVat - $checkBrutto,
$Currency->getPrecision()
);
$checkVat = $checkVat - $diff;
}
// sum
$nettoSum = $this->round($nettoPrice * $Article->getQuantity());
$vatSum = $nettoSum * ($vat / 100);
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren