Showing posts with label how to calculate data in asp.net. Show all posts
Showing posts with label how to calculate data in asp.net. Show all posts

Tuesday, July 24, 2018

how to calculate DAILY WAGES CALCULATION. in asp.net | sradha webcreations

                                   DAILY WAGES CALCULATION.

LABOUR NAME
DATE
WORKING HOURS
PER HOUR
TOTAL


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

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

    }
    protected void ButtonTOTAL_Click(object sender, EventArgs e)
    {
        string sLabourName;
        string sDate;
        float fWorkingHours;
        float fPerHours;
        float fTotal;

        sLabourName = TextBoxLABOUR.Text;
        sDate = TextBoxDATE.Text;
        fWorkingHours = Convert.ToInt32(TextBoxWORKING.Text);
        fPerHours = Convert.ToInt32(TextBoxPER.Text);
        fTotal = fWorkingHours * fPerHours;
        TextBoxTOTAL.Text = Convert.ToString(fTotal);

    }
   
protected void ButtonSAVE_Click(object sender, EventArgs e)
    {
        string connectionstring=ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString;

        string insertsql = "insert into dailywages (labourname,date,workinghours,perhours,total) values(@labourname,@date,@workinghours,@perhours,@total)";

        using (SqlConnection myconnection = new SqlConnection(connectionstring))
        {
            myconnection.Open();
            SqlCommand mycommand = new SqlCommand(insertsql,myconnection);
            mycommand.Parameters.AddWithValue("@labourname",TextBoxLABOUR.Text);
            mycommand.Parameters.AddWithValue("@date",TextBoxDATE.Text);
            mycommand.Parameters.AddWithValue("@workinghours",TextBoxWORKING.Text);
            mycommand.Parameters.AddWithValue("@perhours",TextBoxPER.Text);
            mycommand.Parameters.AddWithValue("@total",TextBoxTOTAL.Text);
            mycommand.ExecuteNonQuery();
            myconnection.Close();
                     
        }
        TextBoxLABOUR.Text = string.Empty;
        TextBoxDATE.Text = string.Empty;
        TextBoxWORKING.Text = string.Empty;
        TextBoxPER.Text = string.Empty;
        TextBoxTOTAL.Text = string.Empty;
    }
}



how to calculate salary in asp.net | sradha webcreations

how to calculate salary in asp.net 

SALARY_CALCULATION.ASPX

Name
Remunaretion  AutoPostBack= True, textChang Event will be fired.
Basic  enable=false
Wash enable=false
medical enable=false
other enable=false
total enable=false
Paid Duty AutoPostBack= True, textChang Event will be fired.
Payable basic enable=false
Pwash enable=false
pmedical enable=false
pother enable=false
payable Total enable=false
TDS enable=false
WF enable=false
grand Total enable=false

