On a credit memo pdf template i'm using `${nsforma...
# advancedpdf
a
On a credit memo pdf template i'm using
${nsformat_currency(record.total * -1)}
to output the value in the transaction currency (e.g. EUR) but as a negative amount instead of a positive - I am seeing it output with a
-
sign instead of
()
parens for the negative amounts, despite all the preferences being set to negative (General Preferences, Subsidiary, User Preferences and Customer Preferences all have parens selected) - all other subsidiaries correctly show the parens except one - the Germany (EUR) subsidiary. I have no idea why - anyone know what might be going on?
So I hate it, but I managed to do it this way:
${record.custbody_bm_currencydisplaysymbol}${(record.total * -1)?string(",##0.00;(##0.00)")}
that custom record is non-stored, and just sources in the Currency record 'Currency Symbol' field
s
just curious, do you get different results using nsformat_currency and nsformat_number (other than the currency symbol not showing)? If so, it could be the EUR currency has a format override
a
nsformat_currency:
nsformat_number:
currency format is definitely not overridden
i wonder if it's relate to the currency locale...
hmm, there was German and German (EURO) as options, but it didn't seem to make any difference
oh well
s
that’s really puzzling! especially since it’s isolated to one subsidiary
a
right?
i wonder if there will be the same issue when i put the template into production
s
You could try the simpler method in production and test it against a customer in each subsidiary, assuming there aren’t a crazy number of subsidiaries. Occasionally things work differently in production (we are seeing that right now with some other functionality), but there’s no way to know. And if it is the same, you already have the fix for it, even though it’s a bit ugly. The best mentor I ever had said that the first goal in programming is getting the right output. Making the code nice is just a gift to yourself or the future maintainer. The end users don’t care what your code looks like. You could always wrap that in a Freemarker macro or function if it’s something you’ll do in more than one place.
c
is the format the same as the old "?string.currency"?
a
@creece
?string.currency
behaved weird for me - the Euro character specifically did not output, it would output a little square instead
also i think it was still using the minus sign and not the parens