private String[][] getCashFlow() { String rows[][] = new String[sidit.getNoteTerm()][9]; double prin = sidit.getFmv(); double growth = sidit.getAssetGrowth(); double income = sidit.getAssetIncome(); double pay[] = sidit.getNotePayment(); double premium = sidit.getLifePremium(); double lifeYears = sidit.getLifePremiumYears(); double noteBalance[] = sidit.getNoteBalance(); for (int i = 0; i < sidit.getNoteTerm(); i++) { rows[i][0] = Integer.toString(i + 1); rows[i][1] = dollar.format(prin); rows[i][2] = dollar.format(prin * growth); rows[i][3] = dollar.format(prin * income); rows[i][4] = dollar.format(-pay[i]); if (i < lifeYears) { rows[i][5] = dollar.format(-premium); } else { rows[i][5] = ""; premium = 0; } prin = prin * (1 + growth + income) - pay[i] - premium; rows[i][6] = dollar.format(prin); rows[i][7] = dollar.format(prin + sidit.getLifeDeathBenefit() - noteBalance[i]); rows[i][8] = "[border=l+r+b][border=r+b][border=r+b][border=r+b][border=r+b][border=r+b,color=" + makeColor(0, 0, 24) + "][border=r+b][border=r+b]"; } return rows; }
// Include table public void page4() { drawBorder(pageIcon, "IDIT"); drawHeader(userInfo.getClientHeading(), "Intentionally Defective Irrevocable Trust (IDIT)"); // Summary Rectangle rct = new Rectangle(prctTop); PageTable table = new PageTable(writer); table.setTableFormat(rct, 3); table.setTableFont("arial.TTF"); table.setTableFontBold("arialbd.TTF"); table.setFontSize(12); float widths[] = {.45f, .1f, .45f}; int alignments[] = {PdfPCell.ALIGN_LEFT, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_RIGHT}; table.setColumnWidths(widths); table.setColumnAlignments(alignments); String noteStructure = "Annual Level Principal + Interest"; if (sidit.getNoteType() == 1) noteStructure = "Annual Amoritized"; if (sidit.getNoteType() == 2) noteStructure = "Annual Interest + Balloon"; String cells[][] = { {"SUMMARY", "", "", "[colspan=3,align=center,bold=1][][]"}, {"", "", "", "[][][]"}, { "Value of Assets to be Sold (pre discount)", "", dollar.format(sidit.getFmv() - sidit.getGiftAmount()), "[][][]" }, { "Discount", "", percent.format(1.0 - (sidit.getDmv() / (sidit.getFmv() - sidit.getGiftAmount()))), "[][][]" }, {"Net Value of Assets Sold", "", dollar.format(sidit.getDmv()), "[][][]"}, {"Amount of Gift to Trust", "", dollar.format(sidit.getGiftAmount()), "[][][]"}, {"Total Amount of Trust Assets", "", dollar.format(sidit.getFmv()), "[][][]"}, { "Yield on Trust Assets(Growth/Income)", "", percent.format(sidit.getAssetGrowth() + sidit.getAssetIncome()), "[][][]" }, {"Note Value", "", dollar.format(sidit.getDmv()), "[][][]"}, {"Note Term", "", number.format(sidit.getNoteTerm()), "[][][]"}, {"Note Interest Rate per Year", "", percent.format(sidit.getNoteRate()), "[][][]"}, {"Note Payout Structure", "", noteStructure, "[][][]"}, { "Life Premium (paid for " + Integer.toString(sidit.getNoteTerm()) + " years)", "", dollar.format(sidit.getLifePremium()), "[][][]" }, {"Life Death Benefit", "", dollar.format(sidit.getLifeDeathBenefit()), "[][][]"} }; table.buildTableEx(cells); table.drawTable(); // Build the Cash Flow Table here!!!! // Draw cash flow table rct = new Rectangle(prctBottom); rct.setTop(rct.getTop() + (1.f * 72)); float widths2[] = {.1f, .2f, .2f, .2f, .2f, .1f, .2f, .2f}; int alignments2[] = { PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_RIGHT, PdfPCell.ALIGN_RIGHT, PdfPCell.ALIGN_RIGHT, PdfPCell.ALIGN_RIGHT, PdfPCell.ALIGN_RIGHT, PdfPCell.ALIGN_RIGHT, PdfCell.ALIGN_RIGHT }; PageTable cashFlow = new PageTable(writer); cashFlow.setTableFormat(rct, 8); cashFlow.setTableFont("arial.TTF"); cashFlow.setTableFontBold("arialbd.TTF"); cashFlow.setFontSize(8); cashFlow.setColumnWidths(widths2); cashFlow.setColumnAlignments(alignments2); String heading[][] = { { "Trust Cash Flow", "", "", "", "", "", "", "", "[bold=1,colspan=8,align=center,ptsize=12][][][][][][][]" }, {" ", "", "", "", "", "", "", "", "[][][][][][][][]"}, { "Year", "Beg. Principal", "Growth", "Income", "Payout", "Premium Payment", "End Principal", "Amt. to Family *", "[bold=1,border=l+t+b+r,align=center][bold=1,border=l+t+b+r,align=center]" + "[bold=1,border=l+t+b+r,align=center][bold=1,border=l+t+b+r,align=center]" + "[bold=1,border=l+t+b+r,align=center][bold=1,border=l+t+b+r,align=center]" + "[bold=1,border=l+t+b+r,align=center][bold=1,border=l+t+b+r,align=center]" } }; String rows[][] = getCashFlow(); String singleRow[][] = new String[1][7]; String cont[][] = { { "[Continued on Next Page]", "", "", "", "", "", "", "[bold=1,colspan=7,align=center][][][][][][][]" }, {" ", "", "", "", "", "", "", "[][][][][][][][]"} }; int idx = 0; if (sidit.getNoteTerm() > 17) { cashFlow.buildTableEx(heading); while (idx < 12) { singleRow[0] = rows[idx++]; cashFlow.buildTableEx(singleRow); } cashFlow.buildTableEx(cont); cashFlow.drawTable(); // Draw the following label at the bottom String lb1 = "* Includes life insurance should death occur at any year minus the value of the note."; drawLabel(lb1, prctBottom, "GARA.TTF", new Color(64, 64, 64), 9, LBL_LEFT, LBL_BOTTOM); newPage(); // We need to go to a new page // Redraw heading drawBorder(pageIcon, "IDIT"); drawHeader(userInfo.getClientHeading(), "Intentionaly Defective Irrevocable Trust"); // Readraw Table Heading rct = new Rectangle(prctTop); cashFlow = new PageTable(writer); cashFlow.setTableFormat(rct, 8); cashFlow.setTableFont("arial.TTF"); cashFlow.setTableFontBold("arialbd.TTF"); cashFlow.setFontSize(8); cashFlow.setColumnWidths(widths2); cashFlow.setColumnAlignments(alignments2); heading[0][0] = "Trust Cash Flow (Cont.)"; cashFlow.buildTableEx(heading); // Include the missing rows while (idx < sidit.getNoteTerm()) { singleRow[0] = rows[idx++]; cashFlow.buildTableEx(singleRow); } cashFlow.drawTable(); drawLabel(lb1, prctBottom, "GARA.TTF", new Color(64, 64, 64), 9, LBL_LEFT, LBL_BOTTOM); } else { cashFlow.buildTableEx(heading); cashFlow.buildTableEx(getCashFlow()); cashFlow.drawTable(); // Draw the following label at the bottom String lb1 = "* Includes life insurance should death occur at any year minus the value of the note."; drawLabel(lb1, prctBottom, "GARA.TTF", new Color(64, 64, 64), 9, LBL_LEFT, LBL_BOTTOM); } }