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

Merge branch 'next' into 'master'

Next

See merge request !24
Übergeordnete 08bbc8e0 188e799a
No related branches found
Tags 1.6.5
2 Merge Requests!140Update 'next-4.x' with latest changes from 'main',!24Next
Pipeline #4778 bestanden mit Phase
in 31 Sekunden
......@@ -53,15 +53,43 @@ function ($price, $formatted, $vat) {
}
$vat = ($vat / 100) + 1;
$price = $price / $vat;
$netto = $price / $vat;
$netto = round($netto, QUI\ERP\Defaults::getPrecision());
// gegenrechnung
$precision = QUI\ERP\Defaults::getPrecision();
$bruttoInput = round($price, $precision);
$decimalParts = explode('.', $bruttoInput);
$inputPrecision = isset($decimalParts[1]) ? strlen($decimalParts[1]) : 0;
$brutto = round($netto, $precision) * $vat;
$brutto = round($brutto, $inputPrecision);
if ($brutto != $bruttoInput) {
$netto = round($netto, $precision);
$brutto = round($netto * $vat, $inputPrecision);
if ($brutto != $bruttoInput) {
for ($i = 0; $i < 10; $i++) {
$nettoCheck = substr($netto, 0, -$precision);
$bruttoCheck = round($nettoCheck * $vat, $inputPrecision);
if ($bruttoCheck == $bruttoInput) {
$netto = $nettoCheck;
break;
}
}
}
}
if (isset($formatted) && $formatted) {
return QUI\ERP\Defaults::getCurrency()->format($price);
return QUI\ERP\Defaults::getCurrency()->format($netto);
}
$price = \round($price, QUI\ERP\Defaults::getPrecision());
//$netto = round($netto, QUI\ERP\Defaults::getPrecision());
return $price;
return $netto;
},
['price', 'formatted', 'vat']
);
......@@ -600,6 +600,7 @@ public function calcArticlePrice(Article $Article, $callback = false)
$price = $isNetto ? $nettoPrice : $bruttoPrice;
$sum = $isNetto ? $nettoSum : $bruttoSum;
$basisPrice = $isNetto ? $basisNettoPrice : $basisNettoPrice + ($basisNettoPrice * $vat / 100);
$basisPrice = round($basisPrice, QUI\ERP\Defaults::getPrecision());
$vatArray = [
'vat' => $vat,
......
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