Fixes for displaying negative numbers

This commit is contained in:
David Bomba 2023-03-01 16:32:47 +11:00
parent 8247ff41e4
commit be88aa356a
2 changed files with 8 additions and 1 deletions

View File

@ -13,7 +13,6 @@
namespace App\Services\PdfMaker;
use App\Models\Credit;
use App\Models\Invoice;
use App\Models\Quote;
use App\Services\PdfMaker\Designs\Utilities\BaseDesign;
use App\Services\PdfMaker\Designs\Utilities\DesignHelpers;

View File

@ -201,6 +201,8 @@ class Number
public static function formatMoneyNoRounding($value, $entity) :string
{
$currency = $entity->currency();
$_value = $value;
$thousand = $currency->thousand_separator;
$decimal = $currency->decimal_separator;
@ -247,6 +249,12 @@ class Number
} elseif ($swapSymbol) {
return "{$value} ".trim($symbol);
} elseif ($entity->getSetting('show_currency_code') === false) {
if ($_value < 0) {
$value = substr($value, 1);
$symbol = "-{$symbol}";
}
return "{$symbol}{$value}";
} else {
return self::formatValue($value, $currency);