mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-26 11:48:49 +02:00
Added some helper functions to make it easier to parse Pricedetails
This commit is contained in:
parent
59f62d4a4c
commit
8182e83846
1 changed files with 12 additions and 0 deletions
|
@ -188,6 +188,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
|||
*
|
||||
* @return BigDecimal the price as a bcmath string
|
||||
*/
|
||||
#[Groups(['pricedetail:read'])]
|
||||
public function getPricePerUnit(float|string|BigDecimal $multiplier = 1.0): BigDecimal
|
||||
{
|
||||
$tmp = BigDecimal::of($multiplier);
|
||||
|
@ -249,6 +250,17 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
|||
return $this->currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ISO code of the currency associated with this price information, or null if no currency is selected.
|
||||
* Then the global base currency should be assumed.
|
||||
* @return string|null
|
||||
*/
|
||||
#[Groups(['pricedetail:read'])]
|
||||
public function getCurrencyISOCode(): ?string
|
||||
{
|
||||
return $this->currency?->getIsoCode();
|
||||
}
|
||||
|
||||
/********************************************************************************
|
||||
*
|
||||
* Setters
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue