Example usage for com.itextpdf.text Paragraph Paragraph

List of usage examples for com.itextpdf.text Paragraph Paragraph

Introduction

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

Prototype

public Paragraph() 

Source Link

Document

Constructs a Paragraph.

Usage

From source file:com.grant.report.BillPdf.java

private void addTitlePage(Document document, PrintDetails printDetails) throws DocumentException {
    Paragraph preface = new Paragraph();
    // We add one empty line
    addEmptyLine(preface, 1);/*from  ww w . j  a  v  a  2s .co  m*/
    // Lets write a big header
    preface.add(new Paragraph("GRANT TECH HOLDINGS", catFont));

    addEmptyLine(preface, 1);
    // Will create: Report generated by: _name, _date
    preface.add(new Paragraph("No, 407 A, Colombo Road, Pepiliyana", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            subFont));
    preface.add(new Paragraph("Tel/Fax :0112 199 100 | 0719 192 815 | 0719 392 815", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            subFont));
    preface.add(new Paragraph("E-mail :granttech@sltnet.lk | granttechholdings@gmail.com", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            subFont));
    preface.add(new Paragraph(
            "____________________________________________________________________________________", smallBold));

    preface.add(new Paragraph("Customer Name : " + printDetails.getCustomerName(), smallBold));

    preface.add(new Paragraph("Address : " + printDetails.getAddress(), smallBold));

    preface.add(new Paragraph(
            "Date: " + printDetails.getInvoiceNo() + "                | Order No: " + printDetails.getOrderNo(),
            smallBold));

    preface.add(new Paragraph("Pay Type: " + printDetails.getPayType() + "                | Sales Code: "
            + printDetails.getCustomerName(), smallBold));

    preface.add(new Paragraph("Cheque No: " + printDetails.getNoPay(), smallBold));

    createTable(preface);

    Paragraph preface2 = new Paragraph();
    preface2.setIndentationLeft(350);

    preface2.add(new Paragraph("Sub Total : " + printDetails.getSubTotal(), smallBold));

    preface2.add(new Paragraph("Discount  : " + printDetails.getDiscount() + " %", smallBold));

    preface2.add(new Paragraph("Total  : " + printDetails.getTotal(), smallBold));

    Paragraph preface3 = new Paragraph();

    preface3.add(new Paragraph(
            "____________________________________________________________________________________", smallBold));

    preface3.add(new Paragraph("Goods once sold will not be taken back. ", smallBold2));

    preface3.add(new Paragraph(
            "Cheques to be drawn in favour of Grant Tech Holdings (Pvt) Ltd 1146009208-Commercial Bank-Wadduwa. ",
            verySmBold));
    preface3.add(new Paragraph("goods are accepted in good condition. ", verySmBold));

    preface3.add(new Paragraph(
            "____________________________________________________________________________________", smallBold));

    preface3.add(new Paragraph(
            "Name:___________________________________________                          Signature:__________________________________________",
            smallBold3));

    preface3.add(new Paragraph(
            "I.D No (If credit):__________________________________                          Date:______________________________________________",
            smallBold3));

    preface3.add(new Paragraph(
            "Checked by:_______________________________________                        Authorized by:_______________________________________",
            smallBold3));

    preface3.add(new Paragraph(
            "____________________________________________________________________________________", smallBold));

    // now add all this to the document
    document.add(preface);
    document.add(preface2);
    document.add(preface3);
    document.newPage();
}

From source file:com.groupecom2015.entitieManager.MessageFacade.java

public void sendBuyingConfirmationEmail(List<ArticlePanier> listArt, CompteUser cu) {

    Date d = new Date(System.currentTimeMillis());
    Font font = new Font(Font.FontFamily.TIMES_ROMAN, 14, Font.BOLD);
    Font font_2 = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL);
    Font font_3 = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);
    double total = 0.0;
    String resume = "";
    try {/*from   w  w w .j a v a2  s .  c o  m*/
        // new File( System.getProperty( "user.home" ) +"/"+ cu.getIdCompte()).mkdirs();
        //String FILE = System.getProperty("user.home") +"/"+ cu.getIdCompte()+"/commandeRecu.pdf";
        new File("/home/umar/webapp_photo/uploads/" + cu.getIdCompte()).mkdirs();
        String FILE = "/home/umar/webapp_photo/uploads/" + cu.getIdCompte() + "/commandRecu.pdf";
        Document document = new Document();
        PdfWriter.getInstance(document, new FileOutputStream(FILE));
        document.open();

        Paragraph para = new Paragraph();
        para.add(new Paragraph(d + ""));
        para.add(new Paragraph(""));
        para.add(new Paragraph("Bonjour, " + cu.getNom(), font));
        para.add(new Paragraph("Veuillez trouvez ci-dessous votre le rsum de vos achat", font));
        para.add(new Paragraph(""));

        for (ArticlePanier l : listArt) {
            para.add(new Paragraph(
                    "" + l.getArticle().getNomArticle() + "     " + l.getArticle().getPrixVenteArticle(),
                    font_2));
            total += l.getArticle().getPrixVenteArticle();
            resume = resume + "\n" + l.getArticle().getNomArticle() + "  "
                    + l.getArticle().getPrixVenteArticle() + "\n";
        }
        para.add(new Paragraph("Total : " + total, font_3));
        para.add(new Paragraph(""));
        para.add(new Paragraph("Nous vous remercions pour votre achat", font_2));
        document.add(para);
        document.close();

    } catch (Exception e) {
        e.printStackTrace();
    }

    //sending email with the pdf attached --> dropped

    final String from = "ecomgroup2015@gmail.com"; //ecomgroup2015@gmail.com
    final String to = "" + cu.getEmail();
    final String fileUpload = "/uploads/" + cu.getIdCompte() + "/commandRecu.pdf";
    try {
        Properties properties = new Properties();
        properties.put("mail.smtp.host", "smtp.gmail.com");
        properties.put("mail.smtp.port", "587"); //587
        properties.put("mail.smtp.auth", "true");
        properties.put("mail.smtp.starttls.enable", "true");

        Session session = Session.getInstance(properties, new javax.mail.Authenticator() {
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(from, "groupeecom");
            }
        });

        javax.mail.Message message = new MimeMessage(session);
        message.setFrom(new InternetAddress(from));
        message.setRecipients(javax.mail.Message.RecipientType.TO, InternetAddress.parse(to));
        message.setSubject("Votre recipiss d'achat");
        message.setText("Bonjour " + cu.getNom() + "\n Veuillez trouvez ci-joint votre rsum d'achat\n"
                + "\n  " + resume + "  \n" + total);

        /*BodyPart messageBodyPart = new MimeBodyPart();
        messageBodyPart.setText("Cher(e) "+cu.getNom()+"\n veuillez trouver ci-joint votre recipiss d'achat");
        Multipart multipart = new MimeMultipart();
        multipart.addBodyPart(messageBodyPart);
        messageBodyPart = new MimeBodyPart();
        String filename = "/uploads/"+cu.getIdCompte()+"/commandRecu.pdf";
        DataSource source = new FileDataSource(FILE);
        messageBodyPart.setDataHandler(new DataHandler(source));
        messageBodyPart.setFileName(FILE);
        multipart.addBodyPart(messageBodyPart);
                
        // Send the complete message parts
        message.setContent(multipart);*/
        Transport.send(message);
    } catch (Exception e) {
        e.printStackTrace();
    }

}

From source file:com.horizzon.inventerium.ExportPdf.java

private static void addTitlePage(Document document) throws DocumentException {
    Paragraph preface = new Paragraph();
    // We add one empty line
    addEmptyLine(preface, 1);//  ww  w .jav  a2s .c o m
    // Lets write a big header
    preface.add(new Paragraph("Transaction Details"));

    addEmptyLine(preface, 1);
    // Will create: Report generated by: _name, _date
    preface.add(new Paragraph("Report generated by: " + System.getProperty("user.name") + ", " + new Date(0)));
    addEmptyLine(preface, 3);
    //       preface.add(new Paragraph("This document describes something which is very important ",
    //           smallBold));

    addEmptyLine(preface, 8);

    //       preface.add(new Paragraph("This document is a preliminary version and not subject to your license agreement or any other agreement with vogella.com ;-).",
    //           redFont));

    document.add(preface);
    // Start a new page
    document.newPage();
}

From source file:com.hris.payroll.reports.AdvancesReportPdf.java

