private void btnGuardar_Click(object sender, EventArgs e) { try { this.txtMensajeError.Visible = false; List <Error> Errores = this.ValidarDatos(); if (Errores.Count == 0) { ReporteMonedero Datos = this.ObtenerDatos(); Reporte_NegocioMonedero Neg = new Reporte_NegocioMonedero(); int IDReporte = Neg.GenerarReporteMonedero(Comun.Conexion, Datos.FechaInicio, Datos.FechaFin, Comun.IDUsuario); if (IDReporte > 0) { frmVerReporteMonedero VerReporte = new frmVerReporteMonedero(IDReporte); VerReporte.ShowDialog(); VerReporte.Dispose(); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("Ocurrió un error al generar el reporte.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { this.MostrarMensajeError(Errores); } } catch (Exception ex) { LogError.AddExcFileTxt(ex, "frmNuevoReporteMonedero ~ btnGuardar_Click"); MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void LlenarGrid() { try { Reporte_NegocioMonedero Neg = new Reporte_NegocioMonedero(); List <ReporteMonedero> Lista = Neg.ObtenerReportesMonedero(Comun.Conexion, this.Fecha); this.dgvReportesTrabajosRealizados.AutoGenerateColumns = false; this.dgvReportesTrabajosRealizados.DataSource = Lista; } catch (Exception ex) { throw ex; } }
private void GenerarReporteMonedero() { try { reportViewer1.SetDisplayMode(DisplayMode.PrintLayout); reportViewer1.ZoomMode = ZoomMode.Percent; reportViewer1.ZoomPercent = 100; reportViewer1.LocalReport.DataSources.Clear(); Reporte_NegocioMonedero Neg = new Reporte_NegocioMonedero(); ReporteMonedero DatosReporte = Neg.ObtenerDetalleReporteMonedero(Comun.Conexion, IDReporte); reportViewer1.LocalReport.EnableExternalImages = true; ReportParameter[] Parametros = new ReportParameter[7]; Parametros[0] = new ReportParameter("Empresa", Comun.NombreComercial); Parametros[1] = new ReportParameter("Eslogan", Comun.Eslogan); Parametros[2] = new ReportParameter("Direccion", Comun.Direccion); Parametros[3] = new ReportParameter("TituloReporte", "REPORTE MONEDERO"); if (File.Exists(@"Resources\Documents\" + Comun.UrlLogo.ToLower())) { string Aux = new Uri(Path.Combine(System.Windows.Forms.Application.StartupPath, @"Resources\Documents\" + Comun.UrlLogo.ToLower())).AbsoluteUri; Parametros[4] = new ReportParameter("UrlLogo", new Uri(Path.Combine(System.Windows.Forms.Application.StartupPath, @"Resources\Documents\" + Comun.UrlLogo.ToLower())).AbsoluteUri); } else { Parametros[4] = new ReportParameter("UrlLogo", new Uri(Path.Combine(System.Windows.Forms.Application.StartupPath, @"Resources\Documents\Default.jpg")).AbsoluteUri); } Parametros[5] = new ReportParameter("FechaInicio", DatosReporte.FechaInicio.ToShortDateString()); Parametros[6] = new ReportParameter("FechaFin", DatosReporte.FechaFin.ToShortDateString()); this.reportViewer1.LocalReport.ReportEmbeddedResource = "StephManager.Informes.Reportes.Monedero.rdlc"; reportViewer1.LocalReport.SetParameters(Parametros); reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("ReporteMonedero", DatosReporte.Detalle)); this.reportViewer1.RefreshReport(); } catch (Exception ex) { throw ex; } }