mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-23 20:35:03 +02:00
Respect the currency of the prices when calculating average part price.
This commit is contained in:
parent
a479dc81c4
commit
af3dfafe22
5 changed files with 148 additions and 101 deletions
|
@ -181,7 +181,7 @@ class Pricedetail extends DBElement
|
|||
/**
|
||||
* Get the price for a single unit in the currency associated with this price detail.
|
||||
*
|
||||
* @param float $multiplier The returned price (float or string) will be multiplied
|
||||
* @param float|string $multiplier The returned price (float or string) will be multiplied
|
||||
* with this multiplier.
|
||||
*
|
||||
* You will get the price for $multiplier parts. If you want the price which is stored
|
||||
|
@ -190,7 +190,7 @@ class Pricedetail extends DBElement
|
|||
* @return string the price as a bcmath string
|
||||
|
||||
*/
|
||||
public function getPricePerUnit($multiplier = 1) : string
|
||||
public function getPricePerUnit($multiplier = 1.0) : string
|
||||
{
|
||||
$multiplier = (string) $multiplier;
|
||||
$tmp = bcmul($this->price, $multiplier, static::PRICE_PRECISION);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue