Friday, July 12, 2019

Advanced Printing > Print Total Amount of Invoice with Two Decimal Digits

Scenario:
Advanced Printing feature is enabled for the account and an Advanced PDF/HTML Template is set for printing transactions. When printing the transaction, Total field will not have decimal digits if the number is an integer (this means that an invoice having total $9 will be printed with $9 instead of $9.00)

Question:
How to print two digits decimal number in the total field with advanced printing template even if the value is integer?

Answer:
The Template Editor in Advanced Printing uses FreeMarker-based syntax. FreeMarker documentation is available at http://freemarker.sourceforge.net/docs/index.html

The field on the Advanced PDF/HTML template should contain the formula ${record.total?string("0.00")} instead of ${record.total} to show two digits decimal for the total of the transaction. To change it, edit the Advanced PDF/HTML template by navigating to Customization > Forms > Advanced PDF/HTML templates and in the template editor identify the ${record.total} to be changed.

More information on how a numerical value can be formated as string can be found at http://freemarker.org/docs/ref_builtins_number.html


 


No comments:

Post a Comment