Page 1 of 1

Insert a BR (R$) Currency in dataFormats.cfg

Posted: 2018-07-30 19:29
by Marcelo Vitoria
Hello friends

I need to set the money display mask to the Brazilian default (R$), so I need to add a mask in the dataFormats.cfg that
either as: number_format($num, 2, ',', '.');

resulting for example:

The value at US $ 100,000.50

It would become R$ 100.000,50

How should I proceed? Will it also change the input method of values in the application?

Thank you

Re: Insert a BR (R$) Currency in dataFormats.cfg

Posted: 2018-07-30 21:46
by pbottcher
Hi,

you can try to add this for the value only

Code: Select all

numberformat 2 decimals; REPLACE(REPLACE(REPLACE(FORMAT(%%FIELD%%, 2), '.', ':'), ',', '.'), ':', ',')

It will only change the display in the table-view. In the detail view you need to take care of the conversion and possible calculations via the js hook.
To convert the data back correctly for the database you will need to handle the data in the hooks/<tablename>.php file <tablename>_before_insert and <tablename>_before_update functions.

Re: Insert a BR (R$) Currency in dataFormats.cfg

Posted: 2018-07-31 14:55
by Marcelo Vitoria
Hello pböttcher,
Thanks a lot for the help.

I'll try to implement.