Example usage for com.lowagie.text.pdf PdfPTable setWidths

List of usage examples for com.lowagie.text.pdf PdfPTable setWidths

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfPTable setWidths.

Prototype

public void setWidths(int relativeWidths[]) throws DocumentException 

Source Link

Document

Sets the relative widths of the table.

Usage

From source file:org.cgiar.ccafs.ap.summaries.projects.pdf.ProjectSummaryPDF.java

License:Open Source License

/**
 * This method is used for add Outcomes in the project summary
 *///from   w w  w.ja va  2 s.c  om
private void addProjectOutcomes(String number) {
    Paragraph outcomesBlock = new Paragraph();
    outcomesBlock.setAlignment(Element.ALIGN_JUSTIFIED);
    Paragraph title = new Paragraph(number + ". " + this.getText("summaries.project.outcome"), HEADING2_FONT);
    outcomesBlock.add(title);
    outcomesBlock.add(Chunk.NEWLINE);
    ;
    title = new Paragraph();
    title.setFont(HEADING3_FONT);
    title.add(number + ".1 " + this.getText("summaries.project.outcomeNarrative"));
    outcomesBlock.add(title);
    outcomesBlock.add(Chunk.NEWLINE);
    ;

    // Project outcome statement
    Paragraph body = new Paragraph();
    body.setFont(BODY_TEXT_BOLD_FONT);
    body.add(this.getText("summaries.project.outcomeStatement"));

    // body.setFont(BODY_TEXT_FONT);
    if (project.getOutcomes() == null || project.getOutcomes().get(String.valueOf(midOutcomeYear)) == null
            || project.getOutcomes().get(String.valueOf(midOutcomeYear)).getStatement() == null
            || project.getOutcomes().get(String.valueOf(midOutcomeYear)).getStatement().equals("")) {
        body.add(": ");
        body.setFont(BODY_TEXT_FONT);
        body.add(this.getText("summaries.project.empty"));
    } else {
        body.setFont(BODY_TEXT_FONT);
        body.add(Chunk.NEWLINE);
        body.add(this.messageReturn(project.getOutcomes().get(String.valueOf(midOutcomeYear)).getStatement()));

    }
    body.add(Chunk.NEWLINE);
    ;
    outcomesBlock.add(body);

    try {
        document.newPage();
        document.add(outcomesBlock);
    } catch (DocumentException e) {
        LOG.error("There was an error trying to add the project focuses to the project summary pdf", e);
    }

    Anchor anchor;
    currentPlanningYear--;
    ////////////////// Reporting
    PdfPTable table;
    if (project.isReporting()) {
        for (int year = currentPlanningYear; year < midOutcomeYear; year++) {

            // Annual progress towards
            outcomesBlock = new Paragraph();
            outcomesBlock.setAlignment(Element.ALIGN_JUSTIFIED);
            outcomesBlock.setFont(BODY_TEXT_BOLD_FONT);
            outcomesBlock.add(this.getText("summaries.project.outcomeAnnualProgress",
                    new String[] { String.valueOf(year) }));
            outcomesBlock.setFont(BODY_TEXT_FONT);

            if (project.getOutcomes() == null || project.getOutcomes().get(String.valueOf(year)) == null) {
                outcomesBlock.add(this.getText("summaries.project.empty"));
            } else {
                outcomesBlock.add(
                        this.messageReturn(project.getOutcomes().get(String.valueOf(year)).getStatement()));
            }
            outcomesBlock.add(Chunk.NEWLINE);
            outcomesBlock.add(Chunk.NEWLINE);

            try {
                document.add(outcomesBlock);
            } catch (DocumentException e) {
                LOG.error("There was an error trying to add the project focuses to the project summary pdf", e);
            }

            if (year == this.currentPlanningYear) {
                table = new PdfPTable(1);
                table.setLockedWidth(true);
                table.setTotalWidth(500);

                ///// outcome toward in reporting cycle
                outcomesBlock = new Paragraph();
                outcomesBlock.setFont(TABLE_BODY_BOLD_FONT);
                outcomesBlock.add(this.getText("summaries.project.outcomeAnnualTowards",
                        new String[] { String.valueOf(year) }));

                outcomesBlock.setFont(TABLE_BODY_FONT);

                if (project.getOutcomes() == null || project.getOutcomes().get(String.valueOf(year)) == null) {
                    outcomesBlock.add(this.getText("summaries.project.empty"));
                } else {
                    outcomesBlock.add(this
                            .messageReturn(project.getOutcomes().get(String.valueOf(year)).getAnualProgress()));
                }

                this.addTableBodyCell(table, outcomesBlock, Element.ALIGN_JUSTIFIED, 1);

                ///// outcome communication
                outcomesBlock = new Paragraph();
                outcomesBlock.setFont(TABLE_BODY_BOLD_FONT);
                outcomesBlock.add(this.getText("summaries.project.outcomeAnnualCommunication"));
                outcomesBlock.setFont(TABLE_BODY_FONT);

                if (project.getOutcomes() == null || project.getOutcomes().get(String.valueOf(year)) == null) {
                    outcomesBlock.add(this.getText("summaries.project.empty"));
                } else {
                    outcomesBlock.add(this
                            .messageReturn(project.getOutcomes().get(String.valueOf(year)).getComunication()));
                }
                this.addTableBodyCell(table, outcomesBlock, Element.ALIGN_JUSTIFIED, 1);

                // Any evendence
                outcomesBlock = new Paragraph();
                outcomesBlock.setFont(TABLE_BODY_BOLD_FONT);
                outcomesBlock.add(this.getText("summaries.project.outcomeAnnualEvidence"));
                outcomesBlock.setFont(TABLE_BODY_FONT);

                if (project.getOutcomes() == null || project.getOutcomes().get(String.valueOf(year)) == null
                        || project.getOutcomes().get(String.valueOf(year)).getFile() == null
                        || project.getOutcomes().get(String.valueOf(year)).getFile().equals("")) {
                    outcomesBlock.add(this.getText("summaries.project.empty"));
                } else {

                    anchor = new Anchor(project.getOutcomes().get(String.valueOf(year)).getFile(),
                            TABLE_BODY_FONT_LINK);
                    anchor.setReference(config.getDownloadURL() + "/projects/" + project.getId()
                            + "/project_outcome/" + project.getOutcomes().get(String.valueOf(year)).getFile());
                    outcomesBlock.add(anchor);
                }
                this.addTableBodyCell(table, outcomesBlock, Element.ALIGN_LEFT, 1);
                try {
                    document.add(table);
                    outcomesBlock = new Paragraph();
                    outcomesBlock.add(Chunk.NEWLINE);
                    document.add(outcomesBlock);
                } catch (DocumentException e) {
                    LOG.error("There was an error trying to add the project focuses to the project summary pdf",
                            e);
                }
            }
        }

    }
    ////////////////// Planning
    else {
        String outcomeProgress = new String();
        for (int year = currentPlanningYear; year < midOutcomeYear; year++) {
            // Annual progress towards
            outcomesBlock = new Paragraph();
            outcomesBlock.setAlignment(Element.ALIGN_JUSTIFIED);
            outcomesBlock.setFont(BODY_TEXT_BOLD_FONT);
            outcomesBlock.add(this.getText("summaries.project.outcomeAnnualProgress",
                    new String[] { String.valueOf(year) }));

            if (project.getOutcomes() == null || project.getOutcomes().get(String.valueOf(year)) == null
                    || project.getOutcomes().get(String.valueOf(year)).getStatement() == null
                    || project.getOutcomes().get(String.valueOf(year)).getStatement().equals("")) {
                outcomesBlock.add(": ");
                outcomesBlock.setFont(BODY_TEXT_FONT);
                outcomeProgress = this.getText("summaries.project.empty");
            } else {
                outcomesBlock.add(Chunk.NEWLINE);
                outcomeProgress = this
                        .messageReturn(project.getOutcomes().get(String.valueOf(year)).getStatement());
                outcomesBlock.setFont(BODY_TEXT_FONT);
            }
            outcomesBlock.add(outcomeProgress);
            outcomesBlock.add(Chunk.NEWLINE);
            ;
            outcomesBlock.add(Chunk.NEWLINE);
            ;

            try {
                document.add(outcomesBlock);
            } catch (DocumentException e) {
                LOG.error("There was an error trying to add the project focuses to the project summary pdf", e);
            }
        }

    }

    // Lesson regardins
    outcomesBlock = new Paragraph();
    outcomesBlock.setAlignment(Element.ALIGN_JUSTIFIED);
    outcomesBlock.setFont(BODY_TEXT_BOLD_FONT);
    if (project.isReporting()) {
        outcomesBlock.add(this.getText("summaries.project.outcome.reporting.lessonRegarding"));
    } else {
        outcomesBlock.add(this.getText("summaries.project.outcome.lessonRegarding"));
    }
    outcomesBlock.setFont(BODY_TEXT_FONT);
    if (project.getComponentLesson("outcomes") != null) {
        outcomesBlock.add(this.messageReturn(project.getComponentLesson("outcomes").getLessons()));
    } else {
        outcomesBlock.add(this.messageReturn(null));
    }
    try {
        document.add(outcomesBlock);
    } catch (DocumentException e) {
        LOG.error("There was an error trying to add the project focuses to the project summary pdf", e);
    }
    // ******************* CCAFS Outcomes***************/
    this.addProjectCCAFSOutcomes(number);

    // **********************************************************************************
    // ******************* Other contributions***************/
    // **********************************************************************************

    OtherContribution otherContribution = project.getIpOtherContribution();

    try {
        outcomesBlock = new Paragraph();
        outcomesBlock.setAlignment(Element.ALIGN_JUSTIFIED);

        title = new Paragraph(
                number + ".3 " + this.getText("summaries.project.outcome.ccafs.outcomes.other.contributions"),
                HEADING3_FONT);
        outcomesBlock.add(Chunk.NEWLINE);
        outcomesBlock.add(Chunk.NEWLINE);
        outcomesBlock.add(title);
        outcomesBlock.add(Chunk.NEWLINE);

        // Contribution to other Impact Pathways:
        outcomesBlock.setFont(BODY_TEXT_BOLD_FONT);
        if (project.isReporting()) {
            outcomesBlock.add(this.getText(
                    "summaries.project.outcome.ccafs.outcomes.reporting.other.contributions.pathways"));
        } else {

            outcomesBlock
                    .add(this.getText("summaries.project.outcome.ccafs.outcomes.other.contributions.pathways"));
        }
        outcomesBlock.setFont(BODY_TEXT_FONT);

        if (otherContribution == null || otherContribution.getContribution() == null
                || otherContribution.getContribution().equals("")) {
            outcomesBlock.add(": " + this.getText("summaries.project.empty"));
        } else {
            outcomesBlock.add(Chunk.NEWLINE);
            outcomesBlock.add(otherContribution.getContribution());
        }

        outcomesBlock.add(Chunk.NEWLINE);
        outcomesBlock.add(Chunk.NEWLINE);

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

        Paragraph cell;

        if (project.isReporting()) {

            if (project.getOtherContributions().isEmpty()) {

            } else {
                table = new PdfPTable(4);
                table.setWidths(new int[] { 2, 4, 4, 4 });
                table.setLockedWidth(true);
                table.setTotalWidth(500);

                // adding headers
                cell = new Paragraph(this.getText("summaries.project.reporting.ccafs.outcomes.region"),
                        TABLE_HEADER_FONT);
                this.addTableHeaderCell(table, cell);

                cell = new Paragraph(this.getText("summaries.project.reporting.ccafs.outcomes.indicator"),
                        TABLE_HEADER_FONT);
                this.addTableHeaderCell(table, cell);

                cell = new Paragraph(this.getText("summaries.project.reporting.ccafs.outcomes.describe",
                        new String[] { String.valueOf(this.currentReportingYear) }), TABLE_HEADER_FONT);
                this.addTableHeaderCell(table, cell);

                cell = new Paragraph(this.getText("summaries.project.reporting.ccafs.outcomes.ablequantily"),
                        TABLE_HEADER_FONT);
                this.addTableHeaderCell(table, cell);

                // Adding contain
                for (ProjecteOtherContributions projectOther : project.getOtherContributions()) {
                    cell = new Paragraph(projectOther.getRegion(), TABLE_BODY_FONT);
                    this.addTableBodyCell(table, cell, Element.ALIGN_JUSTIFIED, 1);

                    cell = new Paragraph(projectOther.getIndicators(), TABLE_BODY_FONT);
                    this.addTableBodyCell(table, cell, Element.ALIGN_JUSTIFIED, 1);

                    cell = new Paragraph(projectOther.getDescription(), TABLE_BODY_FONT);
                    this.addTableBodyCell(table, cell, Element.ALIGN_JUSTIFIED, 1);

                    cell = new Paragraph(String.valueOf(projectOther.getTarget()), TABLE_BODY_FONT);
                    this.addTableBodyCell(table, cell, Element.ALIGN_JUSTIFIED, 1);

                }
                document.add(table);
                document.add(Chunk.NEWLINE);
            }
            // // Collaboration with other CRPs
            cell = new Paragraph(this.getText("summaries.project.reporting.ccafs.outcomes.collaborating"),
                    BODY_TEXT_BOLD_FONT);

            if (project.getListCRPContributions().isEmpty()) {
                cell.add(": ");
                cell.setFont(BODY_TEXT_FONT);
                cell.add(this.messageReturn(null));
                cell.add(Chunk.NEWLINE);
                document.add(cell);
            } else {
                document.add(cell);
                document.add(Chunk.NEWLINE);

                for (CRPContribution crpContribution : project.getListCRPContributions()) {
                    table = new PdfPTable(1);
                    table.setLockedWidth(true);
                    table.setTotalWidth(500);

                    cell = new Paragraph(this.messageReturn(crpContribution.getCrp().getName()),
                            TABLE_BODY_BOLD_FONT);
                    cell.setAlignment(Element.ALIGN_LEFT);
                    this.addTableBodyCell(table, cell, Element.ALIGN_CENTER, 1);

                    cell = new Paragraph(
                            this.getText("summaries.project.reporting.ccafs.outcomes.natureCollaboration"),
                            TABLE_BODY_BOLD_FONT);
                    cell.setFont(TABLE_BODY_FONT);
                    cell.add(this.messageReturn(crpContribution.getNatureCollaboration()));
                    this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1);

                    cell = new Paragraph(
                            this.getText("summaries.project.reporting.ccafs.outcomes.achievedOutcome"),
                            TABLE_BODY_BOLD_FONT);
                    cell.setFont(TABLE_BODY_FONT);
                    cell.add(this.messageReturn(crpContribution.getExplainAchieved()));
                    this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1);

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

            }
        }

        else {
            outcomesBlock = new Paragraph();
            // Contribution to another Center activity:
            outcomesBlock.setFont(BODY_TEXT_BOLD_FONT);
            outcomesBlock
                    .add(this.getText("summaries.project.outcome.ccafs.outcomes.other.contributions.center"));
            outcomesBlock.setFont(BODY_TEXT_FONT);
            if (otherContribution == null || otherContribution.getAdditionalContribution() == null
                    || otherContribution.getAdditionalContribution().equals("")) {
                outcomesBlock.add(": " + this.getText("summaries.project.empty"));
            } else {
                outcomesBlock.add(otherContribution.getAdditionalContribution());
                outcomesBlock.add(Chunk.NEWLINE);
                outcomesBlock.add(Chunk.NEWLINE);

            }

            boolean addParagraph = false;
            cell = new Paragraph();
            ;
            cell.setFont(BODY_TEXT_BOLD_FONT);

            table = new PdfPTable(2);

            cell.add(this.getText("summaries.project.outcome.ccafs.outcomes.other.contributions.covered"));
            if (otherContribution != null)

            {
                List<CRPContribution> listCRP = otherContribution.getCrpContributions();
                if (listCRP.isEmpty()) {
                    cell.setFont(BODY_TEXT_FONT);
                    cell.add(this.getText("summaries.project.empty"));
                    addParagraph = true;
                } else {
                    table.setWidths(new int[] { 4, 6 });
                    table.setLockedWidth(true);
                    table.setTotalWidth(500);

                    this.addCustomTableCell(table, cell, Element.ALIGN_LEFT, BODY_TEXT_FONT, Color.WHITE,
                            table.getNumberOfColumns(), 0, false);

                    // adding headers
                    this.addTableHeaderCell(table,
                            new Paragraph(
                                    this.getText(
                                            "summaries.project.outcome.ccafs.outcomes.other.contributions.crp"),
                                    TABLE_HEADER_FONT));

                    this.addTableHeaderCell(table,
                            new Paragraph(this.getText(
                                    "summaries.project.outcome.ccafs.outcomes.other.contributions.nature"),
                                    TABLE_HEADER_FONT));

                    for (CRPContribution CRPContribution : listCRP) {
                        if (CRPContribution != null && CRPContribution.getCrp() != null) {
                            cell = new Paragraph();
                            cell.setFont(TABLE_BODY_FONT);
                            cell.add(CRPContribution.getCrp().getName());
                            this.addTableBodyCell(table, cell, Element.ALIGN_CENTER, 1);

                            cell = new Paragraph();
                            cell.setFont(TABLE_BODY_FONT);
                            cell.add(CRPContribution.getNatureCollaboration());
                            this.addTableBodyCell(table, cell, Element.ALIGN_JUSTIFIED, 1);
                        }
                    }
                }
            } else

            {
                cell.add(": ");
                cell.setFont(BODY_TEXT_FONT);
                cell.add(this.getText("summaries.project.empty"));
                addParagraph = true;
            }
            document.add(outcomesBlock);
            // Add paragraphs to document
            if (addParagraph) {
                document.add(cell);
            } else

            {
                document.add(table);
            }

            document.add(Chunk.NEWLINE);

            // Lesson regardins Other contributions
            outcomesBlock = new Paragraph();
            outcomesBlock.setAlignment(Element.ALIGN_JUSTIFIED);
            outcomesBlock.setFont(BODY_TEXT_BOLD_FONT);
            outcomesBlock.add(this
                    .getText("summaries.project.outcome.ccafs.outcomes.other.contributions.lessonRegarding"));
            outcomesBlock.setFont(BODY_TEXT_FONT);
            if (project.getComponentLesson("otherContributions") != null)

            {
                outcomesBlock
                        .add(this.messageReturn(project.getComponentLesson("otherContributions").getLessons()));
            } else

            {
                outcomesBlock.add(this.messageReturn(null));
            }
            document.add(outcomesBlock);
        }
        // **********************************************************************************
        // *************************** Outcome Case Studies *************************************
        // **********************************************************************************
        int counter = 0;
        if (project.isReporting()) {
            document.newPage();
            title = new Paragraph(
                    number + ".4 " + this.getText("summaries.project.reporting.outcome.case.studies"),
                    HEADING3_FONT);
            document.add(title);

            if (project.getCaseStudies().isEmpty()) {
                document.add(
                        new Paragraph(this.getText("summaries.project.reporting.outcome.not.case.studies")));
            } else {
                title = new Paragraph();
                title.add(Chunk.NEWLINE);
                document.add(title);

                for (CasesStudies caseStudy : project.getCaseStudies()) {

                    counter++;
                    table = new PdfPTable(1);
                    table.setLockedWidth(true);
                    table.setTotalWidth(500);

                    // case study
                    cell = new Paragraph(
                            this.getText("summaries.project.reporting.outcome.case.study") + " #" + counter,
                            TABLE_HEADER_FONT);
                    this.addTableHeaderCell(table, cell);
                    // this.addCustomTableCell(table, cell, Element.ALIGN_LEFT, BODY_TEXT_FONT, Color.WHITE,
                    // table.getNumberOfColumns(), 0, false);

                    // Title
                    cell = new Paragraph(this.getText("summaries.project.reporting.outcome.casestudy.title"),
                            TABLE_BODY_BOLD_FONT);
                    cell.setFont(TABLE_BODY_FONT);
                    cell.add(caseStudy.getTitle());
                    this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1);

                    // Outcome statement
                    cell = new Paragraph(
                            this.getText("summaries.project.reporting.outcome.casestudy.outcomestatement"),
                            TABLE_BODY_BOLD_FONT);
                    cell.setFont(TABLE_BODY_FONT);
                    cell.add(caseStudy.getOutcomeStatement());
                    this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1);

                    // Research outputs
                    cell = new Paragraph(
                            this.getText("summaries.project.reporting.outcome.casestudy.researchoutputs"),
                            TABLE_BODY_BOLD_FONT);
                    cell.setFont(TABLE_BODY_FONT);
                    cell.add(caseStudy.getResearchOutputs());
                    this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1);

                    // Research partners
                    cell = new Paragraph(
                            this.getText("summaries.project.reporting.outcome.casestudy.researchPartners"),
                            TABLE_BODY_BOLD_FONT);
                    cell.setFont(TABLE_BODY_FONT);
                    cell.add(caseStudy.getResearchPartners());
                    this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1);

                    // activities Contributed
                    cell = new Paragraph(
                            this.getText("summaries.project.reporting.outcome.casestudy.activitiesContributed"),
                            TABLE_BODY_BOLD_FONT);
                    cell.setFont(TABLE_BODY_FONT);
                    cell.add(caseStudy.getActivities());
                    this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1);

                    // Non Research Partners
                    cell = new Paragraph(
                            this.getText("summaries.project.reporting.outcome.casestudy.nonResearchPartners"),
                            TABLE_BODY_BOLD_FONT);
                    cell.setFont(TABLE_BODY_FONT);
                    cell.add(caseStudy.getNonResearchPartneres());
                    this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1);

                    // Output Users
                    cell = new Paragraph(
                            this.getText("summaries.project.reporting.outcome.casestudy.outputUsers"),
                            TABLE_BODY_BOLD_FONT);
                    cell.setFont(TABLE_BODY_FONT);
                    cell.add(caseStudy.getOutputUsers());
                    this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1);

                    // Output Used
                    cell = new Paragraph(
                            this.getText("summaries.project.reporting.outcome.casestudy.outputWasUsed"),
                            TABLE_BODY_BOLD_FONT);
                    cell.setFont(TABLE_BODY_FONT);
                    cell.add(caseStudy.getOutputUsed());
                    this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1);

                    // Evidence
                    cell = new Paragraph(
                            this.getText("summaries.project.reporting.outcome.casestudy.evidenceOutcome"),
                            TABLE_BODY_BOLD_FONT);
                    cell.setFont(TABLE_BODY_FONT);
                    cell.add(caseStudy.getEvidenceOutcome());
                    this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1);

                    // References
                    cell = new Paragraph(
                            this.getText("summaries.project.reporting.outcome.casestudy.references"),
                            TABLE_BODY_BOLD_FONT);
                    cell.setFont(TABLE_BODY_FONT);
                    cell.add(caseStudy.getReferencesCase());
                    this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1);

                    // Outcome indicators
                    cell = new Paragraph(
                            this.getText("summaries.project.reporting.outcome.casestudy.primaryOutcome",
                                    new String[] { String.valueOf(this.midOutcomeYear) }),
                            TABLE_BODY_BOLD_FONT);
                    cell.setFont(TABLE_BODY_FONT);
                    cell.add("\n");
                    for (IPIndicator ipIndicator : caseStudy.getCaseStudyIndicators()) {
                        if (ipIndicator.getOutcome() != null) {
                            cell.add(ipIndicator.getOutcome().getDescription());
                        }
                        cell.add(" " + ipIndicator.getDescription() + "\n");
                    }
                    this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1);

                    // Explain link
                    cell = new Paragraph(
                            this.getText("summaries.project.reporting.outcome.casestudy.explainLink"),
                            TABLE_BODY_BOLD_FONT);
                    cell.setFont(TABLE_BODY_FONT);
                    cell.add(caseStudy.getExplainIndicatorRelation());
                    this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1);

                    // year
                    cell = new Paragraph(this.getText("summaries.project.reporting.outcome.casestudy.year"),
                            TABLE_BODY_BOLD_FONT);
                    cell.setFont(TABLE_BODY_FONT);
                    cell.add(String.valueOf(caseStudy.getYear()));
                    this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1);

                    // upload
                    cell = new Paragraph(this.getText("summaries.project.reporting.outcome.casestudy.upload"),
                            TABLE_BODY_BOLD_FONT);
                    cell.setFont(TABLE_BODY_FONT);
                    if (caseStudy.getFile() == null || caseStudy.getFile().equals("")) {
                        cell.add(this.messageReturn(null));
                    } else {
                        anchor = new Anchor(caseStudy.getFile(), TABLE_BODY_FONT_LINK);
                        anchor.setReference(config.getDownloadURL() + "/projects/" + project.getId()
                                + "/caseStudy/" + caseStudy.getFile());
                        cell.add(anchor);
                    }
                    this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1);

                    document.add(table);
                    document.add(new Paragraph(Chunk.NEWLINE));
                }
            }
        }

    } catch (DocumentException e) {
        LOG.error("There was an error trying to add the project focuses to the project summary pdf", e);
    }

}

From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java

License:Open Source License

public void generatePDF() throws ApplicationException {
    logger.debug("FA1---inside generate pdf ");
    generateDisplayData(mbHeader, egBillRegister);
    try {//from  w  w  w. j  a v  a2s .  com
        // start header Part
        final PdfPTable contractorBillMainTable = new PdfPTable(11);
        contractorBillMainTable.setWidthPercentage(100);
        contractorBillMainTable
                .setWidths(new float[] { 1.5f, 1.5f, 1.5f, 1.5f, 1.5f, 1.5f, 1.5f, 1.5f, 1.5f, 1.5f, 1.5f });
        contractorBillMainTable.getDefaultCell().setPadding(4);
        contractorBillMainTable.getDefaultCell().setBorderWidth(1);
        createHeaderRow(contractorBillMainTable);
        createDetailsRows(contractorBillMainTable);
        document.add(contractorBillMainTable);
        document.add(spacer());

        // ---approval details for workflow
        final PdfPTable approvaldetailsTable = createApprovalDetailsTable(egBillRegister);

        if (approvaldetailsTable.getRows().size() != 1) {
            document.add(makePara("Approval Details"));
            document.add(spacer());
            document.add(approvaldetailsTable);
            document.add(spacer());
        }
        if (contractorBillMainTable.getRows().size() > 11)
            document.newPage();
        createFooter();
        // create certificate page
        document.newPage();
        createCertificate();
        document.close();
    } catch (final DocumentException e) {
        throw new ApplicationRuntimeException(CONTRACTOR_PDF_ERROR, e);
    }
}

