protected void LinkBtnExportExcel_Click(object sender, EventArgs e)
        {
            try
            {
                System.Threading.Thread.Sleep(2000);
                Response.Clear();
                Response.Buffer = true;
                Response.ClearContent();
                Response.ClearHeaders();
                Response.Charset = "";
                string         FileName       = "EmployeeList.xls";
                StringWriter   strwritter     = new StringWriter();
                HtmlTextWriter htmltextwrtter = new HtmlTextWriter(strwritter);
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                Response.ContentType = "application/vnd.ms-excel";
                Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName);

                GVEMP.GridLines             = GridLines.Both;
                GVEMP.HeaderStyle.Font.Bold = true;

                GVEMP.RenderControl(htmltextwrtter);

                Response.Write(strwritter.ToString());
                Response.End();
            }
            catch (Exception ex)
            {
                throw;
                //ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true);
                //lblalert.Text = ex.Message;
            }
        }
        public void getempsale(string booker, string fdat, string tdat)
        {
            try
            {
                string query = " select tbl_MSal.MSal_id,ROW_NUMBER() OVER(ORDER BY tbl_MSal.MSal_id DESC) AS [ID], CreatedBy, DSal_ItmQty ,GTtl as [Total], replace (convert(NVARCHAR, CreatedAt, 101), '/', '/') as [CreatedAt],tbl_MSal.CompanyId, tbl_MSal.BranchId, Booker,SalMan from tbl_MSal inner join tbl_DSal on tbl_MSal.MSal_id = tbl_DSal.MSal_id where booker = '" + booker + "' and CreatedAt between '" + fdat + "' and '" + tdat + "' and tbl_MSal.CompanyId = '" + Session["CompanyID"] + "' and tbl_MSal.BranchId= '" + Session["BranchID"] + "' group by CreatedBy,DSal_ItmQty,DSal_ttl,CreatedAt,GTtl,tbl_MSal.CompanyId, tbl_MSal.BranchId,tbl_MSal.MSal_id,Booker,SalMan  order by MSal_id desc ";

                dt_ = DBConnection.GetQueryData(query);

                if (dt_.Rows.Count > 0)
                {
                    GVEMP.DataSource = dt_;
                    GVEMP.DataBind();
                }
                else
                {
                    //
                }
                string total = " select  tbl_MSal.MSal_id,ROW_NUMBER() OVER(ORDER BY tbl_MSal.MSal_id DESC) AS [ID], CreatedBy, DSal_ItmQty ,sum(GTtl) as [Total Sales],  replace (convert(NVARCHAR, CreatedAt, 101), '/', '/') as [CreatedAt],tbl_MSal.CompanyId, tbl_MSal.BranchId, Booker,SalMan from tbl_MSal inner join tbl_DSal on tbl_MSal.MSal_id = tbl_DSal.MSal_id where booker = '" + booker + "' and CreatedAt between '" + fdat + "' and '" + tdat + "' and tbl_MSal.CompanyId = '" + Session["CompanyID"] + "' and tbl_MSal.BranchId= '" + Session["BranchID"] + "' group by CreatedBy,DSal_ItmQty,DSal_ttl,CreatedAt,GTtl,tbl_MSal.CompanyId, tbl_MSal.BranchId,tbl_MSal.MSal_id,Booker,SalMan ";

                dt_ = DBConnection.GetQueryData(total);

                if (dt_.Rows.Count > 0)
                {
                    lbl_ttl.Text = dt_.Rows[0]["Total Sales"].ToString();
                }
                else
                {
                    // Code Error
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }