예제 #1
0
        public PDFpago ListarPagoPdf(int idPago)
        {
            OracleDataReader dr;

            try
            {
                operaciones.abrirConexion();
                object[] parametro = new object[2];
                parametro[0] = idPago;
                parametro[1] = "PAGO";
                OracleCommand cmd = operaciones.execSP("PDF_PAGO", parametro);
                dr = cmd.ExecuteReader();
                PDFpago pdfPago = new PDFpago();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        pdfPago.nombre_titutal    = dr[0].ToString();
                        pdfPago.rut_empresa       = dr[1].ToString();
                        pdfPago.giro              = dr[2].ToString();
                        pdfPago.telefono          = Convert.ToInt32(dr[3].ToString());
                        pdfPago.servicios         = dr[4].ToString();
                        pdfPago.fecha_realizacion = Convert.ToDateTime(dr[5].ToString());
                        pdfPago.fecha_expiracion  = Convert.ToDateTime(dr[6].ToString());
                        pdfPago.impuesto          = Convert.ToInt32(dr[7].ToString());
                        pdfPago.monto             = Convert.ToInt32(dr[8].ToString());
                        pdfPago.monto_total       = Convert.ToInt32(dr[9].ToString());
                        pdfPago.estado_pago       = dr[10].ToString();
                    }
                }
                dr.Dispose();
                return(pdfPago);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                operaciones.cerrarConexion();
            }
        }
