/// <summary> /// Procedimiento para cargar la grilla /// </summary> private void CargarGrilla() { try { // Cargar Grilla DsReporteMontosDeVentasDeCobranza DsReporte = new DsReporteMontosDeVentasDeCobranza(); DsReporte = (DsReporteMontosDeVentasDeCobranza)Session["DsReporteMontosDeVentasDeCobranza"]; SisPackController.AdministrarGrillas.Configurar(GridReporte, "ClienteId", DsReporte.Datos.Count, true, false); GridReporte.AllowPaging = false; GridReporte.ShowFooter = true; GridReporte.DataSource = DsReporte; GridReporte.DataMember = "Datos"; GridReporte.DataBind(); } catch (Exception ex) { } }
public DsReporteMontosDeVentasDeCobranza GetMontosDeVentasDeCobranzasDataSet() { DsReporteMontosDeVentasDeCobranza Ds = new DsReporteMontosDeVentasDeCobranza(); // Cargo los parametros SqlParameter ParamDesdeFecha = new SqlParameter("@DesdeFecha", DesdeFecha); //Utiles.BaseDatos.FechaToSql(DesdeFecha) SqlParameter ParamHastaFecha = new SqlParameter("@HastaFecha", HastaFecha); //Utiles.BaseDatos.FechaToSql(HastaFecha) SqlParameter ParamEstadoUsuario = new SqlParameter("@EstadoCliente", Utiles.BaseDatos.IntToSql(EstadoCliente)); SqlParameter ParamNombre = new SqlParameter("@Nombre", Utiles.BaseDatos.StrToSql(Nombre)); SqlParameter ParamCodigo = new SqlParameter("@Codigo", Utiles.BaseDatos.StrToSql(Codigo)); SqlParameter ParamCUIT = new SqlParameter("@CUIT", Utiles.BaseDatos.StrToSql(CUIT)); SqlParameter ParamLocalidad = new SqlParameter("@Localidad", Utiles.BaseDatos.StrToSql(Localidad)); SqlParameter ParamProvincia = new SqlParameter("@Provincia", Utiles.BaseDatos.StrToSql(Provincia)); SqlParameter ParamDesdeImporte = new SqlParameter("@DesdeImporte", Utiles.BaseDatos.DoubleToSql(DesdeImporte)); SqlParameter ParamHastaImporte = new SqlParameter("@HastaImporte", Utiles.BaseDatos.DoubleToSql(HastaImporte)); // Obtengo los datos Config.Conexion.LlenarTypeDataSet(Ds.Datos, System.Data.CommandType.StoredProcedure, "ReporteMontosDeVentasDeCobranzaSel", ParamDesdeFecha, ParamHastaFecha, ParamEstadoUsuario, ParamNombre, ParamCodigo, ParamCUIT, ParamLocalidad, ParamProvincia, ParamDesdeImporte, ParamHastaImporte); // Devuelvo el DataSet obtenido return(Ds); }
private void BtnExportarAExcel_Click(object sender, System.EventArgs e) { // Reviso si los datos estan cargados en el objeto sessión if (Session["DsReporteMontosDeVentasDeCobranza"] != null && Session["DsReporteMontosDeVentasDeCobranza"] is DsReporteMontosDeVentasDeCobranza) { // Estan cargados // Configuro el Grid GridReporte SisPackController.AdministrarGrillas.Configurar(GridReporte, "ClienteId", this.CantidadOpciones, true, true); GridReporte.ShowFooter = true; GridReporte.AllowPaging = false; // Cargo el objeto DsReporte DsReporteMontosDeVentasDeCobranza DsReporte = (DsReporteMontosDeVentasDeCobranza)Session["DsReporteMontosDeVentasDeCobranza"]; // Cargo el objeto DsReporte en el grid GridReporte.DataSource = DsReporte; GridReporte.DataMember = "Datos"; GridReporte.DataBind(); // Exporto los datos a excel new Utiles.DataGridExcelExporter(GridReporte, "Reporte montos de ventas de cobranzas").Export("ReporteMontosVentasCobranzas.xls"); } }
/// <summary> /// Procedimiento para enlazar la grilla con los datos de la BD /// </summary> /// <param name="currentPage">indica el número de página a enlazar</param> private void BindGrid(int currentPage) { try { // Creo un objeto del tipo IReporteMontosDeVentasDeCobranza IReporteMontosDeVentasDeCobranza Reporte = ReporteMontosDeVentasDeCobranzaFactory.GetReporteMontosDeVentasDeCobranza(); // Cargo los parametros Reporte.DesdeFecha = Utiles.Fechas.FormatFechaDDMMYYYY(txtFechaDesde.Text); Reporte.HastaFecha = Utiles.Fechas.FormatFechaDDMMYYYY(txtFechaHasta.Text); if (RbTodos.Checked == true) { Reporte.EstadoCliente = 0; } else if (RBHabilitados.Checked == true) { Reporte.EstadoCliente = 1; } else if (RBInhabilitados.Checked == true) { Reporte.EstadoCliente = 2; } else if (RbActivos.Checked == true) { Reporte.EstadoCliente = 3; } else if (RbPasivos.Checked == true) { Reporte.EstadoCliente = 4; } Reporte.Nombre = TxtNombre.Text; Reporte.Codigo = TxtCodigo.Text; Reporte.CUIT = TxtCUIT.Text; Reporte.Localidad = TxtLocalidad.Text; Reporte.Provincia = TxtProvincia.Text; Reporte.DesdeImporte = Utiles.Validaciones.obtieneDouble(TxtDesdeImporte.Text); Reporte.HastaImporte = Utiles.Validaciones.obtieneDouble(TxtHastaImporte.Text); // Configuro el Grid GridReporte SisPackController.AdministrarGrillas.Configurar(GridReporte, "ClienteId", this.CantidadOpciones, true, true); GridReporte.ShowFooter = true; // Cargo el objeto DsReporte DsReporteMontosDeVentasDeCobranza DsReporte = Reporte.GetMontosDeVentasDeCobranzasDataSet(); // Guardo el objeto DsReporte en el objeto Session Session["DsReporteMontosDeVentasDeCobranza"] = DsReporte; // Cargo el objeto DsReporte en el grid GridReporte.DataSource = DsReporte; GridReporte.DataMember = "Datos"; GridReporte.CurrentPageIndex = currentPage; GridReporte.DataBind(); // Reviso si tengo que activar el boton exportar a excel e imprimir if (DsReporte.Datos.Count > 0) { // Hay que activarlos BtnExportarAExcel.Enabled = true; BtnImprimir.Enabled = true; } else { // Hay que desactivarlos BtnExportarAExcel.Enabled = false; BtnImprimir.Enabled = false; } } catch (Exception ex) { ((ErrorWeb)phErrores.Controls[0]).setMensaje(ex.Message); } }