Example usage for com.itextpdf.text BaseColor WHITE

List of usage examples for com.itextpdf.text BaseColor WHITE

Introduction

In this page you can find the example usage for com.itextpdf.text BaseColor WHITE.

Prototype

BaseColor WHITE

To view the source code for com.itextpdf.text BaseColor WHITE.

Click Source Link

Usage

From source file:es.clinica.veterinaria.facturas.FacturaPdf.java

public PdfPTable createTable() throws DocumentException {
    // a table with three columns
    int iva = 0, iva2 = 0;
    DecimalFormat df = new DecimalFormat("0.00");
    PdfPTable table = new PdfPTable(6);
    table.setTotalWidth(new float[] { 50, 65, 150, 150, 65, 70 });
    table.setLockedWidth(true);//from www. jav  a 2  s.  co m

    // the cell object
    // we add a cell with colspan 3
    PdfPCell cell = new PdfPCell(new Phrase("CANT."));
    cell.setColspan(1);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
    cell.setPaddingTop(5);
    cell.setPaddingBottom(5);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("FECHA"));
    cell.setColspan(1);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
    cell.setPaddingTop(5);
    cell.setPaddingBottom(5);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("CONCEPTO"));
    cell.setColspan(1);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
    cell.setPaddingTop(5);
    cell.setPaddingBottom(5);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("DESCRIPCIN"));
    cell.setColspan(1);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
    cell.setPaddingTop(5);
    cell.setPaddingBottom(5);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("PRECIO"));
    cell.setColspan(1);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
    cell.setPaddingTop(5);
    cell.setPaddingBottom(5);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("IMPORTE"));
    cell.setColspan(1);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
    cell.setPaddingTop(5);
    cell.setPaddingBottom(5);
    table.addCell(cell);

    HashSet<Venta> ventas = this.getFactura().getVentas();
    for (Venta venta : ventas) {
        HashSet<VentaLinea> listVenta = venta.getVenta_lineas();

        for (VentaLinea vlinea : listVenta) {
            if (vlinea.getTipo() == 1) {
                if (vlinea.getProducto().getIva() != null) {
                    iva2 = vlinea.getProducto().getIva().getValor();
                    //                    System.out.println("IVA: " +iva2);
                }
            } else if (vlinea.getTipo() == 2) {
                if (vlinea.getServicio().getIva() != null) {
                    iva2 = vlinea.getServicio().getIva().getValor();
                    //                    System.out.println("IVA: " +iva2);
                }
            }

            //Para hacer el calculo nos vamos a quedar con el IVA mayor
            if (iva < iva2) {
                iva = iva2;
            }

            cell = new PdfPCell(new Phrase(vlinea.getCantidad() + "", small));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setPaddingBottom(5);
            table.addCell(cell);

            cell = new PdfPCell(
                    new Phrase(new SimpleDateFormat("dd-MM-yyyy").format(vlinea.getFecha()), small));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setPaddingBottom(5);
            table.addCell(cell);

            if (vlinea.getTipo() == 2) { //Servicio
                table.addCell(new PdfPCell(new Phrase(vlinea.getNombre(), small)));

                String descripcion = vlinea.getDescripcion();
                if (descripcion == null || "null".equals(descripcion)) {
                    table.addCell(new PdfPCell(new Phrase(" ", small)));
                    //                System.out.println("null:" + descripcion);
                } else {
                    table.addCell(new PdfPCell(new Phrase(descripcion, small)));
                    //                System.out.println("!null:" + descripcion);
                }
            } else if (vlinea.getTipo() == 1) { //Producto
                //Si el producto es Tratamiento
                if (vlinea.getProducto().getFamilia().isTratamiento()) {
                    table.addCell(new PdfPCell(new Phrase("Tratamiento", small)));
                    table.addCell(new PdfPCell(new Phrase("", small)));
                } else {

                    table.addCell(new PdfPCell(new Phrase(vlinea.getNombre(), small)));

                    String descripcion = vlinea.getDescripcion();
                    if (descripcion == null || "null".equals(descripcion)) {
                        table.addCell(new PdfPCell(new Phrase(" ", small)));
                        //                System.out.println("null:" + descripcion);
                    } else {
                        table.addCell(new PdfPCell(new Phrase(descripcion, small)));
                        //                System.out.println("!null:" + descripcion);
                    }
                }
            }
            cell = new PdfPCell(new Phrase(df.format(vlinea.getPvp()) + " ", small));
            cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
            cell.setPaddingBottom(5);
            table.addCell(cell);

            cell = new PdfPCell(new Phrase(df.format(vlinea.getPreciototalNoIVA()) + " ", small));
            cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
            cell.setPaddingBottom(5);
            table.addCell(cell);
        }
    }

    cell = new PdfPCell(new Phrase(" "));
    cell.setColspan(1);
    cell.setBorderWidthBottom(0);
    cell.setBorderWidthLeft(0);
    cell.setBorder(0);
    cell.setBorderColorLeft(BaseColor.WHITE);
    cell.setBorderColorBottom(BaseColor.WHITE);
    cell.setPaddingBottom(5);
    table.addCell(cell);
    table.addCell(cell);
    table.addCell(cell);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("SUMA"));
    cell.setColspan(1);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
    cell.setPaddingBottom(5);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase(df.format(factura.getCoste()) + " ", smallBold));
    cell.setColspan(1);
    cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell.setPaddingBottom(5);
    table.addCell(cell);

    /* IVA */
    cell = new PdfPCell(new Phrase(" "));
    cell.setColspan(1);
    cell.setBorderWidthBottom(0);
    cell.setBorderWidthLeft(0);
    cell.setBorder(0);
    cell.setBorderColorLeft(BaseColor.WHITE);
    cell.setBorderColorBottom(BaseColor.WHITE);
    cell.setPaddingBottom(5);
    table.addCell(cell);
    table.addCell(cell);
    table.addCell(cell);
    table.addCell(cell);

    float costetotal = (float) (factura.getCostetotal());

    cell = new PdfPCell(new Phrase("IVA " + iva + "%"));
    cell.setColspan(1);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
    cell.setPaddingBottom(5);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase(df.format(factura.getIvas()) + " ", smallBold));
    cell.setColspan(1);
    cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell.setPaddingBottom(5);
    table.addCell(cell);

    /* COSTE TOTAL */
    cell = new PdfPCell(new Phrase(" "));
    cell.setColspan(1);
    cell.setBorderWidthBottom(0);
    cell.setBorderWidthLeft(0);
    cell.setBorder(0);
    cell.setBorderColorLeft(BaseColor.WHITE);
    cell.setBorderColorBottom(BaseColor.WHITE);
    cell.setPaddingBottom(5);
    table.addCell(cell);
    table.addCell(cell);
    table.addCell(cell);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("TOTAL"));
    cell.setColspan(1);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
    cell.setPaddingBottom(5);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase(df.format(costetotal) + " ", smallBold));
    cell.setColspan(1);
    cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell.setPaddingBottom(5);
    table.addCell(cell);

    return table;
}

