protected void Page_Load(object sender, EventArgs e)
        {
            this.btnToOrder.BorderStyle = BorderStyle.None;
            this.btnToOrder.BackColor   = Color.Transparent;

            int n_instancias = 0;

            if (this.hidCerrarSesion.Value != "cerrar")
            {
                this.btnActualiza.BorderStyle  = BorderStyle.None;
                this.btnActualiza.Visible      = false;
                this.btnActualizaX.BorderStyle = BorderStyle.None;
                //INICIO Permiso de ver esta pantalla
                bool permiso = false;
                try
                {
                    int[] idPantallas = (int[])Session["Pantallas"];
                    for (int i = 0; i < idPantallas.Length; i++)
                    {
                        if (idPantallas[i] == 4)
                        {
                            permiso = true;
                            break;
                        }
                    }
                    if (permiso == false)
                    {
                        cerrarSesion();
                    }
                }
                catch (Exception)
                {
                    cerrarSesion();
                }

                indice = -2;

                if (btnbuscar == false)
                {
                    try {
                        indice = int.Parse(Request.QueryString["index"]);
                        cont   = Request.QueryString["cont"];
                    }
                    catch (Exception)
                    {
                    }
                }

                if (this.datepicker.Text != "" && this.datepicker2.Text != "")
                {
                    Session["fecha1"] = this.datepicker.Text;
                    Session["fecha2"] = this.datepicker2.Text;
                }

                this.lblExpandirTodo.Text = "<a href='pagos.aspx?index=-3&cont=et'><div class='ico-expandir_Todo' title='Expandir todo'></div></a>";
                this.lblContraerTodo.Text = "<a href='pagos.aspx?index=-4&cont=ct'><div class='ico-contraer_Todo' title='Contraer todo'></div></a>";
                Pagos res = new Pagos();
                List <PAbiertasYPago> lstPag = null;
                try
                {
                    try
                    {
                        if (this.hidActualiza.Value != "actualiza")
                        {
                            lstPag = (List <PAbiertasYPago>)Session["lstPagos"];
                        }
                    }
                    catch (Exception)
                    {
                    }
                    if (lstPag == null || lstPag.Count <= 0)
                    {
                        List <string[]> listaDiferentesInstancias = (List <string[]>)Session["listaDiferentesInstancias"];
                        n_instancias = listaDiferentesInstancias.Count;
                        string fecha1 = Session["fecha1"].ToString();
                        lstPag = res.getPagos(fecha1, Session["fecha2"].ToString(), listaDiferentesInstancias);

                        Session["lstPagos"] = lstPag;
                    }
                }
                catch (Exception)
                {
                    this.lblTabla.Text = "<h3>Ocurrio un error al obtener los datos<h3>";
                }

                if (lstPag.Count > 0)
                {
                    ConvertTittles conv = new ConvertTittles();

                    if (this.hidHeader.Value != "")
                    {
                        List <PAbiertasYPago> list    = null;
                        List <PAbiertasYPago> lstPag2 = null;
                        list    = eliminarRE(lstPag);
                        list    = Utiles.ordenarListaPagos(list, this.hidHeader.Value.ToString().Trim());
                        lstPag2 = rellenarRE(list, lstPag);
                        if (this.modoOrdenar.Value.ToString().Trim() == "desc")
                        {
                            lstPag2 = ordenarReversa(lstPag2);
                            this.modoOrdenar.Value = "asc";
                        }
                        else
                        {
                            this.modoOrdenar.Value = "desc";
                        }
                        lstPag = lstPag2;
                        //lstPag = lstPag2;
                        Session["lstPagos"] = lstPag;
                    }
                    this.lblTabla.Text        = conv.convertListPAbiertasToTableInCode(lstPag, indice, cont, "tableToOrder");
                    this.btnActualiza.Visible = true;
                }
                else
                {
                    string[] status = res.status;
                    this.lblTabla.Text = "<br/><br/><h3>No se encontraron datos<h3>";
                    if (status.Length > 0)
                    {
                        for (int i = 0; i < status.Length; i++)
                        {
                            if (status[i] != "" && status[i] != null)
                            {
                                this.lblTabla.Text += "<br/><h3>" + status[i] + "</h3>";
                            }
                        }
                        this.lblTabla.Text += "<br/><h3>" + "Se recomienda intentar utilizando los campos de fecha" + "</h3>";
                    }
                    if (n_instancias <= 0)
                    {
                        this.lblTabla.Text = "<br/><br/><br/><h3>" + "Este usuario no tiene sociedades activas, por lo que no puede obtener datos" + "</h3>";
                    }
                }

                btnbuscar = false;
            }
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.hidCerrarSesion.Value != "cerrar")
            {
                this.btnActualiza.BorderStyle  = BorderStyle.None;
                this.btnActualiza.Visible      = false;
                this.btnActualizaX.BorderStyle = BorderStyle.None;
                //INICIO Permiso de ver esta pantalla
                bool permiso = false;
                try
                {
                    int[] idPantallas = (int[])Session["Pantallas"];
                    for (int i = 0; i < idPantallas.Length; i++)
                    {
                        if (idPantallas[i] == 2)
                        {
                            permiso = true;
                            break;
                        }
                    }
                    if (permiso == false)
                    {
                        cerrarSesion();
                    }
                }
                catch (Exception)
                {
                    cerrarSesion();
                }
                //FIN Permiso de ver esta pantalla

                PartidasAbiertas res = new PartidasAbiertas();

                string fecha1 = this.datepicker.Text;
                string fecha2 = this.datepicker2.Text;

                try
                {
                    int             n_instancias = 0;
                    List <string[]> listaDiferentesInstancias = (List <string[]>)Session["listaDiferentesInstancias"];
                    n_instancias = listaDiferentesInstancias.Count;

                    List <PAbiertasYPago> lstPAbiertas = res.getfacturasAbiertas(fecha1, fecha2, listaDiferentesInstancias);

                    ConvertTittles conv = new ConvertTittles();

                    if (lstPAbiertas.Count > 0)
                    {
                        this.lblTabla.Text = conv.convertListPAbiertasToTableInCodeFacturas(lstPAbiertas);
                    }
                    else
                    {
                        string[] status = res.status;
                        this.lblTabla.Text = "<br/><br/><h3>No se encontraron datos<h3>";
                        if (status.Length > 0)
                        {
                            for (int i = 0; i < status.Length; i++)
                            {
                                if (status[i] != "" && status[i] != null)
                                {
                                    this.lblTabla.Text += "<br/><h3>" + status[i] + "</h3>";
                                }
                            }
                            this.lblTabla.Text += "<br/><h3>" + "Se recomienda intentar utilizando los campos de fecha" + "</h3>";

                            this.btnActualiza.Visible = true;
                        }
                        if (n_instancias <= 0)
                        {
                            this.lblTabla.Text = "<br/><br/><br/><h3>" + "Este usuario no tiene sociedades activas, por lo que no puede obtener datos" + "</h3>";
                        }
                    }
                    //if (this.lblTabla.Text  != "")
                    //{
                    //    this.btnActualiza.Visible = true;
                    //}
                }
                catch (Exception)
                {
                    this.lblTabla.Text = "<h3>Ocurrio un error al obtener los datos<h3>";
                }
            }
        }