How to convert Amount in Words using Crystal Report?

How 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: i) go to Field Explorer ii) right click on Formula Fields click on New give specific name iii) Formula Editor window will open just paste the Code given below iv) Save & Close... v) Just drag the Field to your specific required Location that done.
  1. numbervar RmVal: = 0;  
  2. currencyVar Amt: = 0;  
  3. numbervar pAmt: = 0;  
  4. stringvar InWords: = "Rupees ";  
  5. Amt: = ({  
  6.     vwCostTypes.UnitCost  
  7. });  
  8. if Amt > 10000000 then RmVal: = truncate(ToNumber(Amt) / 10000000);  
  9. if Amt = 10000000 then RmVal: = 1;  
  10. if RmVal = 1 then InWords: = InWords + " " + towords(RmVal, 0) + " crore"  
  11. else if RmVal > 1 then InWords: = InWords + " " + towords(RmVal, 0) + " crores";  
  12. Amt: = Amt - Rmval * 10000000;  
  13. if Amt > 100000 then RmVal: = truncate(ToNumber(Amt) / 100000);  
  14. if Amt = 100000 then RmVal: = 1;  
  15. if RmVal >= 1 then InWords: = InWords + " " + towords(RmVal, 0) + " lakhs";  
  16. Amt: = Amt - Rmval * 100000;  
  17. if Amt > 0 then InWords: = InWords + " " + towords(truncate(Amt), 0);  
  18. pAmt: = (ToNumber(Amt) - truncate(ToNumber(Amt))) * 100;  
  19. if pAmt > 0 then InWords: = InWords + " and " + towords(pAmt, 0) + " paisa only"  
  20. else InWords: = InWords + " only";  
  21. UPPERCASE(InWords)