List of usage examples for com.lowagie.text.pdf PdfPTable PdfPTable
public PdfPTable(PdfPTable table)
PdfPTable
. From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java
License:Open Source License
protected PdfPTable createContractorTable() { final PdfPTable contractorTable = new PdfPTable(11); contractorTable.getDefaultCell().setBorderWidth(1); contractorTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); contractorTable.getDefaultCell().setColspan(7); contractorTable.addCell(pdfLabel.get("contractorbill.pdf.contractoraddress") + newLine + contactorName + newLine + contractorAddress + newLine); contractorTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); contractorTable.getDefaultCell().setColspan(4); contractorTable.addCell(pdfLabel.get("contractorbill.pdf.billno") + billGenNumber + newLine + pdfLabel.get("contractorbill.pdf.dateofbill") + billDate + newLine + pdfLabel.get("contractorbill.pdf.typeofbill") + billType + newLine); return contractorTable; }
From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java
License:Open Source License
private PdfPTable createApprovalDetailsTable(final ContractorBillRegister egBillRegister) throws DocumentException { try {//from w w w.ja v a 2 s. c o m final PdfPTable approvaldetailsTable = new PdfPTable(5); approvaldetailsTable.setWidthPercentage(100); approvaldetailsTable.setWidths(new float[] { 2f, 1f, 1f, 1.5f, 2f }); addRow(approvaldetailsTable, true, makePara("Approval Step"), centerPara("Name"), centerPara("Designation"), centerPara("Approved on"), centerPara("Remarks")); List<StateHistory<Position>> history = null; if (egBillRegister != null && egBillRegister.getCurrentState() != null && egBillRegister.getCurrentState().getHistory() != null) history = egBillRegister.getStateHistory(); if (history != null) { Collections.reverse(history); for (final StateHistory ad : history) displayHistory(ad, approvaldetailsTable); } return approvaldetailsTable; } catch (final Exception e) { throw new ApplicationRuntimeException("Exception occured while getting approval details " + e); } }
From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java
License:Open Source License
private PdfPTable createMultiYearTable(final AbstractEstimate estimate) throws DocumentException { final PdfPTable multiyearTable = new PdfPTable(3); multiyearTable.setWidthPercentage(100); multiyearTable.setWidths(new float[] { 1f, 2f, 2f }); addRow(multiyearTable, true, makePara("Sl No"), centerPara("Year"), centerPara("Percentage")); int i = 0;/*from ww w .ja va2 s. c o m*/ for (final MultiYearEstimate year : estimate.getMultiYearEstimates()) addRow(multiyearTable, true, makePara(++i), makePara(year.getFinancialYear().getFinYearRange(), Element.ALIGN_CENTER), rightPara(year.getPercentage())); return multiyearTable; }
From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java
License:Open Source License
private PdfPTable createOverheadsTable(final AbstractEstimate estimate) throws DocumentException { final PdfPTable overheadsTable = new PdfPTable(3); overheadsTable.setWidthPercentage(100); overheadsTable.setWidths(new float[] { 1f, 4f, 2f }); addRow(overheadsTable, true, makePara("Sl No"), centerPara("Description"), centerPara("Amount")); addRow(overheadsTable, true, makePara("1"), makePara("Work Value"), rightPara(toCurrency(estimate.getWorkValue()))); int i = 1;//from w w w. j a v a2s . c o m for (final OverheadValue oh : estimate.getOverheadValues()) addRow(overheadsTable, true, makePara(++i), makePara(getOverheadDescription(oh)), rightPara(toCurrency(oh.getAmount()))); addRow(overheadsTable, true, centerPara(""), makePara("TOTAL"), rightPara(toCurrency(estimate.getTotalAmount()))); return overheadsTable; }
From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java
License:Open Source License
private PdfPTable createDepositAppropriationTable(final AbstractEstimate estimate, final String appropriationNumber) throws DocumentException { int isReject = -1; depositWorksUsageService = abstractEstimateService.getDepositWorksUsageService(); BigDecimal totalUtilizedAmt;// w w w. ja v a 2 s .co m BigDecimal amtAppropriatedsofar; BigDecimal totalDepositAmt; BigDecimal balOnHand; BigDecimal balanceAvailable; BigDecimal amtAppropriated; final Accountdetailtype accountdetailtype = worksService.getAccountdetailtypeByName("DEPOSITCODE"); estimateAppropriationService = abstractEstimateService.getEstimateAppropriationService(); abstractEstimateAppropriationList = estimateAppropriationService.findAllBy( "from AbstractEstimateAppropriation aea where aea.abstractEstimate.id=? and aea.depositWorksUsage.id is not null order by id, aea.depositWorksUsage.financialYearId asc", estimate.getId()); final PdfPTable depositWorksAppropriationTable = new PdfPTable(2); depositWorksAppropriationTable.setWidthPercentage(100); depositWorksAppropriationTable.setWidths(new float[] { 2f, 8f }); if (appropriationNumber != null && appropriationNumber.toUpperCase().contains("BC")) isReject = 1; if (appropriationNumber != null && estimate.getTotalAmount() != null && isReject == -1) { addRow(depositWorksAppropriationTable, true, centerPara("Deposit Code"), centerPara(estimate.getDepositCode().getCode())); addRow(depositWorksAppropriationTable, true, centerPara("Account Code"), centerPara(estimate.getFinancialDetails().get(0).getCoa().getGlcode() + "-" + estimate.getFinancialDetails().get(0).getCoa().getName())); addRow(depositWorksAppropriationTable, true, makePara("Function Center"), centerPara(estimate.getFinancialDetails().get(0).getFunction().getName())); addRow(depositWorksAppropriationTable, true, makePara("Department"), centerPara(estimate.getUserDepartment().getName())); addRow(depositWorksAppropriationTable, true, makePara("Amount of the Estimate "), rightPara(toCurrency(estimate.getTotalAmount()))); final PdfPTable appropriationDetailTable = new PdfPTable(6); addRow(appropriationDetailTable, true, makePara(7f, "Appropriation Number"), makePara(7f, "Total Deposit Amount"), makePara(7f, "Amount Appropriated so far"), makePara(7f, "Amount Appropriated"), makePara(7f, "Balance on Hand"), makePara(7f, "Balance After Appropriation")); for (final AbstractEstimateAppropriation abstractEstimateAppropriation : abstractEstimateAppropriationList) if (abstractEstimateAppropriation.getDepositWorksUsage().getConsumedAmount().doubleValue() != 0) { totalDepositAmt = depositWorksUsageService.getTotalDepositWorksAmount( estimate.getDepositCode().getFund(), abstractEstimateAppropriation.getAbstractEstimate().getFinancialDetails().get(0) .getCoa(), accountdetailtype, estimate.getDepositCode().getId(), abstractEstimateAppropriation.getDepositWorksUsage().getAppropriationDate()); totalUtilizedAmt = depositWorksUsageService.getTotalUtilizedAmountForDepositWorks( abstractEstimateAppropriation.getAbstractEstimate().getFinancialDetails().get(0), abstractEstimateAppropriation.getDepositWorksUsage().getCreatedDate()); if (totalUtilizedAmt == null) totalUtilizedAmt = BigDecimal.ZERO; amtAppropriatedsofar = totalUtilizedAmt .subtract(abstractEstimateAppropriation.getDepositWorksUsage().getConsumedAmount()); balOnHand = totalDepositAmt.subtract(amtAppropriatedsofar); amtAppropriated = abstractEstimateAppropriation.getDepositWorksUsage().getConsumedAmount(); balanceAvailable = BigDecimal .valueOf(totalDepositAmt.doubleValue() - totalUtilizedAmt.doubleValue()); addRow(appropriationDetailTable, true, makePara(7f, abstractEstimateAppropriation.getDepositWorksUsage().getAppropriationNumber()), rightPara(7f, toCurrency(totalDepositAmt.doubleValue())), rightPara(7f, toCurrency(amtAppropriatedsofar.doubleValue())), rightPara(7f, toCurrency(amtAppropriated.doubleValue())), rightPara(7f, toCurrency(balOnHand.doubleValue())), rightPara(7f, toCurrency(balanceAvailable.doubleValue()))); } final PdfPCell appDetailpdfCell = new PdfPCell(appropriationDetailTable); appDetailpdfCell.setBorderWidth(0); final PdfPCell appDetailRightHeader = new PdfPCell( makePara("Financail Year Wise Appropriation Details")); appDetailRightHeader.setVerticalAlignment(Element.ALIGN_MIDDLE); depositWorksAppropriationTable.addCell(appDetailRightHeader); appropriationDetailTable.setWidthPercentage(100); depositWorksAppropriationTable.addCell(appDetailpdfCell); } return depositWorksAppropriationTable; }
From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java
License:Open Source License
private PdfPTable createBudgetaryAppropriationTable(final AbstractEstimate estimate, final String appropriationNumber) throws DocumentException { int isReject = -1; final List<FinancialDetail> financialdetails = estimate.getFinancialDetails(); BigDecimal totalGrant;//from w w w .j ava2s .c o m BigDecimal budgetAvailable; BigDecimal balOnHand; BigDecimal amtAppropriated; BigDecimal totGrantafterMultiFactor = BigDecimal.ZERO; estimateAppropriationService = abstractEstimateService.getEstimateAppropriationService(); abstractEstimateAppropriationList = estimateAppropriationService.findAllBy( "from AbstractEstimateAppropriation aea where aea.abstractEstimate.id=? and aea.budgetUsage.id is not null order by aea.budgetUsage.id,aea.budgetUsage.financialYearId asc", estimate.getId()); final PdfPTable budgetaryAppropriationTable = new PdfPTable(1); budgetaryAppropriationTable.setWidthPercentage(100); budgetaryAppropriationTable.setWidths(new float[] { 8f }); if (appropriationNumber != null && appropriationNumber.toUpperCase().contains("BC")) isReject = 1; if (appropriationNumber != null && estimate.getTotalAmount() != null && isReject == -1) for (final FinancialDetail financialDetail : financialdetails) if (financialDetail.getBudgetGroup() != null) { addRow(budgetaryAppropriationTable, true, centerPara("Budget Head"), centerPara(financialDetail.getBudgetGroup().getName())); addRow(budgetaryAppropriationTable, true, makePara("Function Center"), centerPara(financialDetail.getFunction().getName())); addRow(budgetaryAppropriationTable, true, makePara("Amount of the Estimate "), rightPara(toCurrency(estimate.getTotalAmount()))); } final PdfPTable appropriationDetailTable = new PdfPTable(8); int count = 0; for (final AbstractEstimateAppropriation abstractEstimateAppropriation : abstractEstimateAppropriationList) if (abstractEstimateAppropriation.getBudgetUsage().getConsumedAmount() != 0) { final Department dept = getDeptFromBudgtAppropriationNo( abstractEstimateAppropriation.getBudgetUsage().getAppropriationnumber()); totalGrant = abstractEstimateService.getTotalGrantForYearAsOnDate(financialdetails.get(0), abstractEstimateAppropriation.getBudgetUsage().getFinancialYearId().longValue(), Integer.parseInt(dept.getId().toString()), abstractEstimateAppropriation.getBudgetUsage().getUpdatedTime()); final BigDecimal planningBudgetPerc = abstractEstimateService.getPlanningBudgetPercentage( financialdetails.get(0), abstractEstimateAppropriation.getBudgetUsage().getFinancialYearId().longValue(), Integer.parseInt(dept.getId().toString())); if (planningBudgetPerc != null && planningBudgetPerc.compareTo(BigDecimal.ZERO) != 0) { totGrantafterMultiFactor = totalGrant.multiply(planningBudgetPerc.divide(new BigDecimal(100))); appValue = planningBudgetPerc.divide(new BigDecimal(100)).toString(); } budgetAvailable = abstractEstimateAppropriation.getBalanceAvailable(); balOnHand = budgetAvailable .add(new BigDecimal(abstractEstimateAppropriation.getBudgetUsage().getConsumedAmount())); amtAppropriated = totGrantafterMultiFactor.subtract(balOnHand); // Print only for the first time if (count == 0) { addRow(budgetaryAppropriationTable, false, makePara(""), centerPara("Financial Year Wise Appropriation Details ")); addRow(appropriationDetailTable, true, makePara(8f, "Department"), makePara(8f, "Appropriation Number"), makePara(8f, "Total Grant"), makePara(8f, appValue + " Times Total Grant"), makePara(8f, "Amount Appropriated so far"), makePara(8f, "Amount Appropriated"), makePara(8f, "Balance on Hand"), makePara(8f, "Balance After Appropriation")); } addRow(appropriationDetailTable, true, rightPara(8f, dept.getName()), makePara(8f, abstractEstimateAppropriation.getBudgetUsage().getAppropriationnumber()), rightPara(8f, toCurrency(totalGrant.doubleValue())), rightPara(8f, toCurrency(totGrantafterMultiFactor.doubleValue())), rightPara(8f, toCurrency(amtAppropriated.doubleValue())), rightPara(8f, toCurrency(abstractEstimateAppropriation.getBudgetUsage().getConsumedAmount())), rightPara(8f, toCurrency(balOnHand.doubleValue())), rightPara(8f, toCurrency(budgetAvailable.doubleValue()))); count++; } final PdfPCell appDetailpdfCell = new PdfPCell(appropriationDetailTable); appropriationDetailTable.setWidthPercentage(100); budgetaryAppropriationTable.addCell(appDetailpdfCell); return budgetaryAppropriationTable; }
From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java
License:Open Source License
private PdfPTable createApprovalDetailsTable(final AbstractEstimate estimate) throws DocumentException { try {// w ww .ja v a 2s.c o m PdfPTable approvaldetailsTable = null; if (shouldShowApprovalNumber) { approvaldetailsTable = new PdfPTable(6); approvaldetailsTable.setWidths(new float[] { 2f, 1f, 1f, 1f, 1.5f, 2f }); } else { approvaldetailsTable = new PdfPTable(5); approvaldetailsTable.setWidths(new float[] { 2f, 1.5f, 1.5f, 1.5f, 2f }); } approvaldetailsTable.setWidthPercentage(100); addRow(approvaldetailsTable, true, makePara("Approval Step"), centerPara("Name"), centerPara("Designation"), centerPara("Approved on"), centerPara("Remarks")); if (estimate != null && estimate.getCurrentState() != null) { history = new LinkedList<>(); if (estimate.getCurrentState().getHistory() != null) history.addAll(estimate.getCurrentState().getHistory()); history.add(new StateHistory(estimate.getCurrentState())); } if (history != null) for (final StateHistory stateHistory : history) displayHistory(stateHistory, approvaldetailsTable); return approvaldetailsTable; } catch (final Exception e) { throw new ApplicationRuntimeException("Exception occured while getting approval details " + e); } }
From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java
License:Open Source License
private PdfPTable createEstimateDetailsTable1(final AbstractEstimate estimate) throws DocumentException { try {//from www . j av a 2s . c om final PdfPTable estimateDetailsTable1 = new PdfPTable(2); estimateDetailsTable1.setWidthPercentage(75); estimateDetailsTable1.setWidths(new float[] { 0.6f, 1f }); addRow(estimateDetailsTable1, true, centerPara("Department"), centerPara(estimate.getExecutingDepartment().getName())); addRow(estimateDetailsTable1, true, centerPara("Name of the Work"), centerPara(estimate.getName())); addRow(estimateDetailsTable1, true, centerPara("Estimate Number"), centerPara(estimate.getEstimateNumber())); return estimateDetailsTable1; } catch (final Exception e) { throw new ApplicationRuntimeException("Exception occured while estimate details method1 " + e); } }
From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java
License:Open Source License
private PdfPTable createBudgetDetailsForEstimateTable(final AbstractEstimate estimate) throws DocumentException { try {/* ww w .j av a 2 s .co m*/ final PdfPTable estBudgetDetailsTable = new PdfPTable(4); estBudgetDetailsTable.setWidthPercentage(75); estBudgetDetailsTable.setWidths(new float[] { 0.6f, 1f, 0.5f, 1f }); BigDecimal totalGrant; BigDecimal budgetAvailable; BigDecimal balOnHand; BigDecimal amtAppropriated = BigDecimal.ZERO; BigDecimal totGrantafterMultiFactor = BigDecimal.ZERO; BigDecimal totalUtilizedAmt; BigDecimal amtAppropriatedsofar = BigDecimal.ZERO; worksService.getAccountdetailtypeByName("DEPOSITCODE"); AbstractEstimateAppropriation latestAbstractEstimateAppropriation; if (abstractEstimateAppropriationList != null && !abstractEstimateAppropriationList.isEmpty()) { latestAbstractEstimateAppropriation = abstractEstimateAppropriationList .get(abstractEstimateAppropriationList.size() - 1); if (latestAbstractEstimateAppropriation != null) if (estimate.getDepositCode() == null) { if (latestAbstractEstimateAppropriation.getBudgetUsage().getConsumedAmount() != 0) { final Department dept = getDeptFromBudgtAppropriationNo( latestAbstractEstimateAppropriation.getBudgetUsage().getAppropriationnumber()); totalGrant = abstractEstimateService.getTotalGrantForYearAsOnDate( estimate.getFinancialDetails().get(0), latestAbstractEstimateAppropriation.getBudgetUsage().getFinancialYearId() .longValue(), Integer.parseInt(dept.getId().toString()), latestAbstractEstimateAppropriation.getBudgetUsage().getUpdatedTime()); final BigDecimal planningBudgetPerc = abstractEstimateService .getPlanningBudgetPercentage(estimate.getFinancialDetails().get(0), latestAbstractEstimateAppropriation.getBudgetUsage() .getFinancialYearId().longValue(), Integer.parseInt(dept.getId().toString())); if (planningBudgetPerc != null && planningBudgetPerc.compareTo(BigDecimal.ZERO) != 0) { totGrantafterMultiFactor = totalGrant .multiply(planningBudgetPerc.divide(new BigDecimal(100))); appValue = planningBudgetPerc.divide(new BigDecimal(100)).toString(); } budgetAvailable = latestAbstractEstimateAppropriation.getBalanceAvailable(); balOnHand = budgetAvailable.add(new BigDecimal( latestAbstractEstimateAppropriation.getBudgetUsage().getConsumedAmount())); amtAppropriated = totGrantafterMultiFactor.subtract(balOnHand); } } else if (latestAbstractEstimateAppropriation.getDepositWorksUsage().getConsumedAmount() .doubleValue() != 0) { totalUtilizedAmt = depositWorksUsageService.getTotalUtilizedAmountForDepositWorks( latestAbstractEstimateAppropriation.getAbstractEstimate().getFinancialDetails() .get(0), latestAbstractEstimateAppropriation.getDepositWorksUsage().getCreatedDate()); if (totalUtilizedAmt == null) totalUtilizedAmt = BigDecimal.ZERO; amtAppropriatedsofar = totalUtilizedAmt.subtract( latestAbstractEstimateAppropriation.getDepositWorksUsage().getConsumedAmount()); } } addRow(estBudgetDetailsTable, true, centerPara("Estimate Date"), centerPara(DateUtils.getFormattedDate(estimate.getEstimateDate(), "dd/MM/yyyy")), centerPara("Fund"), centerPara(estimate.getFinancialDetails().isEmpty() ? "" : estimate.getFinancialDetails().get(0).getFund().getName())); if (estimate.getDepositCode() == null) { addRow(estBudgetDetailsTable, true, centerPara("Function "), centerPara(estimate.getFinancialDetails().isEmpty() ? "" : estimate.getFinancialDetails().get(0).getFunction().getName()), centerPara("Budget Head"), centerPara(estimate.getFinancialDetails().isEmpty() ? "" : estimate.getFinancialDetails().get(0).getBudgetGroup().getName())); addRow(estBudgetDetailsTable, true, centerPara("Amount Appropriated so far"), centerPara(amtAppropriated == null ? "" : toCurrency(amtAppropriated.doubleValue())), centerPara("Estimate Amount"), centerPara(toCurrency(estimate.getTotalAmount().getValue()))); } else { addRow(estBudgetDetailsTable, true, centerPara("Function "), centerPara(estimate.getFinancialDetails().isEmpty() ? "" : estimate.getFinancialDetails().get(0).getFunction().getName()), centerPara("Deposit COA/Deposit Code"), centerPara(estimate.getFinancialDetails().isEmpty() ? "" : estimate.getFinancialDetails().get(0).getCoa().getGlcode().concat("-") .concat(estimate.getFinancialDetails().get(0).getCoa().getName()) .concat(" / ").concat(estimate.getDepositCode().getCode()))); addRow(estBudgetDetailsTable, true, centerPara("Amount Appropriated so far"), centerPara( amtAppropriatedsofar == null ? "" : toCurrency(amtAppropriatedsofar.doubleValue())), centerPara("Estimate Amount"), makePara(toCurrency(estimate.getTotalAmount().getValue()), Element.ALIGN_RIGHT)); } return estBudgetDetailsTable; } catch (final Exception e) { throw new ApplicationRuntimeException("Exception occured while estimate details method 2 " + e); } }
From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java
License:Open Source License
private PdfPTable createBalanceAmtCalculationTable(final AbstractEstimate estimate) throws DocumentException { try {/* ww w .ja va 2 s . co m*/ final PdfPTable estimateDetailsTable2 = new PdfPTable(2); estimateDetailsTable2.setWidthPercentage(75); estimateDetailsTable2.setWidths(new float[] { 0.6f, 1f }); BigDecimal budgetAvailable = BigDecimal.ZERO; BigDecimal totalUtilizedAmt; BigDecimal totalDepositAmt; BigDecimal balanceAvailable = BigDecimal.ZERO; final Accountdetailtype accountdetailtype = worksService.getAccountdetailtypeByName("DEPOSITCODE"); if (abstractEstimateAppropriationList != null && !abstractEstimateAppropriationList.isEmpty()) { final AbstractEstimateAppropriation latestAbstractEstimateAppropriation = abstractEstimateAppropriationList .get(abstractEstimateAppropriationList.size() - 1); if (latestAbstractEstimateAppropriation != null) if (estimate.getDepositCode() == null) { if (latestAbstractEstimateAppropriation.getBudgetUsage().getConsumedAmount() != 0) budgetAvailable = latestAbstractEstimateAppropriation.getBalanceAvailable(); } else if (latestAbstractEstimateAppropriation.getDepositWorksUsage().getConsumedAmount() .doubleValue() != 0) { totalDepositAmt = depositWorksUsageService.getTotalDepositWorksAmount( estimate.getDepositCode().getFund(), latestAbstractEstimateAppropriation.getAbstractEstimate().getFinancialDetails() .get(0).getCoa(), accountdetailtype, estimate.getDepositCode().getId(), latestAbstractEstimateAppropriation.getDepositWorksUsage().getAppropriationDate()); totalUtilizedAmt = depositWorksUsageService.getTotalUtilizedAmountForDepositWorks( latestAbstractEstimateAppropriation.getAbstractEstimate().getFinancialDetails() .get(0), latestAbstractEstimateAppropriation.getDepositWorksUsage().getCreatedDate()); if (totalUtilizedAmt == null) totalUtilizedAmt = BigDecimal.ZERO; balanceAvailable = BigDecimal .valueOf(totalDepositAmt.doubleValue() - totalUtilizedAmt.doubleValue()); } } if (estimate.getDepositCode() == null) addRow(estimateDetailsTable2, true, centerPara("Balance Amount Available"), centerPara(budgetAvailable == null ? "" : toCurrency(budgetAvailable.doubleValue()))); else addRow(estimateDetailsTable2, true, centerPara("Balance Amount Available"), centerPara(balanceAvailable == null ? "" : toCurrency(balanceAvailable.doubleValue()))); addRow(estimateDetailsTable2, true, centerPara("Reference"), centerPara(space1)); addRow(estimateDetailsTable2, true, centerPara("Any Other Remarks"), centerPara(space1 + "\n\n")); return estimateDetailsTable2; } catch (final Exception e) { throw new ApplicationRuntimeException( "Exception occured while estimate and budget details method 3" + e); } }