mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for rounding display on line items
This commit is contained in:
parent
4a88491195
commit
4769204a3f
@ -181,7 +181,10 @@ class Number
|
|||||||
|
|
||||||
/* 08-01-2022 allow increased precision for unit price*/
|
/* 08-01-2022 allow increased precision for unit price*/
|
||||||
$v = rtrim(sprintf('%f', $value),"0");
|
$v = rtrim(sprintf('%f', $value),"0");
|
||||||
$precision = strlen(substr(strrchr($v, $decimal), 1));
|
// $precision = strlen(substr(strrchr($v, $decimal), 1));
|
||||||
|
|
||||||
|
if($v<1)
|
||||||
|
$precision = strlen($v) - strrpos($v, '.') - 1;
|
||||||
|
|
||||||
$value = number_format($v, $precision, $decimal, $thousand);
|
$value = number_format($v, $precision, $decimal, $thousand);
|
||||||
$symbol = $currency->symbol;
|
$symbol = $currency->symbol;
|
||||||
|
@ -305,8 +305,14 @@ trait MakesInvoiceValues
|
|||||||
//$data[$key][$table_type.'.quantity'] = Number::formatValue($item->quantity, $this->client->currency());
|
//$data[$key][$table_type.'.quantity'] = Number::formatValue($item->quantity, $this->client->currency());
|
||||||
|
|
||||||
//change quantity from localized number, to decimal format with no trailing zeroes 06/09/21
|
//change quantity from localized number, to decimal format with no trailing zeroes 06/09/21
|
||||||
$data[$key][$table_type.'.quantity'] = rtrim($item->quantity, $locale_info['decimal_point']);
|
|
||||||
$data[$key][$table_type.'.unit_cost'] = Number::formatMoney($item->cost, $this->client);
|
//30-01-2022 - improve rounding display for Unit quantity
|
||||||
|
$data[$key][$table_type.'.quantity'] = $item->quantity >=1 ? rtrim(number_format($item->quantity, $this->client->currency()->precision), $locale_info['decimal_point']) : rtrim(number_format($item->quantity,15), 0);
|
||||||
|
// $data[$key][$table_type.'.quantity'] = rtrim($item->quantity, $locale_info['decimal_point']);
|
||||||
|
|
||||||
|
//30-01-2022 - improve rounding display for Unit Cost
|
||||||
|
$data[$key][$table_type.'.unit_cost'] = Number::formatMoneyNoRounding($item->cost, $this->client);
|
||||||
|
|
||||||
$data[$key][$table_type.'.cost'] = Number::formatMoney($item->cost, $this->client);
|
$data[$key][$table_type.'.cost'] = Number::formatMoney($item->cost, $this->client);
|
||||||
|
|
||||||
$data[$key][$table_type.'.line_total'] = Number::formatMoney($item->line_total, $this->client);
|
$data[$key][$table_type.'.line_total'] = Number::formatMoney($item->line_total, $this->client);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user