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

Minor fixes for displaying negative numbers

This commit is contained in:
David Bomba 2023-03-06 11:03:19 +11:00
parent 8281b42657
commit 63bf30252d
2 changed files with 3 additions and 1 deletions

View File

@ -94,7 +94,6 @@ class BaseImport
$csv = base64_decode($base64_encoded_csv);
$csv = Reader::createFromString($csv);
$csvdelimiter = self::detectDelimiter($csv);
nlog("delmiter = {$csvdelimiter}");
$csv->setDelimiter($csvdelimiter);
$stmt = new Statement();

View File

@ -231,12 +231,15 @@ class Number
/* 08-01-2022 allow increased precision for unit price*/
$v = rtrim(sprintf('%f', $value), '0');
$parts = explode('.', $v);
/* 08-02-2023 special if block to render $0.5 to $0.50*/
if ($v < 1 && strlen($v) == 3) {
$precision = 2;
} elseif ($v < 1) {
$precision = strlen($v) - strrpos($v, '.') - 1;
} elseif(is_array($parts) && $parts[0] != 0) {
$precision = 2;
}
$value = number_format($v, $precision, $decimal, $thousand);