SALARY_CALCULATION.ASPX.CS

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class _Default : System.Web.UI.Page
{
   
    double dBasic;
    double dWash;
    double dMedical;
    double dOther;

    double dPBasic;
    double dPWash;
    double dPMedical;
    double dPOther;

    double dTds;
    double dWf;
    double dPayableTotal;

    protected void Buttontotal_Click(object sender, EventArgs e)
    {
        double dtotal;

        dBasic = Convert.ToDouble(TextBoxBASIC.Text);
        dWash = Convert.ToDouble(TextBoxWASH.Text);
        dMedical = Convert.ToDouble(TextBoxWASH.Text);
        dOther = Convert.ToDouble(TextBoxOTHER.Text);

        dtotal=(dBasic+dMedical+dWash+dOther);
        TextBoxTOTAL.Text = Convert.ToString(dtotal);
    }
    protected void TextBoxREMUNARETION_TextChanged(object sender, EventArgs e)
    {
        double dRemunaretion;
        dRemunaretion = Convert.ToDouble(TextBoxREMUNARETION.Text);
       
        dBasic = (dRemunaretion * 80 / 100);
        TextBoxBASIC.Text = Convert.ToString(dBasic);

        dWash=(dRemunaretion*5/100);
        TextBoxWASH.Text = Convert.ToString(dWash);

        dMedical=(dRemunaretion*5/100);
        TextBoxMEDICAL.Text = Convert.ToString(dMedical);
       
        dOther=(dRemunaretion*10/100);
        TextBoxOTHER.Text = Convert.ToString(dOther);

    }
    protected void TextBoxPAID_TextChanged(object sender, EventArgs e)
    {
        double dPaidDuibty;
       
        dPaidDuibty = Convert.ToDouble(TextBoxPAID.Text);
        dBasic = Convert.ToDouble(TextBoxBASIC.Text);

        dPBasic = dBasic / 30 * dPaidDuibty;
        TextBoxPBasic.Text = Convert.ToString(dPBasic);

        dWash = Convert.ToDouble(TextBoxWASH.Text);
        dPWash= dWash / 30 * dPaidDuibty;
        TextBoxpwash.Text = Convert.ToString(dPWash);

        dMedical = Convert.ToDouble(TextBoxMEDICAL.Text);
        dPMedical = dMedical / 30 * dPaidDuibty;
        TextBoxpmedical.Text = Convert.ToString(dPMedical);

        dOther = Convert.ToDouble(TextBoxOTHER.Text);
        dPOther = dOther / 30 * dPaidDuibty;
        TextBoxpother.Text = Convert.ToString(dPOther);

                   }
    protected void buttongrandtotal_Click(object sender, EventArgs e)
    {
        double dGrandTotal;

        dPayableTotal = Convert.ToDouble(TextBoxpayabletotal.Text);
        dTds = Convert.ToDouble(TextBoxtds.Text);
        dWf = Convert.ToDouble(TextBoxwf.Text );

        dGrandTotal=(dPayableTotal-(dTds+dWf));
        TextBoxgrandtotal.Text = Convert.ToString(dGrandTotal);

    }
   
    protected void TextBoxpayabletotal_TextChanged(object sender, EventArgs e)
    {
        double dTds;
        double dWf;
        double dPayableTotal;

        dPayableTotal = Convert.ToDouble(TextBoxpayabletotal.Text);
        dTds = dPayableTotal * 10 / 100;
        TextBoxtds.Text = Convert.ToString(dTds);

        dWf = dPayableTotal * 20 / 100;
        TextBoxwf.Text = Convert.ToString(dWf);

              
    }


    protected void buttonpaybletotal_Click(object sender, EventArgs e)
    {
        double dPayableTotal;
        dPBasic = Convert.ToDouble(TextBoxPBasic.Text);
        dPWash = Convert.ToDouble(TextBoxpwash.Text);
        dPMedical = Convert.ToDouble(TextBoxpmedical.Text);
        dPOther = Convert.ToDouble(TextBoxpother.Text);
        dPayableTotal = dPBasic + dPWash + dPMedical + dPOther;
        TextBoxpayabletotal.Text = Convert.ToString(dPayableTotal);
        double dTds;
        double dWf;  

        dPayableTotal = Convert.ToDouble(TextBoxpayabletotal.Text);
        dTds = dPayableTotal * 10 / 100;
        TextBoxtds.Text = Convert.ToString(dTds);

        dWf = 100;
        TextBoxwf.Text = Convert.ToString(dWf);
    }

    protected void Buttonsave_Click(object sender, EventArgs e)
    {
        string connectionstring=ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString;
        string insertsql = "insert into salarycalculation(name,remunaretion,basic,wash,medical,other,total,paidduty,pbasic,pwash,pmedical,pother,ptotal,tds,wf,gtotal)values(@name,@remunaretion,@basic,@wash,@medical,@other,@ptotal,@paidduty,@pbasic,@pwash,@pmedical,@pother,@ptotal,@tds,@wf,@gtotal)";

        using (SqlConnection myconnection = new SqlConnection(connectionstring))
        {
            myconnection.Open();
            SqlCommand mycommand = new SqlCommand(insertsql,myconnection);
            mycommand.Parameters.AddWithValue("@name",TextBoxNAME.Text);
       mycommand.Parameters.AddWithValue("@remunaretion",TextBoxREMUNARETION.Text);
            mycommand.Parameters.AddWithValue("@basic",TextBoxBASIC.Text);
            mycommand.Parameters.AddWithValue("@wash",TextBoxWASH.Text);
            mycommand.Parameters.AddWithValue("@medical",TextBoxMEDICAL.Text);
            mycommand.Parameters.AddWithValue("@other",TextBoxOTHER.Text);
            mycommand.Parameters.AddWithValue("@total",TextBoxTOTAL.Text);
            mycommand.Parameters.AddWithValue("@paidduty",TextBoxPAID.Text);
            mycommand.Parameters.AddWithValue("@pbasic",TextBoxPBasic.Text);
            mycommand.Parameters.AddWithValue("@pwash",TextBoxpwash.Text);
            mycommand.Parameters.AddWithValue("@pmedical",TextBoxpmedical.Text);
            mycommand.Parameters.AddWithValue("@pother",TextBoxpother.Text);
            mycommand.Parameters.AddWithValue("@ptotal",TextBoxpayabletotal.Text);
            mycommand.Parameters.AddWithValue("@tds",TextBoxtds.Text);
            mycommand.Parameters.AddWithValue("@wf",TextBoxwf.Text);
        mycommand.Parameters.AddWithValue("@gtotal",TextBoxgrandtotal.Text);

            mycommand.ExecuteNonQuery();
            myconnection.Close();
        }
        TextBoxNAME.Text = string.Empty;
        TextBoxREMUNARETION.Text = string.Empty;
        TextBoxBASIC.Text = string.Empty;
        TextBoxWASH.Text = string.Empty;
        TextBoxMEDICAL.Text = string.Empty;
        TextBoxOTHER.Text = string.Empty;
        TextBoxTOTAL.Text = string.Empty;
        TextBoxPAID.Text = string.Empty;
        TextBoxPBasic.Text = string.Empty;
        TextBoxpwash.Text = string.Empty;
        TextBoxpmedical.Text = string.Empty;
        TextBoxpother.Text = string.Empty;
        TextBoxpayabletotal.Text = string.Empty;
        TextBoxtds.Text = string.Empty;
        TextBoxwf.Text = string.Empty;
        TextBoxgrandtotal.Text = string.Empty;
            }
    }