private void BindGridFactura(Int32 currentPage)
        {
            DsImportesVentas ds = null;

            // configuro la grilla
            SisPackController.AdministrarGrillas.Configurar(gridFacturasConceptos, this.CantidadOpciones);
            gridFacturasConceptos.ShowFooter  = true;
            gridFacturasConceptos.AllowPaging = true;

            if (ddlGridFacturasAgrupadoPor.SelectedValue == "0")
            {
                gridFacturasConceptos.Columns[0].HeaderText = "Agencia";
            }
            else if (ddlGridFacturasAgrupadoPor.SelectedValue == "1")
            {
                gridFacturasConceptos.Columns[0].HeaderText = "Concepto de facturación";
            }
            else
            {
                gridFacturasConceptos.Columns[0].HeaderText = "";
            }

            // Reviso si los datos están en memoria
            if (Session["DsImportesVentas_FacturasConceptos"] == null)
            {
                // Los datos no están en memoria. Los busco
                IConsultasVentas consulta = ConsultasVentasFactory.GetConsultasVentas();
                if (this.busqAgenciaOrigen.Sucursal != "" && this.busqAgenciaOrigen.RazonSocial != "" && this.busqAgenciaOrigen.AgenciaID != "" && this.ddlZonaOrigen.SelectedValue.ToString() == "0")
                {
                    consulta.AgenciaOrigenID = Convert.ToInt32(this.busqAgenciaOrigen.AgenciaID);
                }
                else
                {
                    consulta.AgenciaOrigenID = 0;
                    consulta.ZonaOrigenID    = Utiles.Validaciones.obtieneEntero(this.ddlZonaOrigen.SelectedValue.ToString());
                }


                consulta.ConceptoFacturacionID       = Utiles.Validaciones.obtieneEntero(ddlConceptoFacturacion.SelectedValue);
                consulta.FechaDesde                  = this.txtFechaDesde.Text != "" ? Utiles.Fechas.FormatFechaDDMMYYYY(this.txtFechaDesde.Text) : Utiles.Fechas.FormatFechaDDMMYYYY("01/01/1900");
                consulta.FechaHasta                  = this.txtFechaHasta.Text != "" ? Utiles.Fechas.FormatFechaDDMMYYYY(this.txtFechaHasta.Text) : DateTime.Today;
                consulta.AgrupacionFacturasConceptos = Convert.ToInt32(ddlGridFacturasAgrupadoPor.SelectedValue);
                consulta.CondicionPagoID             = Utiles.Validaciones.obtieneEntero(this.ddlCondicionPago.SelectedValue);
                ds = consulta.GetImportesFacturasConceptos();
                Session["DsImportesVentas_FacturasConceptos"] = ds;
            }
            else
            {
                // Los datos están en memoria
                ds = (DsImportesVentas)Session["DsImportesVentas_FacturasConceptos"];
            }

            // Cargo los datos
            gridFacturasConceptos.DataSource = ds.FacturasConceptos;
            gridFacturasConceptos.PageIndex  = currentPage;
            gridFacturasConceptos.DataBind();

            lblTituloGrillaGuias.Visible = true;
        }
        private void PopulateGrid()
        {
            Grid.DataSource = this.Datos;
            Grid.DataBind();
            GridFooter.DataSource = this.datosFooter;
            GridFooter.DataBind();

            // Reviso si los datos están en memoria
            if (Session["DsImportesVentas_FacturasConceptos_lstMontosVentas"] != null)
            {
                // Los datos están en memoria
                DsImportesVentas ds = (DsImportesVentas)Session["DsImportesVentas_FacturasConceptos_lstMontosVentas"];
                gridFacturasConceptos.DataSource = ds.FacturasConceptos;
                gridFacturasConceptos.DataBind();
            }
        }
        protected void gridFacturasConceptos_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Header)
            {
                e.Item.Cells[0].Text = Request.QueryString["Entidad"].ToString();
            }
            if (e.Item.ItemType == ListItemType.Footer)
            {
                e.Item.Cells[0].Text = "Total:";

                Double _totalNeto = 0, _totalIVA = 0, _total = 0, _cantidadComprobantes = 0;

                // Reviso si los datos están en memoria
                if (Session["DsImportesVentas_FacturasConceptos_lstMontosVentas"] != null)
                {
                    // Los datos están en memoria
                    DsImportesVentas ds = (DsImportesVentas)Session["DsImportesVentas_FacturasConceptos_lstMontosVentas"];

                    if (Double.TryParse(ds.FacturasConceptos.Compute("sum(TotalNeto)", "").ToString(), out _totalNeto) == false)
                    {
                        _totalNeto = 0;
                    }

                    if (Double.TryParse(ds.FacturasConceptos.Compute("sum(TotalIVA)", "").ToString(), out _totalIVA) == false)
                    {
                        _totalIVA = 0;
                    }

                    if (Double.TryParse(ds.FacturasConceptos.Compute("sum(Total)", "").ToString(), out _total) == false)
                    {
                        _total = 0;
                    }

                    if (Double.TryParse(ds.FacturasConceptos.Compute("sum(CantidadComprobantes)", "").ToString(), out _cantidadComprobantes) == false)
                    {
                        _cantidadComprobantes = 0;
                    }
                }

                e.Item.Cells[1].Text = _totalNeto.ToString("#,###0.00");
                e.Item.Cells[2].Text = _totalIVA.ToString("#,###0.00");
                e.Item.Cells[3].Text = _total.ToString("#,###0.00");
                e.Item.Cells[4].Text = _cantidadComprobantes.ToString("#,###0");
            }
        }
        public DsImportesVentas GetImportesFacturasConceptos()
        {
            DsImportesVentas ds                   = new DsImportesVentas();
            SqlParameter     pAgencia             = new SqlParameter("@AgenciaID", Utiles.BaseDatos.IntToSql(this.AgenciaOrigenID));
            SqlParameter     pConceptoFacturacion = new SqlParameter("@ConceptoFacturacionID", Utiles.BaseDatos.IntToSql(ConceptoFacturacionID));
            SqlParameter     pFechaDesde          = new SqlParameter("@FechaDesde", fechaDesde);
            SqlParameter     pFechaHasta          = new SqlParameter("@FechaHasta", fechaHasta);
            SqlParameter     pAgrupacion          = new SqlParameter("@Agrupacion", AgrupacionFacturasConceptos);
            SqlParameter     pCondicionPagoID     = new SqlParameter("@CondicionPagoID", Utiles.BaseDatos.IntToSql(this.CondicionPagoID));
            SqlParameter     pClienteID           = new SqlParameter("@ClienteID", Utiles.BaseDatos.IntToSql(ClienteID));
            SqlParameter     pVendedorID          = new SqlParameter("@VendedorID", Utiles.BaseDatos.IntToSql(VendedorID));
            SqlParameter     pZonasOrigen         = new SqlParameter("@ZonaOrigenID", Utiles.BaseDatos.IntToSql(ZonaOrigenID));

            Config.Conexion.LlenarTypeDataSet(ds.FacturasConceptos, System.Data.CommandType.StoredProcedure, "GetVentasByAgenciaIDConceptoFacturacionID",
                                              pAgencia, pConceptoFacturacion, pAgrupacion, pFechaDesde, pFechaHasta, pCondicionPagoID, pClienteID, pVendedorID, pZonasOrigen);

            return(ds);
        }
        protected void gridFacturasConceptos_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Footer)
            {
                e.Row.Cells[0].Text = "Total:";

                Double _totalNeto = 0, _totalIVA = 0, _total = 0, _cantidadComprobantes = 0;

                // Reviso si los datos están en memoria
                if (Session["DsImportesVentas_FacturasConceptos"] != null)
                {
                    // Los datos están en memoria
                    DsImportesVentas ds = (DsImportesVentas)Session["DsImportesVentas_FacturasConceptos"];

                    if (Double.TryParse(ds.FacturasConceptos.Compute("sum(TotalNeto)", "").ToString(), out _totalNeto) == false)
                    {
                        _totalNeto = 0;
                    }

                    if (Double.TryParse(ds.FacturasConceptos.Compute("sum(TotalIVA)", "").ToString(), out _totalIVA) == false)
                    {
                        _totalIVA = 0;
                    }

                    if (Double.TryParse(ds.FacturasConceptos.Compute("sum(Total)", "").ToString(), out _total) == false)
                    {
                        _total = 0;
                    }

                    if (Double.TryParse(ds.FacturasConceptos.Compute("sum(CantidadComprobantes)", "").ToString(), out _cantidadComprobantes) == false)
                    {
                        _cantidadComprobantes = 0;
                    }
                }

                e.Row.Cells[1].Text = _totalNeto.ToString("#,###0.00");
                e.Row.Cells[2].Text = _totalIVA.ToString("#,###0.00");
                e.Row.Cells[3].Text = _total.ToString("#,###0.00");
                e.Row.Cells[4].Text = _cantidadComprobantes.ToString("#,###0");
            }
        }
        public DsImportesVentas GetImportesVentasByAgenciaUnidadVenta()
        {
            DsImportesVentas ds              = new DsImportesVentas();
            SqlParameter     pAgenciaOrigen  = new SqlParameter("@AgenciaOrigenID", Utiles.BaseDatos.IntToSql(this.AgenciaOrigenID));
            SqlParameter     pAgenciaDestino = new SqlParameter("@AgenciaDestinoID", Utiles.BaseDatos.IntToSql(this.AgenciaDestinoID));
            SqlParameter     pZonasOrigen    = new SqlParameter("@ZonaOrigenID", Utiles.BaseDatos.IntToSql(ZonaOrigenID));
            SqlParameter     pZonasDestino   = new SqlParameter("@ZonaDestinoID", Utiles.BaseDatos.IntToSql(ZonaDestinoID));

            SqlParameter pUnidadVentaID     = new SqlParameter("@UnidadVentaID", Utiles.BaseDatos.IntToSql(this.UnidadVentaID));
            SqlParameter pFechaDesde        = new SqlParameter("@FechaDesde", fechaDesde);
            SqlParameter pFechaHasta        = new SqlParameter("@FechaHasta", fechaHasta);
            SqlParameter pAgrupacion        = new SqlParameter("@TipoAgrupacion", this.tipoAgrupacion);
            SqlParameter pCategoriaUVentaID = new SqlParameter("@CategoriaUVentaID", Utiles.BaseDatos.IntToSql(this.CategoriaUVentaID));
            SqlParameter pCondicionPagoID   = new SqlParameter("@CondicionPagoID", Utiles.BaseDatos.IntToSql(this.CondicionPagoID));

            Config.Conexion.LlenarTypeDataSet(ds.Datos, System.Data.CommandType.StoredProcedure, "GetVentasByAgenciaIDUVentaID",
                                              pAgenciaOrigen, pAgenciaDestino, pUnidadVentaID, pAgrupacion, pFechaDesde, pFechaHasta, pCategoriaUVentaID, pCondicionPagoID, pZonasOrigen, pZonasDestino);


            return(ds);
        }
        private void BindGrid(int currentPage)
        {
            SisPackController.AdministrarGrillas.Configurar(this.dtgListados, "EntidadID", this.CantidadOpciones, true, true);

            IConsultasVentas consulta = ConsultasVentasFactory.GetConsultasVentas();

            if (this.busqAgenciaOrigen.Sucursal != "" && this.busqAgenciaOrigen.RazonSocial != "" && this.busqAgenciaOrigen.AgenciaID != "" && this.ddlZonaOrigen.SelectedValue.ToString() == "0")
            {
                consulta.AgenciaOrigenID = Convert.ToInt32(this.busqAgenciaOrigen.AgenciaID);
            }
            else
            {
                consulta.AgenciaOrigenID = 0;
                consulta.ZonaOrigenID    = Utiles.Validaciones.obtieneEntero(this.ddlZonaOrigen.SelectedValue.ToString());
            }
            if (this.busqAgenciaDestino.Sucursal != "" && this.busqAgenciaDestino.RazonSocial != "" && this.busqAgenciaDestino.AgenciaID != "" && this.ddlZonaDestino.SelectedValue.ToString() == "0")
            {
                consulta.AgenciaDestinoID = Convert.ToInt32(this.busqAgenciaDestino.AgenciaID);
            }
            else
            {
                consulta.AgenciaDestinoID = 0;
                consulta.ZonaDestinoID    = Utiles.Validaciones.obtieneEntero(this.ddlZonaDestino.SelectedValue.ToString());
            }

            consulta.UnidadVentaID     = Utiles.Validaciones.obtieneEntero(this.ddlUnidadVenta.SelectedValue);
            consulta.FechaDesde        = this.txtFechaDesde.Text != "" ? Utiles.Fechas.FormatFechaDDMMYYYY(this.txtFechaDesde.Text) : Utiles.Fechas.FormatFechaDDMMYYYY("01/01/1900");
            consulta.FechaHasta        = this.txtFechaHasta.Text != "" ? Utiles.Fechas.FormatFechaDDMMYYYY(this.txtFechaHasta.Text) : DateTime.Today;
            consulta.TipoAgrupacion    = Convert.ToInt32(this.ddlAgrupado.SelectedValue);
            consulta.CategoriaUVentaID = Utiles.Validaciones.obtieneEntero(this.ddlCategoriasUVenta.SelectedValue);
            consulta.CondicionPagoID   = Utiles.Validaciones.obtieneEntero(this.ddlCondicionPago.SelectedValue);
            DsImportesVentas ds = (DsImportesVentas)consulta.GetImportesVentasByAgenciaUnidadVenta();

            this.dtgListados.DataSource       = ds;
            Session["DsImportesVentas"]       = ds;
            this.dtgListados.CurrentPageIndex = currentPage;
            this.dtgListados.DataBind();

            lblTituloGrillaFacturas.Visible = true;
        }
        /*private void dtgListados_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
         * {
         *      this.BindGrid(e.NewPageIndex);
         * }*/
        private void dtgListados_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                e.Item.Cells[2].Text = Utiles.Formatos.Importe(Convert.ToDouble(DataBinder.Eval(e.Item.DataItem, "PesoTotal")));

                e.Item.Cells[4].Text  = Utiles.Formatos.Importe(Convert.ToDouble(DataBinder.Eval(e.Item.DataItem, "ImporteFlete")));
                e.Item.Cells[5].Text  = Utiles.Formatos.Importe(Convert.ToDouble(DataBinder.Eval(e.Item.DataItem, "ImporteRetiro")));
                e.Item.Cells[6].Text  = Utiles.Formatos.Importe(Convert.ToDouble(DataBinder.Eval(e.Item.DataItem, "ImporteEntrega")));
                e.Item.Cells[7].Text  = Utiles.Formatos.Importe(Convert.ToDouble(DataBinder.Eval(e.Item.DataItem, "ImporteSeguro")));
                e.Item.Cells[8].Text  = Utiles.Formatos.Importe(Convert.ToDouble(DataBinder.Eval(e.Item.DataItem, "ImporteServicioAdicional")));
                e.Item.Cells[9].Text  = Utiles.Formatos.Importe(Convert.ToDouble(DataBinder.Eval(e.Item.DataItem, "ImporteComisContraReembolso")));
                e.Item.Cells[10].Text = Utiles.Formatos.Importe(Convert.ToDouble(DataBinder.Eval(e.Item.DataItem, "ImporteContrareembolso")));
                e.Item.Cells[11].Text = Utiles.Formatos.Importe(Convert.ToDouble(DataBinder.Eval(e.Item.DataItem, "ImporteRecargoTarjeta")));
                e.Item.Cells[12].Text = Utiles.Formatos.Importe(Convert.ToDouble(DataBinder.Eval(e.Item.DataItem, "IVAInscriptoTotal")));
                e.Item.Cells[13].Text = Utiles.Formatos.Importe(Convert.ToDouble(DataBinder.Eval(e.Item.DataItem, "ImporteNetoTotal")));
                e.Item.Cells[14].Text = Utiles.Formatos.Importe(Convert.ToDouble(DataBinder.Eval(e.Item.DataItem, "ImporteTotalGuia")));
            }
            else if (e.Item.ItemType == ListItemType.Footer)
            {
                DsImportesVentas dsIV = (DsImportesVentas)Session["DsImportesVentas"];

                if (dsIV != null && dsIV.Tables[0].Rows.Count > 0)
                {
                    int    CantidadBultosTotal         = Utiles.Validaciones.obtieneEntero(Convert.ToString(dsIV.Datos.Compute("Sum(CantidadBultosTotal)", "")));
                    int    CantidadGuias               = Utiles.Validaciones.obtieneEntero(Convert.ToString(dsIV.Datos.Compute("Sum(CantidadGuias)", "")));
                    double ValorDeclaradoTotal         = Utiles.Validaciones.obtieneDouble(Convert.ToString(dsIV.Datos.Compute("Sum(ValorDeclaradoTotal)", "")));
                    double PesoTotal                   = Utiles.Validaciones.obtieneDouble(Convert.ToString(dsIV.Datos.Compute("Sum(PesoTotal)", "")));
                    double IVAInscriptoTotal           = Utiles.Validaciones.obtieneDouble(Convert.ToString(dsIV.Datos.Compute("Sum(IVAInscriptoTotal)", "")));
                    double ImporteNetoTotal            = Utiles.Validaciones.obtieneDouble(Convert.ToString(dsIV.Datos.Compute("Sum(ImporteNetoTotal)", "")));
                    double ImporteTotalGuia            = Utiles.Validaciones.obtieneDouble(Convert.ToString(dsIV.Datos.Compute("Sum(ImporteTotalGuia)", "")));
                    double ImporteFlete                = Utiles.Validaciones.obtieneDouble(Convert.ToString(dsIV.Datos.Compute("Sum(ImporteFlete)", "")));
                    double ImporteRetiro               = Utiles.Validaciones.obtieneDouble(Convert.ToString(dsIV.Datos.Compute("Sum(ImporteRetiro)", "")));
                    double ImporteEntrega              = Utiles.Validaciones.obtieneDouble(Convert.ToString(dsIV.Datos.Compute("Sum(ImporteEntrega)", "")));
                    double ImporteSeguro               = Utiles.Validaciones.obtieneDouble(Convert.ToString(dsIV.Datos.Compute("Sum(ImporteSeguro)", "")));
                    double ImporteComisContraReembolso = Utiles.Validaciones.obtieneDouble(Convert.ToString(dsIV.Datos.Compute("Sum(ImporteComisContraReembolso)", "")));
                    double ImporteContrareembolso      = Utiles.Validaciones.obtieneDouble(Convert.ToString(dsIV.Datos.Compute("Sum(ImporteContrareembolso)", "")));
                    double ImporteRecargoTarjeta       = Utiles.Validaciones.obtieneDouble(Convert.ToString(dsIV.Datos.Compute("Sum(ImporteRecargoTarjeta)", "")));
                    double ImporteServicioAdicional    = Utiles.Validaciones.obtieneDouble(Convert.ToString(dsIV.Datos.Compute("Sum(ImporteServicioAdicional)", "")));

                    e.Item.Cells[0].Text = "Total";

                    e.Item.Cells[1].Text = ValorDeclaradoTotal.ToString("#,##0.00");
                    e.Item.Cells[2].Text = PesoTotal.ToString("#,##0.00");
                    e.Item.Cells[3].Text = CantidadBultosTotal.ToString();
                    e.Item.Cells[4].Text = ImporteFlete.ToString("#,##0.00");
                    e.Item.Cells[5].Text = ImporteRetiro.ToString("#,##0.00");
                    e.Item.Cells[6].Text = ImporteEntrega.ToString("#,##0.00");
                    e.Item.Cells[7].Text = ImporteSeguro.ToString("#,##0.00");

                    e.Item.Cells[8].Text  = ImporteServicioAdicional.ToString("#,##0.00");
                    e.Item.Cells[9].Text  = ImporteComisContraReembolso.ToString("#,##0.00");
                    e.Item.Cells[10].Text = ImporteContrareembolso.ToString("#,##0.00");
                    e.Item.Cells[11].Text = ImporteRecargoTarjeta.ToString("#,##0.00");
                    e.Item.Cells[12].Text = IVAInscriptoTotal.ToString("#,##0.00");
                    e.Item.Cells[13].Text = ImporteNetoTotal.ToString("#,##0.00");
                    e.Item.Cells[14].Text = ImporteTotalGuia.ToString("#,##0.00");
                    e.Item.Cells[15].Text = CantidadGuias.ToString();

                    DsImportesVentas ds = new DsImportesVentas();

                    ds.Datos.AddDatosRow(0, "", 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0);
                    Session["DsImportesVentasFooter"] = ds;
                }
            }
        }
