|
|
|
|
|
|
|
|
} 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( |
|
|
return $solver->getPriceByRefUnitInherited($product) * ($solver->getQuantityInherited( |
|
|
$product |
|
|
|
|
|
) / $solver->getUnitInherited($product)->getCoefficient()); |
|
|
|
|
|
|
|
|
$product |
|
|
|
|
|
) / $solver->getUnitInherited($product)->getCoefficient()); |
|
|
} else { |
|
|
} else { |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getPriceWithReduction(ProductPropertyInterface $product) |
|
|
|
|
|
{ |
|
|
|
|
|
return $this->applyReductionCatalog( |
|
|
|
|
|
$product, |
|
|
|
|
|
$this->getPrice($product), |
|
|
|
|
|
$this->getPriceWithTax($product), |
|
|
|
|
|
1, |
|
|
|
|
|
null, |
|
|
|
|
|
false |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public function getPriceWithTax(ProductPropertyInterface $product) |
|
|
public function getPriceWithTax(ProductPropertyInterface $product) |
|
|
{ |
|
|
{ |
|
|
return $this->applyTax( |
|
|
return $this->applyTax( |
|
|
$this->getPrice($product), |
|
|
|
|
|
$this->productFamilySolver->getTaxRateInherited($product)->getValue() |
|
|
|
|
|
|
|
|
$this->getPrice($product), |
|
|
|
|
|
$this->productFamilySolver->getTaxRateInherited($product)->getValue() |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$solver = $this->getSolver($product); |
|
|
$solver = $this->getSolver($product); |
|
|
|
|
|
|
|
|
if ($solver->getBehaviorPriceInherited($product) == 'by-piece') { |
|
|
if ($solver->getBehaviorPriceInherited($product) == 'by-piece') { |
|
|
return ($this->getPrice($product) * $solver->getUnitInherited($product)->getCoefficient( |
|
|
|
|
|
)) / $solver->getQuantityInherited($product); |
|
|
|
|
|
|
|
|
return ($this->getPrice($product) * $solver->getUnitInherited($product)->getCoefficient()) / $solver->getQuantityInherited($product); |
|
|
} elseif ($solver->getBehaviorPriceInherited($product) == 'by-reference-unit') { |
|
|
} elseif ($solver->getBehaviorPriceInherited($product) == 'by-reference-unit') { |
|
|
return $solver->getPriceByRefUnitInherited($product); |
|
|
return $solver->getPriceByRefUnitInherited($product); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getPriceByRefUnitWithTax(ProductPropertyInterface $product) |
|
|
public function getPriceByRefUnitWithTax(ProductPropertyInterface $product) |
|
|
{ |
|
|
{ |
|
|
return $this->applyTax( |
|
|
return $this->applyTax( |
|
|
$this->getPriceByRefUnit($product), |
|
|
|
|
|
$this->productFamilySolver->getTaxRateInherited($product)->getValue() |
|
|
|
|
|
|
|
|
$this->getPriceByRefUnit($product), |
|
|
|
|
|
$this->productFamilySolver->getTaxRateInherited($product)->getValue() |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
//TODO voir différence entre prix ici et dans tableau décli |
|
|
//TODO voir différence entre prix ici et dans tableau décli |
|
|
return $this->applyReductionCatalog( |
|
|
return $this->applyReductionCatalog( |
|
|
$product, |
|
|
|
|
|
$this->getPrice($product), |
|
|
|
|
|
$this->getPriceWithTax($product) |
|
|
|
|
|
|
|
|
$product, |
|
|
|
|
|
$this->getPrice($product), |
|
|
|
|
|
$this->getPriceWithTax($product) |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//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( |
|
|
public function getPriceWithTaxByReduction( |
|
|
ProductPropertyInterface $product, |
|
|
|
|
|
ReductionCatalogInterface $reductionCatalog |
|
|
|
|
|
) { |
|
|
|
|
|
|
|
|
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 |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($priceWithTax) { |
|
|
if ($priceWithTax) { |
|
|
return $this->round( |
|
|
return $this->round( |
|
|
($this->getPriceByRefUnitWithTax($product) * $this->getPriceWithTaxAndReduction($product)) |
|
|
|
|
|
/ $priceWithTax |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
($this->getPriceByRefUnitWithTax($product) * $this->getPriceWithTaxAndReduction($product)) |
|
|
|
|
|
/ $priceWithTax |
|
|
|
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return 0; |
|
|
return 0; |
|
|
|
|
|
|
|
|
} 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( |
|
|
return $solver->getBuyingPriceByRefUnitInherited($product) * ($solver->getQuantityInherited( |
|
|
$product |
|
|
|
|
|
) / $solver->getUnitInherited($product)->getCoefficient()); |
|
|
|
|
|
|
|
|
$product |
|
|
|
|
|
) / $solver->getUnitInherited($product)->getCoefficient()); |
|
|
} else { |
|
|
} else { |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getBuyingPriceWithTax(ProductPropertyInterface $product) |
|
|
public function getBuyingPriceWithTax(ProductPropertyInterface $product) |
|
|
{ |
|
|
{ |
|
|
return $this->applyTax( |
|
|
return $this->applyTax( |
|
|
$this->getBuyingPrice($product), |
|
|
|
|
|
$this->productFamilySolver->getTaxRateInherited($product)->getValue() |
|
|
|
|
|
|
|
|
$this->getBuyingPrice($product), |
|
|
|
|
|
$this->productFamilySolver->getTaxRateInherited($product)->getValue() |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getBuyingPriceByRefUnitWithTax(ProductPropertyInterface $product) |
|
|
public function getBuyingPriceByRefUnitWithTax(ProductPropertyInterface $product) |
|
|
{ |
|
|
{ |
|
|
return $this->applyTax( |
|
|
return $this->applyTax( |
|
|
$this->getBuyingPriceByRefUnit($product), |
|
|
|
|
|
$this->productFamilySolver->getTaxRateInherited($product)->getValue() |
|
|
|
|
|
|
|
|
$this->getBuyingPriceByRefUnit($product), |
|
|
|
|
|
$this->productFamilySolver->getTaxRateInherited($product)->getValue() |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|