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 := Sum({DataTable1.Freight});
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 + " Rupees and " + towords(pAmt,0) + " paisa Only."
else
InWords := InWords + " Rupees Only.";
Propercase(InWords)
You need to change the below line with the field name.
Amt := Sum({DataTable1.Freight});
Output