Convert Total to Words in PDF

Solution

Create a custom text field and apply formula for converting the amount to words
The formula is given below

CASE WHEN {total}=0 THEN ‘ZERO’
ELSE TO_CHAR(TO_DATE(TO_CHAR(TRUNC({total}, 0)),’J’),’JSP’) || ‘ ‘ || ‘AND ‘ || (
CASE WHEN LENGTH(TO_CHAR(REGEXP_REPLACE({total}, ‘^[0-9]+.’, ”))) = 1 THEN
TO_CHAR(TO_DATE(TO_CHAR(TRUNC(REGEXP_REPLACE({total}, ‘^[0-9]+.’, ”), 0)*10),’J’),’JSP’) || ‘ ONLY’
ELSE TO_CHAR(TO_DATE(TO_CHAR(TRUNC(REGEXP_REPLACE({total}, ‘^[0-9]+.’, ”), 0)),’J’),’JSP’) || ‘  ONLY’
END)
END


Then you can use this custom field value to retrieve in PDF template

Leave a comment

Your email address will not be published. Required fields are marked *