So I have the base_paid_amount that must be converted in to words.
To do this, we can use frappe.utils.money_in_words() function
e.g. base_paid_amout = ₱ 10,388.23
Output: PHP Ten Thousand, Three Hundred And Eighty Eight and Twenty Three Centavo only.
The Twenty Three Centavo should be displayed as fraction 23/100
Expected Output: PHP Ten Thousand, Three Hundred And Eighty Eight and 23/100 only.
This is what I did. I use split function to separate the whole amount and the centavo part.
{% set var1 = doc.get_formatted(“base_paid_amount”) %}
{% set amount_array = var1.split(‘.’) %}
{% set whole_amount = amount_array[0] %}
{% set fraction_amount = amount_array[1] %}
Then I use the frappe.utils.money_in_words() to print it into words and str.replace()on to eliminate the “only.” when converting it into words.
{{ frappe.utils.money_in_words(whole_amount, doc.currency).replace(" only.", “”) }} And {{ fraction_amount }}/100 only.
Output: And 23/100 only.
It doesn’t print the whole_amount.
I noticed that whole_amount is a list. It doesn’t print when using frappe.utils.money_in_words() to print a list. However, it works fine if it is a string.
I have also tried converting the list to a string using str.join() but I am also not sure if I’m doing it right as it still doesn’t work.
How to solve this? Or is there other way to print the number/amount in words without using the frappe.utils.money_in_words() function?
Thank you.
P.S. I have no any coding/scripting background.