From source file:fll.web.playoff.ScoresheetGenerator.java

License:Open Source License

public void writeFile(final OutputStream out, final boolean orientationIsPortrait) throws DocumentException {

    // This creates our new PDF document and declares its orientation
    Document pdfDoc;/*from w  ww  .  j  a v  a2  s.  c o m*/
    if (orientationIsPortrait) {
        pdfDoc = new Document(PageSize.LETTER); // portrait
    } else {
        pdfDoc = new Document(PageSize.LETTER.rotate()); // landscape
    }
    PdfWriter.getInstance(pdfDoc, out);

    // Measurements are always in points (72 per inch)
    // This sets up 1/2 inch margins side margins and 0.35in top and bottom
    // margins
    pdfDoc.setMargins(0.5f * POINTS_PER_INCH, 0.5f * POINTS_PER_INCH, 0.35f * POINTS_PER_INCH,
            0.35f * POINTS_PER_INCH);
    pdfDoc.open();

    // Header cell with challenge title to add to both scoresheets
    final Paragraph titleParagraph = new Paragraph();
    final Chunk titleChunk = new Chunk(m_pageTitle,
            FontFactory.getFont(FontFactory.HELVETICA_BOLD, 14, Font.NORMAL, BaseColor.WHITE));
    titleParagraph.setAlignment(Element.ALIGN_CENTER);
    titleParagraph.add(titleChunk);

    titleParagraph.add(Chunk.NEWLINE);
    final Chunk swVersionChunk = new Chunk("SW version: " + Version.getVersion(),
            FontFactory.getFont(FontFactory.HELVETICA, 8, Font.NORMAL, BaseColor.WHITE));
    titleParagraph.add(swVersionChunk);
    if (null != m_revision) {

        final Chunk revisionChunk = new Chunk(" Descriptor revision: " + m_revision,
                FontFactory.getFont(FontFactory.HELVETICA, 8, Font.NORMAL, BaseColor.WHITE));

        titleParagraph.add(revisionChunk);
    }

    final PdfPCell head = new PdfPCell();
    head.setColspan(2);
    head.setBorder(1);
    head.setPaddingTop(0);
    head.setPaddingBottom(3);
    head.setBackgroundColor(new BaseColor(64, 64, 64));
    head.setVerticalAlignment(Element.ALIGN_TOP);
    head.addElement(titleParagraph);

    // Cells for score field, and 2nd check initials
    final Phrase des = new Phrase("Data Entry Score _______", ARIAL_8PT_NORMAL);
    final PdfPCell desC = new PdfPCell(des);
    desC.setBorder(0);
    desC.setPaddingTop(9);
    desC.setPaddingRight(36);
    desC.setHorizontalAlignment(Element.ALIGN_RIGHT);
    final Phrase sci = new Phrase("2nd Check Initials _______", ARIAL_8PT_NORMAL);
    final PdfPCell sciC = new PdfPCell(sci);
    sciC.setBorder(0);
    sciC.setPaddingTop(9);
    sciC.setPaddingRight(36);
    sciC.setHorizontalAlignment(Element.ALIGN_RIGHT);

    // Create a table with a grid cell for each scoresheet on the page
    PdfPTable wholePage = getTableForPage(orientationIsPortrait);
    wholePage.setWidthPercentage(100);
    for (int i = 0; i < m_numSheets; i++) {
        if (i > 0 && (orientationIsPortrait || (i % 2) == 0)) {
            pdfDoc.newPage();
            wholePage = getTableForPage(orientationIsPortrait);
            wholePage.setWidthPercentage(100);
        }

        // This table is a single score sheet
        final PdfPTable scoreSheet = new PdfPTable(2);
        // scoreSheet.getDefaultCell().setBorder(Rectangle.LEFT | Rectangle.BOTTOM
        // | Rectangle.RIGHT | Rectangle.TOP); //FIXME DEBUG should be NO_BORDER
        scoreSheet.getDefaultCell().setBorder(Rectangle.NO_BORDER);
        scoreSheet.getDefaultCell().setPaddingRight(1);
        scoreSheet.getDefaultCell().setPaddingLeft(0);

        scoreSheet.addCell(head);

        final PdfPTable teamInfo = new PdfPTable(7);
        teamInfo.setWidthPercentage(100);
        teamInfo.setWidths(new float[] { 1f, 1f, 1f, 1f, 1f, 1f, .9f });

        // Time label cell
        final Paragraph timeP = new Paragraph("Time:", ARIAL_10PT_NORMAL);
        timeP.setAlignment(Element.ALIGN_RIGHT);
        final PdfPCell timeLc = new PdfPCell(scoreSheet.getDefaultCell());
        timeLc.addElement(timeP);
        teamInfo.addCell(timeLc);
        // Time value cell
        final Paragraph timeV = new Paragraph(null == m_time[i] ? SHORT_BLANK : m_time[i], COURIER_10PT_NORMAL);
        final PdfPCell timeVc = new PdfPCell(scoreSheet.getDefaultCell());
        timeVc.addElement(timeV);
        teamInfo.addCell(timeVc);

        // Table label cell
        final Paragraph tblP = new Paragraph("Table:", ARIAL_10PT_NORMAL);
        tblP.setAlignment(Element.ALIGN_RIGHT);
        final PdfPCell tblLc = new PdfPCell(scoreSheet.getDefaultCell());
        tblLc.addElement(tblP);
        teamInfo.addCell(tblLc);
        // Table value cell
        final Paragraph tblV = new Paragraph(m_table[i], COURIER_10PT_NORMAL);
        final PdfPCell tblVc = new PdfPCell(scoreSheet.getDefaultCell());
        tblVc.addElement(tblV);
        teamInfo.addCell(tblVc);

        // Round number label cell
        final Paragraph rndP = new Paragraph("Round:", ARIAL_10PT_NORMAL);
        rndP.setAlignment(Element.ALIGN_RIGHT);
        final PdfPCell rndlc = new PdfPCell(scoreSheet.getDefaultCell());
        rndlc.addElement(rndP);
        teamInfo.addCell(rndlc);
        // Round number value cell
        final Paragraph rndV = new Paragraph(m_round[i], COURIER_10PT_NORMAL);
        final PdfPCell rndVc = new PdfPCell(scoreSheet.getDefaultCell());
        // rndVc.setColspan(2);
        rndVc.addElement(rndV);
        teamInfo.addCell(rndVc);

        final PdfPCell temp1 = new PdfPCell(scoreSheet.getDefaultCell());
        // temp1.setColspan(2);
        temp1.addElement(new Paragraph("Judge ____", ARIAL_8PT_NORMAL));
        teamInfo.addCell(temp1);

        // Team number label cell
        final Paragraph nbrP = new Paragraph("Team #:", ARIAL_10PT_NORMAL);
        nbrP.setAlignment(Element.ALIGN_RIGHT);
        final PdfPCell nbrlc = new PdfPCell(scoreSheet.getDefaultCell());
        nbrlc.addElement(nbrP);
        teamInfo.addCell(nbrlc);
        // Team number value cell
        final Paragraph nbrV = new Paragraph(null == m_number[i] ? SHORT_BLANK : String.valueOf(m_number[i]),
                COURIER_10PT_NORMAL);
        final PdfPCell nbrVc = new PdfPCell(scoreSheet.getDefaultCell());
        nbrVc.addElement(nbrV);
        teamInfo.addCell(nbrVc);

        // Team division label cell
        final Paragraph divP = new Paragraph(m_divisionLabel[i], ARIAL_10PT_NORMAL);
        divP.setAlignment(Element.ALIGN_RIGHT);
        final PdfPCell divlc = new PdfPCell(scoreSheet.getDefaultCell());
        divlc.addElement(divP);
        divlc.setColspan(2);
        teamInfo.addCell(divlc);
        // Team division value cell
        final Paragraph divV = new Paragraph(m_division[i], COURIER_10PT_NORMAL);
        final PdfPCell divVc = new PdfPCell(scoreSheet.getDefaultCell());
        divVc.setColspan(2);
        divVc.addElement(divV);
        teamInfo.addCell(divVc);

        final PdfPCell temp2 = new PdfPCell(scoreSheet.getDefaultCell());
        // temp2.setColspan(2);
        temp2.addElement(new Paragraph("Team ____", ARIAL_8PT_NORMAL));
        teamInfo.addCell(temp2);

        // Team name label cell
        final Paragraph nameP = new Paragraph("Team Name:", ARIAL_10PT_NORMAL);
        nameP.setAlignment(Element.ALIGN_RIGHT);
        final PdfPCell namelc = new PdfPCell(scoreSheet.getDefaultCell());
        namelc.setColspan(2);
        namelc.addElement(nameP);
        teamInfo.addCell(namelc);
        // Team name value cell
        final Paragraph nameV = new Paragraph(m_name[i], COURIER_10PT_NORMAL);
        final PdfPCell nameVc = new PdfPCell(scoreSheet.getDefaultCell());
        nameVc.setColspan(5);
        nameVc.addElement(nameV);
        teamInfo.addCell(nameVc);

        // add team info cell to the team table
        final PdfPCell teamInfoCell = new PdfPCell(scoreSheet.getDefaultCell());
        teamInfoCell.addElement(teamInfo);
        teamInfoCell.setColspan(2);

        scoreSheet.addCell(teamInfoCell);

        if (null != m_goalsTable) {
            final PdfPCell goalCell = new PdfPCell(m_goalsTable);
            goalCell.setBorder(0);
            goalCell.setPadding(0);
            goalCell.setColspan(2);
            scoreSheet.addCell(goalCell);
        }

        scoreSheet.addCell(desC);
        scoreSheet.addCell(sciC);

        if (null != m_copyright) {
            final Phrase copyright = new Phrase("\u00A9" + m_copyright, f6i);
            final PdfPCell copyrightC = new PdfPCell(scoreSheet.getDefaultCell());
            copyrightC.addElement(copyright);
            copyrightC.setBorder(0);
            copyrightC.setHorizontalAlignment(Element.ALIGN_CENTER);
            copyrightC.setColspan(2);

            scoreSheet.addCell(copyrightC);
        }

        // the cell in the whole page table that will contain the single score
        // sheet
        final PdfPCell scoresheetCell = new PdfPCell(scoreSheet);
        scoresheetCell.setBorder(0);
        scoresheetCell.setPadding(0);

        // Interior borders between scoresheets on a page
        if (!orientationIsPortrait) {
            if (i % 2 == 0) {
                scoresheetCell.setPaddingRight(0.1f * POINTS_PER_INCH);
            } else {
                scoresheetCell.setPaddingLeft(0.1f * POINTS_PER_INCH);
            }
        }

        // Add the current scoresheet to the page
        wholePage.addCell(scoresheetCell);

        // Add the current table of scoresheets to the document
        if (orientationIsPortrait || (i % 2 != 0)) {
            pdfDoc.add(wholePage);
        }
    }

    // Add a blank cells to complete the table of the last page
    if (!orientationIsPortrait && m_numSheets % 2 != 0) {
        final PdfPCell blank = new PdfPCell();
        blank.setBorder(0);
        wholePage.addCell(blank);
        pdfDoc.add(wholePage);
    }

    pdfDoc.close();
}

