Convert Number (Currency) to word in Crystal Report

Last Reply on Apr 03, 2018 04:05 AM By dharmendr

Posted on Mar 23, 2018 01:13 PM

Hello,

I am using ToWords function of crystal report in asp.net web application to convert Grand Total Amount in words but its not giving desired output.

E.g. My Grand Total is - 383,960 Rs.

So desired result is -

Three Lakhs eighty tree thousand nine hundred and sixty rupees only

But ToWord function of CR giving me result as below-

Three Hundred Eighty Three Thousand Nine Hundred Sixty Rupees Only.

 

My Formula is -

 

ProperCase(ToWords(tonumber({@NetPayableAmount}),0)) +' Rupees'+' Only.'

 How to get desired output.

 

Thanks in advance

Posted on Apr 03, 2018 04:05 AM

Hi ashishk,

To Convert Amount (Currency) in words directly on Crystal Report. Just simply copy paste below code in your function.

To Create function follow the steps given below:

1. Go to Field Explorer in report design.

2. Right click on Formula Fields click on New give specific name.

3. Select Use Editor to open Formula Workshop window. Just paste the code given below.

4. Click on Save and Close.

5. Just drag the Field to your specific required Location.

Code

numbervar RmVal:=0; 
numbervar Amt:=0; 
numbervar pAmt:=0; 
stringvar InWords :=""; 
Amt := Round(1595595435,0); 
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 Amt = 0 then RmVal := 0;
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 + " Rupees only"; 
UPPERCASE(InWords) 

You need to change the below line with the field name.

Amt := Round(1595595435,0);

 Example:

Amt := Round({@NetPayableAmount},0);

Output