FastReport icon indicating copy to clipboard operation
FastReport copied to clipboard

Does not support indian numbering system.

Open frontlook-admin opened this issue 6 years ago • 6 comments

It does not support Indian rupee symbol or indian numbering symbol. Also number in words. Please add Indian numbering system and rupee sign. Eg=> 23458525=>Two crores thirty four lakhs fifty eight thousands five hundred and twenty five

Singular And Plural of items mentioned below is for help if required

One Crore=>Two Crore. One Lakh => Two Lakh One Thousand => Two Thousand One Hundred => Two Hundred

frontlook-admin avatar Sep 23 '20 18:09 frontlook-admin

Hi,

Thanks for request! We will add this in our development plan.

fediachov avatar Sep 24 '20 14:09 fediachov

Thanks. One more thing Lakh can also be written as Lac

frontlook-admin avatar Sep 24 '20 14:09 frontlook-admin

I have written some codes. See if you can implement it.

`public static class NumberStrings { public static string[] currencyDenotionIndian => new[] {"Rupees", "Paise"};

    public static string NumberToWordsFull(long number)
    {
        if (number == 0) { return "zero"; }
        if (number < 0) { return "minus " + NumberToWordsFull(Math.Abs(number)); }
        string words = "";
        if ((number / 10000000) > 0) { words += NumberToWordsFull(number / 10000000) + " Crore "; number %= 10000000; }
        if ((number / 100000) > 0) { words += NumberToWordsFull(number / 100000) + " Lakh "; number %= 100000; }
        if ((number / 1000) > 0) { words += NumberToWordsFull(number / 1000) + " Thousand "; number %= 1000; }
        if ((number / 100) > 0) { words += NumberToWordsFull(number / 100) + " Hundred "; number %= 100; }
        if (number > 0)
        {
            if (words != "") { words += "and "; }
            var unitsMap = new[] { "Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen" };
            var tensMap = new[] { "Zero", "Ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "seventy", "Eighty", "Ninety" };
            if (number < 20) { words += unitsMap[number]; }
            else { words += tensMap[number / 10]; if ((number % 10) > 0) { words += "-" + unitsMap[number % 10]; } }
        }
        return words;
    }

    public static string NumberToWordsFull(double number,bool IfCurrency,bool showRupees = false)
    {
        var num = number.ToString().Split('.');
        var words1 = NumberToWordsFull(long.Parse(num[0]));

        var word2 = string.Empty;
        if (num.Length > 1 && long.Parse(num[1]) > 1)
            {
                var pt = num[1].ToCharArray();
                word2 = pt.Aggregate(word2,
                    (current, n) => current + (NumberToWordsFull(long.Parse(n.ToString())) + " "));
            }

        if (IfCurrency)
        {
            if (showRupees)
            {
                return num.Length > 1 && long.Parse(num[1]) > 1 ? $"{currencyDenotionIndian[0]} {words1} And {word2}{currencyDenotionIndian[1]} Only"
                    : $"{currencyDenotionIndian[0]} {words1} Only";
            }
            return num.Length>1 && long.Parse(num[1]) > 1 ? $"{words1} And {word2}{currencyDenotionIndian[1]} Only"
                : $"{words1} Only";
        }

        return long.Parse(num[1]) > 1 ? $"{words1} Point {word2}"
            : $"{words1} ";
    }

    
}

`

frontlook-admin avatar Oct 02 '20 09:10 frontlook-admin

The number to words system you implemented in Indian Format must be upto Crore. Arabs and Kharabs are not used.

frontlook-admin avatar May 19 '22 06:05 frontlook-admin

In Indian official documents Nil, Arab, Kharab is not used. It is used till crore. Please fix it.

frontlook-admin avatar Sep 14 '22 11:09 frontlook-admin

Could you please clarify how numbers larger than 999999999 should be handled? I've tried several online converters, and looks like they all max out at that value. Should it be "Hundred Crore" and so on? Some examples would be very welcome.

Alekarfes avatar Jan 10 '24 10:01 Alekarfes