//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 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); } }