using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public class CommFun { public static String ConvToWordRupee(decimal Amount) { if (Amount == 0) return ""; string strConv=""; string strAmount = Amount.ToString().Trim(); int IndexDot=strAmount.IndexOf('.'); strAmount=strAmount.Substring(0, IndexDot); int Len = strAmount.Length; string Temp = ""; if (Len == 8 || Len == 9) { if (Len == 8) { strAmount = "0" + strAmount; Len = strAmount.Length; } Temp = strAmount.Substring(0, Len - 7); Temp = GetTen(Temp); if (Temp != "") { strConv += Temp; strConv += " करोड़ "; } Len = Len - 2; strAmount = strAmount.Substring(2, Len); } if (Len == 6 || Len == 7) { if (Len == 6) { strAmount = "0" + strAmount; Len = strAmount.Length; } Temp = strAmount.Substring(0, Len - 5); Temp=GetTen(Temp); if (Temp != "") { strConv += Temp; strConv += " लाख "; } Len = Len - 2; strAmount = strAmount.Substring(2, Len); } if (Len == 4 || Len == 5) { if (Len == 4) { strAmount = "0" + strAmount; Len = strAmount.Length; } Temp = strAmount.Substring(0, Len - 3); Temp = GetTen(Temp); if (Temp != "") { strConv += Temp; strConv += " हजार "; } Len = Len - 2; strAmount = strAmount.Substring(2, Len); } if (Len == 3) { Temp = strAmount.Substring(0, Len - 2); Temp = GetTen(Temp); if (Temp != "") { strConv += Temp; strConv += " सौ "; } Len = Len - 1; } if (Len == 2 || Len==1) { Temp = strAmount; Temp= GetTen(Temp); if(Temp=="") { strConv += Temp; } } strConv += " रुपये मात्र |"; return strConv; //लाख //हजार } private static string GetTen(string Num) { string strNum = ""; switch(Convert.ToInt16(Num)) { case 1: strNum = "एक"; break; case 2: strNum = "दो"; break; case 3: strNum = "तीन"; break; case 4: strNum = "चार"; break; case 5: strNum = "पाँच"; break; case 6: strNum = "छः"; break; case 7: strNum = "सात"; break; case 8: strNum = "आठ"; break; case 9: strNum = "नौ"; break; case 10: strNum = "दस"; break; case 11: strNum = "ग्यारह"; break; case 12: strNum = "बारह"; break; case 13: strNum = "तेरह"; break; case 14: strNum = "चौदह"; break; case 15: strNum = "पंद्रह"; break; case 16: strNum = "सोलह"; break; case 17: strNum = "सत्तरह"; break; case 18: strNum = "अठारह"; break; case 19: strNum = "उन्नीस"; break; case 20: strNum = "बीस"; break; case 21: strNum = "इक्कीस"; break; case 22: strNum = "बाईस"; break; case 23: strNum = "तेईस"; break; case 24: strNum = "चौबीस"; break; case 25: strNum = "पच्चीस"; break; case 26: strNum = "छब्बीस"; break; case 27: strNum = "सत्ताईस"; break; case 28: strNum = "अट्ठाईस"; break; case 29: strNum = "उनतीस"; break; case 30: strNum = "तीस"; break; case 31: strNum = "इकतीस"; break; case 32: strNum = "बत्तीस"; break; case 33: strNum = "तैंतीस"; break; case 34: strNum = "चौंतीस"; break; case 35: strNum = "पैंतीस"; break; case 36: strNum = "छत्तीस"; break; case 37: strNum = "सैंतीस"; break; case 38: strNum = "अड़तीस"; break; case 39: strNum = "उनतालीस"; break; case 40: strNum = "चालीस"; break; case 41: strNum = "इकतालीस"; break; case 42: strNum = "बयालीस"; break; case 43: strNum = "तैंतालीस"; break; case 44: strNum = "चौवालीस"; break; case 45: strNum = "पैंतालीस"; break; case 46: strNum = "छियालीस"; break; case 47: strNum = "सैंतालीस"; break; case 48: strNum = "अड़तालीस"; break; case 49: strNum = "उनचास"; break; case 50: strNum = "पचास"; break; case 51: strNum = "इक्यावन"; break; case 52: strNum = "बावन"; break; case 53: strNum = "तिरेपन"; break; case 54: strNum = "चौवन"; break; case 55: strNum = "पचपन"; break; case 56: strNum = "छप्पन"; break; case 57: strNum = "सत्तावन"; break; case 58: strNum = "अट्ठावन"; break; case 59: strNum = "उनसठ"; break; case 60: strNum = "साठ"; break; case 61: strNum = "इकसठ"; break; case 62: strNum = "बासठ"; break; case 63: strNum = "तिरेसठ"; break; case 64: strNum = "चौंसठ"; break; case 65: strNum = "पैंसठ"; break; case 66: strNum = "छियासठ"; break; case 67: strNum = "सड़सठ"; break; case 68: strNum = "अड़सठ"; break; case 69: strNum = "उनहत्तर"; break; case 70: strNum = "सत्तर"; break; case 71: strNum = "इकहत्तर"; break; case 72: strNum = "बहत्तर"; break; case 73: strNum = "तिहत्तर"; break; case 74: strNum = "चौहत्तर"; break; case 75: strNum = "पचहत्तर"; break; case 76: strNum = "छिहत्तर"; break; case 77: strNum = "सतहत्तर"; break; case 78: strNum = "अठहत्तर"; break; case 79: strNum = "उनासी"; break; case 80: strNum = "अस्सी"; break; case 81: strNum = "इक्यासी"; break; case 82: strNum = "बयासी"; break; case 83: strNum = "तिरासी"; break; case 84: strNum = "चौरासी"; break; case 85: strNum = "पचासी"; break; case 86: strNum = "छियासी"; break; case 87: strNum = "सत्तासी"; break; case 88: strNum = "अट्ठासी"; break; case 89: strNum = "नवासी"; break; case 90: strNum = "नब्बे"; break; case 91: strNum = "इक्यानबे"; break; case 92: strNum = "बानबे"; break; case 93: strNum = "तिरानबे"; break; case 94: strNum = "चौरानबे"; break; case 95: strNum = "पंचानबे"; break; case 96: strNum = "छियानबे"; break; case 97: strNum = "सत्तानबे"; break; case 98: strNum = "अट्ठानबे"; break; case 99: strNum = "निन्यानबे"; break; } return strNum; } public Decimal decVal(String str) { try { if (str == "") { return 0; } else { return Convert.ToDecimal(str); } } catch (Exception ex) { throw new Exception(ex.Message.ToString()); } } }