private void CalculateGrossTotals() { Int32 SalBasic, SalHra, SalCca, SalConv, SalLta, SalSpec, SalUnif, SalVeh, SalChild, SalBnp, SalMed, SalPet, SalGross; SalBasic = SalHra = SalCca = SalConv = SalLta = SalSpec = SalUnif = SalVeh = SalChild = SalBnp = SalMed = SalPet = SalGross = 0; if (txtSalBasic.Text.Length > 0) { SalBasic = Convert.ToInt32(txtSalBasic.Text); } if (txtHRA.Text.Length > 0) { SalHra = Convert.ToInt32(txtHRA.Text); } if (txtCCA.Text.Length > 0) { SalCca = Convert.ToInt32(txtCCA.Text); } if (txtConve.Text.Length > 0) { SalConv = Convert.ToInt32(txtConve.Text); } if (txtLTA.Text.Length > 0) { SalLta = Convert.ToInt32(txtLTA.Text); } if (txtSpecial.Text.Length > 0) { SalSpec = Convert.ToInt32(txtSpecial.Text); } if (txtUniform.Text.Length > 0) { SalUnif = Convert.ToInt32(txtUniform.Text); } if (txtVehicle.Text.Length > 0) { SalVeh = Convert.ToInt32(txtVehicle.Text); } if (txtChild.Text.Length > 0) { SalChild = Convert.ToInt32(txtChild.Text); } if (txtBNP.Text.Length > 0) { SalBnp = Convert.ToInt32(txtBNP.Text); } if (txtMED.Text.Length > 0) { SalMed = Convert.ToInt32(txtMED.Text); } if (txtPET.Text.Length > 0) { SalPet = Convert.ToInt32(txtPET.Text); } SalGross = Convert.ToInt32(SalBasic + SalHra + SalCca + SalConv + SalLta + SalSpec + SalUnif + SalVeh + SalChild + SalBnp + SalMed + SalPet); txtGrosSal.Text = SalGross.ToString("0"); }
private void btnSave_Click(object sender, EventArgs e) { int ival = 0; objDb = new SQLDB(); string strCommand = ""; if (CheckData()) { Int32 SalBasic, SalHra, SalCca, SalConv, SalLta, SalSpec, SalUnif, SalVeh, SalChild, SalBnp, SalMed, SalPet, SalGross; SalBasic = SalHra = SalCca = SalConv = SalLta = SalSpec = SalUnif = SalVeh = SalChild = SalBnp = SalMed = SalPet = SalGross = 0; if (txtSalBasic.Text.Length > 0) { SalBasic = Convert.ToInt32(txtSalBasic.Text); } if (txtHRA.Text.Length > 0) { SalHra = Convert.ToInt32(txtHRA.Text); } if (txtCCA.Text.Length > 0) { SalCca = Convert.ToInt32(txtCCA.Text); } if (txtConve.Text.Length > 0) { SalConv = Convert.ToInt32(txtConve.Text); } if (txtLTA.Text.Length > 0) { SalLta = Convert.ToInt32(txtLTA.Text); } if (txtSpecial.Text.Length > 0) { SalSpec = Convert.ToInt32(txtSpecial.Text); } if (txtUniform.Text.Length > 0) { SalUnif = Convert.ToInt32(txtUniform.Text); } if (txtVehicle.Text.Length > 0) { SalVeh = Convert.ToInt32(txtVehicle.Text); } if (txtChild.Text.Length > 0) { SalChild = Convert.ToInt32(txtChild.Text); } if (txtBNP.Text.Length > 0) { SalBnp = Convert.ToInt32(txtBNP.Text); } if (txtMED.Text.Length > 0) { SalMed = Convert.ToInt32(txtMED.Text); } if (txtPET.Text.Length > 0) { SalPet = Convert.ToInt32(txtPET.Text); } SalGross = Convert.ToInt32(SalBasic + SalHra + SalCca + SalConv + SalLta + SalSpec + SalUnif + SalVeh + SalChild + SalBnp + SalMed + SalPet); txtGrosSal.Text = SalGross.ToString("0"); if (txtGrosSal.Text != "0") { try { if (flage == true) { strCommand = "UPDATE HR_SAL_STRU_MASTER SET HSSM_SALSTRU_TYPE='" + cbSalStructType.Tag.ToString() + "',HSSM_SALSTRU_CODE='" + txtSalStructCode.Text + "',HSSM_EFFECTED_FROM ='" + Convert.ToDateTime(dtpSalStructFrom.Value).ToString("dd/MMM/yyyy") + //"',HSSM_EFFECTED_TO='" + Convert.ToDateTime(dtpSalStructTo.Value).ToString("dd/MMM/yyyy") + "',HSSM_SALSTRU_STATUS='y',HSSM_BASIC=" + SalBasic + ",HSSM_HRA=" + SalHra + ",HSSM_CCA=" + SalCca + ",HSSM_CONV_ALW=" + SalConv + ",HSSM_LTA_ALW=" + SalLta + ",HSSM_SPL_ALW=" + SalSpec + ",HSSM_UNF_ALW=" + SalUnif + ",HSSM_VEH_ALW=" + SalVeh + ",HSSM_CH_ED_ALW=" + SalChild + ",HSSM_BNP_ALW=" + SalBnp + ",HSSM_MED_REIMB=" + SalMed + ",HSSM_PET_ALW=" + SalPet + ",HSSM_GROSS=" + Convert.ToInt32(txtGrosSal.Text) + ",HSSM_MODIFIED_BY='" + CommonData.LogUserId + "',HSSM_MODIFIED_DATE=getdate()" + " WHERE HSSM_SALSTRU_CODE='" + txtSalStructCode.Text + "'"; if (cbSalStructType.SelectedIndex == 2) { strCommand += "UPDATE HR_SAL_STRU_MASTER SET HSSM_DESG_CODE=" + Convert.ToInt32(CbDesig.SelectedValue) + " WHERE HSSM_SALSTRU_CODE='" + txtSalStructCode.Text + "'"; } } else if (flage == false) { strCommand = "INSERT INTO HR_SAL_STRU_MASTER(HSSM_SALSTRU_TYPE" + ",HSSM_SALSTRU_CODE" + ",HSSM_EFFECTED_FROM" + ",HSSM_SALSTRU_STATUS" + ",HSSM_BASIC" + ",HSSM_HRA" + ",HSSM_CCA" + ",HSSM_CONV_ALW" + ",HSSM_LTA_ALW" + ",HSSM_SPL_ALW" + ",HSSM_UNF_ALW" + ",HSSM_VEH_ALW" + ",HSSM_CH_ED_ALW" + ",HSSM_BNP_ALW" + ",HSSM_MED_REIMB" + ",HSSM_PET_ALW" + ",HSSM_GROSS "; if (cbSalStructType.Text.Equals("DESIGNATION")) { strCommand += ",HSSM_DESG_CODE"; } strCommand += ",HSSM_CREATED_BY,HSSM_CREATED_DATE)VALUES('" + cbSalStructType.Tag.ToString() + "','" + txtSalStructCode.Text + "','" + Convert.ToDateTime(dtpSalStructFrom.Value).ToString("dd/MMM/yyyy") + "','Y'," + SalBasic + "," + SalHra + "," + SalCca + "," + SalConv + "," + SalLta + "," + SalSpec + "," + SalUnif + "," + SalVeh + "," + SalChild + "," + SalBnp + "," + SalMed + "," + SalPet + "," + Convert.ToInt32(txtGrosSal.Text) + " "; if (cbSalStructType.Text.Equals("DESIGNATION")) { strCommand += "," + Convert.ToInt32(CbDesig.SelectedValue) + " "; } strCommand += ",'" + CommonData.LogUserId + "',getdate())"; } if (strCommand.Length > 10) { ival = objDb.ExecuteSaveData(strCommand); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } if (ival > 0) { MessageBox.Show("Data Saved Successfully", "SSERP", MessageBoxButtons.OK, MessageBoxIcon.Information); btnClear_Click(null, null); flage = false; } else { MessageBox.Show("Data Not Saved ", "SSERP", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }