Re: number format on reports
Posted: Tue Dec 01, 2020 8:15 pm
Hi,
The problem with formatting on the report looks to be related to the nuformat Form (on which formats are defined).
In case there is currency (sign) defined the format is following (for example):
€ 1,000.00 (with space between sign and number)
in case of no sign the space is left in the format.
and that is causing the problem in the function nuGetNumberFormat($f) in the ./nucommon.php
because we have comparison like "1,000.00" with " 1,000.00" - what is not equivalent and finally proper format is not assigned.
To corect the issue I modified the JS on the nuformat Form as following (3 last lines from the code below):
and on the tests I performed so far it's working OK.
The problem with formatting on the report looks to be related to the nuformat Form (on which formats are defined).
In case there is currency (sign) defined the format is following (for example):
€ 1,000.00 (with space between sign and number)
in case of no sign the space is left in the format.
and that is causing the problem in the function nuGetNumberFormat($f) in the ./nucommon.php
because we have comparison like "1,000.00" with " 1,000.00" - what is not equivalent and finally proper format is not assigned.
To corect the issue I modified the JS on the nuformat Form as following (3 last lines from the code below):
Code: Select all
...
var si = $('#sign').val();
var se = $('#separator').val();
var pl = $('#places').val();
var de = Number(pl) > 0 ? $('#decimal').val() : '';
var cu = JSON.stringify([si,se,de,pl]);
var space='';
if (si!=='') {space=' ';}
$('#srm_format').val(si + space +'1' + se + '000' + de + String(0).repeat(pl)).change();
...