Wednesday, June 27, 2018

HOW TO CREATE BASIC GST CALCULATOR IN ASP.NET - (ADD GST AND REMOVE GST)

HERE IN THIS .NET Tutorial WE WILL CREATE BASIC GST CALCULATOR IN ASP.NET - (ADD GST AND REMOVE GST)

GST Tax Calculation Formula
All one needs to do is input the net amount of a good or service and the applicable GST rate (5%, 12%, 18% or 28%) into the tool. Click on the 'Calculate' button and instantly get the gross price of the good or service. GST calculation is represented by the below example:

A goods or service is sold at the rate of Rs.500. GST rate is 18%. Gross amount of the goods or service = 500 + [500 x (18/100)] = Rs.590

Formula for GST calculation:

Add GST:
-----------------------------------------------------------------------------------------------------------------------------
GST Amount = (Original Cost x (GST% /100) )

Net Price = Original Cost + GST Amount
-------------------------------------------------------------------------------------------------------------------------------
Original Cost=500
GST%= 18%
GST Convert=(18/100)=0.18
GST Amount =Original Cost * GST Convert
GST Amount = 500 * 0.18=90
Net Price = Original Cost + GST Amount
Net Price = 500 +90=Rs 590.

-------------------------------------------------------------------------------------------------------------------------------
Remove GST:
GST Amount = Original Cost - [Original Cost x {100/(100+GST%)}]

Net Price = Original Cost - GST Amount
--------------------------------------------------------------------------------------------------------------------------------
Original Cost=500
GST%= 18%
GST Amount = Original Cost - [Original Cost x {100/(100+GST%)}]
GST Amount = 500 - [500 x {100/(100+18)}]=76.271186
Net Price = Original Cost - GST Amount
Net Price = 500 - 76.271186=423.728814

As Per Indian GST System.

So Let Begin With Coding

Step1 :- Design Form And Save As Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .style1
        {
            width: 112px;
        }
    </style>
</head>
<body style="height: 75px; width: 575px">
    <form id="form1" runat="server">
    <div>
   
        <table style="width: 62%; height: 71px;">
            <tr>
                <td class="style1">
                    <asp:Label ID="Label1" runat="server" Text="Original Cost :-"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style1">
                    <asp:Label ID="Label2" runat="server" Text="GST% :-"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style1">
                    &nbsp;</td>
                <td>
                    <asp:Button ID="Button1" runat="server" onclick="Button1_Click"
                        Text="Add GST" />
&nbsp;
                    <asp:Button ID="Button2" runat="server" onclick="Button2_Click"
                        Text="Remove GST" />
                </td>
            </tr>
            <tr>
                <td class="style1">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style1">
                    &nbsp;</td>
                <td>
                    <asp:Label ID="Label3" runat="server" Text="Net Price :-"></asp:Label>
&nbsp;
                    <asp:Label ID="Label4" runat="server" Font-Bold="True" ForeColor="#00CC00"></asp:Label>
                </td>
            </tr>
        </table>
   
    </div>
    </form>
</body>
</html>

Step 2 : C# Code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        decimal OriginalCost = Convert.ToDecimal(TextBox1.Text);
        decimal GST = (Convert.ToDecimal(TextBox2.Text)/100);
        decimal GSTAmount = (OriginalCost + (OriginalCost * GST));
        Label4.Text = GSTAmount.ToString();
   
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        decimal OriginalCost = Convert.ToDecimal(TextBox1.Text);
        decimal GST = Convert.ToDecimal(TextBox2.Text);
        decimal GSTAmount = (OriginalCost - (OriginalCost * (100/(100+GST))));
        decimal NetPrice = OriginalCost - GSTAmount;
        Label4.Text = NetPrice.ToString();
   
    }
}

Output :-





Add GST




REMOVE GST




Video Related To This Topic Is Here Below.
HOW TO CREATE BASIC GST CALCULATOR IN ASP.NET - (ADD GST AND REMOVE GST)


No comments:

Post a Comment