void GetSalaryByDate() { try { string OCODE = ((SessionUser)Session["SessionUser"]).OCode; List <Salary_Viewer> empSalary = new List <Salary_Viewer>(); empSalary = aSalary_Proccess_BLL.Get_PendingSalaryByDate(Convert.ToDateTime(txtFromDate.Text)).ToList(); if (empSalary.Count > 0) { GridViewSalaryList.DataSource = empSalary.ToList(); GridViewSalaryList.DataBind(); } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Data Processed!')", true); GridViewSalaryList.DataSource = null; GridViewSalaryList.DataBind(); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }
protected void btnReleaseHeldUpSalary_Click(object sender, EventArgs e) { try { if (GridViewSalaryList.Rows.Count < 0) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Held Up Salary in the list!')", true); } foreach (GridViewRow gvRow in GridViewSalaryList.Rows) { CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox")); Label lblEID = ((Label)gvRow.FindControl("lblEID")); TextBox txttotalDeductDay = ((TextBox)gvRow.FindControl("txttotalDeductDay")); string eid = lblEID.Text.ToString(); DateTime salaryMonth = Convert.ToDateTime(txtFromDate.Text); var helduplist = aSalary_Proccess_BLL.GetAll_HeldUpList(txtFromDate.Text).ToList(); if (rowChkBox.Checked == true) { if (helduplist.Count > 0) { HRM_Pay_Salary _HRM_Pay_Salary = new HRM_Pay_Salary(); _HRM_Pay_Salary = _context.HRM_Pay_Salary.Where(c => c.EID == eid && c.Salary_Month == salaryMonth).First(); _HRM_Pay_Salary.Pay_Status = true; _HRM_Pay_Salary.IsSalaryRelease = true; _HRM_Pay_Salary.OCode = ((SessionUser)Session["SessionUser"]).OCode; _HRM_Pay_Salary.Edit_Date = DateTime.Now; _HRM_Pay_Salary.Edit_User = ((SessionUser)Session["SessionUser"]).UserId; try { _context.SaveChanges(); ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Process Successfully')", true); GridViewSalaryList.DataSource = null; GridViewSalaryList.DataBind(); } catch (Exception ex) { throw ex; } } } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Data Found!')", true); } } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }
void GetHeldUpByDate() { try { string OCODE = ((SessionUser)Session["SessionUser"]).OCode; List <Salary_Viewer> empSalary = new List <Salary_Viewer>(); empSalary = aSalary_Proccess_BLL.GetAll_HeldUpList(txtFromDate.Text).ToList(); if (empSalary.Count > 0) { GridViewSalaryList.DataSource = empSalary.ToList(); GridViewSalaryList.DataBind(); //for (int j = 0; j < GridViewSalaryList.Rows.Count; j++) //{ // GridViewSalaryList.Rows[j].Cells[16].BackColor = System.Drawing.Color.Green; // CheckBox cb = new System.Web.UI.WebControls.CheckBox(); // cb.ID = "chkChecked_" + j; // cb.EnableViewState = true; // cb.Text = "chk" + j; // GridViewSalaryList.Rows[j].Cells[16].Controls.Add(cb); //} } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Data Processed!')", true); GridViewSalaryList.DataSource = null; GridViewSalaryList.DataBind(); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }
protected void BtnSave_Click(object sender, EventArgs e) { try { if (GridViewSalaryList.Rows.Count == 0) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No processed salray in the list!')", true); return; } List <HRM_Pay_Salary> lstHRM_Pay_Salary = new List <HRM_Pay_Salary>(); foreach (GridViewRow gvRow in GridViewSalaryList.Rows) { //CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox")); HRM_Pay_Salary _HRM_Pay_Salary = new HRM_Pay_Salary(); //if (rowChkBox.Checked == true) //{ CheckBox rowheldupCheckBox = ((CheckBox)gvRow.FindControl("rowheldupCheckBox")); Label lblSalaryId = (Label)gvRow.FindControl("lblSalaryId"); _HRM_Pay_Salary.PaySalary_ID = Convert.ToInt32(lblSalaryId.Text); if (rowheldupCheckBox.Checked == true) { _HRM_Pay_Salary.IsSalaryHeldup = true; _HRM_Pay_Salary.Pay_Status = false; } else { _HRM_Pay_Salary.IsSalaryHeldup = false; _HRM_Pay_Salary.Pay_Status = true; } _HRM_Pay_Salary.OCode = ((SessionUser)Session["SessionUser"]).OCode; _HRM_Pay_Salary.Edit_User = ((SessionUser)Session["SessionUser"]).UserId; _HRM_Pay_Salary.Edit_Date = DateTime.Now; lstHRM_Pay_Salary.Add(_HRM_Pay_Salary); //} } int result = aSalary_Proccess_BLL.UpdateHeldupSalary(lstHRM_Pay_Salary); if (result == 1) { // // create voucher to temp table // string OCODE = ((SessionUser)Session["SessionUser"]).OCode; // string Edit_User = ((SessionUser)Session["SessionUser"]).UserId.ToString(); // string Company_Code = "CMP201507251"; // string ModuleName = "Payroll"; // string ModuleType = "Salary"; // string VoucherType = "JOURNAL"; // var row1 = aSalary_Proccess_BLL.GetTotalNetPayableByDate(Convert.ToDateTime(txtFromDate.Text)).ToList(); // var row2 = aSalary_Proccess_BLL.GetTotalHeldUpByDate(Convert.ToDateTime(txtFromDate.Text)).ToList(); // var row3 = aSalary_Proccess_BLL.GetTotalPayableByDate(Convert.ToDateTime(txtFromDate.Text)).ToList(); // var row4 = aSalary_Proccess_BLL.GetTotalTDSByDate(Convert.ToDateTime(txtFromDate.Text)).ToList(); // var row5 = aSalary_Proccess_BLL.GetTotalAdvanceByDate(Convert.ToDateTime(txtFromDate.Text)).ToList(); // var row6 = aSalary_Proccess_BLL.GetTotalStampByDate(Convert.ToDateTime(txtFromDate.Text)).ToList(); // if (row3.Count > 0) // { // var TotalPayable = row3.First(); // var netPayable = row1.First(); // var TDSPayable = row4.First(); // var HeldPayable = (row2.Count > 0 ? row2.First() : null); // var AdvancePayable = row5.First(); // var StampPayable = row6.First(); // aSalary_Proccess_BLL.Enter_VoucherDetailsForTotalSalary(OCODE, Company_Code, Edit_User, ModuleName, ModuleType, VoucherType, Convert.ToDecimal(TotalPayable.Net_Payable), Convert.ToDecimal(netPayable.Net_Payable) // , (HeldPayable == null ? 0 : Convert.ToDecimal(HeldPayable.Net_Payable)) // , Convert.ToDecimal(TDSPayable.TotalTax), Convert.ToDecimal(AdvancePayable.AdvanceDeduction), Convert.ToDecimal(StampPayable.Stamp), "n/a"); //} ///// GridViewSalaryList.DataSource = null; GridViewSalaryList.DataBind(); ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Processed Successfully')", true); } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Processing Faliure!')", true); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }