List of usage examples for com.lowagie.text.pdf PdfPTable PdfPTable
public PdfPTable(PdfPTable table)
PdfPTable
. From source file:org.kitodo.production.services.data.ProcessService.java
License:Open Source License
private PdfPTable getPdfTable(List<List<HSSFCell>> rowList) { // create formatter for cells with default locale DataFormatter formatter = new DataFormatter(); PdfPTable table = new PdfPTable(9); table.setSpacingBefore(20);// w w w . j ava 2 s .c o m for (List<HSSFCell> row : rowList) { for (HSSFCell hssfCell : row) { String stringCellValue = formatter.formatCellValue(hssfCell); table.addCell(stringCellValue); } } return table; }
From source file:org.kuali.kfs.gl.report.TransactionReport.java
License:Open Source License
/** * Appends the scrubber totals/statistics and error report to the given (iText) document object. * //w w w .ja v a 2s .c om * @param document the PDF document * @param headerFont font for header * @param textFont font for report text * @param errorSortedList list of error'd transactions * @param reportErrors map containing transactions and the errors associated with each transaction * @param reportSummary list of summary objects * @param runDate date report was run * @throws DocumentException */ public void appendReport(Document document, Font headerFont, Font textFont, List<Transaction> errorSortedList, Map<Transaction, List<Message>> reportErrors, List<Summary> reportSummary, Date runDate) throws DocumentException { // Sort what we get Collections.sort(reportSummary); float[] summaryWidths = { 80, 20 }; PdfPTable summary = new PdfPTable(summaryWidths); summary.setWidthPercentage(40); PdfPCell cell = new PdfPCell(new Phrase("S T A T I S T I C S", headerFont)); cell.setColspan(2); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); summary.addCell(cell); for (Iterator iter = reportSummary.iterator(); iter.hasNext();) { Summary s = (Summary) iter.next(); cell = new PdfPCell(new Phrase(s.getDescription(), textFont)); cell.setBorder(Rectangle.NO_BORDER); summary.addCell(cell); if ("".equals(s.getDescription())) { cell = new PdfPCell(new Phrase("", textFont)); cell.setBorder(Rectangle.NO_BORDER); summary.addCell(cell); } else { DecimalFormat nf = new DecimalFormat("###,###,###,##0"); cell = new PdfPCell(new Phrase(nf.format(s.getCount()), textFont)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); summary.addCell(cell); } } cell = new PdfPCell(new Phrase("")); cell.setColspan(2); cell.setBorder(Rectangle.NO_BORDER); summary.addCell(cell); document.add(summary); if (reportErrors != null && reportErrors.size() > 0) { float[] warningWidths = { 4, 3, 6, 5, 5, 4, 5, 5, 4, 5, 5, 9, 4, 36 }; PdfPTable warnings = new PdfPTable(warningWidths); warnings.setHeaderRows(2); warnings.setWidthPercentage(100); cell = new PdfPCell(new Phrase("W A R N I N G S", headerFont)); cell.setColspan(14); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); warnings.addCell(cell); // Add headers cell = new PdfPCell(new Phrase("Year", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("COA", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("Account", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("Sacct", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("Obj", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("SObj", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("BalTyp", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("ObjTyp", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("Prd", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("DocType", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("Origin", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("DocNbr", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("Seq", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("Warning", headerFont)); warnings.addCell(cell); for (Iterator errorIter = errorSortedList.iterator(); errorIter.hasNext();) { Transaction tran = (Transaction) errorIter.next(); boolean first = true; List errors = (List) reportErrors.get(tran); for (Iterator listIter = errors.iterator(); listIter.hasNext();) { String msg = null; Object m = listIter.next(); if (m instanceof Message) { Message mm = (Message) m; msg = mm.getMessage(); } else { if (m == null) { msg = ""; } else { msg = m.toString(); } } if (first) { first = false; if (tran.getUniversityFiscalYear() == null) { cell = new PdfPCell(new Phrase("NULL", textFont)); } else { cell = new PdfPCell(new Phrase(tran.getUniversityFiscalYear().toString(), textFont)); } warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getChartOfAccountsCode(), textFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getAccountNumber(), textFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getSubAccountNumber(), textFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getFinancialObjectCode(), textFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getFinancialSubObjectCode(), textFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getFinancialBalanceTypeCode(), textFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getFinancialObjectTypeCode(), textFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getUniversityFiscalPeriodCode(), textFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getFinancialDocumentTypeCode(), textFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getFinancialSystemOriginationCode(), textFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getDocumentNumber(), textFont)); warnings.addCell(cell); if (tran.getTransactionLedgerEntrySequenceNumber() == null) { cell = new PdfPCell(new Phrase("NULL", textFont)); } else { cell = new PdfPCell(new Phrase( tran.getTransactionLedgerEntrySequenceNumber().toString(), textFont)); } warnings.addCell(cell); } else { cell = new PdfPCell(new Phrase("", textFont)); cell.setColspan(13); warnings.addCell(cell); } cell = new PdfPCell(new Phrase(msg, textFont)); warnings.addCell(cell); } } document.add(warnings); } }
From source file:org.kuali.kfs.module.ar.report.service.impl.ContractsGrantsInvoiceReportServiceImpl.java
License:Open Source License
/** * this method generated the actual pdf for the Contracts & Grants LOC Review Document. * * @param os/*from w ww . j ava2 s .com*/ * @param LOCDocument */ protected void generateLOCReviewInPdf(OutputStream os, ContractsGrantsLetterOfCreditReviewDocument locDocument) { try { Document document = new Document( new Rectangle(ArConstants.LOCReviewPdf.LENGTH, ArConstants.LOCReviewPdf.WIDTH)); PdfWriter.getInstance(document, os); document.open(); Paragraph header = new Paragraph(); Paragraph text = new Paragraph(); Paragraph title = new Paragraph(); // Lets write the header header.add(new Paragraph(configService.getPropertyValueAsString(ArKeyConstants.LOC_REVIEW_PDF_TITLE), ArConstants.PdfReportFonts.LOC_REVIEW_TITLE_FONT)); if (StringUtils.isNotEmpty(locDocument.getLetterOfCreditFundGroupCode())) { header.add(new Paragraph( configService.getPropertyValueAsString(ArKeyConstants.LOC_REVIEW_PDF_HEADER_FUND_GROUP_CODE) + locDocument.getLetterOfCreditFundGroupCode(), ArConstants.PdfReportFonts.LOC_REVIEW_TITLE_FONT)); } if (StringUtils.isNotEmpty(locDocument.getLetterOfCreditFundCode())) { header.add(new Paragraph( configService.getPropertyValueAsString(ArKeyConstants.LOC_REVIEW_PDF_HEADER_FUND_CODE) + locDocument.getLetterOfCreditFundCode(), ArConstants.PdfReportFonts.LOC_REVIEW_TITLE_FONT)); } header.add(new Paragraph(KFSConstants.BLANK_SPACE)); header.setAlignment(Element.ALIGN_CENTER); title.add(new Paragraph( configService.getPropertyValueAsString(ArKeyConstants.LOC_REVIEW_PDF_HEADER_DOCUMENT_NUMBER) + locDocument.getDocumentNumber(), ArConstants.PdfReportFonts.LOC_REVIEW_HEADER_FONT)); Person person = getPersonService() .getPerson(locDocument.getFinancialSystemDocumentHeader().getInitiatorPrincipalId()); // writing the Document details title.add(new Paragraph( configService.getPropertyValueAsString(ArKeyConstants.LOC_REVIEW_PDF_HEADER_APP_DOC_STATUS) + locDocument.getFinancialSystemDocumentHeader().getApplicationDocumentStatus(), ArConstants.PdfReportFonts.LOC_REVIEW_HEADER_FONT)); title.add( new Paragraph( configService.getPropertyValueAsString( ArKeyConstants.LOC_REVIEW_PDF_HEADER_DOCUMENT_INITIATOR) + person.getName(), ArConstants.PdfReportFonts.LOC_REVIEW_HEADER_FONT)); title.add(new Paragraph( configService .getPropertyValueAsString(ArKeyConstants.LOC_REVIEW_PDF_HEADER_DOCUMENT_CREATE_DATE) + getDateTimeService().toDateString( locDocument.getFinancialSystemDocumentHeader().getWorkflowCreateDate()), ArConstants.PdfReportFonts.LOC_REVIEW_HEADER_FONT)); title.add(new Paragraph(KFSConstants.BLANK_SPACE)); title.setAlignment(Element.ALIGN_RIGHT); text.add(new Paragraph( configService.getPropertyValueAsString(ArKeyConstants.LOC_REVIEW_PDF_SUBHEADER_AWARDS), ArConstants.PdfReportFonts.LOC_REVIEW_SMALL_BOLD)); text.add(new Paragraph(KFSConstants.BLANK_SPACE)); document.add(header); document.add(title); document.add(text); PdfPTable table = new PdfPTable(11); table.setTotalWidth(ArConstants.LOCReviewPdf.RESULTS_TABLE_WIDTH); // fix the absolute width of the table table.setLockedWidth(true); // relative col widths in proportions - 1/11 float[] widths = new float[] { 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f }; table.setWidths(widths); table.setHorizontalAlignment(0); addAwardHeaders(table); if (CollectionUtils.isNotEmpty(locDocument.getHeaderReviewDetails()) && CollectionUtils.isNotEmpty(locDocument.getAccountReviewDetails())) { for (ContractsGrantsLetterOfCreditReviewDetail item : locDocument.getHeaderReviewDetails()) { table.addCell(Long.toString(item.getProposalNumber())); table.addCell(item.getAwardDocumentNumber()); table.addCell(item.getAgencyNumber()); table.addCell(item.getCustomerNumber()); table.addCell(getDateTimeService().toDateString(item.getAwardBeginningDate())); table.addCell(getDateTimeService().toDateString(item.getAwardEndingDate())); table.addCell( contractsGrantsBillingUtilityService.formatForCurrency(item.getAwardBudgetAmount())); table.addCell( contractsGrantsBillingUtilityService.formatForCurrency(item.getLetterOfCreditAmount())); table.addCell( contractsGrantsBillingUtilityService.formatForCurrency(item.getClaimOnCashBalance())); table.addCell(contractsGrantsBillingUtilityService.formatForCurrency(item.getAmountToDraw())); table.addCell(contractsGrantsBillingUtilityService .formatForCurrency(item.getAmountAvailableToDraw())); PdfPCell cell = new PdfPCell(); cell.setPadding(ArConstants.LOCReviewPdf.RESULTS_TABLE_CELL_PADDING); cell.setColspan(ArConstants.LOCReviewPdf.RESULTS_TABLE_COLSPAN); PdfPTable newTable = new PdfPTable(ArConstants.LOCReviewPdf.INNER_TABLE_COLUMNS); newTable.setTotalWidth(ArConstants.LOCReviewPdf.INNER_TABLE_WIDTH); // fix the absolute width of the newTable newTable.setLockedWidth(true); // relative col widths in proportions - 1/8 float[] newWidths = new float[] { 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f }; newTable.setWidths(newWidths); newTable.setHorizontalAlignment(0); addAccountsHeaders(newTable); for (ContractsGrantsLetterOfCreditReviewDetail newItem : locDocument .getAccountReviewDetails()) { if (item.getProposalNumber().equals(newItem.getProposalNumber())) { newTable.addCell(newItem.getAccountDescription()); newTable.addCell(newItem.getChartOfAccountsCode()); newTable.addCell(newItem.getAccountNumber()); String accountExpirationDate = KFSConstants.EMPTY_STRING; if (!ObjectUtils.isNull(newItem.getAccountExpirationDate())) { accountExpirationDate = getDateTimeService() .toDateString(newItem.getAccountExpirationDate()); } newTable.addCell(accountExpirationDate); newTable.addCell(contractsGrantsBillingUtilityService .formatForCurrency(newItem.getAwardBudgetAmount())); newTable.addCell(contractsGrantsBillingUtilityService .formatForCurrency(newItem.getClaimOnCashBalance())); newTable.addCell(contractsGrantsBillingUtilityService .formatForCurrency(newItem.getAmountToDraw())); newTable.addCell(contractsGrantsBillingUtilityService .formatForCurrency(newItem.getFundsNotDrawn())); } } cell.addElement(newTable); table.addCell(cell); } document.add(table); } document.close(); } catch (DocumentException e) { LOG.error("problem during ContractsGrantsInvoiceReportServiceImpl.generateInvoiceInPdf()", e); } }
From source file:org.kuali.kfs.module.endow.report.util.AssetStatementReportPrint.java
License:Educational Community License
/** * Prints report body for endowment detail * // w w w. j a v a 2 s . com * @param endowmentAssetStatementReportDataHolders * @param document * @return */ public boolean printAssetStatementReportBodyForEndowmentTotal( List<AssetStatementReportDataHolder> endowmentAssetStatementReportDataHolders, Document document) { BigDecimal totalHistoryIncomeCash = BigDecimal.ZERO; BigDecimal totalHistoryPrincipalCash = BigDecimal.ZERO; TreeMap<Integer, TreeMap<String, List<ReportGroupData>>> reportGroupsForIncomeTotal = null; TreeMap<Integer, TreeMap<String, List<ReportGroupData>>> reportGroupsForPrincipalTotal = null; // get the cash totals for (AssetStatementReportDataHolder data : endowmentAssetStatementReportDataHolders) { totalHistoryIncomeCash = totalHistoryIncomeCash.add(data.getHistoryIncomeCash()); totalHistoryPrincipalCash = totalHistoryPrincipalCash.add(data.getHistoryPrincipalCash()); } // for income reportGroupsForIncomeTotal = createReportGroupsForTotal(endowmentAssetStatementReportDataHolders, IncomePrincipalIndicator.INCOME); // for principal reportGroupsForPrincipalTotal = createReportGroupsForTotal(endowmentAssetStatementReportDataHolders, IncomePrincipalIndicator.PRINCIPAL); // for each kemid try { Font cellFont = regularFont; // for the common info AssetStatementReportDataHolder reportData = endowmentAssetStatementReportDataHolders.get(0); 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\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)); // 1. Expendable funds PdfPCell cellExpendableFunds = new PdfPCell(new Paragraph("EXPENDABLE FUNDS", titleFont)); cellExpendableFunds.setColspan(6); table.addCell(cellExpendableFunds); PdfPCell cellCashEquivalnets = new PdfPCell(new Paragraph("CASH AND EQUIVALENTS", titleFont)); cellCashEquivalnets.setColspan(6); table.addCell(cellCashEquivalnets); // report groups for income printReportGroupForIncomeEndowmentTotal(reportGroupsForIncomeTotal, totalHistoryIncomeCash, document, table, cellFont); // 2. Endowed funds PdfPCell cellEndowedFunds = new PdfPCell(new Paragraph("ENDOWED FUNDS", titleFont)); cellEndowedFunds.setColspan(6); table.addCell(cellEndowedFunds); table.addCell(cellCashEquivalnets); // report groups for principal printReportGroupForPrincipalEndowmentTotal(reportGroupsForPrincipalTotal, totalHistoryPrincipalCash, document, table, cellFont); // 3. total (endowment + non-endowed) PdfPCell blank = new PdfPCell(new Paragraph("", cellFont)); blank.setColspan(6); blank.setBackgroundColor(Color.LIGHT_GRAY); table.addCell(blank); BigDecimal totalKemidMarketValue = BigDecimal.ZERO; BigDecimal totalKemidEstimatedAnnualIncome = BigDecimal.ZERO; BigDecimal totalKemidFYRemainderEstimatedAnnualIncome = BigDecimal.ZERO; BigDecimal totalKemidNextFYEstimayedAnnualIncome = BigDecimal.ZERO; for (AssetStatementReportDataHolder data : endowmentAssetStatementReportDataHolders) { totalKemidMarketValue = totalKemidMarketValue .add(data.getTotalSumOfMarketValue(IncomePrincipalIndicator.INCOME) .add(data.getTotalSumOfMarketValue(IncomePrincipalIndicator.PRINCIPAL))); totalKemidEstimatedAnnualIncome = totalKemidEstimatedAnnualIncome .add(data.getTotalSumOfEstimatedIncome(IncomePrincipalIndicator.INCOME) .add(data.getTotalSumOfEstimatedIncome(IncomePrincipalIndicator.PRINCIPAL))); totalKemidFYRemainderEstimatedAnnualIncome = totalKemidFYRemainderEstimatedAnnualIncome .add(data.getTotalSumOfRemainderOfFYEstimated(IncomePrincipalIndicator.INCOME) .add(data.getTotalSumOfRemainderOfFYEstimated(IncomePrincipalIndicator.PRINCIPAL))); totalKemidNextFYEstimayedAnnualIncome = totalKemidNextFYEstimayedAnnualIncome .add(data.getTotalSumOfNextFYEstimatedIncome(IncomePrincipalIndicator.INCOME) .add(data.getTotalSumOfNextFYEstimatedIncome(IncomePrincipalIndicator.PRINCIPAL))); } table.addCell(new Paragraph("TOTAL KEMID VALUE", titleFont)); table.addCell(""); table.addCell(getAmountCell( totalKemidMarketValue.add(totalHistoryIncomeCash).add(totalHistoryPrincipalCash), titleFont)); table.addCell(getAmountCell(totalKemidEstimatedAnnualIncome, titleFont)); table.addCell(getAmountCell(totalKemidFYRemainderEstimatedAnnualIncome, titleFont)); table.addCell(getAmountCell(totalKemidNextFYEstimayedAnnualIncome, titleFont)); document.add(table); } 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 the Asset Statement report for Non-Endowed total * //from w w w . j a va2 s. c o m * @param transactionStatementReports * @param document * @return */ public boolean printAssetStatementReportBodyForNonEndowedTotal( List<AssetStatementReportDataHolder> nonEndowedAssetStatementReportDataHolders, Document document) { BigDecimal totalHistoryIncomeCash = BigDecimal.ZERO; BigDecimal totalHistoryPrincipalCash = BigDecimal.ZERO; TreeMap<Integer, TreeMap<String, List<ReportGroupData>>> reportGroupsForTotal = null; // get the cash totals for (AssetStatementReportDataHolder data : nonEndowedAssetStatementReportDataHolders) { totalHistoryIncomeCash = totalHistoryIncomeCash.add(data.getHistoryIncomeCash()); totalHistoryPrincipalCash = totalHistoryPrincipalCash.add(data.getHistoryPrincipalCash()); } reportGroupsForTotal = createReportGroupsForTotal(nonEndowedAssetStatementReportDataHolders, IncomePrincipalIndicator.INCOME); // for each kemid try { Font cellFont = regularFont; // for the common info AssetStatementReportDataHolder reportData = nonEndowedAssetStatementReportDataHolders.get(0); 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\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", titleFont)); cellCashEquivalnets.setColspan(6); table.addCell(cellCashEquivalnets); // report groups printReportGroupForNonEndowedTotal(reportGroupsForTotal, totalHistoryIncomeCash, totalHistoryPrincipalCash, document, table, cellFont); // total PdfPCell blank = new PdfPCell(new Paragraph("", cellFont)); blank.setColspan(6); blank.setBackgroundColor(Color.LIGHT_GRAY); table.addCell(blank); BigDecimal totalKemidMarketValue = BigDecimal.ZERO; BigDecimal totalKemidEstimatedAnnualIncome = BigDecimal.ZERO; BigDecimal totalKemidFYRemainderEstimatedAnnualIncome = BigDecimal.ZERO; BigDecimal totalKemidNextFYEstimayedAnnualIncome = BigDecimal.ZERO; for (AssetStatementReportDataHolder data : nonEndowedAssetStatementReportDataHolders) { totalKemidMarketValue = totalKemidMarketValue .add(data.getTotalSumOfMarketValue(IncomePrincipalIndicator.INCOME)); totalKemidEstimatedAnnualIncome = totalKemidEstimatedAnnualIncome .add(data.getTotalSumOfEstimatedIncome(IncomePrincipalIndicator.INCOME)); totalKemidFYRemainderEstimatedAnnualIncome = totalKemidFYRemainderEstimatedAnnualIncome .add(totalKemidFYRemainderEstimatedAnnualIncome .add(data.getTotalSumOfRemainderOfFYEstimated(IncomePrincipalIndicator.INCOME))); totalKemidNextFYEstimayedAnnualIncome = totalKemidNextFYEstimayedAnnualIncome .add(data.getTotalSumOfNextFYEstimatedIncome(IncomePrincipalIndicator.INCOME)); } table.addCell(new Paragraph("TOTAL KEMID VALUE", titleFont)); table.addCell(""); table.addCell(getAmountCell( totalKemidMarketValue.add(totalHistoryIncomeCash).add(totalHistoryPrincipalCash), titleFont)); table.addCell(getAmountCell(totalKemidEstimatedAnnualIncome, titleFont)); table.addCell(getAmountCell(totalKemidFYRemainderEstimatedAnnualIncome, titleFont)); table.addCell(getAmountCell(totalKemidNextFYEstimayedAnnualIncome, titleFont)); document.add(table); } 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 the Asset Statement report for Endowment detail * /*from www .j a v a2 s .c o m*/ * @param transactionStatementReports * @param document * @return */ public boolean printAssetStatementReportBodyForEndowmentDetail( List<AssetStatementReportDataHolder> endowmentAssetStatementReportDataHolders, Document document) { // for each kemid try { Font cellFont = regularFont; for (AssetStatementReportDataHolder reportData : endowmentAssetStatementReportDataHolders) { 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)); // 1. Expendable funds PdfPCell cellExpendableFunds = new PdfPCell(new Paragraph("EXPENDABLE FUNDS", titleFont)); cellExpendableFunds.setColspan(6); //cellExpendableFunds.setBackgroundColor(Color.LIGHT_GRAY); table.addCell(cellExpendableFunds); PdfPCell cellCashEquivalnets = new PdfPCell(new Paragraph("CASH AND EQUIVALENTS", cellFont)); cellCashEquivalnets.setColspan(6); table.addCell(cellCashEquivalnets); // report groups printReportGroupForIncomeEndowmentDetail(reportData, document, table, cellFont); // 2. Endowed funds PdfPCell cellEndowedFunds = new PdfPCell(new Paragraph("ENDOWED FUNDS", titleFont)); cellEndowedFunds.setColspan(6); //cellEndowedFunds.setBackgroundColor(Color.LIGHT_GRAY); table.addCell(cellEndowedFunds); table.addCell(cellCashEquivalnets); printReportGroupForPrincipalEndowmentDetail(reportData, document, table, cellFont); // 3. total (endowment + non-endowed) 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.getTotalSumOfMarketValue(IncomePrincipalIndicator.PRINCIPAL) .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 the Asset Statement report for Non-Endowed * //from w ww. j a v a 2s. co m * @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.EndowmentReportPrintBase.java
License:Educational Community License
/** * Generates the report header sheet//from ww w .j a v a 2 s .com * * @param reportRequestHeaderDataHolder * @param document * @return */ public boolean printReportHeaderPage(EndowmentReportHeaderDataHolder reportRequestHeaderDataHolder, Document document, String listKemidsInHeader) { try { // report header Phrase header = new Paragraph(new Date().toString()); Paragraph title = new Paragraph(reportRequestHeaderDataHolder.getInstitutionName()); title.setAlignment(Element.ALIGN_CENTER); title.add("\nReport Request Header Sheet\n\n"); document.add(title); PdfPTable requestTable = new PdfPTable(2); requestTable.setWidthPercentage(REQUEST_INFO_TABLE_WIDTH); int[] requestWidths = { 20, 80 }; requestTable.setWidths(requestWidths); requestTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); Paragraph reportRequested = new Paragraph(reportRequestHeaderDataHolder.getReportRequested(), headerSheetRegularFont); Paragraph dateRequested = new Paragraph(new Date().toString(), headerSheetRegularFont); Paragraph requestedBy = new Paragraph(reportRequestHeaderDataHolder.getRequestedBy(), headerSheetRegularFont); Paragraph endowmentOption = new Paragraph(reportRequestHeaderDataHolder.getEndowmentOption(), headerSheetRegularFont); Paragraph reportOption = new Paragraph(reportRequestHeaderDataHolder.getReportOption(), headerSheetRegularFont); requestTable.addCell( createCellWithDefaultFontAndWithoutBorderLine("Report Requested:", Element.ALIGN_RIGHT)); requestTable.addCell(reportRequested); requestTable .addCell(createCellWithDefaultFontAndWithoutBorderLine("Date Requested:", Element.ALIGN_RIGHT)); requestTable.addCell(dateRequested); requestTable .addCell(createCellWithDefaultFontAndWithoutBorderLine("Reqeusted by:", Element.ALIGN_RIGHT)); requestTable.addCell(requestedBy); requestTable.addCell(""); requestTable.addCell(""); requestTable.addCell( createCellWithDefaultFontAndWithoutBorderLine("Endowment Option:", Element.ALIGN_RIGHT)); requestTable.addCell(endowmentOption); requestTable .addCell(createCellWithDefaultFontAndWithoutBorderLine("Report Option:", Element.ALIGN_RIGHT)); requestTable.addCell(reportOption); document.add(requestTable); // Criteria Paragraph criteria = new Paragraph("\nCriteria:\n\n"); document.add(criteria); PdfPTable criteriaTable = new PdfPTable(2); criteriaTable.setWidthPercentage(CRITERIA_TABLE_WIDTH); int[] criteriaWidths = { 30, 50 }; criteriaTable.setWidths(criteriaWidths); criteriaTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); Paragraph benefittingCampus = new Paragraph(reportRequestHeaderDataHolder.getBenefittingCampus(), headerSheetRegularFont); Paragraph benefittingChart = new Paragraph(reportRequestHeaderDataHolder.getBenefittingChart(), headerSheetRegularFont); Paragraph benefittingOrganization = new Paragraph( reportRequestHeaderDataHolder.getBenefittingOrganization(), headerSheetRegularFont); Paragraph kemidTypeCode = new Paragraph(reportRequestHeaderDataHolder.getKemidTypeCode(), headerSheetRegularFont); Paragraph kemidPurposeCode = new Paragraph(reportRequestHeaderDataHolder.getKemidPurposeCode(), headerSheetRegularFont); Paragraph combinationGroupCode = new Paragraph(reportRequestHeaderDataHolder.getCombineGroupCode(), headerSheetRegularFont); criteriaTable.addCell( createCellWithDefaultFontAndWithoutBorderLine("Benefitting Campus:", Element.ALIGN_RIGHT)); criteriaTable.addCell(benefittingCampus); criteriaTable.addCell( createCellWithDefaultFontAndWithoutBorderLine("Benefitting Chart:", Element.ALIGN_RIGHT)); criteriaTable.addCell(benefittingChart); criteriaTable.addCell(createCellWithDefaultFontAndWithoutBorderLine("Benefitting Organization:", Element.ALIGN_RIGHT)); criteriaTable.addCell(benefittingOrganization); criteriaTable.addCell( createCellWithDefaultFontAndWithoutBorderLine("KEMID Type Code:", Element.ALIGN_RIGHT)); criteriaTable.addCell(kemidTypeCode); criteriaTable.addCell( createCellWithDefaultFontAndWithoutBorderLine("KEMID Purpose Code:", Element.ALIGN_RIGHT)); criteriaTable.addCell(kemidPurposeCode); criteriaTable.addCell( createCellWithDefaultFontAndWithoutBorderLine("Combine Group Code:", Element.ALIGN_RIGHT)); criteriaTable.addCell(combinationGroupCode); document.add(criteriaTable); // kemids with multiple benefitting organization Paragraph kemidWithMultipleBenefittingOrganization = new Paragraph( "\nKEMIDs with Multiple Benefitting Organizations:\n\n"); document.add(kemidWithMultipleBenefittingOrganization); List<KemidsWithMultipleBenefittingOrganizationsDataHolder> kemidsWithMultipleBenefittingOrganizationsDataHolder = reportRequestHeaderDataHolder .getKemidsWithMultipleBenefittingOrganizationsDataHolders(); if (kemidsWithMultipleBenefittingOrganizationsDataHolder != null && !kemidsWithMultipleBenefittingOrganizationsDataHolder.isEmpty()) { PdfPTable kemidWithMultipleBenefittingOrganizationTable = new PdfPTable(5); kemidWithMultipleBenefittingOrganizationTable.setWidthPercentage(MULTIPLE_KEMID_TABLE_WIDTH); kemidWithMultipleBenefittingOrganizationTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); Paragraph kemid = new Paragraph("KEMID", titleFont); Paragraph campus = new Paragraph("Campus", titleFont); Paragraph chart = new Paragraph("Chart", titleFont); Paragraph organization = new Paragraph("Organziation", titleFont); Paragraph percent = new Paragraph("Percent", titleFont); kemidWithMultipleBenefittingOrganizationTable.addCell(kemid); kemidWithMultipleBenefittingOrganizationTable.addCell(campus); kemidWithMultipleBenefittingOrganizationTable.addCell(chart); kemidWithMultipleBenefittingOrganizationTable.addCell(organization); kemidWithMultipleBenefittingOrganizationTable.addCell(percent); for (KemidsWithMultipleBenefittingOrganizationsDataHolder kmbo : kemidsWithMultipleBenefittingOrganizationsDataHolder) { kemidWithMultipleBenefittingOrganizationTable .addCell(new Paragraph(kmbo.getKemid(), headerSheetRegularFont)); kemidWithMultipleBenefittingOrganizationTable .addCell(new Paragraph(kmbo.getCampus(), headerSheetRegularFont)); kemidWithMultipleBenefittingOrganizationTable .addCell(new Paragraph(kmbo.getChart(), headerSheetRegularFont)); kemidWithMultipleBenefittingOrganizationTable .addCell(new Paragraph(kmbo.getOrganization(), headerSheetRegularFont)); kemidWithMultipleBenefittingOrganizationTable .addCell(new Paragraph(kmbo.getPercent().toString(), headerSheetRegularFont)); } document.add(kemidWithMultipleBenefittingOrganizationTable); } else { Paragraph noneExistMessage = new Paragraph("NONE EXIST\n\n", headerSheetRegularFont); document.add(noneExistMessage); } // kemids selected if ("Y".equalsIgnoreCase(listKemidsInHeader)) { List<String> kemidsSelected = reportRequestHeaderDataHolder.getKemidsSelected(); int totalKemidsSelected = reportRequestHeaderDataHolder.getKemidsSelected().size(); Paragraph kemidsSelectedTitle = new Paragraph("\nKEMIDs Selected: " + totalKemidsSelected + "\n\n"); document.add(kemidsSelectedTitle); PdfPTable kemidsTable = new PdfPTable(KEMIDS_SELECTED_COLUMN_NUM); kemidsTable.setWidthPercentage(KEMID_SELECTED_TABLE_WIDTH); kemidsTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); for (int i = 0; i < totalKemidsSelected; i++) { kemidsTable.addCell(new Paragraph(kemidsSelected.get(i), headerSheetRegularFont)); } // to fill out the rest of the empty cells. Otherwise, the row won't be displayed if (totalKemidsSelected % KEMIDS_SELECTED_COLUMN_NUM != 0) { for (int i = 0; i < (KEMIDS_SELECTED_COLUMN_NUM - totalKemidsSelected % KEMIDS_SELECTED_COLUMN_NUM); i++) { kemidsTable.addCell(""); } } document.add(kemidsTable); } } catch (Exception e) { return false; } return true; }
From source file:org.kuali.kfs.module.endow.report.util.EndowmentReportPrintBase.java
License:Educational Community License
/** * Generates the footer//from ww w.j a v a 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; }