Example usage for com.lowagie.text.pdf PdfPCell PdfPCell

List of usage examples for com.lowagie.text.pdf PdfPCell PdfPCell

Introduction

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

Prototype

public PdfPCell(PdfPCell cell) 

Source Link

Document

Constructs a deep copy of a PdfPCell.

Usage

From source file:org.kuali.kfs.module.endow.report.util.AssetStatementReportPrint.java

License:Educational Community License

/**
 * Generates the Asset Statement report for Non-Endowed    
 * /*from   w  ww. j  a v  a2s.  com*/
 * @param transactionStatementReports
 * @param document
 * @return
 */
public boolean printAssetStatementReportBodyForNonEndowedDetail(
        List<AssetStatementReportDataHolder> nonEndowedAssetStatementReportDataHolders, Document document) {

    // for each kemid
    try {
        Font cellFont = regularFont;
        for (AssetStatementReportDataHolder reportData : nonEndowedAssetStatementReportDataHolders) {

            document.newPage();

            // header
            StringBuffer title = new StringBuffer();
            title.append(reportData.getInstitution()).append("\n");
            title.append("STATEMENT OF ASSETS FOR PERIOD ENDING").append("\n");
            title.append(reportData.getMonthEndDate()).append("\n");
            title.append(reportData.getKemid()).append("     ").append(reportData.getKemidLongTitle())
                    .append("\n\n");
            Paragraph header = new Paragraph(title.toString());
            header.setAlignment(Element.ALIGN_CENTER);
            document.add(header);

            // report table
            float[] colsWidth = { 15f, 17f, 17f, 17f, 17f, 17f };
            PdfPTable table = new PdfPTable(colsWidth);
            table.setWidthPercentage(FULL_TABLE_WIDTH);
            table.getDefaultCell().setPadding(5);

            // column titles
            table.addCell("");
            table.addCell(createCell("UNITS HELD", titleFont, Element.ALIGN_RIGHT, true));
            table.addCell(createCell("MARKET VALUE", titleFont, Element.ALIGN_RIGHT, true));
            table.addCell(createCell("ESTIMATED\nANNUAL INCOME", titleFont, Element.ALIGN_RIGHT, true));
            table.addCell(
                    createCell("FY REMAINDER ESTIMATED\nANNUAL INCOME", titleFont, Element.ALIGN_RIGHT, true));
            table.addCell(createCell("NEXT FY ESTIMATED\nANNUAL INCOME", titleFont, Element.ALIGN_RIGHT, true));

            PdfPCell cellCashEquivalnets = new PdfPCell(new Paragraph("CASH AND EQUIVALENTS", cellFont));
            cellCashEquivalnets.setColspan(6);
            table.addCell(cellCashEquivalnets);

            // report groups 
            printReportGroupForNonEndowedDetail(reportData, document, table, cellFont);

            // total
            PdfPCell blank = new PdfPCell(new Paragraph("", cellFont));
            blank.setColspan(6);
            blank.setBackgroundColor(Color.LIGHT_GRAY);
            table.addCell(blank);

            BigDecimal totalKemidMarketValue = reportData
                    .getTotalSumOfMarketValue(IncomePrincipalIndicator.INCOME)
                    .add(reportData.getHistoryIncomeCash()).add(reportData.getHistoryPrincipalCash());
            BigDecimal totalKemidEstimatedAnnualIncome = reportData
                    .getTotalSumOfEstimatedIncome(IncomePrincipalIndicator.INCOME)
                    .add(reportData.getTotalSumOfEstimatedIncome(IncomePrincipalIndicator.PRINCIPAL));
            BigDecimal totalKemidFYRemainderEstimatedAnnualIncome = reportData
                    .getTotalSumOfRemainderOfFYEstimated(IncomePrincipalIndicator.INCOME)
                    .add(reportData.getTotalSumOfRemainderOfFYEstimated(IncomePrincipalIndicator.PRINCIPAL));
            BigDecimal totalKemidNextFYEstimayedAnnualIncome = reportData
                    .getTotalSumOfNextFYEstimatedIncome(IncomePrincipalIndicator.INCOME)
                    .add(reportData.getTotalSumOfNextFYEstimatedIncome(IncomePrincipalIndicator.PRINCIPAL));

            table.addCell(new Paragraph("TOTAL KEMID VALUE", titleFont));
            table.addCell("");
            table.addCell(getAmountCell(totalKemidMarketValue, titleFont));
            table.addCell(getAmountCell(totalKemidEstimatedAnnualIncome, titleFont));
            table.addCell(getAmountCell(totalKemidFYRemainderEstimatedAnnualIncome, titleFont));
            table.addCell(getAmountCell(totalKemidNextFYEstimayedAnnualIncome, titleFont));

            document.add(table);

            // footer
            printFooter(reportData.getFooter(), document);
        }
    } catch (Exception e) {
        LOG.error(e.getMessage());
        return false;
    }

    return true;
}

From source file:org.kuali.kfs.module.endow.report.util.AssetStatementReportPrint.java

License:Educational Community License

/**
 * Generates report group for income endowment detail
 * //from   w w w .  jav  a2  s .  c o m
 * @param reportData
 * @param docuement
 * @param table
 * @param cellFont
 * @throws Exception
 */
