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

refactor: discount#10

Übergeordneter be521441
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -376,13 +376,14 @@ public function calcProductList(ProductList $List, $callback = false): ProductLi
$PriceFactor->setNettoSum($priceFactorValue);
if (!$isNetto) {
$vCalc = $vat / 100 + 1;
if (!$isNetto && !$PriceFactor->hasValueText()) {
$vCalc = $Vat->getValue() / 100 + 1;
$bruttoDisplay = \round($priceFactorValue * $vCalc, $Currency->getPrecision());
$bruttoDisplay = $Currency->format($bruttoDisplay);
$PriceFactor->setValueText($bruttoDisplay);
}
break;
// Prozent Angabe
......@@ -734,6 +735,26 @@ public function getProductPrice(
$vatSum = \round($vatSum, $Currency->getPrecision());
}
// price factor display with empty value text
// for brutto user -> brutto display values
if (!$isNetto) {
foreach ($priceFactors as $PriceFactor) {
if ($PriceFactor->hasValueText()) {
continue;
}
$vCalc = $Vat->getValue() / 100 + 1;
$netto = $PriceFactor->getValue();
$bruttoDisplay = \round($netto * $vCalc, $Currency->getPrecision());
$bruttoDisplay = $Currency->format($bruttoDisplay);
$PriceFactor->setValueText($bruttoDisplay);
}
}
if (!$isNetto) {
// korrektur rechnung / 1 cent problem
$checkVatBrutto = $nettoPriceNotRounded * ($vatValue / 100 + 1);
......
......@@ -72,7 +72,7 @@ class PriceFactor implements QUI\ERP\Products\Interfaces\PriceFactorInterface
protected $calculatedSum = 0;
/**
* @var string
* @var string|false
*/
protected $valueText = false;
......@@ -330,7 +330,7 @@ public function setValue($value)
* The text for the value presentation
* If no value text is set, normal value is used
*
* @param string $value
* @param string|false $value
*/
public function setValueText($value)
{
......
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