We are generating invoices using PDF templates in SuiteCRM. One of our requirement is to print the total amount in words. We have added a placeholder in the template file as %%total_amount_in_words%%. Then in …\modules\AOS_PDF_Templates\generatePdf.php file, we have added the following lines of code.
The values from $aos_invoices_total_amount is 10,000.00 (with comma as per the formatting). We would like to get this removed as we want to pass this to another php function to get the number in words. With the above code, the conversion fails when we call the function as the ‘,’ (Comma) is not removed.
Just to make sure we are doing it right, we have tried replacing even one of the digits. Its still fails to replace it. Looks like we are not able to manipulate anything on the string.
How are you “showing” those values? I wonder if their value is actually just 10000 and the commas just get added again when it’s displayed. You could determine this better if you were looking at the values in a debugger.
No, there is no way to do that unless you write the function yourself.
What you’re facing here is just some weird PHP behavior. It really should work, and once you understand what’s happening, which data types are being used, which functions are changing the display, etc., it should be pretty easy to solve. I just can’t help much from a distance - you need to be able to debug the code and test different things to figure out what is wrong… good luck.