From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java

License:Open Source License

private PdfPTable createApprovalDetailsTable(final ContractorBillRegister egBillRegister)
        throws DocumentException {
    try {/*from  ww  w. j  a va  2  s.  c  o m*/
        final PdfPTable approvaldetailsTable = new PdfPTable(5);
        approvaldetailsTable.setWidthPercentage(100);
        approvaldetailsTable.setWidths(new float[] { 2f, 1f, 1f, 1.5f, 2f });
        addRow(approvaldetailsTable, true, makePara("Approval Step"), centerPara("Name"),
                centerPara("Designation"), centerPara("Approved on"), centerPara("Remarks"));

        List<StateHistory<Position>> history = null;
        if (egBillRegister != null && egBillRegister.getCurrentState() != null
                && egBillRegister.getCurrentState().getHistory() != null)
            history = egBillRegister.getStateHistory();

        if (history != null) {
            Collections.reverse(history);
            for (final StateHistory ad : history)
                displayHistory(ad, approvaldetailsTable);
        }
        return approvaldetailsTable;
    } catch (final Exception e) {
        throw new ApplicationRuntimeException("Exception occured while getting approval details " + e);
    }
}

From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java

License:Open Source License

private PdfPTable createMultiYearTable(final AbstractEstimate estimate) throws DocumentException {
    final PdfPTable multiyearTable = new PdfPTable(3);
    multiyearTable.setWidthPercentage(100);
    multiyearTable.setWidths(new float[] { 1f, 2f, 2f });
    addRow(multiyearTable, true, makePara("Sl No"), centerPara("Year"), centerPara("Percentage"));
    int i = 0;/*from   w w w  .j av a 2  s. c  om*/
    for (final MultiYearEstimate year : estimate.getMultiYearEstimates())
        addRow(multiyearTable, true, makePara(++i),
                makePara(year.getFinancialYear().getFinYearRange(), Element.ALIGN_CENTER),
                rightPara(year.getPercentage()));
    return multiyearTable;
}