protected void printReportGroupForIncomeEndowmentDetail(AssetStatementReportDataHolder reportData,
        Document docuement, PdfPTable table, Font cellFont) throws Exception {

    table.addCell(new Paragraph("Income Cash", cellFont));
    table.addCell("");
    table.addCell(getAmountCell(reportData.getHistoryIncomeCash(), cellFont));
    table.addCell("");
    table.addCell("");
    table.addCell("");

    TreeMap<Integer, TreeMap<String, ReportGroupData>> reportGroups = reportData.getReportGroupsForIncome();

    if (reportGroups == null || reportGroups.isEmpty()) {
        table.addCell(new Paragraph("TOTAL CASH AND\nEQUIVALENTS", cellFont));
        table.addCell("");
        table.addCell(getAmountCell(reportData.getHistoryIncomeCash(), cellFont));
        table.addCell("");
        table.addCell("");
        table.addCell("");
        return;
    }

    // Cash and equivalents first
    TreeMap<String, ReportGroupData> cashEquivalentsData = reportData.getReportGroupsForIncome().get(1);
    if (cashEquivalentsData != null && !cashEquivalentsData.isEmpty()) {
        Iterator<String> secirutyIdSet = cashEquivalentsData.keySet().iterator();
        while (secirutyIdSet.hasNext()) {
            // get securityId
            String securityId = secirutyIdSet.next();
            ReportGroupData data = cashEquivalentsData.get(securityId);
            table.addCell(new Paragraph(data.getSecurityDesc(), cellFont));
            table.addCell(getAmountCell(data.getSumOfUnits(), cellFont, FORMAT164));
            table.addCell(getAmountCell(data.getSumOfMarketValue(), cellFont));
            table.addCell(getAmountCell(data.getSumOfEstimatedIncome(), cellFont));
            table.addCell(getAmountCell(data.getSumOfRemainderOfFYEstimated(), cellFont));
            table.addCell(getAmountCell(data.getSumOfNextFYEstimatedIncome(), cellFont));
        }
    }
    table.addCell(new Paragraph("TOTAL CASH AND\nEQUIVALENTS", cellFont));
    table.addCell("");
    table.addCell(
            getAmountCell(reportData.getTotalMarketValueForCashEquivalents(IncomePrincipalIndicator.INCOME)
                    .add(reportData.getHistoryIncomeCash()), cellFont));
    table.addCell("");
    table.addCell("");
    table.addCell("");

    // Other report group
    Iterator<Integer> reportGroupOrderSet = reportGroups.keySet().iterator();
    while (reportGroupOrderSet.hasNext()) {

        Integer reportGroupOrder = reportGroupOrderSet.next();
        if (reportGroupOrder.intValue() > 1) {
            TreeMap<String, ReportGroupData> reportGroupData = reportData.getReportGroupsForIncome()
                    .get(reportGroupOrder);
            if (reportGroupData == null || reportGroupData.isEmpty()) {
                continue;
            }
            // print report group description
            String reportGroupDesc = reportGroupData.firstEntry().getValue().getReportGroupDesc();
            PdfPCell groupDescCell = new PdfPCell(new Paragraph(reportGroupDesc, cellFont));
            groupDescCell.setColspan(6);
            table.addCell(groupDescCell);

            // print info per security  
            Iterator<String> secirutyIdSet = reportGroupData.keySet().iterator();
            while (secirutyIdSet.hasNext()) {
                String securityId = secirutyIdSet.next();
                ReportGroupData data = reportGroupData.get(securityId);
                table.addCell(new Paragraph(data.getSecurityDesc(), cellFont));
                table.addCell(getAmountCell(data.getSumOfUnits(), cellFont, FORMAT164));
                table.addCell(getAmountCell(data.getSumOfMarketValue(), cellFont));
                table.addCell(getAmountCell(data.getSumOfEstimatedIncome(), cellFont));
                table.addCell(getAmountCell(data.getSumOfRemainderOfFYEstimated(), cellFont));
                table.addCell(getAmountCell(data.getSumOfNextFYEstimatedIncome(), cellFont));
            }

            // report group totals
            table.addCell(new Paragraph("TOTAL " + convertToUpperCase(reportGroupDesc), cellFont));
            table.addCell("");
            table.addCell(getAmountCell(
                    reportData.getTotalSumOfMarketValue(IncomePrincipalIndicator.INCOME, reportGroupOrder),
                    cellFont));
            table.addCell("");
            table.addCell("");
            table.addCell("");
        }
    }

    // total expendable funds
    table.addCell(new Paragraph("TOTAL EXPENDABLE FUNDS", titleFont));
    table.addCell("");
    table.addCell(getAmountCell(reportData.getTotalSumOfMarketValue(IncomePrincipalIndicator.INCOME)
            .add(reportData.getHistoryIncomeCash()), cellFont));
    table.addCell(
            getAmountCell(reportData.getTotalSumOfEstimatedIncome(IncomePrincipalIndicator.INCOME), cellFont));
    table.addCell(getAmountCell(reportData.getTotalSumOfRemainderOfFYEstimated(IncomePrincipalIndicator.INCOME),
            cellFont));
    table.addCell(getAmountCell(reportData.getTotalSumOfNextFYEstimatedIncome(IncomePrincipalIndicator.INCOME),
            cellFont));
}

From source file:org.kuali.kfs.module.endow.report.util.AssetStatementReportPrint.java

License:Educational Community License

/**
 * Generates report group for principal endowment detail
 * /*  w  w  w.  ja v  a 2 s.  c  o  m*/
 * @param reportData
 * @param docuement
 * @param table
 * @param cellFont
 */
protected void printReportGroupForPrincipalEndowmentDetail(AssetStatementReportDataHolder reportData,
        Document docuement, PdfPTable table, Font cellFont) {

    table.addCell(new Paragraph("Principal Cash", cellFont));
    table.addCell("");
    table.addCell(getAmountCell(reportData.getHistoryPrincipalCash(), cellFont));
    table.addCell("");
    table.addCell("");
    table.addCell("");

    TreeMap<Integer, TreeMap<String, ReportGroupData>> reportGroups = reportData.getReportGroupsForPrincipal();
    if (reportGroups == null || reportGroups.isEmpty()) {
        table.addCell(new Paragraph("TOTAL CASH AND\nEQUIVALENTS", cellFont));
        table.addCell("");
        table.addCell(getAmountCell(reportData.getHistoryPrincipalCash(), cellFont));
        table.addCell("");
        table.addCell("");
        table.addCell("");
        return;
    }

    // Cash and equivalents first
    TreeMap<String, ReportGroupData> cashEquivalentsData = reportData.getReportGroupsForPrincipal().get(1);
    if (cashEquivalentsData != null && !cashEquivalentsData.isEmpty()) {
        Iterator<String> secirutyIdSet = cashEquivalentsData.keySet().iterator();
        while (secirutyIdSet.hasNext()) {
            // get securityId
            String securityId = secirutyIdSet.next();
            ReportGroupData data = cashEquivalentsData.get(securityId);
            table.addCell(new Paragraph(data.getSecurityDesc(), cellFont));
            table.addCell(getAmountCell(data.getSumOfUnits(), cellFont, FORMAT164));
            table.addCell(getAmountCell(data.getSumOfMarketValue(), cellFont));
            table.addCell(getAmountCell(data.getSumOfEstimatedIncome(), cellFont));
            table.addCell(getAmountCell(data.getSumOfRemainderOfFYEstimated(), cellFont));
            table.addCell(getAmountCell(data.getSumOfNextFYEstimatedIncome(), cellFont));
        }
    }
    table.addCell(new Paragraph("TOTAL CASH AND\nEQUIVALENTS", cellFont));
    table.addCell("");
    table.addCell(
            getAmountCell(reportData.getTotalMarketValueForCashEquivalents(IncomePrincipalIndicator.PRINCIPAL)
                    .add(reportData.getHistoryPrincipalCash()), cellFont));
    table.addCell("");
    table.addCell("");
    table.addCell("");

    // other report groups
    Iterator<Integer> reportGroupOrderSet = reportGroups.keySet().iterator();
    while (reportGroupOrderSet.hasNext()) {

        Integer reportGroupOrder = reportGroupOrderSet.next();
        if (reportGroupOrder.intValue() > 1) {
            TreeMap<String, ReportGroupData> reportGroupData = reportData.getReportGroupsForPrincipal()
                    .get(reportGroupOrder);
            if (reportGroupData == null || reportGroupData.isEmpty()) {
                continue;
            }
            // print report group description
            String reportGroupDesc = reportGroupData.firstEntry().getValue().getReportGroupDesc();
            PdfPCell groupDescCell = new PdfPCell(new Paragraph(reportGroupDesc, cellFont));
            groupDescCell.setColspan(6);
            table.addCell(groupDescCell);

            // print info per security
            Iterator<String> secirutyIdSet = reportGroupData.keySet().iterator();
            while (secirutyIdSet.hasNext()) {
                String securityId = secirutyIdSet.next();
                ReportGroupData data = reportGroupData.get(securityId);
                table.addCell(new Paragraph(data.getSecurityDesc(), cellFont));
                table.addCell(getAmountCell(data.getSumOfUnits(), cellFont, FORMAT164));
                table.addCell(getAmountCell(data.getSumOfMarketValue(), cellFont));
                table.addCell(getAmountCell(data.getSumOfEstimatedIncome(), cellFont));
                table.addCell(getAmountCell(data.getSumOfRemainderOfFYEstimated(), cellFont));
                table.addCell(getAmountCell(data.getSumOfNextFYEstimatedIncome(), cellFont));
            }

            // report group totals
            table.addCell(new Paragraph("TOTAL " + convertToUpperCase(reportGroupDesc), cellFont));
            table.addCell("");
            table.addCell(getAmountCell(
                    reportData.getTotalSumOfMarketValue(IncomePrincipalIndicator.PRINCIPAL, reportGroupOrder),
                    cellFont));
            table.addCell("");
            table.addCell("");
            table.addCell("");
        }
    }

    // total expendable funds
    table.addCell(new Paragraph("TOTAL ENDOWED FUNDS", titleFont));
    table.addCell("");
    table.addCell(getAmountCell(reportData.getTotalSumOfMarketValue(IncomePrincipalIndicator.PRINCIPAL)
            .add(reportData.getHistoryPrincipalCash()), cellFont));
    table.addCell(getAmountCell(reportData.getTotalSumOfEstimatedIncome(IncomePrincipalIndicator.PRINCIPAL),
            cellFont));
    table.addCell(getAmountCell(
            reportData.getTotalSumOfRemainderOfFYEstimated(IncomePrincipalIndicator.PRINCIPAL), cellFont));
    table.addCell(getAmountCell(
            reportData.getTotalSumOfNextFYEstimatedIncome(IncomePrincipalIndicator.PRINCIPAL), cellFont));
}

