private void SaveData() { dsPayroll_SalaryPackage objDs = new dsPayroll_SalaryPackage(); Payroll_PaySlipOptionMgr objOptMgr = new Payroll_PaySlipOptionMgr(); string IsDelete = "N"; long lngID = 0; try { string strConfrimDate = ""; if (string.IsNullOrEmpty(txtEffDate.Text.Trim()) == false) { strConfrimDate = Common.ReturnDate(txtEffDate.Text.Trim()); } if (hfIsUpdate.Value == "N") { lngID = objDB.GerMaxIDNumber("EmpSalaryAmendment", "LogId"); } else { lngID = Convert.ToInt32(hfID.Value); } DataTable dtBfPlc = objOptMgr.SelectPayrollBenefitsPolicyData("0"); DataRow[] foundPlcRow; foundPlcRow = null; //Basic DataRow nRow1 = objDs.dtSalPackUpdate.NewRow(); nRow1["SHEADID"] = 1; nRow1["PAYAMT"] = Common.RoundDecimal(txtBasicSalary.Text, 0); objDs.dtSalPackUpdate.Rows.Add(nRow1); //House Rent foundPlcRow = dtBfPlc.Select("SHEADID=2"); if (foundPlcRow.Length > 0) { DataRow nRow2 = objDs.dtSalPackUpdate.NewRow(); nRow2["SHEADID"] = 2; nRow2["PAYAMT"] = objEmpInfoMgr.GetHeadAmount(Common.RoundDecimal(txtBasicSalary.Text, 0), Common.RoundDecimal(foundPlcRow[0]["Value"].ToString(), 0)); objDs.dtSalPackUpdate.Rows.Add(nRow2); } // Medical foundPlcRow = dtBfPlc.Select("SHEADID=3"); if (foundPlcRow.Length > 0) { DataRow nRow2 = objDs.dtSalPackUpdate.NewRow(); nRow2["SHEADID"] = 3; nRow2["PAYAMT"] = objEmpInfoMgr.GetHeadAmount(Common.RoundDecimal(txtBasicSalary.Text, 0), Common.RoundDecimal(foundPlcRow[0]["Value"].ToString(), 0)); objDs.dtSalPackUpdate.Rows.Add(nRow2); } // Conveyance foundPlcRow = dtBfPlc.Select("SHEADID=4"); if (foundPlcRow.Length > 0) { DataRow nRow2 = objDs.dtSalPackUpdate.NewRow(); nRow2["SHEADID"] = 4; nRow2["PAYAMT"] = objEmpInfoMgr.GetHeadAmount(Common.RoundDecimal(txtBasicSalary.Text, 0), Common.RoundDecimal(foundPlcRow[0]["Value"].ToString(), 0)); objDs.dtSalPackUpdate.Rows.Add(nRow2); } // Calculate Gross, Incremented Amount, and Percent decimal decGross = Common.RoundDecimal(txtBasicSalary.Text.Trim(), 0) + Common.RoundDecimal(txtHouseRent.Text.Trim(), 0) + Common.RoundDecimal(txtMedical.Text.Trim(), 0) + Common.RoundDecimal(txtConveyance.Text.Trim(), 0); decimal decIncrAmt = decGross - Common.RoundDecimal(lblGross.Text.Trim(), 0); decimal decIncrPercnt = (decIncrAmt * 100) / Common.RoundDecimal(lblGross.Text.Trim(), 0); decIncrPercnt = Common.RoundDecimal(decIncrPercnt.ToString(), 2); objEmpInfoMgr.InsertEmpSalaryAmendment(lngID.ToString(), txtEmpID.Text.Trim(), ddlAction.SelectedValue.ToString(), ddlAction.SelectedItem.ToString(), strConfrimDate, txtBasicSalary.Text, txtHouseRent.Text.Trim(), txtMedical.Text.Trim(), txtConveyance.Text.Trim(), decGross.ToString(), txtRemarks.Text.Trim(), decIncrAmt.ToString(), decIncrPercnt.ToString(), Session["USERID"].ToString(), Common.SetDateTime(DateTime.Now.ToString()), hfIsUpdate.Value, IsDelete, lblSalPac.ToolTip.ToString(), objDs.dtSalPackUpdate); if (hfIsUpdate.Value == "N") { lblMsg.Text = "Record Saved Successfully"; } else { lblMsg.Text = "Record Updated Successfully"; } this.EntryMode(false); this.ClearControls(); //this.OpenRecord(); } catch (Exception ex) { lblMsg.Text = ""; throw (ex); } }