From source file:fr.ybonnel.breizhcamppdf.PdfRenderer.java

License:Apache License

private PdfPCell createHeaderCell(String content) {
    Paragraph paragraph = new Paragraph();
    Font font = new Font();
    font.setColor(BaseColor.WHITE);
    paragraph.setFont(font);/*from   ww w  .  j av a 2 s.  c o  m*/
    paragraph.add(new Phrase(content));
    PdfPCell cell = new PdfPCell(paragraph);
    cell.setPaddingBottom(10);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBackgroundColor(BaseColor.GRAY);
    return cell;
}

From source file:Funciones.TicketPDF.java

PdfPTable tablaHeader() throws IOException, BadElementException {
    PdfPTable tablaheader = new PdfPTable(4);
    tablaheader.setTotalWidth(600);/*  w  ww.jav  a  2 s . co  m*/
    BasededatosManager bd = new BasededatosManager();
    try {
        ResultSet consulta = bd.consultar("SELECT logoempresa FROM configuracion");
        byte[] arreglo = null;
        while (consulta.next()) {
            arreglo = consulta.getBytes("logoempresa");
        }
        Image logo = Image.getInstance(arreglo);
        logo.scalePercent(15);
        PdfPCell celdalogo = new PdfPCell(logo);
        celdalogo.setBorderColor(BaseColor.WHITE);
        celdalogo.setColspan(4);
        celdalogo.setHorizontalAlignment(Element.ALIGN_CENTER);
        tablaheader.addCell(celdalogo);
    } catch (SQLException ex) {
        Logger.getLogger(PedidoPDF.class.getName()).log(Level.SEVERE, null, ex);
    }
    Font a = new Font(FontFamily.HELVETICA, 18, Font.BOLD, BaseColor.BLACK);
    PdfPCell celdatitulo = new PdfPCell(new Paragraph("PEDIDO PIZZAS", a));
    celdatitulo.setColspan(2);
    celdatitulo.setBorderColor(BaseColor.WHITE);
    tablaheader.addCell(celdatitulo);
    PdfPCell celdafecha = new PdfPCell(new Paragraph("Fecha: " + LocalDate.now(), f));
    celdafecha.setBorderColor(BaseColor.WHITE);
    tablaheader.addCell(celdafecha);
    PdfPCell celdapedido = new PdfPCell(new Paragraph("N Pedido: " + idpedido, f));
    celdapedido.setBorderColor(BaseColor.WHITE);
    tablaheader.addCell(celdapedido);
    vacio.setColspan(4);
    vacio.setBorder(Rectangle.BOTTOM);
    tablaheader.addCell(vacio);
    return tablaheader;
}