public AdvancesReportPdf(int branchId, Date payrollDate, String reportType) {
    this.branchId = branchId;
    this.payrollDate = payrollDate;
    this.reportType = reportType;

    Document document = null;// www  .  ja v  a 2  s.c o m
    Rectangle pageSize = new Rectangle(318, 825);

    try {
        document = new Document(PageSize.A4.rotate(), 37, 37, 37, 37);
        PdfWriter writer = PdfWriter.getInstance(document, outputStream);
        document.open();

        int tradeId = cs.getTradeIdByBranchId(branchId);
        int corporateId = cs.getCorporateIdByTradeId(tradeId);

        Paragraph reportHeader = new Paragraph();
        reportHeader.setAlignment(Element.ALIGN_LEFT);
        reportHeader.add(new Phrase(cs.getCorporateById(corporateId).toUpperCase(), header));
        document.add(reportHeader);

        reportHeader = new Paragraph();
        reportHeader.setAlignment(Element.ALIGN_LEFT);
        reportHeader.add(new Phrase("Trade: " + cs.getTradeById(tradeId).toUpperCase(), header));
        document.add(reportHeader);

        reportHeader = new Paragraph();
        reportHeader.setAlignment(Element.ALIGN_LEFT);
        reportHeader.add(new Phrase("Branch: " + cs.getBranchById(getBranchId()).toUpperCase(), header));
        document.add(reportHeader);

        reportHeader = new Paragraph();
        reportHeader.setAlignment(Element.ALIGN_LEFT);
        reportHeader.add(new Phrase("Advances Type: " + getReportType(), content));
        document.add(reportHeader);

        reportHeader = new Paragraph();
        reportHeader.setAlignment(Element.ALIGN_LEFT);
        reportHeader.add(new Phrase("Payroll Period: " + CommonUtil.changeDateFormat(
                ps.findPayrollRegisterByBranch(getBranchId(), getPayrollDate()).getPayrollDate().toString()),
                content));
        document.add(reportHeader);

        reportHeader = new Paragraph();
        reportHeader.setAlignment(Element.ALIGN_LEFT);
        reportHeader.add(new Phrase("Cut-off Date: "
                + CommonUtil.changeDateFormat(ps.findPayrollRegisterByBranch(getBranchId(), getPayrollDate())
                        .getAttendancePeriodFrom().toString())
                + " - "
                + CommonUtil.changeDateFormat(ps.findPayrollRegisterByBranch(getBranchId(), getPayrollDate())
                        .getAttendancePeriodTo().toString()),
                content));
        document.add(reportHeader);

        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);

        PdfPTable table = new PdfPTable(3);
        //            table.setWidthPercentage(100);
        table.setTotalWidth(new float[] { 180, 120, 300 });
        table.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.getDefaultCell().setBorder(Rectangle.NO_BORDER);

        PdfPCell cellLabel = new PdfPCell();
        Paragraph parLabel = new Paragraph();
        parLabel.add(new Phrase("EMPLOYEE", boldFont));
        parLabel.setAlignment(Element.ALIGN_LEFT);
        cellLabel.addElement(parLabel);
        cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellLabel.setBorder(Rectangle.BOTTOM);
        table.addCell(cellLabel);

        cellLabel = new PdfPCell();
        parLabel = new Paragraph();
        parLabel.add(new Phrase("AMOUNT", boldFont));
        parLabel.setAlignment(Element.ALIGN_RIGHT);
        cellLabel.addElement(parLabel);
        cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellLabel.setBorder(Rectangle.BOTTOM);
        table.addCell(cellLabel);

        cellLabel = new PdfPCell();
        parLabel = new Paragraph();
        parLabel.add(new Phrase("PARTICULARS", boldFont));
        parLabel.setAlignment(Element.ALIGN_LEFT);
        cellLabel.addElement(parLabel);
        cellLabel.setPaddingLeft(20);
        cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellLabel.setBorder(Rectangle.BOTTOM);
        table.addCell(cellLabel);

        String middlename;
        double grandTotalAmount = 0;
        double subTotalAmount;
        int prCounter = 0;
        int advancesCounter;
        for (PayrollRegister pr : ps.findByBranch(getBranchId(), getPayrollDate())) {
            if (pr.getMiddlename().isEmpty() || pr.getMiddlename() == null) {
                middlename = "";
            } else {
                middlename = pr.getMiddlename().toUpperCase();
            }
            String employee = pr.getLastname().toUpperCase() + ", " + pr.getFirstname().toUpperCase() + " "
                    + middlename;
            subTotalAmount = 0;
            advancesCounter = 0;
            for (Advances a : as.findByPayroll(pr.getPayrollId(), getReportType())) {
                cellLabel = new PdfPCell();
                parLabel = new Paragraph();
                if (advancesCounter == 0) {
                    parLabel.add(new Phrase(employee, content));
                } else {
                    parLabel.add(new Phrase("", content));
                }
                parLabel.setAlignment(Element.ALIGN_LEFT);
                cellLabel.addElement(parLabel);
                cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
                cellLabel.setBorder(Rectangle.NO_BORDER);
                table.addCell(cellLabel);

                cellLabel = new PdfPCell();
                parLabel = new Paragraph();
                parLabel.add(new Phrase(CommonUtil.formatNumValue(a.getAmount()), content));
                parLabel.setAlignment(Element.ALIGN_RIGHT);
                cellLabel.addElement(parLabel);
                cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
                subTotalAmount = subTotalAmount + a.getAmount();
                advancesCounter++;
                if (advancesCounter == as.findByPayroll(pr.getPayrollId(), getReportType()).size()) {
                    cellLabel.setBorder(Rectangle.BOTTOM);
                } else {
                    cellLabel.setBorder(Rectangle.NO_BORDER);
                }
                table.addCell(cellLabel);

                cellLabel = new PdfPCell();
                parLabel = new Paragraph();
                parLabel.add(new Phrase(a.getParticulars(), content));
                parLabel.setAlignment(Element.ALIGN_LEFT);
                cellLabel.addElement(parLabel);
                cellLabel.setPaddingLeft(20);
                cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
                cellLabel.setBorder(Rectangle.NO_BORDER);
                table.addCell(cellLabel);
            }

            if (subTotalAmount != 0) {
                subTotal(table, subTotalAmount);
            }

            grandTotalAmount = grandTotalAmount + subTotalAmount;
            prCounter++;
        }

        grandTotal(table, grandTotalAmount);
        document.add(table);
    } catch (DocumentException ex) {
        Logger.getLogger(AdvancesReportPdf.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
        document.close();
    }

}

From source file:com.hris.payroll.reports.AdvancesReportPdf.java

