protected void Page_Load(object sender, EventArgs e)
        {
            //Page.RegisterRedirectOnSessionEndScript();

            page = this.Page;
            if (!IsPostBack)
            {
                string facturas = Request.QueryString["F"];
                Txt_num_doc.Text = facturas;

                List <string> u_negocio    = ReporteRNegocio.trae_app(User.Identity.Name).Split(',').ToList();
                bool          correcto_app = false;
                foreach (string u_ne in u_negocio)
                {
                    if (u_ne.Trim() == "24" || u_ne.Trim() == "43")
                    {
                        correcto_app = true;
                    }
                }
                if (!correcto_app)
                {
                    Response.Redirect("MENU.aspx");
                }

                if (Session["SW_PERMI"].ToString() == "1")
                {
                    //titulo.InnerHtml = "<i class='fa fa-file-o fa-3x'></i> <a class='h1' href='reportes.aspx?s=1'>Abarrotes</a>";
                    titulo2.HRef      = "reportes.aspx?s=1";
                    titulo2.InnerText = "Abarrotes";
                }
                else if (Session["SW_PERMI"].ToString() == "2")
                {
                    //titulo.InnerHtml = "<i class='fa fa-file-o fa-3x'></i> <a class='h1' href='reportes.aspx?s=2'>Granos</a>";
                    titulo2.HRef      = "reportes.aspx?s=2";
                    titulo2.InnerText = "Granos";
                }

                USER            = User.Identity.Name.ToString();
                l_usuario_.Text = USER;
                DateTime t  = DateTime.Now;
                DateTime t2 = DateTime.Now;
                //////t = new DateTime(t.Year, t.Month - 6, 1);
                txt_desde.Text = ReporteRNegocio.CALCULA_DESDE(t.Month, t.Year);
                txt_hasta.Text = t2.ToShortDateString();

                string es_vendedor = ReporteRNegocio.esvendedor(USER);
                if (es_vendedor == "2")
                {
                    btn_excel.Visible  = false;
                    btn_excel2.Visible = false;
                }
                else
                {
                    btn_excel.Visible  = true;
                    btn_excel2.Visible = true;
                }
                ImageClickEventArgs ex = new ImageClickEventArgs(1, 2);
                b_Click(sender, ex);
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //container.Attributes["style"] = "min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto; display:block;";
         //ScriptManager.RegisterStartupScript(Page, this.GetType(), "xwte", "<script>llena_hich() </script>", false);
         DateTime t  = DateTime.Now;
         DateTime t2 = DateTime.Now;
         //t = new DateTime(t.Year, t.Month - 6, 1);
         txt_desde.Text = ReporteRNegocio.CALCULA_DESDE(t.Month, t.Year);
         txt_hasta.Text = t2.ToShortDateString();
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetExpires(DateTime.Now);
            Response.Cache.SetNoServerCaching();
            Response.Cache.SetNoStore();

            if (!IsPostBack)
            {
                List <string> u_negocio    = ReporteRNegocio.trae_app(User.Identity.Name).Split(',').ToList();
                bool          correcto_app = false;
                foreach (string u_ne in u_negocio)
                {
                    if (u_ne.Trim() == "6" || u_ne.Trim() == "12")
                    {
                        correcto_app = true;
                    }
                }
                if (!correcto_app)
                {
                    Response.Redirect("MENU.aspx");
                }

                DateTime t  = DateTime.Now;
                DateTime t2 = DateTime.Now;
                ////t = new DateTime(t.Year, t.Month - 6, 1);
                txt_desde.Text = ReporteRNegocio.CALCULA_DESDE(t.Month, t.Year);
                txt_hasta.Text = t2.ToShortDateString();

                if (Session["SW_PERMI"].ToString() == "1")
                {
                    //titulo.InnerHtml = "<i class='fa fa-file-o fa-3x'></i> <a class='h1' href='reportes.aspx?s=1'>Abarrotes</a>";
                    titulo2.HRef      = "reportes.aspx?s=1";
                    titulo2.InnerText = "Abarrotes";
                }
                else if (Session["SW_PERMI"].ToString() == "2")
                {
                    //titulo.InnerHtml = "<i class='fa fa-file-o fa-3x'></i> <a class='h1' href='reportes.aspx?s=2'>Granos</a>";
                    titulo2.HRef      = "reportes.aspx?s=2";
                    titulo2.InnerText = "Granos";
                }

                USER = User.Identity.Name.ToString();

                string vendedor = ReporteRNegocio.esvendedor(User.Identity.Name.ToString());
                if (vendedor == "2")
                {
                    filtros.Visible   = false;
                    l_vendedores.Text = User.Identity.Name.ToString();
                    grupos            = agregra_comillas(ReporteRNegocio.grupos_usuario_v_report(User.Identity.Name.ToString()));
                    grupos2           = grupos;
                    btn_productos_Click(sender, e);
                }
                else
                {
                    grupos  = agregra_comillas(ReporteRNegocio.grupos_usuario(User.Identity.Name.ToString()));
                    grupos2 = grupos;
                }
                cargar_bodegas();
                cargar_vendedores();
            }
        }