From source file:gov.nih.nci.firebird.service.registration.AbstractPdfWriterGenerator.java

License:Open Source License

private void addSignatureField() throws DocumentException {
    PdfFormField field = PdfFormField.createSignature(writer);
    Rectangle signatureFieldRectangle = new Rectangle(SIGNATURE_FIELD_LOWER_LEFT_X,
            SIGNATURE_FIELD_LOWER_LEFT_Y, SIGNATURE_FIELD_UPPER_RIGHT_X, SIGNATURE_FIELD_UPPER_RIGHT_Y);
    field.setWidget(signatureFieldRectangle, PdfAnnotation.HIGHLIGHT_INVERT);
    field.setFieldName("signature");
    field.setFlags(PdfAnnotation.FLAGS_PRINT);
    field.setPage();/*w ww.  j a v  a2s  . c  om*/
    field.setMKBorderColor(BaseColor.BLACK);
    field.setMKBackgroundColor(BaseColor.WHITE);
    PdfAppearance appearance = PdfAppearance.createAppearance(writer, SIGNATURE_FIELD_WIDTH,
            SIGNATURE_FIELD_HEIGHT);
    appearance.rectangle(SIGNATURE_FIELD_APPEARANCE_X, SIGNATURE_FIELD_APPEARANCE_Y,
            SIGNATURE_FIELD_APPEARANCE_WIDTH, SIGNATURE_FIELD_APPEARANCE_HEIGHT);
    appearance.stroke();
    field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, appearance);
    writer.addAnnotation(field);
}

From source file:GUI_StafKlinik.Panel_Penggajian.java

