|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
if($entity instanceof ProductPropertyInterface) { |
|
|
if($entity instanceof ProductPropertyInterface) { |
|
|
if($entity->getBehaviorPriceInherited() == 'by-piece') { |
|
|
if($entity->getBehaviorPriceInherited() == 'by-piece') { |
|
|
return ($this->getPriceInherited($entity) * $entity->getUnitInherited()->getCoefficient()) / $entity->getQuantityInherited() ; |
|
|
|
|
|
|
|
|
return ($this->getPrice($entity) * $entity->getUnitInherited()->getCoefficient()) / $entity->getQuantityInherited() ; |
|
|
} |
|
|
} |
|
|
elseif($entity->getBehaviorPriceInherited() == 'by-reference-unit') { |
|
|
elseif($entity->getBehaviorPriceInherited() == 'by-reference-unit') { |
|
|
return $entity->getPriceByRefUnitInherited() ; |
|
|
return $entity->getPriceByRefUnitInherited() ; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private function getPriceWithTaxAndReductionCatalog($entity, $price, $priceWithTax): ?float |
|
|
|
|
|
|
|
|
public function getPriceWithTaxAndReductionCatalog($entity, $price, $priceWithTax, $reductionCatalog = null): ?float |
|
|
{ |
|
|
{ |
|
|
if($entity instanceof ProductPropertyInterface) { |
|
|
|
|
|
$reductionCatalog = $entity->getReductionCatalogInherited() ; |
|
|
|
|
|
|
|
|
|
|
|
if($reductionCatalog) { |
|
|
|
|
|
$reductionCatalogValue = $reductionCatalog->getValue() ; |
|
|
|
|
|
$reductionCatalogUnit = $reductionCatalog->getUnit() ; |
|
|
|
|
|
$reductionCatalogBehaviorTaxRate = $reductionCatalog->getBehaviorTaxRate() ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if($reductionCatalog) { |
|
|
|
|
|
$reductionCatalogValue = $reductionCatalog->getValue() ; |
|
|
|
|
|
$reductionCatalogUnit = $reductionCatalog->getUnit() ; |
|
|
|
|
|
$reductionCatalogBehaviorTaxRate = $reductionCatalog->getBehaviorTaxRate() ; |
|
|
} |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
if($entity instanceof ProductPropertyInterface) { |
|
|
|
|
|
$reductionCatalog = $entity->getReductionCatalogInherited() ; |
|
|
|
|
|
|
|
|
|
|
|
if($reductionCatalog) { |
|
|
|
|
|
$reductionCatalogValue = $reductionCatalog->getValue() ; |
|
|
|
|
|
$reductionCatalogUnit = $reductionCatalog->getUnit() ; |
|
|
|
|
|
$reductionCatalogBehaviorTaxRate = $reductionCatalog->getBehaviorTaxRate() ; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if($entity instanceof OrderProductInterface) { |
|
|
|
|
|
// OrderProductReductionCatalog |
|
|
|
|
|
$reductionCatalog = null ; |
|
|
|
|
|
|
|
|
if($entity instanceof OrderProductInterface) { |
|
|
|
|
|
// OrderProductReductionCatalog |
|
|
|
|
|
$reductionCatalog = null ; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(isset($reductionCatalogValue) && isset($reductionCatalogUnit) && isset($reductionCatalogBehaviorTaxRate)) { |
|
|
if(isset($reductionCatalogValue) && isset($reductionCatalogUnit) && isset($reductionCatalogBehaviorTaxRate)) { |