Beispiel #9
0
        private void BindGridFactura(Int32 currentPage)
        {
            DsImportesVentas ds = null;

            // configuro la grilla
            SisPackController.AdministrarGrillas.Configurar(gridFacturasConceptos, this.CantidadOpciones);
            gridFacturasConceptos.ShowFooter  = true;
            gridFacturasConceptos.AllowPaging = true;

            if (rbtAgencias.Checked)
            {
                gridFacturasConceptos.Columns[0].HeaderText = "Agencia";
            }
            else if (rbtVendedores.Checked)
            {
                gridFacturasConceptos.Columns[0].HeaderText = "Vendedor";
            }
            else if (rbtClientes.Checked)
            {
                gridFacturasConceptos.Columns[0].HeaderText = "Cliente";
            }
            else if (rbtAgrupacionCliente.Checked)
            {
                gridFacturasConceptos.Columns[0].HeaderText = "Clientes";
            }
            else
            {
                gridFacturasConceptos.Columns[0].HeaderText = "";
            }

            // Reviso si los datos están en memoria
            if (Session["DsImportesVentas_FacturasConceptos_lstMontosVentas"] == null)
            {
                // Los datos no están en memoria. Los busco
                IConsultasVentas consulta = ConsultasVentasFactory.GetConsultasVentas();

                if (rbtAgencias.Checked)
                {
                    consulta.AgenciaOrigenID             = busqAgencia.AgenciaID == "" ? 0 : Convert.ToInt32(this.busqAgencia.AgenciaID);
                    consulta.ClienteID                   = 0;
                    consulta.VendedorID                  = 0;
                    consulta.AgrupacionFacturasConceptos = 0;
                }
                else if (rbtClientes.Checked)
                {
                    consulta.ClienteID                   = busqCliente.ClienteID == "" ? 0 : Convert.ToInt32(busqCliente.ClienteID);
                    consulta.AgenciaOrigenID             = 0;
                    consulta.VendedorID                  = 0;
                    consulta.AgrupacionFacturasConceptos = 2;
                }
                else if (rbtVendedores.Checked)
                {
                    consulta.VendedorID                  = busqVendedor.VendedorID == "" ? 0 : Convert.ToInt32(busqVendedor.VendedorID);
                    consulta.AgenciaOrigenID             = 0;
                    consulta.ClienteID                   = 0;
                    consulta.AgrupacionFacturasConceptos = 3;
                }

                else if (rbtAgrupacionCliente.Checked)
                {
                    consulta.ClienteID                   = ddlAgrupacionCliente.SelectedValue == "" ? 0 : Convert.ToInt32(ddlAgrupacionCliente.SelectedValue);
                    consulta.AgenciaOrigenID             = 0;
                    consulta.VendedorID                  = 0;
                    consulta.AgrupacionFacturasConceptos = 4;
                }

                consulta.ConceptoFacturacionID = Utiles.Validaciones.obtieneEntero(ddlConceptoFacturacion.SelectedValue);
                consulta.FechaDesde            = this.txtFechaDesde.Text != "" ? Utiles.Fechas.FormatFechaDDMMYYYY(this.txtFechaDesde.Text) : Utiles.Fechas.FormatFechaDDMMYYYY("01/01/1900");
                consulta.FechaHasta            = this.txtFechaHasta.Text != "" ? Utiles.Fechas.FormatFechaDDMMYYYY(this.txtFechaHasta.Text) : DateTime.Today;
                consulta.CondicionPagoID       = Utiles.Validaciones.obtieneEntero(this.ddlCondicionPago.SelectedValue);
                ds = consulta.GetImportesFacturasConceptos();
                Session["DsImportesVentas_FacturasConceptos_lstMontosVentas"] = ds;
            }
            else
            {
                // Los datos están en memoria
                ds = (DsImportesVentas)Session["DsImportesVentas_FacturasConceptos_lstMontosVentas"];
            }

            String Orden;

            if (rbtOrdenAlfabetico.Checked)
            {
                if (ddlOrdenAlfabetico.SelectedValue == "0")
                {
                    Orden = "EntidadDescrip desc";
                }
                else
                {
                    Orden = "EntidadDescrip";
                }
            }
            else if (rbtOrdenFacturacion.Checked)
            {
                if (ddlOrdenFacturacion.SelectedValue == "0")
                {
                    Orden = "";
                }
                else
                {
                    Orden = "";
                }
            }
            else
            {
                Orden = "";
            }

            // Cargo los datos
            gridFacturasConceptos.DataSource = ds.FacturasConceptos.Select("", Orden);
            gridFacturasConceptos.PageIndex  = currentPage;
            gridFacturasConceptos.DataBind();

            lblTituloGrillaFacturas.Visible = true;
        }