//Reporte que se genera al dar doble click sobre una factura private void GenerarReporte() { try { String idfactura = dtgVentas.CurrentRow.Cells["IDFactura"].Value.ToString(); String numfactura = dtgVentas.CurrentRow.Cells["NumFactura"].Value.ToString(); String empleado = dtgVentas.CurrentRow.Cells["Empleado"].Value.ToString(); String fecha = dtgVentas.CurrentRow.Cells["Hora"].Value.ToString(); ReporteFactura reporte = new ReporteFactura(); DataTable data = Cache.ReporteFacturaDetalle(idfactura); DataRow fila = data.Rows[0]; reporte.SetDataSource(data); reporte.SetParameterValue("pEmpleado", fila["Empleado"].ToString()); reporte.SetParameterValue("pFecha", fila["Fecha"].ToString()); reporte.SetParameterValue("pNumFactura", numfactura); reporte.SetParameterValue("pCliente", fila["Cliente"].ToString()); crvFacturaDetalle.ReportSource = reporte; } catch (Exception e) { MessageBox.Show("Excepcion reporte: " + e.ToString(), "Excepcion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//Reporte por numero de factura private void NumGenerarReporte(String idfactura) { try { DataTable data = Cache.ReporteNumFactura(idfactura); if (data.Rows.Count > 0) { ReporteFactura reporte = new ReporteFactura(); DataRow fila = data.Rows[0]; reporte.SetDataSource(data); reporte.SetParameterValue("pEmpleado", fila["Empleado"].ToString()); reporte.SetParameterValue("pFecha", fila["Fecha"].ToString()); reporte.SetParameterValue("pNumFactura", idfactura); reporte.SetParameterValue("pCliente", fila["Cliente"].ToString()); crvFacturaDetalle.ReportSource = reporte; } else { MessageBox.Show("Factura no encontrada !", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); txbFiltro.Text = ""; } } catch (Exception e) { MessageBox.Show("Excepcion reporte: " + e.ToString(), "Excepcion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void FacturasToolStripMenuItem_Click(object sender, EventArgs e) { RepositorioBase <Facturas> repositorio = new RepositorioBase <Facturas>(); List <Facturas> lista = new List <Facturas>(); lista = repositorio.GetList(p => true); if (lista.Count > 0) { MessageBox.Show("Un momento por favor.", "ButterSoft", MessageBoxButtons.OK, MessageBoxIcon.Information); ReporteFactura reporte = new ReporteFactura(lista); reporte.ShowDialog(); } else { MessageBox.Show("No hay datos para imprimir.", "ButterSoft", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void BtnAceptar_Click(object sender, EventArgs e) { IReporteFactura reporte = new ReporteFactura(); IReporteProducto reporteP = new ReporteProducto(); IReporteServicio reporteS = new ReporteServicio(); if (getFiltro().Equals("Facturas")) { if (getFechaInicial().Length == 0 && getFechaFinal().Length == 0) { MessageBox.Show("No ingresó ningúna fecha. Por favor ingrese un rango de fecha"); } else { reporte.reporteFacturas(getFechaInicial().ToString(), getFechaFinal().ToString(), dataGridView1); } } else if (getFiltro().Equals("Productos")) { if (getFechaInicial().Length == 0 && getFechaFinal().Length == 0) { MessageBox.Show("No ingresó ningúna fecha. Por favor ingrese un rango de fecha"); } else { reporteP.reporteProducto(getFechaInicial().ToString(), getFechaFinal().ToString(), dataGridView1); } } else if (getFiltro().Equals("Servicios")) { if (getFechaInicial().Length == 0 && getFechaFinal().Length == 0) { MessageBox.Show("No ingresó ningúna fecha. Por favor ingrese un rango de fecha"); } else { reporteS.reporteServicio(getFechaInicial().ToString(), getFechaFinal().ToString(), dataGridView1); } } }
private void GenerarReporte() { try { DateTime myDateTime = DateTime.Now; String fecha = myDateTime.ToString("yyyy-MM-dd hh:mm:ss"); ReporteFactura reporte = new ReporteFactura(); reporte.SetDataSource(Cache.CerrarFactura(this.IDFactura, this.Cliente)); reporte.SetParameterValue("pEmpleado", _Sesion.Informacion.Empleado); reporte.SetParameterValue("pNumFactura", (int.Parse(IDFactura) + 100).ToString()); reporte.SetParameterValue("pCliente", this.Cliente); reporte.SetParameterValue("pFecha", fecha); /*ReporteFactura aux = reporte; * reporte.PrintOptions.PaperSize = aux.PrintOptions.PaperSize; * reporte.PrintToPrinter(1, false, 0, 50);*/ crvFactura.ReportSource = reporte; } catch (Exception e) { MessageBox.Show("Excepcion reporte: " + e.ToString(), "Excepcion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void GenerarReporte(double impuesto, FacturaVentas factura, DataTable dt2) { Usuario usuario = new Usuario(); usuario = (Usuario)App.Current.Properties["usuarioSesion"]; ReporteFactura.Reset(); ReportDataSource rd2 = new ReportDataSource("DataSet2", dt2); ReporteFactura.LocalReport.DataSources.Add(rd2); //Array que contendrá los parámetros ReportParameter[] parameters = new ReportParameter[6]; //Establecemos el valor de los parámetros parameters[0] = new ReportParameter("paramImpuesto", impuesto.ToString()); parameters[1] = new ReportParameter("paramCliente", factura.Cliente.Nombre); parameters[2] = new ReportParameter("paramFecha", factura.Fecha.ToString()); parameters[3] = new ReportParameter("paramTipo", factura.TipoPago); parameters[4] = new ReportParameter("paramTotal", factura.Total.ToString()); parameters[5] = new ReportParameter("paramIdentificacion", factura.Cliente.Indentificacion.ToString()); ReporteFactura.LocalReport.ReportEmbeddedResource = "PracticaProfesionalVivarsan.Reportes.ReporteFactura.rdlc"; ReporteFactura.LocalReport.SetParameters(parameters); ReporteFactura.RefreshReport(); }
private void Imprimirbutton_Click(object sender, EventArgs e) { if (listado == null || listado.Count <= 0) { MyerrorProvider.Clear(); MyerrorProvider.SetError(Imprimirbutton, "No hay datos para imprimir."); return; } else { if (listado.Count > 0) { ReporteFactura reporte = new ReporteFactura(listado); reporte.ShowDialog(); } else { MyerrorProvider.Clear(); MyerrorProvider.SetError(Imprimirbutton, "No hay datos para imprimir."); return; } } }