mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-02 06:24:34 +02:00
Use bcmath to calculate correct prices.
This commit is contained in:
parent
43c439bc9e
commit
4391be448d
9 changed files with 82 additions and 98 deletions
|
@ -32,11 +32,13 @@ namespace App\Twig;
|
|||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Base\DBElement;
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
use App\Entity\PriceInformations\Currency;
|
||||
use App\Services\AmountFormatter;
|
||||
use App\Services\EntityURLGenerator;
|
||||
use App\Services\MoneyFormatter;
|
||||
use App\Services\SIFormatter;
|
||||
use App\Services\TreeBuilder;
|
||||
use Money\Currencies;
|
||||
use Symfony\Component\Cache\Adapter\AdapterInterface;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
|
@ -123,9 +125,9 @@ class AppExtension extends AbstractExtension
|
|||
return $item->get();
|
||||
}
|
||||
|
||||
public function formatCurrency($amount, $currency = "")
|
||||
public function formatCurrency($amount, Currency $currency = null, int $decimals = 5)
|
||||
{
|
||||
return $this->moneyFormatter->format($amount, $currency);
|
||||
return $this->moneyFormatter->format($amount, $currency, $decimals);
|
||||
}
|
||||
|
||||
public function siFormat($value, $unit, $decimals = 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue