Total Amounts in Words with Currency name

We can set this in the Field level setup (Free Form Text Type) as the formula for displaying the total Amounts in Words and it also displays the currency name with it. Works fine for amounts with decimals also. Currency names can differ from account to account.

(TO_CHAR(TO_TIMESTAMP(LPAD(TRUNC({total},0),9,’0′), ‘FF9’ ), ‘FFSP’) ||’ ‘) || (CASE {currency} WHEN ‘US Dollar’ THEN ‘DOLLAR’ WHEN ‘British pound’ THEN ‘POUND’ WHEN ‘INR’ THEN ‘RUPEES’ ELSE ‘DOLLARS’ END) || (CASE WHEN {total}-TRUNC({total}, 0) > 0 THEN ‘ 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’) || (CASE {currency} WHEN ‘US Dollar’ THEN ‘CENT’ WHEN ‘British pound’ THEN ‘CENT’ WHEN ‘INR’ THEN ‘PAISA’ ELSE ‘CENT’ END) ||’ ONLY ‘ ELSE TO_CHAR(TO_DATE(TO_CHAR(TRUNC(REGEXP_REPLACE({total}, ‘^[0-9]+.’, ”), 0)),’J’),’JSP’) || ‘ ‘|| (CASE {currency} WHEN ‘US Dollar’ THEN ‘CENT’ WHEN ‘British pound’ THEN ‘CENT’ WHEN ‘INR’ THEN ‘PAISA’ ELSE ‘CENT’ END) || ‘ ONLY ‘ END) ELSE ‘ ‘ END)

Leave a comment

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