Convert Currency to Words (Indian Format) in Crystal Reports
- Hi,
Please can anyone help me how to convert number to words in Indian format in Crystal Reports.
eg. I want to convert Rs.25,12,000 as Rupees Twenty Five Lakhs Twelve thousand only.
I had tried to use ToWords() function but the result is in Millions and Billions. I want the result in Lakhs and crores. Please Help.
Thanks in advance.
Answers
If you are using dataset then you can add another column and use your VB function to convert amount to words and use this dataset column in your report that would be easiest, otherwise you can create formula in CR same way you created in VB.As far as using VB function in Cr is concerned, i read somewhere that you can import DLL in crystalreports to use function written outside CrystalReports.
All Replies
I dont think there is any currency specific formula in CR, what you will need to do is create custom function in your code.
If you are using Oracle as backend, there is one easy way for conversion, playing with julian date and numbers.
- thanks a lot for replying.
I am using SQL Server 2000 as my backend. Can you Please suggest me how do I Proceed.
Create a custom function in my code... means do I need to write it in crystal syntax in the formula editor?
I have written a function in vb.net, can I use it in CR by any way? - I am not using dataset for CR. Instead of adding column in dataset I added a column in the database itself.
Thanks a lot for all the solutions. numbervar RmVal:=0;
numbervar Amt:=0;
numbervar pAmt:=0;
stringvar InWords :="Rupees ";
Amt := Amount to convert;
if Amt > 10000000 then RmVal := truncate(Amt/10000000);
if Amt = 10000000 then RmVal := 1;
if RmVal = 1 then
InWords := InWords + " " + towords(RmVal,0) + " crore"
else
if RmVal > 1 then InWords := InWords + " " + towords(RmVal,0) + " crores";Amt := Amt - Rmval * 10000000;
if Amt > 100000 then RmVal := truncate(Amt/100000);
if Amt = 100000 then RmVal := 1;
if RmVal >=1 then
InWords := InWords + " " + towords(RmVal,0) + " lakhs";Amt := Amt - Rmval * 100000;
if Amt > 0 then InWords := InWords + " " + towords(truncate(Amt),0);
pAmt := (Amt - truncate(Amt)) * 100;
if pAmt > 0 then
InWords := InWords + " and " + towords(pAmt,0) + " paisa only"
else
InWords := InWords + " only";
UPPERCASE(InWords)Dear Tasnim,
Please try with this code
numbervar RmVal:=0;
numbervar Amt:=0;
numbervar pAmt:=0;
stringvar InWords :="Rupees ";Amt := type your value ; // 25,12,000
if Amt > 10000000 then RmVal := truncate(Amt/10000000);
if Amt = 10000000 then RmVal := 1;if RmVal = 1 then
InWords := InWords + " " + towords(RmVal,0) + " crore"
else
if RmVal > 1 then InWords := InWords + " " + towords(RmVal,0) + " crores";
Amt := Amt - Rmval * 10000000;if Amt > 100000 then RmVal := truncate(Amt/100000);
if Amt = 100000 then RmVal := 1;if RmVal = 1 then
InWords := InWords + " " + towords(RmVal,0) + " lakhs"
Else
If RmVal > 1 then InWords := InWords + " " + ToWords(RmVal,0) + "Lakhs";Amt := Amt - Rmval * 100000;
if Amt > 0 then InWords := InWords + " " + towords(truncate(Amt),0);
pAmt := (Amt - truncate(Amt)) * 100;
if pAmt > 0 then
InWords := InWords + " and " + towords(pAmt,0) + " paisa only"
else
InWords := InWords + " only";UPPERCASE(InWords)
Hiran KM
- Proposed As Answer byRajesh Rakyan Tuesday, May 12, 2009 6:56 AM
Hi
please try with this script
you can use it as a formula field
numbervar RmVal:=0;
numbervar Amt:=0;
numbervar pAmt:=0;
stringvar InWords :="Rupees ";Amt := 25,12,000 ;
if Amt > 10000000 then RmVal := truncate(Amt/10000000);
if Amt = 10000000 then RmVal := 1;if RmVal = 1 then
InWords := InWords + " " + towords(RmVal,0) + " crore"
else
if RmVal > 1 then InWords := InWords + " " + towords(RmVal,0) + " crores";
Amt := Amt - Rmval * 10000000;if Amt > 100000 then RmVal := truncate(Amt/100000);
if Amt = 100000 then RmVal := 1;if RmVal = 1 then
InWords := InWords + " " + towords(RmVal,0) + " lakhs"
Else
If RmVal > 1 then InWords := InWords + " " + ToWords(RmVal,0) + "Lakhs";Amt := Amt - Rmval * 100000;
if Amt > 0 then InWords := InWords + " " + towords(truncate(Amt),0);
pAmt := (Amt - truncate(Amt)) * 100;
if pAmt > 0 then
InWords := InWords + " and " + towords(pAmt,0) + " paisa only"
else
InWords := InWords + " only";UPPERCASE(InWords)
Warm Regards,
Hiran
- please try this, 1st you create a formula : NumToWords1
towords(truncate(sum({C_PaymentItem.AMOUNT}),0))
after that the second formula: NumToWords1
if Round({@Total Amount},2) - Int({@Total Amount}) = 0 then
"Ringgit Malaysia: " + ToWords ({@Total Amount},0) + " only"
else
"Ringgit Malaysia: " + {@NumToWords1} + " and " + "Cents " + ToWords ((Round({@Total Amount},2) - Int({@Total Amount})) * 100, 0) + " only"
- hello i can solve your problem. contect with me.9436037998 or your emailid for attechment the code. thanks
- Edited byakku555 Tuesday, November 11, 2008 10:24 AM
Hi,
I have been the same problem before.
Then, i developed SQL functions to convert number input to words and used the same in report.
Now, I am able to use in any application whenever required.
I have posted completed functions with codes to convert amount in numbers to words acc. to Indian numbering style in following link. Plz, check out.
Convert Amount into Words according to Indian or Nepali Numbering Style.
- Edited bythesuraj Saturday, November 15, 2008 5:05 PM

