1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Fixes for displaying negative currencies

This commit is contained in:
David Bomba 2023-02-17 17:19:33 +11:00
parent 2f3cee2fc2
commit 681fc47a68

View File

@ -137,6 +137,8 @@ class Number
{
$value = floatval($value);
$_value = $value;
$currency = $entity->currency();
$thousand = $currency->thousand_separator;
@ -177,6 +179,15 @@ class Number
} elseif ($swapSymbol) {
return "{$value} ".trim($symbol);
} elseif ($entity->getSetting('show_currency_code') === false) {
/* Ensures we place the negative symbol ahead of the currency symbol*/
if($_value < 0){
$value = substr($value, 1);
$symbol = "-{$symbol}";
}
return "{$symbol}{$value}";
} else {
return self::formatValue($value, $currency);