From source file:org.kuali.kfs.module.endow.report.util.AssetStatementReportPrint.java

License:Educational Community License

/**
 * Generates report group non-endowed detail
 * //  www . ja v  a 2  s.  c o m
 * @param reportData
 * @param docuement
 * @param table
 * @param cellFont
 * @throws Exception
 */
protected void printReportGroupForNonEndowedDetail(AssetStatementReportDataHolder reportData,
        Document docuement, PdfPTable table, Font cellFont) throws Exception {

    table.addCell(new Paragraph("Income Cash", cellFont));
    table.addCell("");
    table.addCell(getAmountCell(reportData.getHistoryIncomeCash(), cellFont));
    table.addCell("");
    table.addCell("");
    table.addCell("");

    table.addCell(new Paragraph("Principal Cash", cellFont));
    table.addCell("");
    table.addCell(getAmountCell(reportData.getHistoryPrincipalCash(), cellFont));
    table.addCell("");
    table.addCell("");
    table.addCell("");

    TreeMap<Integer, TreeMap<String, ReportGroupData>> reportGroups = reportData.getReportGroupsForIncome();
    if (reportGroups == null || reportGroups.isEmpty()) {
        table.addCell(new Paragraph("TOTAL CASH AND\nEQUIVALENTS", cellFont));
        table.addCell("");
        table.addCell(getAmountCell(reportData.getHistoryIncomeCash().add(reportData.getHistoryPrincipalCash()),
                cellFont));
        table.addCell("");
        table.addCell("");
        table.addCell("");
        return;
    }

    // print cash equivalents 
    TreeMap<String, ReportGroupData> cashEquivalentsData = reportData.getReportGroupsForIncome().get(1);
    if (cashEquivalentsData != null && !cashEquivalentsData.isEmpty()) {
        Iterator<String> secirutyIdSet = cashEquivalentsData.keySet().iterator();
        while (secirutyIdSet.hasNext()) {
            // get securityId
            String securityId = secirutyIdSet.next();
            ReportGroupData data = cashEquivalentsData.get(securityId);
            table.addCell(new Paragraph(data.getSecurityDesc(), cellFont));
            table.addCell(getAmountCell(data.getSumOfUnits(), cellFont, FORMAT164));
            table.addCell(getAmountCell(data.getSumOfMarketValue(), cellFont));
            table.addCell(getAmountCell(data.getSumOfEstimatedIncome(), cellFont));
            table.addCell(getAmountCell(data.getSumOfRemainderOfFYEstimated(), cellFont));
            table.addCell(getAmountCell(data.getSumOfNextFYEstimatedIncome(), cellFont));
        }
    }
    BigDecimal totalCashEquivalents = reportData
            .getTotalMarketValueForCashEquivalents(IncomePrincipalIndicator.INCOME)
            .add(reportData.getTotalMarketValueForCashEquivalents(IncomePrincipalIndicator.PRINCIPAL))
            .add(reportData.getHistoryIncomeCash()).add(reportData.getHistoryPrincipalCash());
    table.addCell(new Paragraph("TOTAL CASH AND\nEQUIVALENTS", cellFont));
    table.addCell("");
    table.addCell(getAmountCell(totalCashEquivalents, cellFont));
    table.addCell("");
    table.addCell("");
    table.addCell("");

    // print other report groups
    Iterator<Integer> reportGroupOrderSet = reportGroups.keySet().iterator();
    while (reportGroupOrderSet.hasNext()) {

        Integer reportGroupOrder = reportGroupOrderSet.next();
        if (reportGroupOrder.intValue() > 1) {
            TreeMap<String, ReportGroupData> reportGroupData = reportData.getReportGroupsForIncome()
                    .get(reportGroupOrder);
            if (reportGroupData == null || reportGroupData.isEmpty()) {
                continue;
            }
            // print report group description
            String reportGroupDesc = reportGroupData.firstEntry().getValue().getReportGroupDesc();
            PdfPCell groupDescCell = new PdfPCell(new Paragraph(reportGroupDesc, cellFont));
            groupDescCell.setColspan(6);
            table.addCell(groupDescCell);

            // print info per security
            Iterator<String> secirutyIdSet = reportGroupData.keySet().iterator();
            while (secirutyIdSet.hasNext()) {
                String securityId = secirutyIdSet.next();
                if (reportGroupOrder.intValue() > 1) {
                    ReportGroupData data = reportGroupData.get(securityId);

                    table.addCell(new Paragraph(data.getSecurityDesc(), cellFont));
                    table.addCell(getAmountCell(data.getSumOfUnits(), cellFont, FORMAT164));
                    table.addCell(getAmountCell(data.getSumOfMarketValue(), cellFont));
                    table.addCell(getAmountCell(data.getSumOfEstimatedIncome(), cellFont));
                    table.addCell(getAmountCell(data.getSumOfRemainderOfFYEstimated(), cellFont));
                    table.addCell(getAmountCell(data.getSumOfNextFYEstimatedIncome(), cellFont));
                }
            }

            // report group total
            table.addCell(new Paragraph("TOTAL " + convertToUpperCase(reportGroupDesc), cellFont));
            table.addCell("");
            table.addCell(getAmountCell(
                    reportData.getTotalSumOfMarketValue(IncomePrincipalIndicator.INCOME, reportGroupOrder),
                    cellFont));
            table.addCell("");
            table.addCell("");
            table.addCell("");
        }
    }
}

From source file:org.kuali.kfs.module.endow.report.util.AssetStatementReportPrint.java

License:Educational Community License

/**
 * Generates report group income non-endowed total
 * /*www . j  a  v a2 s .  c o  m*/
 * @param reportGroupsForIncomeTotal
 * @param totalHistoryIncomeCash
 * @param docuement
 * @param table
 * @param cellFont
 * @throws Exception
 */
protected void printReportGroupForIncomeEndowmentTotal(
        TreeMap<Integer, TreeMap<String, List<ReportGroupData>>> reportGroupsForIncomeTotal,
        BigDecimal totalHistoryIncomeCash, Document docuement, PdfPTable table, Font cellFont)
        throws Exception {

    table.addCell(new Paragraph("Income Cash", cellFont));
    table.addCell("");
    table.addCell(getAmountCell(totalHistoryIncomeCash, cellFont));
    table.addCell("");
    table.addCell("");
    table.addCell("");

    if (reportGroupsForIncomeTotal == null || reportGroupsForIncomeTotal.isEmpty()) {
        table.addCell(new Paragraph("TOTAL CASH AND\nEQUIVALENTS", titleFont));
        table.addCell("");
        table.addCell(getAmountCell(totalHistoryIncomeCash, cellFont));
        table.addCell("");
        table.addCell("");
        table.addCell("");
        return;
    }

    // Cash and equivalents         
    BigDecimal grandTotalMarketValue1 = BigDecimal.ZERO;
    BigDecimal grandTotalEstimatedAnnualIncome1 = BigDecimal.ZERO;
    BigDecimal grandTotalFyRemainderEAI1 = BigDecimal.ZERO;
    BigDecimal grandTotalNextFyEAI1 = BigDecimal.ZERO;

    TreeMap<String, List<ReportGroupData>> cashEquivalentsData = reportGroupsForIncomeTotal.get(1);
    if (cashEquivalentsData != null && !cashEquivalentsData.isEmpty()) {
        Iterator<String> secirutyIdSet = cashEquivalentsData.keySet().iterator();
        while (secirutyIdSet.hasNext()) {
            // get securityId
            String securityId = secirutyIdSet.next();
            List<ReportGroupData> dataList = cashEquivalentsData.get(securityId);
            BigDecimal totalUnits = BigDecimal.ZERO;
            BigDecimal totalMarketValue = BigDecimal.ZERO;
            BigDecimal totalEstimatedAnnualIncome = BigDecimal.ZERO;
            BigDecimal totalFyRemainderEAI = BigDecimal.ZERO;
            BigDecimal totalNextFyEAI = BigDecimal.ZERO;

            for (ReportGroupData data : dataList) {
                totalUnits = totalUnits.add(data.getSumOfUnits());
                totalMarketValue = totalMarketValue.add(data.getSumOfMarketValue());
                totalEstimatedAnnualIncome = totalEstimatedAnnualIncome.add(data.getSumOfEstimatedIncome());
                totalFyRemainderEAI = totalFyRemainderEAI.add(data.getSumOfRemainderOfFYEstimated());
                totalNextFyEAI = totalNextFyEAI.add(data.getSumOfNextFYEstimatedIncome());
            }

            table.addCell(new Paragraph(dataList.get(0).getSecurityDesc(), cellFont));
            table.addCell(getAmountCell(totalUnits, cellFont, FORMAT164));
            table.addCell(getAmountCell(totalMarketValue, cellFont));
            table.addCell(getAmountCell(totalEstimatedAnnualIncome, cellFont));
            table.addCell(getAmountCell(totalFyRemainderEAI, cellFont));
            table.addCell(getAmountCell(totalNextFyEAI, cellFont));

            grandTotalMarketValue1 = grandTotalMarketValue1.add(totalMarketValue);
            grandTotalEstimatedAnnualIncome1 = grandTotalEstimatedAnnualIncome1.add(totalEstimatedAnnualIncome);
            grandTotalFyRemainderEAI1 = grandTotalFyRemainderEAI1.add(totalFyRemainderEAI);
            grandTotalNextFyEAI1 = grandTotalNextFyEAI1.add(totalNextFyEAI);
        }
    }
    table.addCell(new Paragraph("TOTAL CASH AND\nEQUIVALENTS", titleFont));
    table.addCell("");
    table.addCell(getAmountCell(grandTotalMarketValue1.add(totalHistoryIncomeCash), cellFont));
    table.addCell("");
    table.addCell("");
    table.addCell("");

    // Other report groups
    BigDecimal grandTotalMarketValueN = BigDecimal.ZERO;
    BigDecimal grandTotalEstimatedAnnualIncomeN = BigDecimal.ZERO;
    BigDecimal grandTotalFyRemainderEAIN = BigDecimal.ZERO;
    BigDecimal grandTotalNextFyEAIN = BigDecimal.ZERO;

    Iterator<Integer> reportGroupOrderSet = reportGroupsForIncomeTotal.keySet().iterator();
    while (reportGroupOrderSet.hasNext()) {

        Integer reportGroupOrder = reportGroupOrderSet.next();
        if (reportGroupOrder.intValue() > 1) {
            TreeMap<String, List<ReportGroupData>> reportGroupDataBySecurity = reportGroupsForIncomeTotal
                    .get(reportGroupOrder);

            // print report group description
            String reportGroupDesc = reportGroupDataBySecurity.firstEntry().getValue().get(0)
                    .getReportGroupDesc();
            PdfPCell groupDescCell = new PdfPCell(new Paragraph(reportGroupDesc, titleFont));
            groupDescCell.setColspan(6);
            table.addCell(groupDescCell);

            // print totals per security id         
            BigDecimal totalGroupMarketValue = BigDecimal.ZERO;
            Iterator<String> securityIdSet = reportGroupDataBySecurity.keySet().iterator();
            while (securityIdSet.hasNext()) {
                String securityId = securityIdSet.next();
                List<ReportGroupData> dataList = reportGroupDataBySecurity.get(securityId);
                BigDecimal totalUnits = BigDecimal.ZERO;
                BigDecimal totalMarketValue = BigDecimal.ZERO;
                BigDecimal totalEstimatedAnnualIncome = BigDecimal.ZERO;
                BigDecimal totalFyRemainderEAI = BigDecimal.ZERO;
                BigDecimal totalNextFyEAI = BigDecimal.ZERO;

                for (ReportGroupData data : dataList) {
                    totalUnits = totalUnits.add(data.getSumOfUnits());
                    totalMarketValue = totalMarketValue.add(data.getSumOfMarketValue());
                    totalGroupMarketValue = totalGroupMarketValue.add(data.getSumOfMarketValue());
                    totalEstimatedAnnualIncome = totalEstimatedAnnualIncome.add(data.getSumOfEstimatedIncome());
                    totalFyRemainderEAI = totalFyRemainderEAI.add(data.getSumOfRemainderOfFYEstimated());
                    totalNextFyEAI = totalNextFyEAI.add(data.getSumOfNextFYEstimatedIncome());
                }

                table.addCell(new Paragraph(dataList.get(0).getSecurityDesc(), cellFont));
                table.addCell(getAmountCell(totalUnits, cellFont, FORMAT164));
                table.addCell(getAmountCell(totalMarketValue, cellFont));
                table.addCell(getAmountCell(totalEstimatedAnnualIncome, cellFont));
                table.addCell(getAmountCell(totalFyRemainderEAI, cellFont));
                table.addCell(getAmountCell(totalNextFyEAI, cellFont));

                grandTotalMarketValueN = grandTotalMarketValueN.add(totalMarketValue);
                grandTotalEstimatedAnnualIncomeN = grandTotalEstimatedAnnualIncomeN
                        .add(totalEstimatedAnnualIncome);
                grandTotalFyRemainderEAIN = grandTotalFyRemainderEAIN.add(totalFyRemainderEAI);
                grandTotalNextFyEAIN = grandTotalNextFyEAIN.add(totalNextFyEAI);
            }
            // totals
            table.addCell(new Paragraph("TOTAL " + convertToUpperCase(reportGroupDesc), cellFont));
            table.addCell("");
            table.addCell(getAmountCell(totalGroupMarketValue, cellFont));
            table.addCell("");
            table.addCell("");
            table.addCell("");
        }
    }

    // total expendable funds
    table.addCell(new Paragraph("TOTAL EXPENDABLE FUNDS", titleFont));
    table.addCell("");
    table.addCell(getAmountCell(grandTotalMarketValue1.add(grandTotalMarketValueN).add(totalHistoryIncomeCash),
            cellFont));
    table.addCell(
            getAmountCell(grandTotalEstimatedAnnualIncome1.add(grandTotalEstimatedAnnualIncomeN), cellFont));
    table.addCell(getAmountCell(grandTotalFyRemainderEAI1.add(grandTotalFyRemainderEAIN), cellFont));
    table.addCell(getAmountCell(grandTotalNextFyEAI1.add(grandTotalNextFyEAIN), cellFont));
}