From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java

License:Open Source License

private PdfPTable createOverheadsTable(final AbstractEstimate estimate) throws DocumentException {
    final PdfPTable overheadsTable = new PdfPTable(3);
    overheadsTable.setWidthPercentage(100);
    overheadsTable.setWidths(new float[] { 1f, 4f, 2f });
    addRow(overheadsTable, true, makePara("Sl No"), centerPara("Description"), centerPara("Amount"));
    addRow(overheadsTable, true, makePara("1"), makePara("Work Value"),
            rightPara(toCurrency(estimate.getWorkValue())));
    int i = 1;/*from  www .  ja  v  a 2 s . c  o  m*/
    for (final OverheadValue oh : estimate.getOverheadValues())
        addRow(overheadsTable, true, makePara(++i), makePara(getOverheadDescription(oh)),
                rightPara(toCurrency(oh.getAmount())));
    addRow(overheadsTable, true, centerPara(""), makePara("TOTAL"),
            rightPara(toCurrency(estimate.getTotalAmount())));
    return overheadsTable;
}

From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java

License:Open Source License

private PdfPTable createDepositAppropriationTable(final AbstractEstimate estimate,
        final String appropriationNumber) throws DocumentException {
    int isReject = -1;
    depositWorksUsageService = abstractEstimateService.getDepositWorksUsageService();
    BigDecimal totalUtilizedAmt;//ww  w .  j a  v a  2s .c om
    BigDecimal amtAppropriatedsofar;
    BigDecimal totalDepositAmt;
    BigDecimal balOnHand;
    BigDecimal balanceAvailable;
    BigDecimal amtAppropriated;
    final Accountdetailtype accountdetailtype = worksService.getAccountdetailtypeByName("DEPOSITCODE");
    estimateAppropriationService = abstractEstimateService.getEstimateAppropriationService();
    abstractEstimateAppropriationList = estimateAppropriationService.findAllBy(
            "from AbstractEstimateAppropriation aea where aea.abstractEstimate.id=? and aea.depositWorksUsage.id is not null order by id, aea.depositWorksUsage.financialYearId asc",
            estimate.getId());
    final PdfPTable depositWorksAppropriationTable = new PdfPTable(2);
    depositWorksAppropriationTable.setWidthPercentage(100);
    depositWorksAppropriationTable.setWidths(new float[] { 2f, 8f });

    if (appropriationNumber != null && appropriationNumber.toUpperCase().contains("BC"))
        isReject = 1;

    if (appropriationNumber != null && estimate.getTotalAmount() != null && isReject == -1) {
        addRow(depositWorksAppropriationTable, true, centerPara("Deposit Code"),
                centerPara(estimate.getDepositCode().getCode()));
        addRow(depositWorksAppropriationTable, true, centerPara("Account Code"),
                centerPara(estimate.getFinancialDetails().get(0).getCoa().getGlcode() + "-"
                        + estimate.getFinancialDetails().get(0).getCoa().getName()));
        addRow(depositWorksAppropriationTable, true, makePara("Function Center"),
                centerPara(estimate.getFinancialDetails().get(0).getFunction().getName()));
        addRow(depositWorksAppropriationTable, true, makePara("Department"),
                centerPara(estimate.getUserDepartment().getName()));
        addRow(depositWorksAppropriationTable, true, makePara("Amount of the Estimate "),
                rightPara(toCurrency(estimate.getTotalAmount())));
        final PdfPTable appropriationDetailTable = new PdfPTable(6);
        addRow(appropriationDetailTable, true, makePara(7f, "Appropriation Number"),
                makePara(7f, "Total Deposit Amount"), makePara(7f, "Amount Appropriated so far"),
                makePara(7f, "Amount Appropriated"), makePara(7f, "Balance on Hand"),
                makePara(7f, "Balance After Appropriation"));
        for (final AbstractEstimateAppropriation abstractEstimateAppropriation : abstractEstimateAppropriationList)
            if (abstractEstimateAppropriation.getDepositWorksUsage().getConsumedAmount().doubleValue() != 0) {
                totalDepositAmt = depositWorksUsageService.getTotalDepositWorksAmount(
                        estimate.getDepositCode().getFund(),
                        abstractEstimateAppropriation.getAbstractEstimate().getFinancialDetails().get(0)
                                .getCoa(),
                        accountdetailtype, estimate.getDepositCode().getId(),
                        abstractEstimateAppropriation.getDepositWorksUsage().getAppropriationDate());
                totalUtilizedAmt = depositWorksUsageService.getTotalUtilizedAmountForDepositWorks(
                        abstractEstimateAppropriation.getAbstractEstimate().getFinancialDetails().get(0),
                        abstractEstimateAppropriation.getDepositWorksUsage().getCreatedDate());
                if (totalUtilizedAmt == null)
                    totalUtilizedAmt = BigDecimal.ZERO;
                amtAppropriatedsofar = totalUtilizedAmt
                        .subtract(abstractEstimateAppropriation.getDepositWorksUsage().getConsumedAmount());
                balOnHand = totalDepositAmt.subtract(amtAppropriatedsofar);
                amtAppropriated = abstractEstimateAppropriation.getDepositWorksUsage().getConsumedAmount();
                balanceAvailable = BigDecimal
                        .valueOf(totalDepositAmt.doubleValue() - totalUtilizedAmt.doubleValue());
                addRow(appropriationDetailTable, true,
                        makePara(7f,
                                abstractEstimateAppropriation.getDepositWorksUsage().getAppropriationNumber()),
                        rightPara(7f, toCurrency(totalDepositAmt.doubleValue())),
                        rightPara(7f, toCurrency(amtAppropriatedsofar.doubleValue())),
                        rightPara(7f, toCurrency(amtAppropriated.doubleValue())),
                        rightPara(7f, toCurrency(balOnHand.doubleValue())),
                        rightPara(7f, toCurrency(balanceAvailable.doubleValue())));
            }

        final PdfPCell appDetailpdfCell = new PdfPCell(appropriationDetailTable);
        appDetailpdfCell.setBorderWidth(0);

        final PdfPCell appDetailRightHeader = new PdfPCell(
                makePara("Financail Year Wise Appropriation Details"));
        appDetailRightHeader.setVerticalAlignment(Element.ALIGN_MIDDLE);

        depositWorksAppropriationTable.addCell(appDetailRightHeader);
        appropriationDetailTable.setWidthPercentage(100);
        depositWorksAppropriationTable.addCell(appDetailpdfCell);
    }
    return depositWorksAppropriationTable;
}

From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java

License:Open Source License

private PdfPTable createBudgetaryAppropriationTable(final AbstractEstimate estimate,
        final String appropriationNumber) throws DocumentException {
    int isReject = -1;
    final List<FinancialDetail> financialdetails = estimate.getFinancialDetails();
    BigDecimal totalGrant;/*from   w  ww .  j  a  va2  s . c  om*/
    BigDecimal budgetAvailable;
    BigDecimal balOnHand;
    BigDecimal amtAppropriated;
    BigDecimal totGrantafterMultiFactor = BigDecimal.ZERO;

    estimateAppropriationService = abstractEstimateService.getEstimateAppropriationService();
    abstractEstimateAppropriationList = estimateAppropriationService.findAllBy(
            "from AbstractEstimateAppropriation aea where aea.abstractEstimate.id=? and aea.budgetUsage.id is not null order by aea.budgetUsage.id,aea.budgetUsage.financialYearId asc",
            estimate.getId());

    final PdfPTable budgetaryAppropriationTable = new PdfPTable(1);
    budgetaryAppropriationTable.setWidthPercentage(100);
    budgetaryAppropriationTable.setWidths(new float[] { 8f });
    if (appropriationNumber != null && appropriationNumber.toUpperCase().contains("BC"))
        isReject = 1;

    if (appropriationNumber != null && estimate.getTotalAmount() != null && isReject == -1)
        for (final FinancialDetail financialDetail : financialdetails)
            if (financialDetail.getBudgetGroup() != null) {
                addRow(budgetaryAppropriationTable, true, centerPara("Budget Head"),
                        centerPara(financialDetail.getBudgetGroup().getName()));
                addRow(budgetaryAppropriationTable, true, makePara("Function Center"),
                        centerPara(financialDetail.getFunction().getName()));
                addRow(budgetaryAppropriationTable, true, makePara("Amount of the Estimate "),
                        rightPara(toCurrency(estimate.getTotalAmount())));
            }
    final PdfPTable appropriationDetailTable = new PdfPTable(8);
    int count = 0;
    for (final AbstractEstimateAppropriation abstractEstimateAppropriation : abstractEstimateAppropriationList)
        if (abstractEstimateAppropriation.getBudgetUsage().getConsumedAmount() != 0) {
            final Department dept = getDeptFromBudgtAppropriationNo(
                    abstractEstimateAppropriation.getBudgetUsage().getAppropriationnumber());
            totalGrant = abstractEstimateService.getTotalGrantForYearAsOnDate(financialdetails.get(0),
                    abstractEstimateAppropriation.getBudgetUsage().getFinancialYearId().longValue(),
                    Integer.parseInt(dept.getId().toString()),
                    abstractEstimateAppropriation.getBudgetUsage().getUpdatedTime());
            final BigDecimal planningBudgetPerc = abstractEstimateService.getPlanningBudgetPercentage(
                    financialdetails.get(0),
                    abstractEstimateAppropriation.getBudgetUsage().getFinancialYearId().longValue(),
                    Integer.parseInt(dept.getId().toString()));
            if (planningBudgetPerc != null && planningBudgetPerc.compareTo(BigDecimal.ZERO) != 0) {
                totGrantafterMultiFactor = totalGrant.multiply(planningBudgetPerc.divide(new BigDecimal(100)));
                appValue = planningBudgetPerc.divide(new BigDecimal(100)).toString();
            }
            budgetAvailable = abstractEstimateAppropriation.getBalanceAvailable();
            balOnHand = budgetAvailable
                    .add(new BigDecimal(abstractEstimateAppropriation.getBudgetUsage().getConsumedAmount()));
            amtAppropriated = totGrantafterMultiFactor.subtract(balOnHand);
            // Print only for the first time
            if (count == 0) {
                addRow(budgetaryAppropriationTable, false, makePara(""),
                        centerPara("Financial Year Wise Appropriation Details "));
                addRow(appropriationDetailTable, true, makePara(8f, "Department"),
                        makePara(8f, "Appropriation Number"), makePara(8f, "Total Grant"),
                        makePara(8f, appValue + " Times Total Grant"),
                        makePara(8f, "Amount Appropriated so far"), makePara(8f, "Amount Appropriated"),
                        makePara(8f, "Balance on Hand"), makePara(8f, "Balance After Appropriation"));
            }
            addRow(appropriationDetailTable, true, rightPara(8f, dept.getName()),
                    makePara(8f, abstractEstimateAppropriation.getBudgetUsage().getAppropriationnumber()),
                    rightPara(8f, toCurrency(totalGrant.doubleValue())),
                    rightPara(8f, toCurrency(totGrantafterMultiFactor.doubleValue())),
                    rightPara(8f, toCurrency(amtAppropriated.doubleValue())),
                    rightPara(8f,
                            toCurrency(abstractEstimateAppropriation.getBudgetUsage().getConsumedAmount())),
                    rightPara(8f, toCurrency(balOnHand.doubleValue())),
                    rightPara(8f, toCurrency(budgetAvailable.doubleValue())));
            count++;
        }

    final PdfPCell appDetailpdfCell = new PdfPCell(appropriationDetailTable);
    appropriationDetailTable.setWidthPercentage(100);
    budgetaryAppropriationTable.addCell(appDetailpdfCell);
    return budgetaryAppropriationTable;
}