private void subTotal(PdfPTable table, double subTotalAmount) {
    PdfPCell cellLabel = new PdfPCell();
    Paragraph parLabel = new Paragraph();
    parLabel.add(new Phrase("", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);//from  w w w  . j  a v  a  2  s  .  co  m
    cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cellLabel.setBorder(Rectangle.BOTTOM);
    cellLabel.setPaddingBottom(10);
    table.addCell(cellLabel);

    cellLabel = new PdfPCell();
    parLabel = new Paragraph();
    parLabel.add(new Phrase(
            "SUB TOTAL:      "
                    + CommonUtil.formatNumValue(CommonUtil.roundOffToTwoDecimalPlaces(subTotalAmount)),
            content));
    parLabel.setAlignment(Element.ALIGN_RIGHT);
    cellLabel.addElement(parLabel);
    cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cellLabel.setBorder(Rectangle.BOTTOM);
    cellLabel.setPaddingBottom(10);
    table.addCell(cellLabel);

    cellLabel = new PdfPCell();
    parLabel = new Paragraph();
    parLabel.add(new Phrase("", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setPaddingLeft(20);
    cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cellLabel.setBorder(Rectangle.BOTTOM);
    cellLabel.setPaddingBottom(10);
    table.addCell(cellLabel);
}

From source file:com.hris.payroll.reports.AdvancesReportPdf.java

private void grandTotal(PdfPTable table, double grandTotalAmount) {
    //        PdfPCell cellLabel = new PdfPCell();
    //        Paragraph parLabel = new Paragraph();      
    //        parLabel.add(new Phrase("", content));
    //        parLabel.setAlignment(Element.ALIGN_LEFT);   
    //        cellLabel.addElement(parLabel);     
    //        cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
    //        cellLabel.setBorder(Rectangle.BOTTOM);
    //        cellLabel.setPaddingBottom(10);
    //        table.addCell(cellLabel);

    PdfPCell cellLabel = new PdfPCell();
    Paragraph parLabel = new Paragraph();
    parLabel.add(new Phrase(
            "GRAND TOTAL:      "
                    + CommonUtil.formatNumValue(CommonUtil.roundOffToTwoDecimalPlaces(grandTotalAmount)),
            content));//from   w  w  w . j a v a2s  .c o  m
    parLabel.setAlignment(Element.ALIGN_RIGHT);
    cellLabel.addElement(parLabel);
    cellLabel.setColspan(2);
    cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cellLabel.setBorder(Rectangle.BOTTOM);
    cellLabel.setPaddingBottom(10);
    table.addCell(cellLabel);

    cellLabel = new PdfPCell();
    parLabel = new Paragraph();
    parLabel.add(new Phrase("", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setPaddingLeft(20);
    cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cellLabel.setBorder(Rectangle.BOTTOM);
    cellLabel.setPaddingBottom(10);
    table.addCell(cellLabel);
}

From source file:com.hris.payroll.reports.AdvancesSummaryReportPdf.java

public AdvancesSummaryReportPdf(int branchId, Date payrollDate) {
    this.branchId = branchId;
    this.payrollDate = payrollDate;

    Document document = null;//w w w  . j a v a 2  s.c  o  m
    Rectangle pageSize = new Rectangle(318, 825);

    try {
        document = new Document(PageSize.A4.rotate(), 37, 37, 37, 37);
        PdfWriter writer = PdfWriter.getInstance(document, outputStream);
        document.open();

        int tradeId = cs.getTradeIdByBranchId(branchId);
        int corporateId = cs.getCorporateIdByTradeId(tradeId);

        Paragraph reportHeader = new Paragraph();
        reportHeader.setAlignment(Element.ALIGN_LEFT);
        reportHeader.add(new Phrase(cs.getCorporateById(corporateId).toUpperCase(), header));
        document.add(reportHeader);

        reportHeader = new Paragraph();
        reportHeader.setAlignment(Element.ALIGN_LEFT);
        reportHeader.add(new Phrase("Trade: " + cs.getTradeById(tradeId).toUpperCase(), header));
        document.add(reportHeader);

        reportHeader = new Paragraph();
        reportHeader.setAlignment(Element.ALIGN_LEFT);
        reportHeader.add(new Phrase("Branch: " + cs.getBranchById(getBranchId()).toUpperCase(), header));
        document.add(reportHeader);

        reportHeader = new Paragraph();
        reportHeader.setAlignment(Element.ALIGN_LEFT);
        reportHeader.add(new Phrase("Advances Summary", content));
        document.add(reportHeader);

        reportHeader = new Paragraph();
        reportHeader.setAlignment(Element.ALIGN_LEFT);
        reportHeader.add(new Phrase("Payroll Period: " + CommonUtil.changeDateFormat(
                ps.findPayrollRegisterByBranch(getBranchId(), getPayrollDate()).getPayrollDate().toString()),
                content));
        document.add(reportHeader);

        reportHeader = new Paragraph();
        reportHeader.setAlignment(Element.ALIGN_LEFT);
        reportHeader.add(new Phrase("Cut-off Date: "
                + CommonUtil.changeDateFormat(ps.findPayrollRegisterByBranch(getBranchId(), getPayrollDate())
                        .getAttendancePeriodFrom().toString())
                + " - "
                + CommonUtil.changeDateFormat(ps.findPayrollRegisterByBranch(getBranchId(), getPayrollDate())
                        .getAttendancePeriodTo().toString()),
                content));
        document.add(reportHeader);

        document.add(Chunk.NEWLINE);
        document.add(Chunk.NEWLINE);

        PdfPTable table = new PdfPTable(4);
        //            table.setWidthPercentage(100);
        table.setTotalWidth(new float[] { 180, 120, 130, 300 });
        table.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.getDefaultCell().setBorder(Rectangle.NO_BORDER);

        PdfPCell cellLabel = new PdfPCell();
        Paragraph parLabel = new Paragraph();
        parLabel.add(new Phrase("EMPLOYEE", boldFont));
        parLabel.setAlignment(Element.ALIGN_LEFT);
        cellLabel.addElement(parLabel);
        cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellLabel.setBorder(Rectangle.BOTTOM);
        table.addCell(cellLabel);

        cellLabel = new PdfPCell();
        parLabel = new Paragraph();
        parLabel.add(new Phrase("AMOUNT", boldFont));
        parLabel.setAlignment(Element.ALIGN_RIGHT);
        cellLabel.addElement(parLabel);
        cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellLabel.setBorder(Rectangle.BOTTOM);
        table.addCell(cellLabel);

        cellLabel = new PdfPCell();
        parLabel = new Paragraph();
        parLabel.add(new Phrase("ADVANCES TYPE", boldFont));
        parLabel.setAlignment(Element.ALIGN_LEFT);
        cellLabel.addElement(parLabel);
        cellLabel.setPaddingLeft(20);
        cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellLabel.setBorder(Rectangle.BOTTOM);
        table.addCell(cellLabel);

        cellLabel = new PdfPCell();
        parLabel = new Paragraph();
        parLabel.add(new Phrase("PARTICULARS", boldFont));
        parLabel.setAlignment(Element.ALIGN_LEFT);
        cellLabel.addElement(parLabel);
        cellLabel.setPaddingLeft(20);
        cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellLabel.setBorder(Rectangle.BOTTOM);
        table.addCell(cellLabel);

        String middlename;
        double grandTotalAmount = 0;
        double subTotalAmount;
        int prCounter = 0;
        int advancesCounter;
        for (PayrollRegister pr : ps.findByBranch(getBranchId(), getPayrollDate())) {
            if (pr.getMiddlename().isEmpty() || pr.getMiddlename() == null) {
                middlename = "";
            } else {
                middlename = pr.getMiddlename().toUpperCase();
            }
            String employee = pr.getLastname().toUpperCase() + ", " + pr.getFirstname().toUpperCase() + " "
                    + middlename;
            subTotalAmount = 0;
            advancesCounter = 0;
            for (Advances a : as.findByPayroll(pr.getPayrollId())) {
                cellLabel = new PdfPCell();
                parLabel = new Paragraph();
                if (advancesCounter == 0) {
                    parLabel.add(new Phrase(employee, content));
                } else {
                    parLabel.add(new Phrase("", content));
                }
                parLabel.setAlignment(Element.ALIGN_LEFT);
                cellLabel.addElement(parLabel);
                cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
                cellLabel.setBorder(Rectangle.NO_BORDER);
                table.addCell(cellLabel);

                cellLabel = new PdfPCell();
                parLabel = new Paragraph();
                parLabel.add(new Phrase(CommonUtil.formatNumValue(a.getAmount()), content));
                parLabel.setAlignment(Element.ALIGN_RIGHT);
                cellLabel.addElement(parLabel);
                cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
                subTotalAmount = subTotalAmount + a.getAmount();
                advancesCounter++;
                if (advancesCounter == as.findByPayroll(pr.getPayrollId()).size()) {
                    cellLabel.setBorder(Rectangle.BOTTOM);
                } else {
                    cellLabel.setBorder(Rectangle.NO_BORDER);
                }
                table.addCell(cellLabel);

                cellLabel = new PdfPCell();
                parLabel = new Paragraph();
                parLabel.add(new Phrase(a.getAdvanceType(), content));
                parLabel.setAlignment(Element.ALIGN_LEFT);
                cellLabel.addElement(parLabel);
                cellLabel.setPaddingLeft(20);
                cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
                cellLabel.setBorder(Rectangle.NO_BORDER);
                table.addCell(cellLabel);

                cellLabel = new PdfPCell();
                parLabel = new Paragraph();
                parLabel.add(new Phrase(a.getParticulars(), content));
                parLabel.setAlignment(Element.ALIGN_LEFT);
                cellLabel.addElement(parLabel);
                cellLabel.setPaddingLeft(20);
                cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
                cellLabel.setBorder(Rectangle.NO_BORDER);
                table.addCell(cellLabel);
            }

            if (subTotalAmount != 0) {
                subTotal(table, subTotalAmount);
            }

            grandTotalAmount = grandTotalAmount + subTotalAmount;
            prCounter++;
        }

        grandTotal(table, grandTotalAmount);
        document.add(table);
    } catch (DocumentException ex) {
        Logger.getLogger(AdvancesReportPdf.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
        document.close();
    }
}

From source file:com.hris.payroll.reports.AdvancesSummaryReportPdf.java

private void subTotal(PdfPTable table, double subTotalAmount) {
    PdfPCell cellLabel = new PdfPCell();
    Paragraph parLabel = new Paragraph();
    parLabel.add(new Phrase("", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);/*  w w w  . ja  v a 2s  .c o m*/
    cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cellLabel.setBorder(Rectangle.BOTTOM);
    cellLabel.setPaddingBottom(10);
    table.addCell(cellLabel);

    cellLabel = new PdfPCell();
    parLabel = new Paragraph();
    parLabel.add(new Phrase(
            "SUB TOTAL:      "
                    + CommonUtil.formatNumValue(CommonUtil.roundOffToTwoDecimalPlaces(subTotalAmount)),
            content));
    parLabel.setAlignment(Element.ALIGN_RIGHT);
    cellLabel.addElement(parLabel);
    cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cellLabel.setBorder(Rectangle.BOTTOM);
    cellLabel.setPaddingBottom(10);
    table.addCell(cellLabel);

    cellLabel = new PdfPCell();
    parLabel = new Paragraph();
    parLabel.add(new Phrase("", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setPaddingLeft(20);
    cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cellLabel.setBorder(Rectangle.BOTTOM);
    cellLabel.setPaddingBottom(10);
    table.addCell(cellLabel);

    cellLabel = new PdfPCell();
    parLabel = new Paragraph();
    parLabel.add(new Phrase("", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setPaddingLeft(20);
    cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cellLabel.setBorder(Rectangle.BOTTOM);
    cellLabel.setPaddingBottom(10);
    table.addCell(cellLabel);
}

From source file:com.hris.payroll.reports.AdvancesSummaryReportPdf.java

private void grandTotal(PdfPTable table, double grandTotalAmount) {
    //        PdfPCell cellLabel = new PdfPCell();
    //        Paragraph parLabel = new Paragraph();      
    //        parLabel.add(new Phrase("", content));
    //        parLabel.setAlignment(Element.ALIGN_LEFT);   
    //        cellLabel.addElement(parLabel);     
    //        cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
    //        cellLabel.setBorder(Rectangle.BOTTOM);
    //        cellLabel.setPaddingBottom(10);
    //        table.addCell(cellLabel);

    PdfPCell cellLabel = new PdfPCell();
    Paragraph parLabel = new Paragraph();
    parLabel.add(new Phrase(
            "GRAND TOTAL:      "
                    + CommonUtil.formatNumValue(CommonUtil.roundOffToTwoDecimalPlaces(grandTotalAmount)),
            content));/* w w  w  . ja v  a 2  s . co  m*/
    parLabel.setAlignment(Element.ALIGN_RIGHT);
    cellLabel.addElement(parLabel);
    cellLabel.setColspan(2);
    cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cellLabel.setBorder(Rectangle.BOTTOM);
    cellLabel.setPaddingBottom(10);
    table.addCell(cellLabel);

    cellLabel = new PdfPCell();
    parLabel = new Paragraph();
    parLabel.add(new Phrase("", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setPaddingLeft(20);
    cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cellLabel.setBorder(Rectangle.BOTTOM);
    cellLabel.setPaddingBottom(10);
    table.addCell(cellLabel);

    cellLabel = new PdfPCell();
    parLabel = new Paragraph();
    parLabel.add(new Phrase("", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setPaddingLeft(20);
    cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cellLabel.setBorder(Rectangle.BOTTOM);
    cellLabel.setPaddingBottom(10);
    table.addCell(cellLabel);
}

From source file:com.hris.payroll.reports.PayslipReportPDF.java

private PdfPTable leftColumnTable(PayrollRegister pr, Date payrollDate) throws DocumentException {
    PdfPTable table = new PdfPTable(3);
    table.setTotalWidth(new float[] { 120, 20, 103 });
    table.setWidthPercentage(100);//  w ww  .jav a 2s . co  m
    table.setHorizontalAlignment(Element.ALIGN_LEFT);
    table.setLockedWidth(true);

    PdfPCell cellTitle = new PdfPCell();
    cellTitle.setColspan(3);
    Paragraph parTitle = new Paragraph();
    parTitle.add(new Phrase("Payslip: ", header));
    parTitle.setAlignment(Element.ALIGN_CENTER);
    cellTitle.addElement(parTitle);
    cellTitle.setBorder(cellBorder);
    table.addCell(cellTitle);

    PdfPCell cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(3);
    Paragraph parLabel = new Paragraph();
    parLabel.add(
            new Phrase("Payroll Date: " + CommonUtil.convertDateFormat(getPayrollDate().toString()), content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    //        PdfPCell cellValue = new PdfPCell();
    //        cellValue.setUseAscender(true);
    //        Paragraph parValue = new Paragraph();
    //        parValue.add(new Phrase(CommonUtil.convertDateFormat(getPayrollDate().toString()), content));
    //        parValue.setAlignment(Element.ALIGN_RIGHT);
    //        cellValue.addElement(parValue);     
    //        cellValue.setBorder(cellBorder);
    //        table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(3);
    parLabel = new Paragraph();
    parLabel.add(
            new Phrase(
                    "Cut-off Date: " + CommonUtil.changeDateFormat(pr.getAttendancePeriodFrom().toString())
                            + " - " + CommonUtil.changeDateFormat(pr.getAttendancePeriodTo().toString()),
                    content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    //        PdfPCell cellValue = new PdfPCell();
    //        cellValue.setUseAscender(true);
    //        Paragraph parValue = new Paragraph();
    //        parValue.add(new Phrase(CommonUtil.convertDateFormat(pr.getAttendancePeriodFrom().toString())+" - "+CommonUtil.convertDateFormat(pr.getAttendancePeriodFrom().toString()), content));
    //        parValue.setAlignment(Element.ALIGN_RIGHT);
    //        cellValue.addElement(parValue);     
    //        cellValue.setBorder(cellBorder);
    //        table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(3);
    parLabel = new Paragraph();
    String middlename;
    if (pr.getMiddlename() == null || pr.getMiddlename().isEmpty()) {
        middlename = " ";
    } else {
        middlename = String.valueOf(pr.getMiddlename().toUpperCase().charAt(0)) + ". ";
    }
    String name = pr.getLastname().toUpperCase() + ", " + pr.getFirstname().toUpperCase() + " " + middlename;
    parLabel.add(new Phrase("Employee Name: " + name, content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    //        cellValue = new PdfPCell();
    ////        cellValue.setUseAscender(true);
    //        parValue = new Paragraph();
    //        parValue.add(new Phrase(pr.getLastname().toUpperCase()+", "+pr.getFirstname().toUpperCase()+" "+pr.getMiddlename().toUpperCase().charAt(0)+".", employeeName));
    ////        parValue.add(new Phrase("NAME", content));
    //        parValue.setAlignment(Element.ALIGN_RIGHT);
    //        cellValue.addElement(parValue);     
    //        cellValue.setBorder(cellBorder);
    //        table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(3);
    parLabel = new Paragraph();
    String position = (ephs.findByEmployee(pr.getEmployeeId()).getPosition() == null) ? "N/A"
            : ephs.findByEmployee(pr.getEmployeeId()).getPosition().toUpperCase();
    parLabel.add(new Phrase("POSITION: " + position, smallerFont));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    //        cellValue = new PdfPCell();
    //        cellValue.setUseAscender(true);
    //        parValue = new Paragraph();
    //        parValue.add(new Phrase(CommonUtil.convertDateFormat(new Date().toString()), content));
    //        parValue.setAlignment(Element.ALIGN_RIGHT);
    //        cellValue.addElement(parValue);     
    //        cellValue.setBorder(cellBorder);
    //        table.addCell(cellValue);

    cellLabel = new PdfPCell();
    //        cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.add(new Phrase("Monthly/Daily Rate: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    PdfPCell cellValue = new PdfPCell();
    //        cellValue.setUseAscender(true);
    Paragraph parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(pr.getRate()), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.add(new Phrase("Half-month Rate: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(pr.getHalfMonthSalary()), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("Overtime: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(
            new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(pr.getOvertimePay())), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("Holiday Premium: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    double premium = (pr.getLegalHolidayPay() + pr.getSpecialHolidayPay())
            - (pr.getTotalLatesHolidayDeduction() + pr.getTotalUndertimeHolidayDeduction());
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(premium)), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("Working Day-off: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(pr.getWorkingDayOffPay())),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("Night Differential: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(pr.getNightDifferential())),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("Absences/Lates/Undertime: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    double alu = pr.getAbsences() + pr.getTotalLatesDeduction() + pr.getTotalUndertimeDeduction();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(alu)), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.add(new Phrase("GROSS PAY: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(pr.getGrossPay())), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(Rectangle.TOP | Rectangle.BOTTOM);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("Allowances: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(" ", content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("COLA: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(pr.getColaAllowance()), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Meal Allowance: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(pr.getMealAllowance()), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("AFL: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(pr.getAllowanceForLiquidation()), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Transportation Allowance: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    cellLabel.setColspan(2);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(pr.getTransportationAllowance()), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Housing Allowance: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(pr.getOtherAllowance()), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Communications Allowance: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(pr.getCommunicationAllowance()), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.add(new Phrase("TOTAL PAY: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    double totalPay = pr.getGrossPay() + pr.getCommunicationAllowance() + pr.getTransportationAllowance()
            + pr.getColaAllowance() + pr.getPerDiemAllowance() + pr.getMealAllowance() + pr.getOtherAllowance()
            + pr.getAllowanceForLiquidation();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(totalPay)), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(Rectangle.TOP | Rectangle.BOTTOM);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.add(new Phrase("DEDUCTIONS: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(" ", content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("SSS Contribution: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(pr.getSss())), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("PHIC Contribution: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(pr.getPhic())), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("HDMF Contribution: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(pr.getHdmf())), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("Withholoding Taxes: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(pr.getTax())), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("SSS Loan: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(
            String.valueOf(CommonUtil
                    .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "sss loan"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("HDMF Loan: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(
            String.valueOf(CommonUtil
                    .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "hdmf loan"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("Additional HDMF Contribution: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(
            new Phrase(
                    String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(
                            as.findAdvancesTotalAmount(pr.getPayrollId(), "additional HDMF contribution"))),
                    content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("PAG-IBIG 2: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(
            String.valueOf(CommonUtil
                    .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "pag-ibig ii"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("Advances to O/E: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(" ", content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Cash Bond: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(
            String.valueOf(CommonUtil
                    .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "cash bond"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Cash Advance: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(
            String.valueOf(CommonUtil
                    .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "cash advance"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Lending: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(
            String.valueOf(CommonUtil
                    .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "lending"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Jewelry: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(
            String.valueOf(CommonUtil
                    .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "jewelry"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Staffhouse: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(
            String.valueOf(CommonUtil
                    .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "staffhouse"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Hotel and Restaurant Charges: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(
            new Phrase(
                    String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(
                            as.findAdvancesTotalAmount(pr.getPayrollId(), "hotel and restaurant charges"))),
                    content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Cash Shortages: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil
            .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "cash shortages"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Employee Charges: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil
            .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "employee charges"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("ATM Initial Deposit: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil
            .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "atm initial deposit"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Others__________________: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    double otherCharges = as.findAdvancesTotalAmount(pr.getPayrollId(), "advances to o/e")
            + as.findAdvancesTotalAmount(pr.getPayrollId(), "other charges");
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(otherCharges)), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.add(new Phrase("TOTAL DEDUCTIONS:", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    double totalDeductions = as.findAdvancesTotalAmount(pr.getPayrollId()) + pr.getTax() + pr.getPhic()
            + pr.getHdmf() + pr.getSss();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(totalDeductions)), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(Rectangle.TOP | Rectangle.BOTTOM);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.add(new Phrase("NET PAY:", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    double netPay = CommonUtil.roundOffToTwoDecimalPlaces(totalPay - totalDeductions);
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(netPay)), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    /***************************************************************************/
    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    parLabel = new Paragraph();
    parLabel.add(new Phrase("Adjustments:", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    parLabel = new Paragraph();
    parLabel.add(new Phrase(" ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(
            new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(pr.getAdjustments())), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    /***************************************************************************/
    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    parLabel = new Paragraph();
    //        parLabel.add(new Phrase("_____________________________", content));
    parLabel.add(new Phrase(" ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(Rectangle.TOP | Rectangle.BOTTOM);
    table.addCell(cellLabel);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    parLabel = new Paragraph();
    parLabel.add(new Phrase(" ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    //        parValue.add(new Phrase(String.valueOf(totalPay - totalDeductions), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    /***************************************************************************/
    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    parLabel = new Paragraph();
    parLabel.add(new Phrase("TOTAL AMOUNT TO BE RECEIVED:", smallFont));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase(" ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(netPay + pr.getAdjustments())),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(Rectangle.TOP | Rectangle.BOTTOM);
    table.addCell(cellValue);

    /***************************************************************************/
    cellLabel = new PdfPCell();
    //        cellLabel.setUseAscender(true);
    parLabel = new Paragraph();
    parLabel.add(new Phrase("Prepared By: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellLabel = new PdfPCell();
    //        cellLabel.setUseAscender(true);
    parLabel = new Paragraph();
    parLabel.add(new Phrase(" ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    //        cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase("Conforme: ", content));
    parValue.setAlignment(Element.ALIGN_LEFT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    /***************************************************************************/
    int userId = ubas.findUserByBranch(getBranchId());
    String employeeId = us.findEmployeeIdByUserId(userId);
    Employee e = es.findEmployeeById(employeeId);

    String payrollClerkMiddlename;
    if (e.getMiddlename() == null || e.getMiddlename().isEmpty()) {
        payrollClerkMiddlename = " ";
    } else {
        payrollClerkMiddlename = String.valueOf(e.getMiddlename().toUpperCase().charAt(0)) + ". ";
    }
    String payrollClerk = e.getFirstname().toUpperCase() + " " + payrollClerkMiddlename
            + e.getLastname().toUpperCase();

    String employeeMiddlename;
    if (pr.getMiddlename() == null || pr.getMiddlename().isEmpty()) {
        employeeMiddlename = " ";
    } else {
        employeeMiddlename = String.valueOf(pr.getMiddlename().toUpperCase().charAt(0)) + ". ";
    }
    String employee = pr.getFirstname().toUpperCase() + " " + employeeMiddlename
            + pr.getLastname().toUpperCase();

    cellLabel = new PdfPCell();
    cellLabel.setPaddingTop(30);
    parLabel = new Paragraph();
    parLabel.add(new Phrase(payrollClerk, smallerFont));
    parLabel.setAlignment(Element.ALIGN_CENTER);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(Rectangle.BOTTOM);
    table.addCell(cellLabel);

    cellLabel = new PdfPCell();
    cellLabel.setPaddingTop(30);
    parLabel = new Paragraph();
    parLabel.add(new Phrase(" ", content));
    parLabel.setAlignment(Element.ALIGN_CENTER);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setPaddingTop(30);
    parValue = new Paragraph();
    parValue.add(new Phrase(employee, smallerFont));
    parValue.setAlignment(Element.ALIGN_CENTER);
    cellValue.addElement(parValue);
    cellValue.setBorder(Rectangle.BOTTOM);
    table.addCell(cellValue);

    /***************************************************************************/
    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    parLabel = new Paragraph();
    //        parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("Payroll Clerk", content));
    parLabel.setAlignment(Element.ALIGN_CENTER);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellLabel = new PdfPCell();
    parLabel = new Paragraph();
    //        parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase("Employee", content));
    parValue.setAlignment(Element.ALIGN_CENTER);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    return table;
}