public DataSet DL_BindEmployeeList(EWA_SalarySettings objEWA) { DataSet ds = null; try { //dff prmList = new string[6]; prmList[0] = "@Action"; prmList[1] = objEWA.Action; prmList[2] = "@OrgId"; prmList[3] = objEWA.OrgId.ToString(); prmList[4] = "@PayGrpID"; prmList[5] = objEWA.PayGrpID.ToString(); ds = ObjHelper.FillControl(prmList, "SP_SalarySettings"); if (ds.Tables[0].Rows.Count > 0) { return(ds); } return(ds); } catch (Exception exp) { throw exp; } }
public DataSet DL_SaveSalaryContent(EWA_SalarySettings objEWA) { DataSet dss = new DataSet(); try { cmd = new SqlCommand("SP_SalarySettings", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Action", "Get_TrialSetValues"); cmd.Parameters.AddWithValue("@SalarySleepID", objEWA.SalarySleepID); cmd.Parameters.AddWithValue("@CategoryName", objEWA.CategoryName); cmd.Parameters.AddWithValue("@ContentValue1", objEWA.ContentValue); cmd.Parameters.AddWithValue("@ContentAction", objEWA.ContentAction); cmd.Parameters.AddWithValue("@OrgId", objEWA.OrgId); con.Open(); SqlDataAdapter ad = new SqlDataAdapter(cmd); ad.Fill(dss); con.Close(); return(dss); } catch (Exception exp) { throw exp; } }
public DataSet DL_GetSalarySettings(EWA_SalarySettings objEWA) { DataSet ds = null; try { //dff prmList = new string[12]; prmList[0] = "@Action"; prmList[1] = objEWA.Action; prmList[2] = "@OrgId"; prmList[3] = objEWA.OrgId.ToString(); prmList[4] = "@PayGrpID"; prmList[5] = objEWA.PayGrpID.ToString(); prmList[6] = "@UserCode"; prmList[7] = objEWA.UserCode; prmList[8] = "@SalaryMonth"; prmList[9] = objEWA.SalaryMonth; prmList[10] = "@PostedMonth"; prmList[11] = objEWA.PostedMonth; ds = ObjHelper.FillControl(prmList, "SP_SalarySettings"); //if (ds.Tables[0].Rows.Count > 0) //{ // return ds; //} return(ds); } catch (Exception exp) { throw exp; } }
public DataSet BL_BindEmployeeList(EWA_SalarySettings objEWA) { try { objDL = new DL_SalarySettings(); DataSet ds = objDL.DL_BindEmployeeList(objEWA); return(ds); } catch (Exception exp) { throw exp; } }
public DataSet BL_BindPayGroup(EWA_SalarySettings objEWA) { try { objDL = new DL_SalarySettings(); DataSet ds = objDL.DL_BindPayGroup(objEWA); return(ds); } catch (Exception) { throw; } }
public DataSet GetSalarySettings(EWA_SalarySettings objEWA) { try { objDL = new DL_SalarySettings(); DataSet ds = objDL.DL_GetSalarySettings(objEWA); return(ds); } catch (Exception exp) { throw exp; } }
public DataSet SaveSalaryContent(EWA_SalarySettings objEWA) { try { DL_SalarySettings objDL = new DL_SalarySettings(); return(objDL.DL_SaveSalaryContent(objEWA)); } catch (Exception ex) { throw ex; } finally { objDL = null; } }
public int SalaryHeads_BL(EWA_SalarySettings objEWA) { try { objDL = new DL_SalarySettings(); int flag = objDL.SalaryHeads_DL(objEWA); return(flag); } catch (Exception) { throw; } finally { objDL = null; } }
// Save Salary A public int SaveSalarySlip(EWA_SalarySettings objEWA, DataTable Earnings) { try { DL_SalarySettings objDL = new DL_SalarySettings(); int flag = objDL.DL_SaveSalarySlip(objEWA, Earnings); return(flag); } catch (Exception ex) { throw ex; } finally { objDL = null; } }
public int BL_UpdatePayScale(EWA_SalarySettings objEWA) { try { objDL = new DL_SalarySettings(); int flag = objDL.DL_UpdatePayScale(objEWA); return(flag); } catch (Exception) { throw; } finally { objDL = null; } }
// Salary Heads And Settings #region SalaryHeads public int SalaryHeads_DL(EWA_SalarySettings objEWA) { try { cmd = new SqlCommand("SP_SalarySettings", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Action", objEWA.Action); cmd.Parameters.AddWithValue("@PayGrpContentID", objEWA.PayGrpContentID); cmd.Parameters.AddWithValue("@PayGrpID", objEWA.PayGrpID); cmd.Parameters.AddWithValue("@CategoryName", objEWA.CategoryName); cmd.Parameters.AddWithValue("@CategoryValue", objEWA.CategoryValue); cmd.Parameters.AddWithValue("@ValueType", objEWA.ValueType); //cmd.Parameters.AddWithValue("@ValueOn", objEWA.ValueOn); cmd.Parameters.AddWithValue("@ContentAction", objEWA.ContentAction); cmd.Parameters.AddWithValue("@BasicSalary", objEWA.BasicSalary); cmd.Parameters.AddWithValue("@OrgId", objEWA.OrgId); cmd.Parameters.AddWithValue("@UserId", objEWA.UserId); cmd.Parameters.AddWithValue("@IsActive", objEWA.IsActive); con.Open(); int flag = cmd.ExecuteNonQuery(); con.Close(); return(flag); } catch (Exception ex) { int err = ((System.Data.SqlClient.SqlException)(ex)).Number; if (err == 547 && objEWA.Action == "Delete") { throw new SystemException("Record is in use !!!"); } else { throw ex; } } finally { con.Close(); cmd.Dispose(); } }
// Save Salary Sleep pagefd \ // public int DL_SaveSalarySlip(EWA_SalarySettings objEWA, DataTable Earnings) { try { cmd = new SqlCommand("SP_SalarySettings", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Action", objEWA.Action); cmd.Parameters.AddWithValue("@UserCode", objEWA.UserCode); cmd.Parameters.AddWithValue("@EmployeeName", objEWA.EmployeeName); cmd.Parameters.AddWithValue("@Department", objEWA.Department); cmd.Parameters.AddWithValue("@Designation", objEWA.Designation); cmd.Parameters.AddWithValue("@SalaryMonth", objEWA.SalaryMonth); cmd.Parameters.AddWithValue("@BasicSalary", objEWA.BasicSalary); cmd.Parameters.AddWithValue("@GorssSalary", objEWA.GorssSalary); cmd.Parameters.AddWithValue("@TotalDeduction", objEWA.TotalDeduction); cmd.Parameters.AddWithValue("@LeaveDeduction", objEWA.LeaveDeduction); //cmd.Parameters.AddWithValue("@GorssSalary", objEWA.GorssSalary); cmd.Parameters.AddWithValue("@NetSalary", objEWA.NetSalary); cmd.Parameters.AddWithValue("@AcademicYearId", objEWA.AcademicYearId); cmd.Parameters.AddWithValue("@OrgId", objEWA.OrgId); cmd.Parameters.AddWithValue("@IsActive", objEWA.IsActive); //SqlParameter tblvaluetype = cmd.Parameters.AddWithValue("@SalaryContents", Earnings); //Passing table value parameter //tblvaluetype.SqlDbType = SqlDbType.Structured; con.Open(); int flag = Convert.ToInt32(cmd.ExecuteScalar().ToString()); con.Close(); return(flag); } catch (Exception exp) { throw exp; } }
private void GetReportData() { crEmployeePaySlip crt = new crEmployeePaySlip(); EWA_SalarySettings objEWA = new EWA_SalarySettings(); DL_SalarySettings objDL = new DL_SalarySettings(); String EmpCode = Session["EmpCode"].ToString(); objEWA.UserCode = EmpCode; objEWA.SalaryMonth = Session["PayMonth"].ToString(); DataSet ds = objDL.BindSalarySlipReport(objEWA); crt.SetDataSource(ds.Tables[0]); crvPrintSalarySlip.ReportSource = crt; crvPrintSalarySlip.RefreshReport(); Session.Add("CR_Session", crt); //Add Report into Session CR_Session }
// Bind Salary Slip Report #region [Salary Slip Report] public DataSet BindSalarySlipReport(EWA_SalarySettings objEWA) { DataSet ds = new DataSet(); try { prmList = new string[6]; prmList[0] = "@Action"; prmList[1] = "PrintPaySlip"; prmList[2] = "@UserCode"; prmList[3] = objEWA.UserCode; prmList[4] = "@SalaryMonth"; prmList[5] = objEWA.SalaryMonth; ds = ObjHelper.FillControl(prmList, "SP_SalarySettings"); return(ds); } catch (Exception ex) { throw ex; } }
public DataSet DL_BindPayGroup(EWA_SalarySettings objEWA) { DataSet ds = null; try { prmList = new string[4]; prmList[0] = "@Action"; prmList[1] = "Select"; prmList[2] = "@OrgId"; prmList[3] = objEWA.OrgId.ToString(); ds = ObjHelper.FillControl(prmList, "SP_SalarySettings"); if (ds.Tables[0].Rows.Count > 0) { return(ds); } return(ds); } catch (Exception) { throw; } }
protected void DDL_EmoloyeeName_SelectedIndexChanged(object sender, EventArgs e) { try { ViewState["UserCode"] = DDL_EmoloyeeName.SelectedValue; database db = new database(); PayGroupID = db.getDb_Value("select PayGrpID from tblEmployee where UserCode='" + ViewState["UserCode"] + "'"); if (PayGroupID > 0) { BL_SalarySettings objBL = new BL_SalarySettings(); EWA_SalarySettings objEWA = new EWA_SalarySettings(); objEWA.Action = "GetPayDetails"; objEWA.OrgId = Convert.ToInt32(ViewState["OrgID"]); objEWA.PayGrpID = Convert.ToInt32(PayGroupID); //int.Parse(PayGroupID).ToString();//Convert.ToInt32(ViewState["PayGrpID"]); objEWA.UserCode = DDL_EmoloyeeName.SelectedValue; objEWA.SalaryMonth = Convert.ToDateTime(txtMonth.Text).Month.ToString(); objEWA.PostedMonth = Convert.ToDateTime(txtMonth.Text).Month.ToString(); DataSet ds = objBL.GetSalarySettings(objEWA); if (ds.Tables[0].Rows.Count > 0 || ds.Tables[1].Rows.Count > 0 || ds.Tables[2].Rows.Count > 0 || ds.Tables[3].Rows.Count > 0) { Get_OrganizationDetails(Convert.ToInt32(ViewState["OrgID"])); lblName.Text = ds.Tables[4].Rows[0][1].ToString(); lblDesignation.Text = DDL_Designation.SelectedItem.ToString(); lblName1.Text = ds.Tables[4].Rows[0][1].ToString(); lblDesignation1.Text = DDL_Designation.SelectedItem.ToString(); double GrossSalary = 0, Deductions = 0, NetSalary = 0, leaveDeductions = 0; DataTable dt = new DataTable(); dt.Columns.Add("Description"); dt.Columns.Add("Earnings"); dt.Columns.Add("Deductions"); DataRow dr; if (ds.Tables[3].Rows.Count > 0) { dr = dt.NewRow(); dr[0] = "Basic Salary"; dr[1] = ds.Tables[3].Rows[0][0].ToString(); dr[2] = ""; dt.Rows.Add(dr); txtBasicSalary = Convert.ToDouble(ds.Tables[3].Rows[0][0].ToString()); GrossSalary = GrossSalary + Convert.ToDouble(ds.Tables[3].Rows[0][0].ToString()); } int i = 0; while (ds.Tables[0].Rows.Count > i) { dr = dt.NewRow(); dr[0] = ds.Tables[0].Rows[i][0].ToString(); dr[1] = ds.Tables[0].Rows[i][1].ToString(); dr[2] = ""; GrossSalary = GrossSalary + Convert.ToDouble(ds.Tables[0].Rows[i][1].ToString()); i++; dt.Rows.Add(dr); } i = 0; while (ds.Tables[1].Rows.Count > i) { dr = dt.NewRow(); dr[0] = ds.Tables[1].Rows[i][0].ToString(); dr[1] = ""; dr[2] = ds.Tables[1].Rows[i][1].ToString(); Deductions = Deductions + Convert.ToDouble(ds.Tables[1].Rows[i][1].ToString()); i++; dt.Rows.Add(dr); } int days = DateTime.DaysInMonth(Convert.ToDateTime(txtMonth.Text).Year, Convert.ToDateTime(txtMonth.Text).Month); double leaveday = 0; if (ds.Tables[2].Rows.Count > 0 && ds.Tables[2].Rows[0][0].ToString() != "") { leaveday = Convert.ToDouble(ds.Tables[2].Rows[0][0].ToString()); leaveDeductions = Convert.ToDouble((String.Format("{0:0.00}", (GrossSalary / days) * leaveday)).ToString()); dr = dt.NewRow(); dr[0] = "Leave Deductions"; dr[1] = ""; dr[2] = leaveDeductions; dt.Rows.Add(dr); Deductions = Deductions + leaveDeductions; } lblWorkday.Text = (days - leaveday).ToString(); lblAbsence.Text = leaveday.ToString(); lblWorkday1.Text = (days - leaveday).ToString(); lblAbsence1.Text = leaveday.ToString(); dr = dt.NewRow(); dr[0] = "Total"; dr[1] = GrossSalary; dr[2] = Deductions; dt.Rows.Add(dr); NetSalary = GrossSalary - Deductions; dr = dt.NewRow(); dr[0] = ""; dr[1] = "Net Salary"; dr[2] = NetSalary; dt.Rows.Add(dr); GridView1.DataSource = dt; GridView1.DataBind(); GridView2.DataSource = dt; GridView2.DataBind(); i = 0; while (GridView1.Rows.Count > i) { GridView1.Rows[i].Cells[1].HorizontalAlign = HorizontalAlign.Center; GridView1.Rows[i].Cells[2].HorizontalAlign = HorizontalAlign.Center; i++; } GridView1.Rows[GridView1.Rows.Count - 1].Cells[0].BorderStyle = BorderStyle.None; GridView1.Rows[GridView1.Rows.Count - 1].Cells[1].Font.Bold = true; GridView1.Rows[GridView1.Rows.Count - 1].Cells[2].Font.Bold = true; GridView1.Rows[GridView1.Rows.Count - 1].Cells[1].ForeColor = System.Drawing.Color.DodgerBlue; GridView1.Rows[GridView1.Rows.Count - 2].Cells[0].Font.Bold = true; GridView1.Rows[GridView1.Rows.Count - 2].Cells[1].Font.Bold = true; GridView1.Rows[GridView1.Rows.Count - 2].Cells[2].Font.Bold = true; GridView1.Rows[GridView1.Rows.Count - 2].Cells[0].HorizontalAlign = HorizontalAlign.Center; lblGross.Text = GrossSalary.ToString(); lblNet.Text = NetSalary.ToString(); txtGrossSalary = GrossSalary; txtNetSalary = NetSalary; txtDeductions = Deductions; lblGross1.Text = GrossSalary.ToString(); lblNet1.Text = NetSalary.ToString(); if (ds.Tables[4].Rows.Count > 0) { lblPaymentDate.Text = DateTime.Now.Date.ToShortDateString(); lblBankName.Text = ds.Tables[4].Rows[0][0].ToString(); lblHolderName.Text = ds.Tables[4].Rows[0][1].ToString(); lblAccountNumber.Text = ds.Tables[4].Rows[0][2].ToString(); lblBankBranch.Text = ds.Tables[4].Rows[0][3].ToString(); lblPaymentDate1.Text = DateTime.Now.Date.ToShortDateString(); lblBankName1.Text = ds.Tables[4].Rows[0][0].ToString(); lblHolderName1.Text = ds.Tables[4].Rows[0][1].ToString(); lblAccountNumber1.Text = ds.Tables[4].Rows[0][2].ToString(); lblBankBranch1.Text = ds.Tables[4].Rows[0][3].ToString(); } Panel2.Visible = true; btnPostSalary.Visible = true; btnPrintSalarySlip.Visible = true; } else { GeneralErr("Record Not Found...!"); } } else { msgBox.ShowMessage("Please Apply Pay Scale...!", "Information", UserControls.MessageBox.MessageStyle.Information); } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
protected void btnPostSalary_Click(object sender, EventArgs e) { BL_SalarySettings objBL = new BL_SalarySettings(); EWA_SalarySettings objEWA = new EWA_SalarySettings(); try { objEWA.EmployeeName = DDL_EmoloyeeName.SelectedItem.ToString(); objEWA.UserCode = DDL_EmoloyeeName.SelectedValue.ToString(); objEWA.Department = DDL_Department.SelectedItem.ToString(); objEWA.Designation = DDL_Designation.SelectedItem.ToString(); objEWA.SalaryMonth = txtMonth.Text.ToString(); objEWA.PostedMonth = Convert.ToDateTime(txtMonth.Text).ToString(); objEWA.BasicSalary = txtBasicSalary; objEWA.GorssSalary = txtGrossSalary; objEWA.TotalDeduction = txtDeductions; objEWA.LeaveDeduction = 0;//Convert.ToDouble(txtTotalLeave.Text); objEWA.NetSalary = txtNetSalary; objEWA.OrgId = Convert.ToInt32(Session["OrgId"]); objEWA.AcademicYearId = Convert.ToInt32(Session["AcademicYearId"]); objEWA.Action = "SalarySlipSave"; // CREATING DATA TABLE FOR GRID VIEW DataTable DataSalaryEarning = new DataTable(); DataSalaryEarning.Columns.Add("CategoryName"); DataSalaryEarning.Columns.Add("ContentValue"); DataSalaryEarning.Columns.Add("ContentAction"); string CategoryName, ContentValue, ContentAction; //foreach (GridViewRow gvrow in GridView1.Rows) //{ // CategoryName = GridView1.Rows[gvrow.RowIndex].Cells[0].Text; // if (GridView1.Rows[gvrow.RowIndex].Cells[1].Text != null) // { // ContentValue = GridView1.Rows[gvrow.RowIndex].Cells[1].Text; // DataSalaryEarning.Rows.Add(CategoryName, ContentValue, "Earning"); // } // else // { // ContentValue = GridView1.Rows[gvrow.RowIndex].Cells[2].Text; // DataSalaryEarning.Rows.Add(CategoryName, ContentValue, "Deduction"); // } // i++; //} //foreach (GridViewRow gvrow in grdDeduction.Rows) //{ // CategoryName = grdDeduction.Rows[gvrow.RowIndex].Cells[1].Text; // ContentValue = grdDeduction.Rows[gvrow.RowIndex].Cells[2].Text; // DataSalaryEarning.Rows.Add(CategoryName, ContentValue,"Deduction"); // i++; //} int flag = objBL.SaveSalarySlip(objEWA, DataSalaryEarning); DataSet dss = new DataSet(); DataSet dss1 = new DataSet(); if (flag > 0) { database db = new database(); for (int i = 0; (GridView1.Rows.Count - 2) > i; i++) { CategoryName = GridView1.Rows[i].Cells[0].Text; string date = DateTime.Now.ToShortDateString(); if (GridView1.Rows[i].Cells[1].Text != " ") { ContentValue = GridView1.Rows[i].Cells[1].Text; ContentAction = "Earning"; //db.insert("INSERT INTO tblPostSalaryContents (SalarySleepID,CategoryName,ContentValue,ContentAction,TransDate,AcademicYearId,IsActive) " + // "values('" + flag + "','" + CategoryName + "','" + ContentValue + "','" + ContentAction + "','" + date + "','" + Convert.ToInt32(Session["AcademicYearId"]) + "',1)"); } else { ContentValue = GridView1.Rows[i].Cells[2].Text; ContentAction = "Deduction"; //db.insert("INSERT INTO tblPostSalaryContents (SalarySleepID,CategoryName,ContentValue,ContentAction,TransDate,AcademicYearId,IsActive) " + // "values('" + flag + "','" + CategoryName + "','" + ContentValue + "','" + ContentAction + "','" + date + "','" + Convert.ToInt32(Session["AcademicYearId"]) + "',1)"); } objEWA.ContentValue = ContentValue; objEWA.ContentAction = ContentAction; objEWA.SalarySleepID = flag.ToString(); objEWA.CategoryName = CategoryName; dss1 = objBL.SaveSalaryContent(objEWA); } if (dss1.Tables[0].Rows.Count > 0) { if (dss1.Tables[0].Rows[0]["TokenId"].ToString() != "") { if (dss1.Tables[1].Rows[0]["SenderId"].ToString() != "") { SendPushNotification(dss1.Tables[0].Rows[0]["TokenId"].ToString(), dss1.Tables[0].Rows[0]["Subject"].ToString(), dss1.Tables[0].Rows[0]["OrgName"].ToString(), dss1.Tables[1].Rows[0]["SenderId"].ToString(), dss1.Tables[1].Rows[0]["AppKey"].ToString()); } } } txtMonth.Text = string.Empty; DDL_Department.ClearSelection(); rbtnFacultyType.ClearSelection(); DDL_Designation.ClearSelection(); DDL_EmoloyeeName.ClearSelection(); Panel2.Visible = false; btnPostSalary.Visible = false; btnPrintSalarySlip.Visible = false; msgBox.ShowMessage("Salary Posted Successfully !!!", "Saved", UserControls.MessageBox.MessageStyle.Successfull); } else { if (objEWA.Action == "Save") { msgBox.ShowMessage("Unable to Save !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical); } if (objEWA.Action == "SalarySlipSave" && flag == 0) { Panel2.Visible = false; btnPostSalary.Visible = false; btnPrintSalarySlip.Visible = false; msgBox.ShowMessage("Salary already Posted !!!", "Information", UserControls.MessageBox.MessageStyle.Information); } } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
protected void btnShow_Click(object sender, EventArgs e) { try { ViewState["UserCode"] = Session["UserCode"].ToString(); BL_SalarySettings objBL = new BL_SalarySettings(); EWA_SalarySettings objEWA = new EWA_SalarySettings(); objEWA.Action = "StaffGetSalary_Details"; objEWA.OrgId = Convert.ToInt32(ViewState["OrgID"]); objEWA.PayGrpID = 0; objEWA.UserCode = Session["UserCode"].ToString(); objEWA.SalaryMonth = Convert.ToDateTime(txtMonth.Text).Month.ToString(); objEWA.PostedMonth = txtMonth.Text; DataSet ds = objBL.GetSalarySettings(objEWA); if (ds.Tables[0].Rows.Count > 0 && ds.Tables[1].Rows.Count > 0 && ds.Tables[2].Rows.Count > 0 && ds.Tables[3].Rows.Count > 0) { lbl_CollegeName.Text = ds.Tables[3].Rows[0]["OrgName"].ToString(); lbl_CollegeAddress.Text = ds.Tables[3].Rows[0]["Address"].ToString(); lbl_Number.Text = ds.Tables[3].Rows[0]["PhoneNo"].ToString(); lbl_website.Text = ds.Tables[3].Rows[0]["Website"].ToString(); lbl_CollegeName1.Text = lbl_CollegeName.Text; lbl_CollegeAddress1.Text = ds.Tables[3].Rows[0]["Address"].ToString(); lbl_Number1.Text = ds.Tables[3].Rows[0]["PhoneNo"].ToString(); lbl_website1.Text = ds.Tables[3].Rows[0]["Website"].ToString(); lblmonthyear.Text = Convert.ToDateTime(txtMonth.Text).ToString("MMMM") + " " + Convert.ToDateTime(txtMonth.Text).Year.ToString(); lblName.Text = ds.Tables[0].Rows[0]["EmployeeName"].ToString(); lblDesignation.Text = ds.Tables[0].Rows[0]["Designation"].ToString(); lblName1.Text = lblName.Text; lblmonthyear1.Text = lblmonthyear.Text; lblDesignation1.Text = lblDesignation.Text; lblGross.Text = ds.Tables[0].Rows[0]["GorssSalary"].ToString(); lblNet.Text = ds.Tables[0].Rows[0]["NetSalary"].ToString(); lblGross1.Text = lblGross.Text; lblNet1.Text = lblNet.Text; lblPaymentDate.Text = Convert.ToDateTime(ds.Tables[0].Rows[0]["TransDate"].ToString()).ToString("dd-MM-yyyy"); lblBankName.Text = ds.Tables[0].Rows[0]["BankName"].ToString(); lblHolderName.Text = lblName.Text; lblAccountNumber.Text = ds.Tables[0].Rows[0]["BankAccountNumber"].ToString(); lblBankBranch.Text = ds.Tables[0].Rows[0]["BankBranchName"].ToString(); lblPaymentDate1.Text = Convert.ToDateTime(ds.Tables[0].Rows[0]["TransDate"].ToString()).ToString("dd-MM-yyyy"); lblBankName1.Text = ds.Tables[0].Rows[0]["BankName"].ToString(); lblHolderName1.Text = lblName.Text; lblAccountNumber1.Text = ds.Tables[0].Rows[0]["BankAccountNumber"].ToString(); lblBankBranch1.Text = ds.Tables[0].Rows[0]["BankBranchName"].ToString(); int days = DateTime.DaysInMonth(Convert.ToDateTime(txtMonth.Text).Year, Convert.ToDateTime(txtMonth.Text).Month); double leaveday = 0; lblWorkday.Text = days.ToString(); lblAbsence.Text = "0"; lblWorkday1.Text = days.ToString(); lblAbsence1.Text = "0"; if (ds.Tables[2].Rows.Count > 0 && ds.Tables[2].Rows[0][0].ToString() != "") { leaveday = Convert.ToDouble(ds.Tables[2].Rows[0][0].ToString()); lblWorkday.Text = String.Format("{0:0.00}", (days - leaveday)).ToString(); lblAbsence.Text = leaveday.ToString(); lblWorkday1.Text = String.Format("{0:0.00}", (days - leaveday)).ToString(); lblAbsence1.Text = leaveday.ToString(); } DataTable dt = new DataTable(); dt.Columns.Add("Description"); dt.Columns.Add("Earnings"); dt.Columns.Add("Deductions"); DataRow dr; int i = 0; while (ds.Tables[1].Rows.Count > i) { if (ds.Tables[1].Rows[i]["ContentAction"].ToString() == "Earning") { dr = dt.NewRow(); dr[0] = ds.Tables[1].Rows[i]["CategoryName"].ToString(); dr[1] = ds.Tables[1].Rows[i]["ContentValue"].ToString(); dr[2] = ""; dt.Rows.Add(dr); } else { dr = dt.NewRow(); dr[0] = ds.Tables[1].Rows[i]["CategoryName"].ToString(); dr[1] = ""; dr[2] = ds.Tables[1].Rows[i]["ContentValue"].ToString(); dt.Rows.Add(dr); } i++; } dr = dt.NewRow(); dr[0] = "Total"; dr[1] = lblGross.Text; dr[2] = ds.Tables[0].Rows[0]["TotalDeduction"].ToString(); dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = ""; dr[1] = "Net Salary"; dr[2] = lblNet.Text; dt.Rows.Add(dr); GridView1.DataSource = dt; GridView1.DataBind(); GridView2.DataSource = dt; GridView2.DataBind(); i = 0; while (GridView1.Rows.Count > i) { GridView1.Rows[i].Cells[1].HorizontalAlign = HorizontalAlign.Center; GridView1.Rows[i].Cells[2].HorizontalAlign = HorizontalAlign.Center; i++; } GridView1.Rows[GridView1.Rows.Count - 1].Cells[0].BorderStyle = BorderStyle.None; GridView1.Rows[GridView1.Rows.Count - 1].Cells[1].Font.Bold = true; GridView1.Rows[GridView1.Rows.Count - 1].Cells[2].Font.Bold = true; GridView1.Rows[GridView1.Rows.Count - 1].Cells[1].ForeColor = System.Drawing.Color.DeepSkyBlue; GridView1.Rows[GridView1.Rows.Count - 1].Cells[2].ForeColor = System.Drawing.Color.DeepSkyBlue; Panel2.Visible = true; btnPrintSalarySlip.Visible = true; } else { Panel2.Visible = false; btnPrintSalarySlip.Visible = false; msgBox.ShowMessage("Salary not posted yet...!", "Information", UserControls.MessageBox.MessageStyle.Information); } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }