|
|
|
|
|
|
|
|
$round = true |
|
|
$round = true |
|
|
): ?float { |
|
|
): ?float { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($entity instanceof ProductFamilyInterface) { |
|
|
|
|
|
$taxRate = $this->productFamilySolver->getTaxRateInherited($entity)->getValue(); |
|
|
|
|
|
}else if ($entity instanceof ProductInterface) { |
|
|
|
|
|
$taxRate = $this->productSolver->getTaxRateInherited($entity)->getValue(); |
|
|
|
|
|
}else{ |
|
|
|
|
|
$taxRate = $entity->getTaxRate(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($reductionCatalog) { |
|
|
if ($reductionCatalog) { |
|
|
$reductionCatalogValue = $reductionCatalog->getValue(); |
|
|
$reductionCatalogValue = $reductionCatalog->getValue(); |
|
|
$reductionCatalogUnit = $reductionCatalog->getUnit(); |
|
|
$reductionCatalogUnit = $reductionCatalog->getUnit(); |
|
|
|
|
|
|
|
|
$price, |
|
|
$price, |
|
|
$reductionCatalogValue * $quantity |
|
|
$reductionCatalogValue * $quantity |
|
|
), |
|
|
), |
|
|
$this->productFamilySolver->getTaxRateInherited($entity)->getValue() |
|
|
|
|
|
|
|
|
$taxRate |
|
|
); |
|
|
); |
|
|
} elseif ($reductionCatalogBehaviorTaxRate == 'tax-included') { |
|
|
} elseif ($reductionCatalogBehaviorTaxRate == 'tax-included') { |
|
|
$priceWithTax = $this->applyReductionAmount( |
|
|
$priceWithTax = $this->applyReductionAmount( |
|
|
|
|
|
|
|
|
if ($withTax) { |
|
|
if ($withTax) { |
|
|
$priceReturn = $priceWithTax; |
|
|
$priceReturn = $priceWithTax; |
|
|
} else { |
|
|
} else { |
|
|
$priceReturn = $this->applyPercentNegative($priceWithTax, $this->productFamilySolver->getTaxRateInherited($entity)->getValue()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$priceReturn = $this->applyPercentNegative($priceWithTax, $taxRate); |
|
|
} |
|
|
} |
|
|
if ($round) { |
|
|
if ($round) { |
|
|
return $this->round($priceReturn); |
|
|
return $this->round($priceReturn); |