|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getPriceByUnitRef(): ?float |
|
|
public function getPriceByUnitRef(): ?float |
|
|
{ |
|
|
{ |
|
|
return ($this->getPriceInherited() * $this->getUnitInherited()->getCoefficient()) / $this->getQuantityInherited() ; |
|
|
|
|
|
|
|
|
return $this->calculatePriceByUnitRef($this->getPriceInherited()) ; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getPriceByUnitRefWithTax(): ?float |
|
|
public function getPriceByUnitRefWithTax(): ?float |
|
|
{ |
|
|
{ |
|
|
return $this->calculatePriceWithTax($this->getPriceByUnitRef(), $this->getTaxRateInherited()->getValue()) ; |
|
|
|
|
|
|
|
|
return $this->calculatePriceByUnitRef($this->getPriceWithTax()) ; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function setPrice(float $price): self |
|
|
public function setPrice(float $price): self |
|
|
|
|
|
|
|
|
$price = round(( ($price * 100)) / 100, 2) ; |
|
|
$price = round(( ($price * 100)) / 100, 2) ; |
|
|
return $price ; |
|
|
return $price ; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private function calculatePriceByUnitRef($price) |
|
|
|
|
|
{ |
|
|
|
|
|
return ($price * $this->getUnitInherited()->getCoefficient()) / $this->getQuantityInherited() ; |
|
|
|
|
|
} |
|
|
} |
|
|
} |