From source file:org.kuali.kfs.module.endow.report.util.AssetStatementReportPrint.java

License:Educational Community License

/**
 * Generates report group principal non-endowed total
 * //w w w  . j a  va 2s  .com
 * @param reportGroupsForPrincipalTotal
 * @param totalHistoryPrincipalCash
 * @param docuement
 * @param table
 * @param cellFont
 */
protected void printReportGroupForPrincipalEndowmentTotal(
        TreeMap<Integer, TreeMap<String, List<ReportGroupData>>> reportGroupsForPrincipalTotal,
        BigDecimal totalHistoryPrincipalCash, Document docuement, PdfPTable table, Font cellFont) {

    table.addCell(new Paragraph("Principal Cash", cellFont));
    table.addCell("");
    table.addCell(getAmountCell(totalHistoryPrincipalCash, cellFont));
    table.addCell("");
    table.addCell("");
    table.addCell("");

    if (reportGroupsForPrincipalTotal == null || reportGroupsForPrincipalTotal.isEmpty()) {
        table.addCell(new Paragraph("TOTAL CASH AND\nEQUIVALENTS", titleFont));
        table.addCell("");
        table.addCell(getAmountCell(totalHistoryPrincipalCash, cellFont));
        table.addCell("");
        table.addCell("");
        table.addCell("");
        return;
    }

    // Cash and equivalents         
    BigDecimal grandTotalMarketValue1 = BigDecimal.ZERO;
    BigDecimal grandTotalEstimatedAnnualIncome1 = BigDecimal.ZERO;
    BigDecimal grandTotalFyRemainderEAI1 = BigDecimal.ZERO;
    BigDecimal grandTotalNextFyEAI1 = BigDecimal.ZERO;

    TreeMap<String, List<ReportGroupData>> cashEquivalentsData = reportGroupsForPrincipalTotal.get(1);
    if (cashEquivalentsData != null && !cashEquivalentsData.isEmpty()) {
        Iterator<String> secirutyIdSet = cashEquivalentsData.keySet().iterator();
        while (secirutyIdSet.hasNext()) {
            // get securityId
            String securityId = secirutyIdSet.next();
            List<ReportGroupData> dataList = cashEquivalentsData.get(securityId);
            BigDecimal totalUnits = BigDecimal.ZERO;
            BigDecimal totalMarketValue = BigDecimal.ZERO;
            BigDecimal totalEstimatedAnnualIncome = BigDecimal.ZERO;
            BigDecimal totalFyRemainderEAI = BigDecimal.ZERO;
            BigDecimal totalNextFyEAI = BigDecimal.ZERO;
            //getTotals(dataList, totalUnits, totalMarketValue, totalEstimatedAnnualIncome, totalFyRemainderEAI, totalNextFyEAI);
            for (ReportGroupData data : dataList) {
                totalUnits = totalUnits.add(data.getSumOfUnits());
                totalMarketValue = totalMarketValue.add(data.getSumOfMarketValue());
                totalEstimatedAnnualIncome = totalEstimatedAnnualIncome.add(data.getSumOfEstimatedIncome());
                totalFyRemainderEAI = totalFyRemainderEAI.add(data.getSumOfRemainderOfFYEstimated());
                totalNextFyEAI = totalNextFyEAI.add(data.getSumOfNextFYEstimatedIncome());
            }

            table.addCell(new Paragraph(dataList.get(0).getSecurityDesc(), cellFont));
            table.addCell(getAmountCell(totalUnits, cellFont, FORMAT164));
            table.addCell(getAmountCell(totalMarketValue, cellFont));
            table.addCell(getAmountCell(totalEstimatedAnnualIncome, cellFont));
            table.addCell(getAmountCell(totalFyRemainderEAI, cellFont));
            table.addCell(getAmountCell(totalNextFyEAI, cellFont));

            grandTotalMarketValue1 = grandTotalMarketValue1.add(totalMarketValue);
            grandTotalEstimatedAnnualIncome1 = grandTotalEstimatedAnnualIncome1.add(totalEstimatedAnnualIncome);
            grandTotalFyRemainderEAI1 = grandTotalFyRemainderEAI1.add(totalFyRemainderEAI);
            grandTotalNextFyEAI1 = grandTotalNextFyEAI1.add(totalNextFyEAI);
        }
    }
    table.addCell(new Paragraph("TOTAL CASH AND\nEQUIVALENTS", titleFont));
    table.addCell("");
    table.addCell(getAmountCell(grandTotalMarketValue1.add(totalHistoryPrincipalCash), cellFont));
    table.addCell("");
    table.addCell("");
    table.addCell("");

    // Other report groups
    BigDecimal grandTotalMarketValueN = BigDecimal.ZERO;
    BigDecimal grandTotalEstimatedAnnualIncomeN = BigDecimal.ZERO;
    BigDecimal grandTotalFyRemainderEAIN = BigDecimal.ZERO;
    BigDecimal grandTotalNextFyEAIN = BigDecimal.ZERO;

    Iterator<Integer> reportGroupOrderSet = reportGroupsForPrincipalTotal.keySet().iterator();
    while (reportGroupOrderSet.hasNext()) {

        Integer reportGroupOrder = reportGroupOrderSet.next();
        if (reportGroupOrder.intValue() > 1) {
            TreeMap<String, List<ReportGroupData>> reportGroupDataBySecurity = reportGroupsForPrincipalTotal
                    .get(reportGroupOrder);

            // print report group description
            String reportGroupDesc = reportGroupDataBySecurity.firstEntry().getValue().get(0)
                    .getReportGroupDesc();
            PdfPCell groupDescCell = new PdfPCell(new Paragraph(reportGroupDesc, titleFont));
            groupDescCell.setColspan(6);
            table.addCell(groupDescCell);

            // print totals per security id
            BigDecimal totalGroupMarketValue = BigDecimal.ZERO;
            Iterator<String> securityIdSet = reportGroupDataBySecurity.keySet().iterator();
            while (securityIdSet.hasNext()) {
                String securityId = securityIdSet.next();
                List<ReportGroupData> dataList = reportGroupDataBySecurity.get(securityId);
                BigDecimal totalUnits = BigDecimal.ZERO;
                BigDecimal totalMarketValue = BigDecimal.ZERO;
                BigDecimal totalEstimatedAnnualIncome = BigDecimal.ZERO;
                BigDecimal totalFyRemainderEAI = BigDecimal.ZERO;
                BigDecimal totalNextFyEAI = BigDecimal.ZERO;
                //getTotals(dataList, totalUnits, totalMarketValue, totalEstimatedAnnualIncome, totalFyRemainderEAI, totalNextFyEAI);
                for (ReportGroupData data : dataList) {
                    totalUnits = totalUnits.add(data.getSumOfUnits());
                    totalMarketValue = totalMarketValue.add(data.getSumOfMarketValue());
                    totalGroupMarketValue = totalGroupMarketValue.add(data.getSumOfMarketValue());
                    totalEstimatedAnnualIncome = totalEstimatedAnnualIncome.add(data.getSumOfEstimatedIncome());
                    totalFyRemainderEAI = totalFyRemainderEAI.add(data.getSumOfRemainderOfFYEstimated());
                    totalNextFyEAI = totalNextFyEAI.add(data.getSumOfNextFYEstimatedIncome());
                }

                table.addCell(new Paragraph(dataList.get(0).getSecurityDesc(), cellFont));
                table.addCell(getAmountCell(totalUnits, cellFont, FORMAT164));
                table.addCell(getAmountCell(totalMarketValue, cellFont));
                table.addCell(getAmountCell(totalEstimatedAnnualIncome, cellFont));
                table.addCell(getAmountCell(totalFyRemainderEAI, cellFont));
                table.addCell(getAmountCell(totalNextFyEAI, cellFont));

                grandTotalMarketValueN = grandTotalMarketValueN.add(totalMarketValue);
                grandTotalEstimatedAnnualIncomeN = grandTotalEstimatedAnnualIncomeN
                        .add(totalEstimatedAnnualIncome);
                grandTotalFyRemainderEAIN = grandTotalFyRemainderEAIN.add(totalFyRemainderEAI);
                grandTotalNextFyEAIN = grandTotalNextFyEAIN.add(totalNextFyEAI);
            }

            // report group total
            table.addCell(new Paragraph("TOTAL " + convertToUpperCase(reportGroupDesc), cellFont));
            table.addCell("");
            table.addCell(getAmountCell(totalGroupMarketValue, cellFont));
            table.addCell("");
            table.addCell("");
            table.addCell("");

        }
    }

    // total expendable funds
    table.addCell(new Paragraph("TOTAL ENDOWED FUNDS", titleFont));
    table.addCell("");
    table.addCell(getAmountCell(
            grandTotalMarketValue1.add(grandTotalMarketValueN).add(totalHistoryPrincipalCash), cellFont));
    table.addCell(
            getAmountCell(grandTotalEstimatedAnnualIncome1.add(grandTotalEstimatedAnnualIncomeN), cellFont));
    table.addCell(getAmountCell(grandTotalFyRemainderEAI1.add(grandTotalFyRemainderEAIN), cellFont));
    table.addCell(getAmountCell(grandTotalNextFyEAI1.add(grandTotalNextFyEAIN), cellFont));

}

From source file:org.kuali.kfs.module.endow.report.util.AssetStatementReportPrint.java

License:Educational Community License

/**
 * Generates report group non-endowed total
 * // w w w  .  j a  va 2  s  .c  om
 * @param reportGroupsForTotal
 * @param totalHistoryIncomeCash
 * @param totalHistoryPrincipalCash
 * @param docuement
 * @param table
 * @param cellFont
 * @throws Exception
 */
protected void printReportGroupForNonEndowedTotal(
        TreeMap<Integer, TreeMap<String, List<ReportGroupData>>> reportGroupsForTotal,
        BigDecimal totalHistoryIncomeCash, BigDecimal totalHistoryPrincipalCash, Document docuement,
        PdfPTable table, Font cellFont) throws Exception {

    table.addCell(new Paragraph("Income Cash", cellFont));
    table.addCell("");
    table.addCell(getAmountCell(totalHistoryIncomeCash, cellFont));
    table.addCell("");
    table.addCell("");
    table.addCell("");

    table.addCell(new Paragraph("Principal Cash", cellFont));
    table.addCell("");
    table.addCell(getAmountCell(totalHistoryPrincipalCash, cellFont));
    table.addCell("");
    table.addCell("");
    table.addCell("");

    if (reportGroupsForTotal == null || reportGroupsForTotal.isEmpty()) {
        table.addCell(new Paragraph("TOTAL CASH AND\nEQUIVALENTS", titleFont));
        table.addCell("");
        table.addCell(getAmountCell(totalHistoryIncomeCash, cellFont));
        table.addCell("");
        table.addCell("");
        table.addCell("");
        return;
    }

    // Cash and equivalents         
    BigDecimal grandTotalMarketValue1 = BigDecimal.ZERO;
    BigDecimal grandTotalEstimatedAnnualIncome1 = BigDecimal.ZERO;
    BigDecimal grandTotalFyRemainderEAI1 = BigDecimal.ZERO;
    BigDecimal grandTotalNextFyEAI1 = BigDecimal.ZERO;

    // get the cash equivalents group
    TreeMap<String, List<ReportGroupData>> cashEquivalentsData = reportGroupsForTotal.get(1);
    if (cashEquivalentsData != null && !cashEquivalentsData.isEmpty()) {
        Iterator<String> secirutyIdSet = cashEquivalentsData.keySet().iterator();
        while (secirutyIdSet.hasNext()) {
            // get securityId
            String securityId = secirutyIdSet.next();
            List<ReportGroupData> dataList = cashEquivalentsData.get(securityId);
            BigDecimal totalUnits = BigDecimal.ZERO;
            BigDecimal totalMarketValue = BigDecimal.ZERO;
            BigDecimal totalEstimatedAnnualIncome = BigDecimal.ZERO;
            BigDecimal totalFyRemainderEAI = BigDecimal.ZERO;
            BigDecimal totalNextFyEAI = BigDecimal.ZERO;
            //getTotals(dataList, totalUnits, totalMarketValue, totalEstimatedAnnualIncome, totalFyRemainderEAI, totalNextFyEAI);
            for (ReportGroupData data : dataList) {
                totalUnits = totalUnits.add(data.getSumOfUnits());
                totalMarketValue = totalMarketValue.add(data.getSumOfMarketValue());
                totalEstimatedAnnualIncome = totalEstimatedAnnualIncome.add(data.getSumOfEstimatedIncome());
                totalFyRemainderEAI = totalFyRemainderEAI.add(data.getSumOfRemainderOfFYEstimated());
                totalNextFyEAI = totalNextFyEAI.add(data.getSumOfNextFYEstimatedIncome());
            }
            table.addCell(new Paragraph(dataList.get(0).getSecurityDesc(), cellFont));
            table.addCell(getAmountCell(totalUnits, cellFont, FORMAT164));
            table.addCell(getAmountCell(totalMarketValue, cellFont));
            table.addCell(getAmountCell(totalEstimatedAnnualIncome, cellFont));
            table.addCell(getAmountCell(totalFyRemainderEAI, cellFont));
            table.addCell(getAmountCell(totalNextFyEAI, cellFont));

            grandTotalMarketValue1 = grandTotalMarketValue1.add(totalMarketValue);
            grandTotalEstimatedAnnualIncome1 = grandTotalEstimatedAnnualIncome1.add(totalEstimatedAnnualIncome);
            grandTotalFyRemainderEAI1 = grandTotalFyRemainderEAI1.add(totalFyRemainderEAI);
            grandTotalNextFyEAI1 = grandTotalNextFyEAI1.add(totalNextFyEAI);
        }
    }
    table.addCell(new Paragraph("TOTAL CASH AND\nEQUIVALENTS", titleFont));
    table.addCell("");
    table.addCell(getAmountCell(
            grandTotalMarketValue1.add(totalHistoryIncomeCash).add(totalHistoryPrincipalCash), cellFont));
    table.addCell("");
    table.addCell("");
    table.addCell("");

    // print other report groups
    BigDecimal grandTotalMarketValueN = BigDecimal.ZERO;
    BigDecimal grandTotalEstimatedAnnualIncomeN = BigDecimal.ZERO;
    BigDecimal grandTotalFyRemainderEAIN = BigDecimal.ZERO;
    BigDecimal grandTotalNextFyEAIN = BigDecimal.ZERO;

    Iterator<Integer> reportGroupOrderSet = reportGroupsForTotal.keySet().iterator();
    while (reportGroupOrderSet.hasNext()) {

        Integer reportGroupOrder = reportGroupOrderSet.next();
        if (reportGroupOrder.intValue() > 1) {
            TreeMap<String, List<ReportGroupData>> reportGroupDataBySecurity = reportGroupsForTotal
                    .get(reportGroupOrder);

            // print report group description
            String reportGroupDesc = reportGroupDataBySecurity.firstEntry().getValue().get(0)
                    .getReportGroupDesc();
            PdfPCell groupDescCell = new PdfPCell(new Paragraph(reportGroupDesc, titleFont));
            groupDescCell.setColspan(6);
            table.addCell(groupDescCell);

            // print totals per security id  
            BigDecimal totalGroupMarketValue = BigDecimal.ZERO;
            Iterator<String> securityIdSet = reportGroupDataBySecurity.keySet().iterator();
            while (securityIdSet.hasNext()) {
                String securityId = securityIdSet.next();
                List<ReportGroupData> dataList = reportGroupDataBySecurity.get(securityId);
                BigDecimal totalUnits = BigDecimal.ZERO;
                BigDecimal totalMarketValue = BigDecimal.ZERO;
                BigDecimal totalEstimatedAnnualIncome = BigDecimal.ZERO;
                BigDecimal totalFyRemainderEAI = BigDecimal.ZERO;
                BigDecimal totalNextFyEAI = BigDecimal.ZERO;
                for (ReportGroupData data : dataList) {
                    totalUnits = totalUnits.add(data.getSumOfUnits());
                    totalMarketValue = totalMarketValue.add(data.getSumOfMarketValue());
                    totalGroupMarketValue = totalGroupMarketValue.add(data.getSumOfMarketValue());
                    totalEstimatedAnnualIncome = totalEstimatedAnnualIncome.add(data.getSumOfEstimatedIncome());
                    totalFyRemainderEAI = totalFyRemainderEAI.add(data.getSumOfRemainderOfFYEstimated());
                    totalNextFyEAI = totalNextFyEAI.add(data.getSumOfNextFYEstimatedIncome());
                }

                table.addCell(new Paragraph(dataList.get(0).getSecurityDesc(), cellFont));
                table.addCell(getAmountCell(totalUnits, cellFont, FORMAT164));
                table.addCell(getAmountCell(totalMarketValue, cellFont));
                table.addCell(getAmountCell(totalEstimatedAnnualIncome, cellFont));
                table.addCell(getAmountCell(totalFyRemainderEAI, cellFont));
                table.addCell(getAmountCell(totalNextFyEAI, cellFont));

                grandTotalMarketValueN = grandTotalMarketValueN.add(totalMarketValue);
                grandTotalEstimatedAnnualIncomeN = grandTotalEstimatedAnnualIncomeN
                        .add(totalEstimatedAnnualIncome);
                grandTotalFyRemainderEAIN = grandTotalFyRemainderEAIN.add(totalFyRemainderEAI);
                grandTotalNextFyEAIN = grandTotalNextFyEAIN.add(totalNextFyEAI);
            }

            // report group total
            table.addCell(new Paragraph("TOTAL " + convertToUpperCase(reportGroupDesc), cellFont));
            table.addCell("");
            table.addCell(getAmountCell(totalGroupMarketValue, cellFont));
            table.addCell("");
            table.addCell("");
            table.addCell("");
        }
    }
}

From source file:org.kuali.kfs.module.endow.report.util.EndowmentReportPrintBase.java

License:Educational Community License

/**
 * Generates the footer//from   w  ww . ja  va 2  s.  c o m
 * 
 * @param footerData
 * @param document
 */
public boolean printFooter(EndowmentReportFooterDataHolder footerData, Document document) {

    if (footerData == null) {
        return false;
    }

    try {
        document.add(new Phrase("\n"));

        PdfPTable table = new PdfPTable(2);
        table.setWidthPercentage(FULL_TABLE_WIDTH);
        int[] colWidths = { 40, 60 };
        table.setWidths(colWidths);
        table.getDefaultCell().setPadding(2);

        // left column
        PdfPTable leftTable = new PdfPTable(2);
        leftTable.setWidths(colWidths);
        leftTable.setWidthPercentage(40);

        leftTable.addCell(createCell("Reference: ", footerTitleFont, Element.ALIGN_LEFT, false));
        leftTable.addCell(createCell(footerData.getReference(), footerRegularFont, Element.ALIGN_LEFT, false));
        leftTable.addCell(createCell("Date Established: ", footerTitleFont, Element.ALIGN_LEFT, false));
        leftTable.addCell(
                createCell(footerData.getEstablishedDate(), footerRegularFont, Element.ALIGN_LEFT, false));
        leftTable.addCell(createCell("KEMID Type: ", footerTitleFont, Element.ALIGN_LEFT, false));
        leftTable.addCell(createCell(footerData.getKemidType(), footerRegularFont, Element.ALIGN_LEFT, false));
        leftTable.addCell(createCell("KEMID Purpose: ", footerTitleFont, Element.ALIGN_LEFT, false));
        leftTable.addCell(
                createCell(footerData.getKemidPurpose(), footerRegularFont, Element.ALIGN_LEFT, false));
        leftTable.addCell(createCell("Report Run Date: ", footerTitleFont, Element.ALIGN_LEFT, false));
        leftTable.addCell(
                createCell(footerData.getReportRunDate(), footerRegularFont, Element.ALIGN_LEFT, false));
        table.addCell(leftTable);

        // right column
        PdfPTable rightTable = new PdfPTable(4);
        rightTable.setWidthPercentage(60);

        PdfPCell cellBenefitting = new PdfPCell(new Paragraph("BENEFITTING\n", titleFont));
        cellBenefitting.setColspan(4);
        cellBenefitting.setBorderWidth(0);
        rightTable.addCell(cellBenefitting);

        rightTable.addCell(createCell("Campus", footerTitleFont, Element.ALIGN_LEFT, false));
        rightTable.addCell(createCell("Chart", footerTitleFont, Element.ALIGN_LEFT, false));
        rightTable.addCell(createCell("Organizaztion", footerTitleFont, Element.ALIGN_LEFT, false));
        rightTable.addCell(createCell("Percent", footerTitleFont, Element.ALIGN_LEFT, false));

        List<BenefittingForFooter> benefittingList = footerData.getBenefittingList();
        if (benefittingList != null) {
            for (BenefittingForFooter benefitting : benefittingList) {
                rightTable.addCell(createCell(benefitting.getCampusName(), footerRegularFont,
                        Element.ALIGN_LEFT, Element.ALIGN_TOP, false));
                rightTable.addCell(createCell(benefitting.getChartName(), footerRegularFont, Element.ALIGN_LEFT,
                        Element.ALIGN_TOP, false));
                rightTable.addCell(createCell(benefitting.getOrganizationName(), footerRegularFont,
                        Element.ALIGN_LEFT, Element.ALIGN_TOP, false));
                rightTable.addCell(createCell(benefitting.getBenefittingPercent(), footerRegularFont,
                        Element.ALIGN_LEFT, Element.ALIGN_TOP, false));
            }
        }

        table.addCell(rightTable);

        document.add(table);

    } catch (Exception e) {
        return false;
    }

    return true;
}