From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java

License:Open Source License

private PdfPTable createApprovalDetailsTable(final AbstractEstimate estimate) throws DocumentException {
    try {/*from   w w  w .j  a  va 2  s .c om*/
        PdfPTable approvaldetailsTable = null;
        if (shouldShowApprovalNumber) {
            approvaldetailsTable = new PdfPTable(6);
            approvaldetailsTable.setWidths(new float[] { 2f, 1f, 1f, 1f, 1.5f, 2f });
        } else {
            approvaldetailsTable = new PdfPTable(5);
            approvaldetailsTable.setWidths(new float[] { 2f, 1.5f, 1.5f, 1.5f, 2f });
        }
        approvaldetailsTable.setWidthPercentage(100);
        addRow(approvaldetailsTable, true, makePara("Approval Step"), centerPara("Name"),
                centerPara("Designation"), centerPara("Approved on"), centerPara("Remarks"));

        if (estimate != null && estimate.getCurrentState() != null) {
            history = new LinkedList<>();
            if (estimate.getCurrentState().getHistory() != null)
                history.addAll(estimate.getCurrentState().getHistory());
            history.add(new StateHistory(estimate.getCurrentState()));
        }

        if (history != null)
            for (final StateHistory stateHistory : history)
                displayHistory(stateHistory, approvaldetailsTable);
        return approvaldetailsTable;
    } catch (final Exception e) {
        throw new ApplicationRuntimeException("Exception occured while getting approval details " + e);
    }
}