private PdfPTable createTableLaporan(Penggajian p) {
    PdfPTable tabel = new PdfPTable(2);
    PdfPCell cell;//  w w w . j  a v  a  2s .  c  o m

    cell = new PdfPCell(new Phrase(("Nama Pegawai"), font2));
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setColspan(1);
    cell.setBorder(Rectangle.BOX);
    cell.setBorderWidth(1);
    cell.setBorderColor(BaseColor.WHITE);
    tabel.addCell(cell);

    cell = new PdfPCell(new Phrase(("" + p.getNamaPegawai()), font2));
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setBorderWidth(1);
    cell.setBorderColor(BaseColor.WHITE);
    tabel.addCell(cell);

    cell = new PdfPCell(new Phrase(("ID Pegawai"), font2));
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setColspan(1);
    cell.setBorder(Rectangle.BOX);
    cell.setBorderWidth(1);
    cell.setBorderColor(BaseColor.WHITE);
    tabel.addCell(cell);

    cell = new PdfPCell(new Phrase(("" + p.getIdPegawai()), font2));
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setBorderWidth(1);
    cell.setBorderColor(BaseColor.WHITE);
    tabel.addCell(cell);

    cell = new PdfPCell(new Phrase(("Alamat"), font2));
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setColspan(1);
    cell.setBorder(Rectangle.BOX);
    cell.setBorderWidth(1);
    cell.setBorderColor(BaseColor.WHITE);
    tabel.addCell(cell);

    cell = new PdfPCell(new Phrase((""), font2));
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setBorderWidth(1);
    cell.setBorderColor(BaseColor.WHITE);
    tabel.addCell(cell);

    cell = new PdfPCell(new Phrase(("Telepon"), font2));
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setColspan(1);
    cell.setBorder(Rectangle.BOX);
    cell.setBorderWidth(1);
    cell.setBorderColor(BaseColor.WHITE);
    tabel.addCell(cell);

    cell = new PdfPCell(new Phrase((""), font2));
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setBorderWidth(1);
    cell.setBorderColor(BaseColor.WHITE);
    tabel.addCell(cell);

    cell = new PdfPCell(new Phrase(("Jabatan"), font2));
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setColspan(1);
    cell.setBorder(Rectangle.BOX);
    cell.setBorderWidth(1);
    cell.setBorderColor(BaseColor.WHITE);
    tabel.addCell(cell);

    cell = new PdfPCell(new Phrase((""), font2));
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setBorderWidth(1);
    cell.setBorderColor(BaseColor.WHITE);
    tabel.addCell(cell);

    cell = new PdfPCell(new Phrase(("Gaji Pokok"), font2));
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setColspan(1);
    cell.setBorder(Rectangle.BOX);
    cell.setBorderWidth(1);
    cell.setBorderColor(BaseColor.WHITE);
    tabel.addCell(cell);

    cell = new PdfPCell(new Phrase(("" + p.getGajiPokok()), font2));
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setBorderWidth(1);
    cell.setBorderColor(BaseColor.WHITE);
    tabel.addCell(cell);

    cell = new PdfPCell(new Phrase(("Gaji Tambahan"), font2));
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setColspan(1);
    cell.setBorder(Rectangle.BOX);
    cell.setBorderWidth(1);
    cell.setBorderColor(BaseColor.WHITE);
    tabel.addCell(cell);

    cell = new PdfPCell(new Phrase(("" + p.getGajiTambahan()), font2));
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setBorderWidth(1);
    cell.setBorderColor(BaseColor.WHITE);
    tabel.addCell(cell);

    cell = new PdfPCell(new Phrase(("Total Gaji"), font2));
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setColspan(1);
    cell.setBorder(Rectangle.BOX);
    cell.setBorderWidth(1);
    cell.setBorderColor(BaseColor.WHITE);
    tabel.addCell(cell);

    cell = new PdfPCell(new Phrase(("" + p.getTotalGaji()), font2));
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setBorderWidth(1);
    cell.setBorderColor(BaseColor.WHITE);
    tabel.addCell(cell);

    return tabel;
}

From source file:informes.InformeActividad.java

