示例#1
0
        private void btnReporteValoracion_Click(object sender, RoutedEventArgs e)
        {
            if (!validarFechas())
            {
                MessageBox.Show("La fecha de inicio debe ser menor a la de termino\n Ingrese nuevamente", "Reporteria - Mis Ofertas");
                dpFechaInicio.Focus();
            }
            else
            {
                try
                {
                    Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
                    List <ReporteValoracion> listaRegistros = new List <ReporteValoracion>();

                    if (dpFechaInicio.SelectedDate == null && dpFechaTermino.SelectedDate == null)
                    {
                        listaRegistros = reporteValoracionNeg.listaRegistrosReporteValoracion(null, null);
                    }
                    else
                    {
                        listaRegistros = reporteValoracionNeg.listaRegistrosReporteValoracion(
                            dpFechaInicio.SelectedDate,
                            dpFechaTermino.SelectedDate);
                    }


                    String rutaDirectorioOferta             = "D:/MisOfertas/Reportes/";
                    List <ImagenOferta> listaImagenesOferta = new List <ImagenOferta>();
                    if (!Directory.Exists(rutaDirectorioOferta))
                    {
                        Directory.CreateDirectory(rutaDirectorioOferta);
                    }

                    DateTime fechaCreacionReporte = DateTime.Now;
                    String   rutaReporte          = rutaDirectorioOferta + "/ReporteValoracion" + fechaCreacionReporte.ToString("ddMMyyyyHHmm") + ".pdf";

                    PdfWriter   writer   = new PdfWriter(rutaReporte);
                    PdfDocument pdf      = new PdfDocument(writer);
                    Document    document = new Document(pdf, PageSize.A4);
                    PdfFont     font     = PdfFontFactory.CreateFont(FontConstants.TIMES_ROMAN);


                    string _filePath = System.IO.Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory);
                    _filePath  = Directory.GetParent(_filePath).FullName;
                    _filePath  = Directory.GetParent(_filePath).FullName;
                    _filePath += @"\img\MisOfertas-Letras.png";

                    //string ruta_imagen = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"img\MisOfertas-Letras.png");
                    //String ruta_imagen = "D:/Portafolio 2017/MisOfertasEscritorio/Seba/Satelite_MisOfertas/View/img/MisOfertas-Letras.png";
                    document.Add(new iText.Layout.Element.Image(ImageDataFactory.Create(_filePath)).SetHorizontalAlignment(iText.Layout.Properties.HorizontalAlignment.RIGHT).SetWidth(40).SetHeight(40));


                    document.Add(new iText.Layout.Element.Paragraph("Reporte valoracion de ofertas").SetFont(font).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER).SetFontSize(20));
                    document.Add(new iText.Layout.Element.Paragraph(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString()).SetFont(font).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER).SetFontSize(18));

                    float[] columnWidths = { 1, 5, 6, 5, 5, 5, 5, 5, 5, 5 };//{1,1,10,10,5,5,1,1,1,1,1,1};

                    iText.Layout.Element.Table tableRegistros = new iText.Layout.Element.Table(10).SetFontSize(12);
                    tableRegistros.SetWidthPercent(100);
                    tableRegistros.SetFixedLayout();

                    float fontCell     = 11;
                    float fontCellData = 9;

                    Cell[] headerFooter = new Cell[] {
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("#").SetFontSize(fontCell).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Oferta").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Inicio").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Finalizacion").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Rubro").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Empresa").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Val. Negativas").SetFontSize(fontCell).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Val. Medias").SetFontSize(fontCell).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Val. Positivas").SetFontSize(fontCell).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Total").SetFontSize(fontCell).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER)
                    };
                    //new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Productos").SetFontSize(fontCell),
                    //new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Imagenes").SetFontSize(fontCell)};


                    foreach (Cell hfCell in headerFooter)
                    {
                        tableRegistros.AddHeaderCell(hfCell);
                    }

                    for (int i = 0; i < listaRegistros.Count; i++)
                    {
                        ReporteValoracion reporte = listaRegistros[i];
                        Oferta            oferta  = reporte.Oferta;
                        Rubro             rubro   = reporte.Rubro;
                        Empresa           empresa = reporte.Empresa;
                        tableRegistros.AddCell(oferta.IdOferta.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableRegistros.AddCell(oferta.TituloOferta).SetFontSize(fontCellData);
                        tableRegistros.AddCell(oferta.FechaInicio.ToShortDateString()).SetFontSize(fontCellData);
                        tableRegistros.AddCell(oferta.FechaFinalizacion.ToShortDateString()).SetFontSize(fontCellData);
                        tableRegistros.AddCell(rubro.DescripcionRubro).SetFontSize(fontCellData);
                        tableRegistros.AddCell(empresa.NombreEmpresa).SetFontSize(fontCellData);
                        tableRegistros.AddCell(reporte.CantValoracionNegativas.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableRegistros.AddCell(reporte.CantValoracionMedia.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableRegistros.AddCell(reporte.CantValoracionPositiva.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableRegistros.AddCell(reporte.CantValoracionTotal.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                    }

                    //tableRegistros.AddCell(reporte.CantProductos.ToString()).SetFontSize(fontCellData);
                    //tableRegistros.AddCell(reporte.CantImagenes.ToString()).SetFontSize(fontCellData);
                    document.Add(tableRegistros);
                    document.Close();

                    Mouse.OverrideCursor = System.Windows.Input.Cursors.Arrow;
                    MessageBox.Show("Reporte generado correctamente \n en la ruta: " + rutaReporte, "Reporteria - Mis Ofertas");

                    //Uri test = new Uri(rutaReporte);
                    //WebBrowser.Navigate(rutaReporte);
                }
                catch (Exception err)
                {
                    MessageBox.Show("Se ha presentado un inconveniente al generar el reporet\nIntente nuevamente", "Reporteria - Mis Ofertas");
                }
            }
        }
示例#2
0
        private void btnReporteTienda_Click(object sender, RoutedEventArgs e)
        {
            if (!validarFechas())
            {
                MessageBox.Show("La fecha de inicio debe ser menor a la de termino\n Ingrese nuevamente", "Reporteria - Mis Ofertas");
                dpFechaInicio.Focus();
            }
            else
            {
                try
                {
                    Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;

                    //---------------------SETEO DE REGISTROS PARA LA GENERACION DE LOS REPORTES----------------------------
                    List <ReporteTiendas>   listaConsumidoresRegistradosDia;
                    List <ReporteTiendas>   listaConsumidoresRegistradosMes;
                    List <HistorialCorreo>  listaCorreosEnviados;
                    List <ValoracionOferta> listaValoracionesPorEmpresa;
                    List <Rubro>            listaCuponesGeneradosPorRubro;

                    if (dpFechaInicio.SelectedDate == null && dpFechaTermino.SelectedDate == null)
                    {
                        listaConsumidoresRegistradosDia = reporteTiendasNeg.listaConsumidoresRegistradosDia(null, null);
                        listaConsumidoresRegistradosMes = reporteTiendasNeg.listaConsumidoresRegistradosMes(null, null);
                        listaCorreosEnviados            = historialCorreoNeg.listarCantCorreosEnviados(null, null);
                        listaValoracionesPorEmpresa     = reporteTiendasNeg.listaValoracionesPorEmpresa();
                        listaCuponesGeneradosPorRubro   = reporteTiendasNeg.listaCuponesGeneradosPorRubro();
                    }
                    else
                    {
                        listaConsumidoresRegistradosDia = reporteTiendasNeg.listaConsumidoresRegistradosDia(dpFechaInicio.SelectedDate, dpFechaTermino.SelectedDate);
                        listaConsumidoresRegistradosMes = reporteTiendasNeg.listaConsumidoresRegistradosMes(dpFechaInicio.SelectedDate, dpFechaTermino.SelectedDate);
                        listaCorreosEnviados            = historialCorreoNeg.listarCantCorreosEnviados(dpFechaInicio.SelectedDate, dpFechaTermino.SelectedDate);
                        listaValoracionesPorEmpresa     = reporteTiendasNeg.listaValoracionesPorEmpresa();
                        listaCuponesGeneradosPorRubro   = reporteTiendasNeg.listaCuponesGeneradosPorRubro();
                    }
                    //--------------------------------------------------------------------------------------------------------


                    String rutaDirectorioOferta             = "D:/MisOfertas/Reportes/";
                    List <ImagenOferta> listaImagenesOferta = new List <ImagenOferta>();
                    if (!Directory.Exists(rutaDirectorioOferta))
                    {
                        Directory.CreateDirectory(rutaDirectorioOferta);
                    }

                    DateTime fechaCreacionReporte = DateTime.Now;
                    String   rutaReporte          = rutaDirectorioOferta + "/ReporteTiendas" + fechaCreacionReporte.ToString("ddMMyyyyHHmm") + ".pdf";

                    PdfWriter   writer   = new PdfWriter(rutaReporte);
                    PdfDocument pdf      = new PdfDocument(writer);
                    Document    document = new Document(pdf, PageSize.A4);
                    PdfFont     font     = PdfFontFactory.CreateFont(FontConstants.TIMES_ROMAN);

                    string _filePath = System.IO.Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory);
                    _filePath  = Directory.GetParent(_filePath).FullName;
                    _filePath  = Directory.GetParent(_filePath).FullName;
                    _filePath += @"\img\MisOfertas-Letras.png";
                    document.Add(new iText.Layout.Element.Image(ImageDataFactory.Create(_filePath)).SetHorizontalAlignment(iText.Layout.Properties.HorizontalAlignment.RIGHT).SetWidth(40).SetHeight(40));



                    document.Add(new iText.Layout.Element.Paragraph("Reporte resumenes por tiendas y empresas").SetFont(font).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER).SetFontSize(20));
                    document.Add(new iText.Layout.Element.Paragraph(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString()).SetFont(font).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER).SetFontSize(18));
                    float fontCell     = 11;
                    float fontCellData = 9;

                    //----------------TABLA CONSUMIDORES REGISTRADOR POR DIA-------------------------------
                    document.Add(new iText.Layout.Element.Paragraph("Consumidores registrados por dia").SetFont(font).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER).SetFontSize(20));
                    float[] columnWidthsDIa = { 20f, 60f, 120f, 30f, 30f };

                    iText.Layout.Element.Table tableConsumidoresDia = new iText.Layout.Element.Table(5).SetFontSize(12);
                    tableConsumidoresDia.SetWidthPercent(100);
                    tableConsumidoresDia.SetFixedLayout();


                    Cell[] headerFooter = new Cell[] {
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("#").SetFontSize(fontCell).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Año").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Mes").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Dia").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Consumidores").SetFontSize(fontCell)
                    };

                    foreach (Cell hfCell in headerFooter)
                    {
                        tableConsumidoresDia.AddHeaderCell(hfCell);
                    }


                    for (int i = 0; i < listaConsumidoresRegistradosDia.Count; i++)
                    {
                        ReporteTiendas reporte = listaConsumidoresRegistradosDia[i];
                        tableConsumidoresDia.AddCell(i.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableConsumidoresDia.AddCell(reporte.AnioRegistro.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableConsumidoresDia.AddCell(reporte.MesRegistro.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableConsumidoresDia.AddCell(reporte.DiaRegistro.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableConsumidoresDia.AddCell(reporte.ConsumidoresRegistradosDia.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                    }

                    document.Add(tableConsumidoresDia);


                    //----------------TABLA CONSUMIDORES REGISTRADOR POR MES-------------------------------
                    document.Add(new iText.Layout.Element.Paragraph("Consumidores registrados por mes").SetFont(font).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER).SetFontSize(20));
                    float[] columnWidthsMes = { 20f, 60f, 120f, 30f };

                    iText.Layout.Element.Table tableConsumidoresMes = new iText.Layout.Element.Table(4).SetFontSize(12);
                    tableConsumidoresMes.SetWidthPercent(100);
                    tableConsumidoresMes.SetFixedLayout();


                    Cell[] cellsConsumidoresMes = new Cell[] {
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("#").SetFontSize(fontCell).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Año").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Mes").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Consumidores").SetFontSize(fontCell)
                    };

                    foreach (Cell hfCell in cellsConsumidoresMes)
                    {
                        tableConsumidoresMes.AddHeaderCell(hfCell);
                    }

                    for (int i = 0; i < listaConsumidoresRegistradosMes.Count; i++)
                    {
                        ReporteTiendas reporte = listaConsumidoresRegistradosMes[i];
                        tableConsumidoresMes.AddCell(i.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableConsumidoresMes.AddCell(reporte.AnioRegistro.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableConsumidoresMes.AddCell(reporte.MesRegistro.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableConsumidoresMes.AddCell(reporte.ConsumidoresRegistradosMes.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                    }

                    document.Add(tableConsumidoresMes);

                    //----------------TABLA CANTIDAD CORREOS ENVIADOS POR TIENDA-EMPRESA -------------------------------
                    document.Add(new iText.Layout.Element.Paragraph("Sumatoria de correos enviados").SetFont(font).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER).SetFontSize(20));
                    float[] columnWidthsCorreo = { 20f, 60f, 120f, 30f, 20f, 30f, 30f };

                    iText.Layout.Element.Table tableCorreoEnviados = new iText.Layout.Element.Table(7).SetFontSize(12);
                    tableCorreoEnviados.SetWidthPercent(100);
                    tableCorreoEnviados.SetFixedLayout();


                    Cell[] cellCorreoEnviados = new Cell[] {
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("#").SetFontSize(fontCell).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Empresa").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Local").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Oferta").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Codigo").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Fecha de Envio").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Correos enviados").SetFontSize(fontCell)
                    };


                    foreach (Cell hfCell in cellCorreoEnviados)
                    {
                        tableCorreoEnviados.AddHeaderCell(hfCell);
                    }

                    for (int i = 0; i < listaCorreosEnviados.Count; i++)
                    {
                        HistorialCorreo historialCorreo = listaCorreosEnviados[i];
                        Oferta          oferta          = historialCorreo.Oferta;
                        Local           local           = oferta.Local;
                        Empresa         empresa         = local.Empresa;

                        tableCorreoEnviados.AddCell(i.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableCorreoEnviados.AddCell(empresa.NombreEmpresa).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableCorreoEnviados.AddCell(local.NumeroLocal.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableCorreoEnviados.AddCell(oferta.TituloOferta).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableCorreoEnviados.AddCell(oferta.CodigoOferta.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableCorreoEnviados.AddCell(historialCorreo.FechaEnvio.ToShortDateString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableCorreoEnviados.AddCell(historialCorreo.CantCorreosEnviados.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                    }

                    document.Add(tableCorreoEnviados);

                    //----------------TABLA VALORACIONES POR EMPRESA Y LOCAL-------------------------------
                    document.Add(new iText.Layout.Element.Paragraph("Cantidad de Valoraciones por Empresas").SetFont(font).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER).SetFontSize(20));


                    iText.Layout.Element.Table tableValoracionEmpresa = new iText.Layout.Element.Table(8).SetFontSize(12);
                    tableValoracionEmpresa.SetWidthPercent(100);
                    tableValoracionEmpresa.SetFixedLayout();


                    Cell[] cellEmpresa = new Cell[] {
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("#").SetFontSize(fontCell).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Rut").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Empresa").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Numero de Local").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Valoraciones Negativas").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Valoraciones Medias").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Valoraciones Positivas").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Valoraciones Totales").SetFontSize(fontCell)
                    };

                    foreach (Cell hfCell in cellEmpresa)
                    {
                        tableValoracionEmpresa.AddHeaderCell(hfCell);
                    }


                    for (int i = 0; i < listaValoracionesPorEmpresa.Count; i++)
                    {
                        ValoracionOferta valoracionOferta = listaValoracionesPorEmpresa[i];
                        Empresa          empresa          = valoracionOferta.Empresa;
                        Local            local            = valoracionOferta.Local;

                        tableValoracionEmpresa.AddCell(i.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableValoracionEmpresa.AddCell(empresa.RutEmpresa.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableValoracionEmpresa.AddCell(empresa.NombreEmpresa).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableValoracionEmpresa.AddCell(local.NumeroLocal.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableValoracionEmpresa.AddCell(valoracionOferta.CantValoracionesNegativas.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableValoracionEmpresa.AddCell(valoracionOferta.CantValoracionMedias.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableValoracionEmpresa.AddCell(valoracionOferta.CantValoracionesPositivas.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableValoracionEmpresa.AddCell(valoracionOferta.CantTotalValoraciones.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                    }

                    document.Add(tableValoracionEmpresa);


                    //----------------TABLA CUPONES GENERADOS POR RUBRO-------------------------------
                    document.Add(new iText.Layout.Element.Paragraph("Cupones generados por Rubro").SetFont(font).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER).SetFontSize(20));


                    iText.Layout.Element.Table tableCupones = new iText.Layout.Element.Table(3).SetFontSize(12);
                    tableCupones.SetWidthPercent(100);
                    tableCupones.SetFixedLayout();


                    Cell[] cellsCupones = new Cell[] {
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("#").SetFontSize(fontCell).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Rubro").SetFontSize(fontCell),
                        new Cell().SetBackgroundColor(new DeviceGray(0.75f)).Add("Cupones Generados").SetFontSize(fontCell)
                    };

                    foreach (Cell hfCell in cellsCupones)
                    {
                        tableCupones.AddHeaderCell(hfCell);
                    }

                    for (int i = 0; i < listaCuponesGeneradosPorRubro.Count; i++)
                    {
                        Rubro rubro = listaCuponesGeneradosPorRubro[i];
                        tableCupones.AddCell(i.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableCupones.AddCell(rubro.DescripcionRubro).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                        tableCupones.AddCell(rubro.CantidadCuponesGenerados.ToString()).SetFontSize(fontCellData).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
                    }

                    document.Add(tableCupones);
                    document.Close();
                    Mouse.OverrideCursor = System.Windows.Input.Cursors.Arrow;
                    MessageBox.Show("Reporte generado correctamente \n en la ruta: " + rutaReporte, "Reporteria - Mis Ofertas");
                }
                catch (Exception err)
                {
                    MessageBox.Show("Se ha presentado un inconveniente al generar el reporet\nIntente nuevamente", "Reporteria - Mis Ofertas");
                }
            }
        }