|
|
@@ -42,8 +42,9 @@ trait PriceUtilsTrait |
|
|
|
return round((($price * $percent)) / 100, 2); |
|
|
|
} |
|
|
|
|
|
|
|
public function applyReductionCatalog($entity, $price, $priceWithTax, $reductionCatalog = null, $withTax = true): ?float |
|
|
|
public function applyReductionCatalog($entity, $price, $priceWithTax, $quantity = 1, $reductionCatalog = null, $withTax = true): ?float |
|
|
|
{ |
|
|
|
|
|
|
|
if ($reductionCatalog) { |
|
|
|
$reductionCatalogValue = $reductionCatalog->getValue(); |
|
|
|
$reductionCatalogUnit = $reductionCatalog->getUnit(); |
|
|
@@ -80,14 +81,14 @@ trait PriceUtilsTrait |
|
|
|
$priceWithTax = $this->applyTax( |
|
|
|
$this->applyReductionAmount( |
|
|
|
$price, |
|
|
|
$reductionCatalogValue |
|
|
|
$reductionCatalogValue * $quantity |
|
|
|
), |
|
|
|
$entity->getTaxRateInherited()->getValue() |
|
|
|
); |
|
|
|
} elseif ($reductionCatalogBehaviorTaxRate == 'tax-included') { |
|
|
|
$priceWithTax = $this->applyReductionAmount( |
|
|
|
$priceWithTax, |
|
|
|
$reductionCatalogValue |
|
|
|
$reductionCatalogValue * $quantity |
|
|
|
); |
|
|
|
} |
|
|
|
} |