public void generarInforme() {
    try {//from  ww  w.j av  a2 s. c o m
        Document document = new Document();
        Paragraph ParrafoHoja = new Paragraph();
        String parrafo = this.getDescripsion();
        String ruta = ec.getRealPath("img");
        PdfWriter.getInstance(document, new FileOutputStream(ruta + "\\" + "actividades.pdf"));

        Font fuente = new Font();
        fuente.setColor(255, 0, 0);
        fuente.setSize(30);

        Font fuente3 = new Font();
        fuente3.setColor(255, 255, 255);
        fuente3.setSize(30);

        PdfPTable tabla2 = new PdfPTable(1);
        tabla2.getDefaultCell().setBackgroundColor(BaseColor.BLUE);
        tabla2.setWidthPercentage(110f);
        tabla2.addCell(new Paragraph("UNIDAD EDUCATIVA", fuente3));
        tabla2.addCell(new Paragraph("'MISIONEROS OBLATOS'", fuente3));

        Paragraph p = new Paragraph(parrafo, fuente);

        agregarLineasEnBlanco(ParrafoHoja, 3);

        document.open();
        document.add(tabla2);
        document.add(p);
        document.add(ParrafoHoja);
        Font fuente1 = new Font();
        fuente1.setColor(0, 0, 0);
        fuente1.setSize(5);

        Font fuente2 = new Font();
        fuente2.setColor(255, 0, 0);
        fuente2.setSize(5);
        PdfPTable tabla = new PdfPTable(5);
        tabla.setWidthPercentage(107f);

        Font fuente4 = new Font();
        fuente4.setColor(0, 0, 0);
        fuente4.setSize(8);

        // Paragraph p4 = new Paragraph(parrafo, fuente4);

        //tabla.addCell(new Paragraph("OBJESTRATEGICO",fuente2));
        tabla.addCell(new Paragraph("RESPONSABLE", fuente2));
        tabla.addCell(new Paragraph("CONTROL", fuente2));
        tabla.addCell(new Paragraph("FECHA INICIO", fuente2));
        tabla.addCell(new Paragraph("FECHA FIN", fuente2));
        tabla.addCell(new Paragraph("AVANCE", fuente2));
        int cont = 0;
        tabla.getDefaultCell().setBackgroundColor(BaseColor.WHITE);
        for (int i = 0; i < this.getItems().size(); i++) {
            // Paragraph p1 =new Paragraph(parrafo,fuente);
            String num = String.valueOf(i);
            Paragraph p4 = new Paragraph("Objetivo: " + num + " --> " + this.getItems().get(i).getNombre(),
                    fuente4);
            document.add(p4);
            Paragraph p8 = new Paragraph();
            agregarLineasEnBlanco(p8, 1);
            document.add(p8);

            for (Actividad a : this.getItems().get(i).getActividadCollection()) {
                System.out.println("");
                if (a.getIdObjetivoEstrategico()
                        .getIdObjetivoEstrategico() == (this.getItems().get(i).getIdObjetivoEstrategico())) {
                    cont = 1;
                    tabla.addCell(new Paragraph(a.getIdObjetivoEstrategico().getNombre(), fuente1));

                    tabla.addCell(new Paragraph(a.getIdPersonaResponsable().getNombre(), fuente1));
                    tabla.addCell(new Paragraph(a.getControl(), fuente1));
                    tabla.addCell(new Paragraph(a.getFechaInicio().toString(), fuente1));
                    tabla.addCell(new Paragraph(a.getFechaFin().toString(), fuente1));
                    tabla.addCell(new Paragraph(a.getAvance().toString(), fuente1));

                }
            }
            Paragraph p7 = new Paragraph();
            if (cont == 1) {
                document.add(tabla);
                cont = 0;
                agregarLineasEnBlanco(p7, 2);
                document.add(p7);
            } else {
                Font fuente5 = new Font();
                fuente5.setColor(0, 0, 255);
                fuente5.setSize(10);

                document.add(new Paragraph("No contiene actividades registradas", fuente5));
                agregarLineasEnBlanco(p7, 2);
                document.add(p7);
            }
        }

        document.add(new Paragraph(new Date().toString()));

        document.close();
        System.out.println("aquiiiiii");
    } catch (FileNotFoundException ex) {
        Logger.getLogger(InformeActividad.class.getName()).log(Level.SEVERE, null, ex);
    } catch (DocumentException ex) {
        Logger.getLogger(InformeActividad.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(InformeActividad.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:informes.InformeObjEs.java

public void generarInforme() {
    try {/*  ww w  . j av  a2 s  .  c o m*/
        Document document = new Document();
        Paragraph ParrafoHoja = new Paragraph();
        String parrafo = this.getDescripsion();
        String ruta = ec.getRealPath("img");
        PdfWriter.getInstance(document, new FileOutputStream(ruta + "\\" + "objEstra.pdf"));

        Font fuente = new Font();
        fuente.setColor(255, 0, 0);
        fuente.setSize(30);

        Font fuente3 = new Font();
        fuente3.setColor(255, 255, 255);
        fuente3.setSize(30);
        PdfPTable tabla2 = new PdfPTable(1);
        tabla2.getDefaultCell().setBackgroundColor(BaseColor.BLUE);
        tabla2.setWidthPercentage(110f);
        tabla2.addCell(new Paragraph("UNIDAD EDUCATIVA", fuente3));
        tabla2.addCell(new Paragraph("'MISIONEROS OBLATOS'", fuente3));

        Paragraph p = new Paragraph(parrafo, fuente);

        agregarLineasEnBlanco(ParrafoHoja, 3);

        document.open();
        document.add(tabla2);
        document.add(p);
        document.add(ParrafoHoja);
        Font fuente1 = new Font();
        fuente1.setColor(0, 0, 0);
        fuente1.setSize(5);

        Font fuente2 = new Font();
        fuente2.setColor(255, 0, 0);
        fuente2.setSize(5);
        PdfPTable tabla = new PdfPTable(8);
        tabla.setWidthPercentage(107f);

        tabla.addCell(new Paragraph("OBJETIVO", fuente2));
        tabla.addCell(new Paragraph("META", fuente2));
        tabla.addCell(new Paragraph("DEFINICION", fuente2));
        tabla.addCell(new Paragraph("ACLARACION", fuente2));
        tabla.addCell(new Paragraph("CONCEPTUALIZACION", fuente2));
        tabla.addCell(new Paragraph("INDICADOR", fuente2));
        tabla.addCell(new Paragraph("FORMULA", fuente2));
        tabla.addCell(new Paragraph("UNIDADES", fuente2));

        tabla.getDefaultCell().setBackgroundColor(BaseColor.WHITE);
        for (int i = 0; i < this.getItems().size(); i++) {
            // Paragraph p1 =new Paragraph(parrafo,fuente);

            System.out.println("aquiiiiiiiiiiii" + this.getItems().get(i).getSemaforo());

            tabla.addCell(new Paragraph(this.getItems().get(i).getObjetivoestrategico().getNombre(), fuente1));
            tabla.addCell(new Paragraph(this.getItems().get(i).getMeta(), fuente1));
            tabla.addCell(new Paragraph(this.getItems().get(i).getDefinicion(), fuente1));
            tabla.addCell(new Paragraph(this.getItems().get(i).getAclaracion(), fuente1));
            tabla.addCell(new Paragraph(this.getItems().get(i).getConceptualizacion(), fuente1));
            tabla.addCell(new Paragraph(this.getItems().get(i).getIndicador().getNombre(), fuente1));
            tabla.addCell(new Paragraph(this.getItems().get(i).getIndicador().getFormula(), fuente1));
            tabla.addCell(new Paragraph(String.valueOf(this.getItems().get(i).getIndicador().getUnidades()),
                    fuente1));
        }
        document.add(tabla);
        document.add(new Paragraph(new Date().toString()));

        document.close();
        System.out.println("aquiiiiii");
    } catch (FileNotFoundException ex) {
        Logger.getLogger(InformeObjEs.class.getName()).log(Level.SEVERE, null, ex);
    } catch (DocumentException ex) {
        Logger.getLogger(InformeObjEs.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(InformeObjEs.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:ManagementPackage.ServiceEnd.java

private void txtDoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtDoneActionPerformed
    // TODO add your handling code here:
    Document doc = new Document();
    try {/*from w  ww.  j a  v  a  2s.  co  m*/
        long time = new Date().getTime();
        TransNo = "" + time;
        PdfWriter.getInstance(doc, new FileOutputStream("Invoices\\Invoices" + time + ".pdf"));
        doc.open();

        PdfPTable table = new PdfPTable(4);
        PdfPCell cell1 = new PdfPCell(new Paragraph("Shop Management System \n\n",
                FontFactory.getFont(FontFactory.TIMES_BOLD, 20, Font.BOLD, BaseColor.WHITE)));
        cell1.setColspan(10);
        cell1.setPadding(10);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell1.setBackgroundColor(BaseColor.BLACK);
        table.addCell(cell1);

        PdfPCell cell21 = new PdfPCell(new Paragraph("\n\n"));
        cell21.setColspan(10);
        cell21.setBorder(2);
        cell21.setBorderColorLeft(BaseColor.WHITE);
        table.addCell(cell21);

        PdfPCell cell2 = new PdfPCell(new Paragraph("Invoice/Money Receipt\n"));
        cell2.setColspan(10);
        cell2.setPadding(10);
        cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell2.setBackgroundColor(BaseColor.LIGHT_GRAY);
        table.addCell(cell2);

        PdfPCell cell3 = new PdfPCell(new Paragraph("Transaction No: " + time, FontFactory.getFont(null, 10)));
        cell3.setColspan(2);
        cell3.setPaddingBottom(10);
        cell3.setPaddingTop(10);
        cell3.setBorder(2);
        cell3.setBorderColorLeft(BaseColor.WHITE);
        table.addCell(cell3);

        PdfPCell cell4 = new PdfPCell(
                new Paragraph("Date: " + formatedDateTime, FontFactory.getFont(null, 10)));
        cell4.setColspan(3);
        cell4.setPaddingBottom(10);
        cell4.setPaddingTop(10);
        cell4.setBorder(2);
        cell4.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell4.setBorderColorRight(BaseColor.WHITE);
        table.addCell(cell4);

        //table.addCell("Sl No");
        table.addCell("Product Name");
        table.addCell("Rate");
        table.addCell("Qty");
        table.addCell("Amount (TK)");

        String query = "select product_name, rate, qty, amount from temp_trans WHERE trans_by = '" + user + "'";
        try {
            pst = con.prepareStatement(query);
            rs = pst.executeQuery();
            while (rs.next()) {
                //String sl_no = rs.getString("sl_no");
                String product_name = rs.getString("product_name");
                String rate = rs.getString("rate");
                String qty = rs.getString("qty");
                String amount = rs.getString("amount");

                //table.addCell(sl_no);
                table.addCell(product_name);
                table.addCell(rate);
                table.addCell(qty);

                PdfPCell cellAmount = new PdfPCell(new Paragraph(amount));
                cellAmount.setHorizontalAlignment(Element.ALIGN_RIGHT);
                table.addCell(cellAmount);
            }
            rs.close();
            pst.close();

        } catch (SQLException ex) {
            Logger.getLogger(ServiceEnd.class.getName()).log(Level.SEVERE, null, ex);
        }

        PdfPCell cellb = new PdfPCell(new Paragraph(" "));
        cellb.setColspan(10);
        cellb.setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(cellb);

        //
        PdfPCell celltxtTotal = new PdfPCell(new Paragraph("Total"));
        celltxtTotal.setColspan(3);
        celltxtTotal.setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(celltxtTotal);

        PdfPCell celltxtTotal1 = new PdfPCell(new Paragraph(txtTotal.getText()));
        celltxtTotal1.setColspan(2);
        celltxtTotal1.setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(celltxtTotal1);

        PdfPCell celltxtAdjust = new PdfPCell(new Paragraph("Adjustment"));
        celltxtAdjust.setColspan(3);
        celltxtAdjust.setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(celltxtAdjust);

        PdfPCell celltxtAdjust1 = new PdfPCell(new Paragraph(txtAdjust.getText()));
        celltxtAdjust1.setColspan(2);
        celltxtAdjust1.setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(celltxtAdjust1);

        PdfPCell celltxtTotalPaid = new PdfPCell(new Paragraph("Billed By: " + user));
        celltxtTotalPaid.setColspan(2);
        //celltxtTotalPaid.setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(celltxtTotalPaid);

        PdfPCell celltxtTotalPaid0 = new PdfPCell(new Paragraph("Total Paid"));
        celltxtTotalPaid0.setColspan(1);
        celltxtTotalPaid0.setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(celltxtTotalPaid0);

        PdfPCell celltxtTotalPaid1 = new PdfPCell(new Paragraph(txtTotalPaid.getText()));
        celltxtTotalPaid1.setColspan(2);
        celltxtTotalPaid1.setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(celltxtTotalPaid1);

        doc.add(table);

        doc.close();

        savePermanently();
        clearTempTable();
        //JOptionPane.showMessageDialog(null, "Report Created!");

        // open PDF file
        File file = new File("Invoices\\Invoices" + time + ".pdf");
        if (file.toString().endsWith(".pdf"))
            Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + file);
        else {
            Desktop desktop = Desktop.getDesktop();
            desktop.open(file);
        }

    } catch (DocumentException ex) {
        Logger.getLogger(ServiceEnd.class.getName()).log(Level.SEVERE, null, ex);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(ServiceEnd.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(ServiceEnd.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:ManagementPackage.Setting.java

private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
    // TODO add your handling code here:
    totalAdjustment = 0;/*  w  w w  .j av a  2 s . co m*/
    totalTotalPaid = 0;
    total = 0;

    Document doc = new Document();
    try {
        long time = new Date().getTime();
        PdfWriter.getInstance(doc, new FileOutputStream("Reports\\Daily" + time + " " + formatedDate + ".pdf"));
        doc.open();

        PdfPTable table = new PdfPTable(5);
        PdfPCell cell1 = new PdfPCell(new Paragraph("Shop Management System \n\n",
                FontFactory.getFont(FontFactory.TIMES_BOLD, 20, Font.BOLD, BaseColor.WHITE)));
        cell1.setColspan(10);
        cell1.setPadding(10);
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell1.setBackgroundColor(BaseColor.BLACK);
        table.addCell(cell1);

        PdfPCell cell21 = new PdfPCell(new Paragraph("\n\n"));
        cell21.setColspan(10);
        cell21.setBorder(2);
        cell21.setBorderColorLeft(BaseColor.WHITE);
        table.addCell(cell21);

        PdfPCell cell2 = new PdfPCell(new Paragraph("Daily Report\n"));
        cell2.setColspan(10);
        cell2.setPadding(10);
        cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell2.setBackgroundColor(BaseColor.LIGHT_GRAY);
        table.addCell(cell2);

        PdfPCell cell4 = new PdfPCell(new Paragraph("Date: " + formatedDateTime));
        cell4.setColspan(10);
        cell4.setPaddingBottom(10);
        cell4.setPaddingTop(10);
        cell4.setBorder(2);
        cell4.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell4.setBorderColorRight(BaseColor.WHITE);
        table.addCell(cell4);

        table.addCell("Transaction No");
        table.addCell("Billed By");
        table.addCell("Product Name");
        table.addCell("Qty");
        table.addCell("Amount (TK)");

        String PrevTransNo = " ";
        String query = "select trans_no, product_name, qty, amount, trans_by from trans_details where date = '"
                + formatedDate + "'";
        try {
            pst = con.prepareStatement(query);
            rs = pst.executeQuery();
            while (rs.next()) {
                String NewTransNo = rs.getString("trans_no");
                String product_name = rs.getString("product_name");
                String qty = rs.getString("qty");
                String amount = rs.getString("amount");
                String trans_by = rs.getString("trans_by");

                total = total + Float.parseFloat(amount);

                if (PrevTransNo.equals(NewTransNo))
                    table.addCell(" ");
                else {
                    table.addCell(NewTransNo);
                    String query1 = "select adjustment, total_paid from paid_amount where trans_no = '"
                            + NewTransNo + "'";
                    pst1 = con1.prepareStatement(query1);
                    rs1 = pst1.executeQuery();
                    String adjustment = rs1.getString("adjustment");
                    String total_paid = rs1.getString("total_paid");

                    totalAdjustment = totalAdjustment + Float.parseFloat(adjustment);
                    totalTotalPaid = totalTotalPaid + Float.parseFloat(total_paid);

                    rs1.close();
                    pst1.close();
                }

                PrevTransNo = rs.getString("trans_no");
                table.addCell(trans_by);
                table.addCell(product_name);
                table.addCell(qty);

                PdfPCell cellAmount = new PdfPCell(new Paragraph(amount));
                cellAmount.setHorizontalAlignment(Element.ALIGN_RIGHT);
                table.addCell(cellAmount);

            }
            rs.close();
            pst.close();

        } catch (SQLException ex) {
            Logger.getLogger(ServiceEnd.class.getName()).log(Level.SEVERE, null, ex);
        }

        PdfPCell cellb = new PdfPCell(new Paragraph(" "));
        cellb.setColspan(10);
        cellb.setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(cellb);

        //
        PdfPCell celltxtTotal = new PdfPCell(new Paragraph("Total"));
        celltxtTotal.setColspan(3);
        celltxtTotal.setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(celltxtTotal);

        PdfPCell celltxtTotal1 = new PdfPCell(new Paragraph("" + total));
        celltxtTotal1.setColspan(2);
        celltxtTotal1.setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(celltxtTotal1);

        PdfPCell celltxtAdjust = new PdfPCell(new Paragraph("Adjustment"));
        celltxtAdjust.setColspan(3);
        celltxtAdjust.setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(celltxtAdjust);

        PdfPCell celltxtAdjust1 = new PdfPCell(new Paragraph("" + totalAdjustment));
        celltxtAdjust1.setColspan(2);
        celltxtAdjust1.setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(celltxtAdjust1);

        PdfPCell celltxtTotalPaid = new PdfPCell(new Paragraph("Total Paid"));
        celltxtTotalPaid.setColspan(3);
        celltxtTotalPaid.setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(celltxtTotalPaid);

        PdfPCell celltxtTotalPaid1 = new PdfPCell(new Paragraph("" + totalTotalPaid));
        celltxtTotalPaid1.setColspan(2);
        celltxtTotalPaid1.setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(celltxtTotalPaid1);

        doc.add(table);

        doc.close();

        //JOptionPane.showMessageDialog(null, "Report Created!");
        // open PDF file
        File file = new File("Reports\\Daily" + time + " " + formatedDate + ".pdf");
        if (file.toString().endsWith(".pdf"))
            Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + file);
        else {
            Desktop desktop = Desktop.getDesktop();
            desktop.open(file);
        }

    } catch (DocumentException ex) {
        Logger.getLogger(ServiceEnd.class.getName()).log(Level.SEVERE, null, ex);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(ServiceEnd.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(ServiceEnd.class.getName()).log(Level.SEVERE, null, ex);
    }
}