예제 #2
0
        public void crearPdf(int idPago)
        {
            ReporteControlador reporte = new ReporteControlador();

            PDFpago pdfPago = reporte.ListarPagoPdf(idPago);

            string rutaEscritorio = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\" + pdfPago.nombre_titutal + DateTime.Now.ToString("dd/MMMM/yyyy/HH/mm/ss") + ".pdf";

            PdfWriter   writer   = new PdfWriter(rutaEscritorio);
            PdfDocument pdf      = new PdfDocument(writer);
            Document    document = new Document(pdf);
            Paragraph   header   = new Paragraph("Documento de Pago PDF")
                                   .SetTextAlignment(TextAlignment.CENTER)
                                   .SetFontSize(20);


            Paragraph p = new Paragraph();

            Image img = new Image(ImageDataFactory
                                  .Create(@"..\\..\\IMG\\Logo-Pagina.png"))
                        .SetTextAlignment(TextAlignment.CENTER);


            LineSeparator ls = new LineSeparator(new SolidLine());

            Table table = new Table(4, false);

            table.SetWidth(500);
            Table table2 = new Table(2, false);

            table2.SetWidth(500);
            Table table3 = new Table(2, false);

            table3.SetWidth(500);

            Cell nomCli = new Cell(1, 2)
                          .SetTextAlignment(TextAlignment.CENTER)
                          .Add(new Paragraph("Nombre Cliente:"));

            nomCli.SetBorder(Border.NO_BORDER);

            Cell nomCli2 = new Cell(1, 2)
                           .SetTextAlignment(TextAlignment.LEFT)
                           .Add(new Paragraph(pdfPago.nombre_titutal));

            nomCli2.SetBorder(Border.NO_BORDER);

            Cell giroEmp = new Cell(1, 2)
                           .SetTextAlignment(TextAlignment.CENTER)
                           .Add(new Paragraph("Giro Empresa:"));

            giroEmp.SetBorder(Border.NO_BORDER);

            Cell giroEmp2 = new Cell(1, 2)
                            .SetTextAlignment(TextAlignment.LEFT)
                            .Add(new Paragraph(pdfPago.giro));

            giroEmp2.SetBorder(Border.NO_BORDER);

            Cell rutCli = new Cell(1, 2)
                          .SetTextAlignment(TextAlignment.CENTER)
                          .Add(new Paragraph("Rut Cliente:"));

            rutCli.SetBorder(Border.NO_BORDER);

            Cell rutCli2 = new Cell(1, 2)
                           .SetTextAlignment(TextAlignment.LEFT)
                           .Add(new Paragraph(pdfPago.rut_empresa));

            rutCli2.SetBorder(Border.NO_BORDER);

            Cell tel = new Cell(1, 2)
                       .SetTextAlignment(TextAlignment.CENTER)
                       .Add(new Paragraph("Telefono:"));

            tel.SetBorder(Border.NO_BORDER);

            Cell tel2 = new Cell(1, 2)
                        .SetTextAlignment(TextAlignment.LEFT)
                        .Add(new Paragraph(pdfPago.telefono.ToString()));

            tel2.SetBorder(Border.NO_BORDER);

            Cell serv = new Cell(1, 2)
                        .SetTextAlignment(TextAlignment.CENTER)
                        .Add(new Paragraph("Servicios:"));

            serv.SetBorder(Border.NO_BORDER);

            Cell serv2 = new Cell(1, 2)
                         .SetTextAlignment(TextAlignment.LEFT)
                         .Add(new Paragraph(pdfPago.servicios));

            serv2.SetBorder(Border.NO_BORDER);

            Cell fecIni = new Cell(1, 2)
                          .SetTextAlignment(TextAlignment.CENTER)
                          .Add(new Paragraph("Fecha Inicio Contrato:"));

            fecIni.SetBorder(Border.NO_BORDER);

            Cell fecIni2 = new Cell(1, 2)
                           .SetTextAlignment(TextAlignment.LEFT)
                           .Add(new Paragraph(pdfPago.fecha_realizacion.ToString("MM/dd/yyyy")));

            fecIni2.SetBorder(Border.NO_BORDER);

            Cell fecTer = new Cell(1, 2)
                          .SetTextAlignment(TextAlignment.CENTER)
                          .Add(new Paragraph("Fecha Termino Contrato:"));

            fecTer.SetBorder(Border.NO_BORDER);

            Cell fecTer2 = new Cell(1, 2)
                           .SetTextAlignment(TextAlignment.LEFT)
                           .Add(new Paragraph(pdfPago.fecha_expiracion.ToString("MM/dd/yyyy")));

            fecTer2.SetBorder(Border.NO_BORDER);

            Cell monto = new Cell(1, 2)
                         .SetTextAlignment(TextAlignment.CENTER)
                         .Add(new Paragraph("Monto:"));

            monto.SetBorder(Border.NO_BORDER);

            Cell monto2 = new Cell(1, 2)
                          .SetTextAlignment(TextAlignment.LEFT)
                          .Add(new Paragraph("$" + pdfPago.monto.ToString()));

            monto2.SetBorder(Border.NO_BORDER);

            Cell impuesto = new Cell(1, 2)
                            .SetTextAlignment(TextAlignment.CENTER)
                            .Add(new Paragraph("Impuesto:"));

            impuesto.SetBorder(Border.NO_BORDER);

            Cell impuesto2 = new Cell(1, 2)
                             .SetTextAlignment(TextAlignment.LEFT)
                             .Add(new Paragraph(pdfPago.impuesto.ToString() + "%"));

            impuesto2.SetBorder(Border.NO_BORDER);

            Cell monto_total = new Cell(1, 2)
                               .SetTextAlignment(TextAlignment.CENTER)
                               .Add(new Paragraph("Monto Total:"));

            monto_total.SetBorder(Border.NO_BORDER);

            Cell monto_total2 = new Cell(1, 2)
                                .SetTextAlignment(TextAlignment.LEFT)
                                .Add(new Paragraph("$" + pdfPago.monto_total.ToString()));

            monto_total2.SetBorder(Border.NO_BORDER);

            Cell estado = new Cell(1, 2)
                          .SetTextAlignment(TextAlignment.CENTER)
                          .Add(new Paragraph("Estado Pago:"));

            estado.SetBorder(Border.NO_BORDER);

            Cell estado2 = new Cell(1, 2)
                           .SetTextAlignment(TextAlignment.LEFT)
                           .Add(new Paragraph(pdfPago.estado_pago));

            estado2.SetBorder(Border.NO_BORDER);


            table.AddCell(nomCli);
            table.AddCell(nomCli2);
            table.AddCell(giroEmp);
            table.AddCell(giroEmp2);
            table.AddCell(rutCli);
            table.AddCell(rutCli2);
            table.AddCell(tel);
            table.AddCell(tel2);
            table.AddCell(serv);
            table.AddCell(serv2);
            table.AddCell(fecIni);
            table.AddCell(fecIni2);
            table.AddCell(fecTer);
            table.AddCell(fecTer2);

            table.AddCell(monto);
            table.AddCell(monto2);
            table.AddCell(impuesto);
            table.AddCell(impuesto2);
            table.AddCell(monto_total);
            table.AddCell(monto_total2);
            table.AddCell(estado);
            table.AddCell(estado2);


            document.Add(header);
            document.Add(ls);
            document.Add(img);
            document.Add(ls);
            document.Add(p);
            document.Add(table);


            document.Close();
        }