Tax Calculations in C# (ASP.NET)

Dear Friends,

Here I am going to explain you some interesting topic on taxation (individuals). We came across the scenario and finally we got very simple solutions to calculate it. Here is a code where you can calculate tax of any individual.   


protected double CalculateTaxFromIncome(double income)
    {
        double tax0 = 0, tax = 0, tax1 = 0, tax2 = 0, tax3 = 0;
        double cess = 0;
        double exemptIncome = income > 250000 ? 250000 : income;    //Exempt Income                   
        double incomeChargable10pc = 0.00;                  // Income at 10%
        double incomeChargable20pc = 0.00;                 //  Income at 20%
        double incomeChargable30pc = 0.00;                 // Income  at 30%

        if (income < 250000)
            return tax;
        else
        {
            if ((income - exemptIncome) > 0)
            {
                incomeChargable10pc = (income - exemptIncome) < 500000 ? (income - exemptIncome) : 500000 - 250000;
                tax1 = incomeChargable10pc * 0.1;
            }

            if ((income - (exemptIncome + incomeChargable10pc)) > 0)
            {
                incomeChargable20pc = (income - (exemptIncome + incomeChargable10pc)) > 500000 ? 500000 : (income - (exemptIncome + incomeChargable10pc));
                tax2 = incomeChargable20pc * 0.2;
            }
            if ((income - (exemptIncome + incomeChargable10pc + incomeChargable20pc)) > 0)
            {
                incomeChargable30pc = (income - (exemptIncome + incomeChargable10pc + incomeChargable20pc)) > 0 ? (income - (exemptIncome + incomeChargable10pc + incomeChargable20pc)) : 0;
                tax3 = incomeChargable30pc * 0.3;

            }

            double lessTaxCredit = 0;                        //Less: Tax Credit
            if (income <= 500000)
            {
                lessTaxCredit = 2000; //(having total taxable income upto Rs. 5 lacs)
            }
            tax = ((tax1 + tax2 + tax3) - lessTaxCredit);
            cess = tax * 0.03;

            tax = tax + cess;
            return tax;
        }
    }
Note : this code is generated for a purpose to give an idea about tax calculations in India. This might be not accurate as per rules and laws.
For better understanding  you can refer government tax website.
This is considered as Financial Year 2014-15 and Assessment Year 2015-16. There are variations in rates on every financial year so please consider and change amount as per AY (assessment year).
You need to change rates and tax slabs for every category i.e (Male, Female, Senior Citizen, Very Senior Citizen etc).

I hope it will help you out!


Thanks.

Comments