Page 3 of 3

Re: number format on reports

Unread postPosted: Wed Dec 02, 2020 4:45 am
by Janusz
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 belowe):
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();
...

and on the tests I performed so far it's working OK.

Przechwytywanie.JPG
Przechwytywanie.JPG (22.49 KiB) Viewed 76 times