|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getSolver(ProductPropertyInterface $product) |
|
|
public function getSolver(ProductPropertyInterface $product) |
|
|
{ |
|
|
{ |
|
|
if($product instanceof ProductFamilyInterface) { |
|
|
|
|
|
|
|
|
if ($product instanceof ProductFamilyInterface) { |
|
|
return $this->productFamilySolver; |
|
|
return $this->productFamilySolver; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if($product instanceof ProductInterface) { |
|
|
|
|
|
|
|
|
if ($product instanceof ProductInterface) { |
|
|
return $this->productSolver; |
|
|
return $this->productSolver; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return $solver->getPriceInherited($product); |
|
|
return $solver->getPriceInherited($product); |
|
|
} elseif ($solver->getBehaviorPriceInherited($product) == 'by-reference-unit') { |
|
|
} elseif ($solver->getBehaviorPriceInherited($product) == 'by-reference-unit') { |
|
|
if ($solver->getQuantityInherited($product) > 0) { |
|
|
if ($solver->getQuantityInherited($product) > 0) { |
|
|
return $solver->getPriceByRefUnitInherited($product) * ($solver->getQuantityInherited($product |
|
|
|
|
|
|
|
|
return $solver->getPriceByRefUnitInherited($product) * ($solver->getQuantityInherited( |
|
|
|
|
|
$product |
|
|
) / $solver->getUnitInherited($product)->getCoefficient()); |
|
|
) / $solver->getUnitInherited($product)->getCoefficient()); |
|
|
} else { |
|
|
} else { |
|
|
return 0; |
|
|
return 0; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//Bridge pour applyReductionCatalog qui ne peut pas être appeler à cause du call |
|
|
//Bridge pour applyReductionCatalog qui ne peut pas être appeler à cause du call |
|
|
public function getPriceWithTaxByReduction(ProductPropertyInterface $product, ReductionCatalogInterface $reductionCatalog) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
public function getPriceWithTaxByReduction( |
|
|
|
|
|
ProductPropertyInterface $product, |
|
|
|
|
|
ReductionCatalogInterface $reductionCatalog |
|
|
|
|
|
) { |
|
|
return $this->applyReductionCatalog( |
|
|
return $this->applyReductionCatalog( |
|
|
$product, |
|
|
|
|
|
$this->getPrice($product), |
|
|
|
|
|
$this->getPriceWithTax($product), |
|
|
|
|
|
1, |
|
|
|
|
|
$reductionCatalog |
|
|
|
|
|
|
|
|
$product, |
|
|
|
|
|
$this->getPrice($product), |
|
|
|
|
|
$this->getPriceWithTax($product), |
|
|
|
|
|
1, |
|
|
|
|
|
$reductionCatalog |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getPriceByRefUnitWithTaxAndReduction(ProductPropertyInterface $product) |
|
|
public function getPriceByRefUnitWithTaxAndReduction(ProductPropertyInterface $product) |
|
|
{ |
|
|
{ |
|
|
return ($this->getPriceByRefUnitWithTax($product) * $this->getPriceWithTaxAndReduction($product)) |
|
|
|
|
|
/ $this->getPriceWithTax($product); |
|
|
|
|
|
|
|
|
$priceWithTax = $this->getPriceWithTax($product); |
|
|
|
|
|
|
|
|
|
|
|
if ($priceWithTax) { |
|
|
|
|
|
return ($this->getPriceByRefUnitWithTax($product) * $this->getPriceWithTaxAndReduction($product)) |
|
|
|
|
|
/ $priceWithTax; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $solver->getBuyingPriceInherited($product); |
|
|
return $solver->getBuyingPriceInherited($product); |
|
|
} elseif ($solver->getBehaviorPriceInherited($product) == 'by-reference-unit') { |
|
|
} elseif ($solver->getBehaviorPriceInherited($product) == 'by-reference-unit') { |
|
|
if ($solver->getQuantityInherited($product) > 0) { |
|
|
if ($solver->getQuantityInherited($product) > 0) { |
|
|
return $solver->getBuyingPriceByRefUnitInherited($product) * ($solver->getQuantityInherited($product |
|
|
|
|
|
|
|
|
return $solver->getBuyingPriceByRefUnitInherited($product) * ($solver->getQuantityInherited( |
|
|
|
|
|
$product |
|
|
) / $solver->getUnitInherited($product)->getCoefficient()); |
|
|
) / $solver->getUnitInherited($product)->getCoefficient()); |
|
|
} else { |
|
|
} else { |
|
|
return 0; |
|
|
return 0; |