From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java

License:Open Source License

private PdfPTable createEstimateDetailsTable1(final AbstractEstimate estimate) throws DocumentException {
    try {//from  ww  w  .j  a  v  a 2 s.  c  om
        final PdfPTable estimateDetailsTable1 = new PdfPTable(2);
        estimateDetailsTable1.setWidthPercentage(75);
        estimateDetailsTable1.setWidths(new float[] { 0.6f, 1f });

        addRow(estimateDetailsTable1, true, centerPara("Department"),
                centerPara(estimate.getExecutingDepartment().getName()));
        addRow(estimateDetailsTable1, true, centerPara("Name of the Work"), centerPara(estimate.getName()));
        addRow(estimateDetailsTable1, true, centerPara("Estimate Number"),
                centerPara(estimate.getEstimateNumber()));

        return estimateDetailsTable1;
    } catch (final Exception e) {
        throw new ApplicationRuntimeException("Exception occured while estimate details method1 " + e);
    }
}

From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java

License:Open Source License

private PdfPTable createBudgetDetailsForEstimateTable(final AbstractEstimate estimate)
        throws DocumentException {
    try {/* ww  w.j a v  a2s  .co  m*/

        final PdfPTable estBudgetDetailsTable = new PdfPTable(4);
        estBudgetDetailsTable.setWidthPercentage(75);
        estBudgetDetailsTable.setWidths(new float[] { 0.6f, 1f, 0.5f, 1f });

        BigDecimal totalGrant;
        BigDecimal budgetAvailable;
        BigDecimal balOnHand;
        BigDecimal amtAppropriated = BigDecimal.ZERO;
        BigDecimal totGrantafterMultiFactor = BigDecimal.ZERO;

        BigDecimal totalUtilizedAmt;
        BigDecimal amtAppropriatedsofar = BigDecimal.ZERO;
        worksService.getAccountdetailtypeByName("DEPOSITCODE");
        AbstractEstimateAppropriation latestAbstractEstimateAppropriation;

        if (abstractEstimateAppropriationList != null && !abstractEstimateAppropriationList.isEmpty()) {
            latestAbstractEstimateAppropriation = abstractEstimateAppropriationList
                    .get(abstractEstimateAppropriationList.size() - 1);

            if (latestAbstractEstimateAppropriation != null)
                if (estimate.getDepositCode() == null) {
                    if (latestAbstractEstimateAppropriation.getBudgetUsage().getConsumedAmount() != 0) {
                        final Department dept = getDeptFromBudgtAppropriationNo(
                                latestAbstractEstimateAppropriation.getBudgetUsage().getAppropriationnumber());
                        totalGrant = abstractEstimateService.getTotalGrantForYearAsOnDate(
                                estimate.getFinancialDetails().get(0),
                                latestAbstractEstimateAppropriation.getBudgetUsage().getFinancialYearId()
                                        .longValue(),
                                Integer.parseInt(dept.getId().toString()),
                                latestAbstractEstimateAppropriation.getBudgetUsage().getUpdatedTime());
                        final BigDecimal planningBudgetPerc = abstractEstimateService
                                .getPlanningBudgetPercentage(estimate.getFinancialDetails().get(0),
                                        latestAbstractEstimateAppropriation.getBudgetUsage()
                                                .getFinancialYearId().longValue(),
                                        Integer.parseInt(dept.getId().toString()));
                        if (planningBudgetPerc != null && planningBudgetPerc.compareTo(BigDecimal.ZERO) != 0) {
                            totGrantafterMultiFactor = totalGrant
                                    .multiply(planningBudgetPerc.divide(new BigDecimal(100)));
                            appValue = planningBudgetPerc.divide(new BigDecimal(100)).toString();
                        }

                        budgetAvailable = latestAbstractEstimateAppropriation.getBalanceAvailable();
                        balOnHand = budgetAvailable.add(new BigDecimal(
                                latestAbstractEstimateAppropriation.getBudgetUsage().getConsumedAmount()));
                        amtAppropriated = totGrantafterMultiFactor.subtract(balOnHand);
                    }
                } else if (latestAbstractEstimateAppropriation.getDepositWorksUsage().getConsumedAmount()
                        .doubleValue() != 0) {
                    totalUtilizedAmt = depositWorksUsageService.getTotalUtilizedAmountForDepositWorks(
                            latestAbstractEstimateAppropriation.getAbstractEstimate().getFinancialDetails()
                                    .get(0),
                            latestAbstractEstimateAppropriation.getDepositWorksUsage().getCreatedDate());
                    if (totalUtilizedAmt == null)
                        totalUtilizedAmt = BigDecimal.ZERO;
                    amtAppropriatedsofar = totalUtilizedAmt.subtract(
                            latestAbstractEstimateAppropriation.getDepositWorksUsage().getConsumedAmount());
                }
        }
        addRow(estBudgetDetailsTable, true, centerPara("Estimate Date"),
                centerPara(DateUtils.getFormattedDate(estimate.getEstimateDate(), "dd/MM/yyyy")),
                centerPara("Fund"), centerPara(estimate.getFinancialDetails().isEmpty() ? ""
                        : estimate.getFinancialDetails().get(0).getFund().getName()));
        if (estimate.getDepositCode() == null) {
            addRow(estBudgetDetailsTable, true, centerPara("Function "),
                    centerPara(estimate.getFinancialDetails().isEmpty() ? ""
                            : estimate.getFinancialDetails().get(0).getFunction().getName()),
                    centerPara("Budget Head"), centerPara(estimate.getFinancialDetails().isEmpty() ? ""
                            : estimate.getFinancialDetails().get(0).getBudgetGroup().getName()));
            addRow(estBudgetDetailsTable, true, centerPara("Amount Appropriated so far"),
                    centerPara(amtAppropriated == null ? "" : toCurrency(amtAppropriated.doubleValue())),
                    centerPara("Estimate Amount"),
                    centerPara(toCurrency(estimate.getTotalAmount().getValue())));
        } else {
            addRow(estBudgetDetailsTable, true, centerPara("Function "),
                    centerPara(estimate.getFinancialDetails().isEmpty() ? ""
                            : estimate.getFinancialDetails().get(0).getFunction().getName()),
                    centerPara("Deposit COA/Deposit Code"),
                    centerPara(estimate.getFinancialDetails().isEmpty() ? ""
                            : estimate.getFinancialDetails().get(0).getCoa().getGlcode().concat("-")
                                    .concat(estimate.getFinancialDetails().get(0).getCoa().getName())
                                    .concat(" / ").concat(estimate.getDepositCode().getCode())));
            addRow(estBudgetDetailsTable, true, centerPara("Amount Appropriated so far"),
                    centerPara(
                            amtAppropriatedsofar == null ? "" : toCurrency(amtAppropriatedsofar.doubleValue())),
                    centerPara("Estimate Amount"),
                    makePara(toCurrency(estimate.getTotalAmount().getValue()), Element.ALIGN_RIGHT));
        }

        return estBudgetDetailsTable;
    } catch (final Exception e) {
        throw new ApplicationRuntimeException("Exception occured while estimate details method 2 " + e);
    }
}