From source file:org.kuali.kfs.module.endow.report.util.EndowmentReportPrintBase.java

License:Educational Community License

/**
 * Creates a call with given font, alignments, and borderline
 * //w  w w.j  a va  2 s .c o  m
 * @param contents
 * @param font
 * @param horizontalAlignment
 * @param verticalAlignment
 * @param borderLine
 * @return
 */
public PdfPCell createCell(String contents, Font font, int horizontalAlignment, int verticalAlignment,
        boolean borderLine) {
    if (contents == null)
        contents = "";
    Phrase phr = new Phrase(contents, font);
    PdfPCell cell = new PdfPCell(phr);
    cell.setHorizontalAlignment(horizontalAlignment);
    if (!borderLine) {
        cell.setBorderWidth(0);
    }
    cell.setVerticalAlignment(verticalAlignment);
    return cell;
}

From source file:org.kuali.kfs.module.endow.report.util.TrialBalanceReportPrint.java

License:Educational Community License

/**
 * Generates the Trial Balance report/*from  w  w w  .  j av a 2 s  . c o m*/
 * 
 * @param trialBalanceReports
 * @param document
 * @return
 */
public boolean printTrialBalanceReportBody(List<TrialBalanceReportDataHolder> trialBalanceReports,
        Document document) {

    try {
        // title
        Paragraph title = new Paragraph("KEMID Trial Balance");
        title.setAlignment(Element.ALIGN_CENTER);
        Date currentDate = SpringContext.getBean(KEMService.class).getCurrentDate();
        DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class);
        String asOfDate = dateTimeService.toDateString(currentDate);
        title.add("\nAs of " + asOfDate + "\n\n");
        document.add(title);

        // report table
        PdfPTable table = new PdfPTable(7);
        table.setWidthPercentage(FULL_TABLE_WIDTH);
        int[] relativeWidths = { 10, 15, 15, 15, 15, 15, 15 };
        table.setWidths(relativeWidths);
        table.getDefaultCell().setPadding(2);

        // table titles
        table.addCell(new Phrase("KEMID", titleFont));
        table.addCell(new Phrase("KEMID Name", titleFont));
        table.addCell(new Phrase("Income Cash Balance", titleFont));
        table.addCell(new Phrase("Principal Cash Balance", titleFont));
        table.addCell(new Phrase("KEMID Total Market Value", titleFont));
        table.addCell(new Phrase("Available Expendable Funds", titleFont));
        table.addCell(new Phrase("FY Remainder Estimated Income", titleFont));

        // table body
        Font cellFont = regularFont;
        BigDecimal totalIncomeCashBalance = BigDecimal.ZERO;
        BigDecimal totalPrincipalCashBalance = BigDecimal.ZERO;
        BigDecimal totalMarketValueBalance = BigDecimal.ZERO;
        BigDecimal totalAvailableExpendableFundsBalance = BigDecimal.ZERO;
        BigDecimal totalFyRemainderEstimatedIncome = BigDecimal.ZERO;

        for (TrialBalanceReportDataHolder trialBalanceReport : trialBalanceReports) {

            // totals, which is the last row
            if (trialBalanceReport.getKemid().equalsIgnoreCase("TOTALS")) {
                cellFont = titleFont;
            }

            table.addCell(new Phrase(trialBalanceReport.getKemid(), cellFont));
            table.addCell(new Phrase(trialBalanceReport.getKemidName(), cellFont));
            if (trialBalanceReport.getInocmeCashBalance() != null) {
                String amount = formatAmount(trialBalanceReport.getInocmeCashBalance().bigDecimalValue());
                table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true));
                totalIncomeCashBalance = totalIncomeCashBalance
                        .add(trialBalanceReport.getInocmeCashBalance().bigDecimalValue());
            } else {
                table.addCell(createCell(ZERO_FOR_REPORT, cellFont, Element.ALIGN_RIGHT, true));
            }
            if (trialBalanceReport.getPrincipalcashBalance() != null) {
                String amount = formatAmount(trialBalanceReport.getPrincipalcashBalance().bigDecimalValue());
                totalPrincipalCashBalance = totalPrincipalCashBalance
                        .add(trialBalanceReport.getPrincipalcashBalance().bigDecimalValue());
                table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true));
            } else {
                table.addCell(createCell(ZERO_FOR_REPORT, cellFont, Element.ALIGN_RIGHT, true));
            }
            if (trialBalanceReport.getKemidTotalMarketValue() != null) {
                String amount = formatAmount(trialBalanceReport.getKemidTotalMarketValue());
                totalMarketValueBalance = totalMarketValueBalance
                        .add(trialBalanceReport.getKemidTotalMarketValue());
                table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true));
            } else {
                table.addCell(createCell(ZERO_FOR_REPORT, cellFont, Element.ALIGN_RIGHT, true));
            }
            if (trialBalanceReport.getAvailableExpendableFunds() != null) {
                String amount = formatAmount(trialBalanceReport.getAvailableExpendableFunds());
                totalAvailableExpendableFundsBalance = totalAvailableExpendableFundsBalance
                        .add(trialBalanceReport.getAvailableExpendableFunds());
                table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true));
            } else {
                table.addCell(createCell(ZERO_FOR_REPORT, cellFont, Element.ALIGN_RIGHT, true));
            }
            if (trialBalanceReport.getFyRemainderEstimatedIncome() != null) {
                String amount = formatAmount(trialBalanceReport.getFyRemainderEstimatedIncome());
                totalFyRemainderEstimatedIncome = totalFyRemainderEstimatedIncome
                        .add(trialBalanceReport.getFyRemainderEstimatedIncome());
                table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true));
            } else {
                table.addCell(createCell(ZERO_FOR_REPORT, cellFont, Element.ALIGN_RIGHT, true));
            }
        }

        // totals
        PdfPCell blank = new PdfPCell(new Paragraph("", cellFont));
        blank.setColspan(7);
        blank.setBackgroundColor(Color.LIGHT_GRAY);
        table.addCell(blank);

        table.addCell(createCell("TOTALS", titleFont, Element.ALIGN_LEFT, true));
        table.addCell(createCell("", cellFont, Element.ALIGN_RIGHT, true));
        table.addCell(createCell(formatAmount(totalIncomeCashBalance), cellFont, Element.ALIGN_RIGHT, true));
        table.addCell(createCell(formatAmount(totalPrincipalCashBalance), cellFont, Element.ALIGN_RIGHT, true));
        table.addCell(createCell(formatAmount(totalMarketValueBalance), cellFont, Element.ALIGN_RIGHT, true));
        table.addCell(createCell(formatAmount(totalAvailableExpendableFundsBalance), cellFont,
                Element.ALIGN_RIGHT, true));
        table.addCell(
                createCell(formatAmount(totalFyRemainderEstimatedIncome), cellFont, Element.ALIGN_RIGHT, true));

        document.add(table);

    } catch (Exception e) {
        return false;
    }

    return true;
}