Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
this is digit 174.90


I have applied this crystal report formula but result is
"One hundred seventy five only" 174.90 (This is round figure)


But i want this "One hundred seventy four dollar and ninety cent only" 174.90
formula is under below solve this issue

What I have tried:

if right(Towords({Invoice_Detail.After_Invoice_Discount_Total}),2)="00" 
then
Lcase(ToWords({Invoice_Detail.After_Invoice_Discount_Total},0))+" "+"only"
else 
Lcase(ToWords({Invoice_Detail.After_Invoice_Discount_Total},0))+" and "+Lcase(ToWords(tonumber(right(Totext({Invoice_Detail.After_Invoice_Discount_Total}),2)),0))+" "+" cent only"
Posted
Updated 23-Nov-18 20:03pm

1 solution

Multiply it by 100, convert it to an integer.
Then break that into two values using divide by and modulus 100 into integer values.
Then write a ToWords method that accepts integer values and display them.

(Integer is important here, the storage of float values means you don't necessarily get what you want with floating point).
 
Share this answer
 
Comments
Computechsoft 24-Nov-18 3:04am    
Same issue after Multiply by 100
"Answer is ("One hundred seventy five and 90 paisa only")
I want this ("One hundred seventy four and 90 paisa only"

if right(Towords({Invoice_Detail.After_Invoice_Discount_Total}),2 * 100)="00"
then
Lcase(ToWords({Invoice_Detail.After_Invoice_Discount_Total},0))+" "+"only"
else
Lcase(ToWords({Invoice_Detail.After_Invoice_Discount_Total},0))+" and "+Lcase(ToWords(tonumber(right(Totext({Invoice_Detail.After_Invoice_Discount_Total}),2)),0))+" "+"paisa only"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900