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.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java

License:Open Source License

protected void createDeductionTypeData(final PdfPTable contractorBillMainTable) {
    contractorBillMainTable.getDefaultCell().setBorderWidth(1);
    final PdfPTable createDeductionTypeDataTable = createDeductionTypeDataTable();
    createDeductionTypeDataTable.getDefaultCell().setBorderWidth(1);
    final PdfPCell createWorkValueDataCell = new PdfPCell(createDeductionTypeDataTable);
    createWorkValueDataCell.setColspan(11);
    contractorBillMainTable.addCell(createWorkValueDataCell);
}

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

License:Open Source License

protected void createNetPayable(final PdfPTable contractorBillMainTable) {
    contractorBillMainTable.getDefaultCell().setBorderWidth(1);
    final PdfPTable createNetPayableTable = createNetPayableTable();
    createNetPayableTable.getDefaultCell().setBorderWidth(1);
    final PdfPCell createNetPayableCell = new PdfPCell(createNetPayableTable);
    createNetPayableCell.setColspan(11);
    contractorBillMainTable.addCell(createNetPayableCell);
}

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

License:Open Source License

protected void createWorkValueData(final PdfPTable contractorBillMainTable) {
    contractorBillMainTable.getDefaultCell().setBorderWidth(1);
    final PdfPTable createWorkValueDataTable = createWorkValueDataTable();
    createWorkValueDataTable.getDefaultCell().setBorderWidth(1);
    final PdfPCell createWorkValueDataCell = new PdfPCell(createWorkValueDataTable);
    createWorkValueDataCell.setColspan(11);

    contractorBillMainTable.addCell(createWorkValueDataCell);
}

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

License:Open Source License

protected void createWorkValueLabel(final PdfPTable contractorBillMainTable) {
    contractorBillMainTable.getDefaultCell().setBorderWidth(1);
    final PdfPTable WorkValueLabelTable = createWorkValueLabelTable();
    WorkValueLabelTable.getDefaultCell().setBorderWidth(1);
    final PdfPCell WorkValueLabelCell = new PdfPCell(WorkValueLabelTable);
    WorkValueLabelCell.setColspan(11);//from w w w.  ja  va2s .  c  o m
    contractorBillMainTable.addCell(WorkValueLabelCell);

}

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

License:Open Source License

protected void createDetailsForWorkOrderLabel(final PdfPTable contractorBillMainTable) {
    contractorBillMainTable.getDefaultCell().setBorderWidth(1);
    final PdfPTable detailsForWorkOrderTable = createDetailsForWorkOrderLabelTable();
    detailsForWorkOrderTable.getDefaultCell().setBorderWidth(1);
    final PdfPCell detailsForWorkOrderCell = new PdfPCell(detailsForWorkOrderTable);
    detailsForWorkOrderCell.setColspan(11);
    contractorBillMainTable.addCell(detailsForWorkOrderCell);
}

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

License:Open Source License

protected void createWorkDescRow(final PdfPTable contractorBillMainTable) {
    contractorBillMainTable.getDefaultCell().setBorderWidth(1);
    final PdfPTable workDescTable = createWorkDescTable();
    workDescTable.getDefaultCell().setBorderWidth(1);
    final PdfPCell workDescCell = new PdfPCell(workDescTable);
    workDescCell.setColspan(11);/*  www.  j a  va  2s.  c o m*/
    contractorBillMainTable.addCell(workDescCell);
}

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

License:Open Source License

protected void createContractorRow(final PdfPTable contractorBillMainTable) {
    contractorBillMainTable.getDefaultCell().setBorderWidth(1);
    final PdfPTable contractorTable = createContractorTable();
    contractorTable.getDefaultCell().setBorderWidth(1);
    final PdfPCell contractorCell = new PdfPCell(contractorTable);
    contractorCell.setColspan(11);//from w  ww .  ja v  a 2  s  .c o m
    contractorBillMainTable.addCell(contractorCell);
}

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;/*from w  ww.j  ava2 s . com*/
    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;/*ww w  .  j a  va  2 s  .co  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.measurementbook.MeasurementBookPDFGenerator.java

License:Open Source License

private PdfPTable createMbTable() throws DocumentException {
    PdfPTable mbTable;/*from ww w  .ja v a 2  s.  co  m*/
    if (includeRevisionTypeColumn) {
        mbTable = new PdfPTable(12);
        mbTable.setWidths(new float[] { 1f, 1.5f, 4f, 1.4f, 1.9f, 1.6f, 1.4f, 1.8f, 1.9f, 1.9f, 1.9f, 1.6f });
    } else {
        mbTable = new PdfPTable(11);
        mbTable.setWidths(new float[] { 1f, 1.5f, 4f, 1.9f, 1.6f, 1.4f, 1.8f, 1.9f, 1.9f, 1.9f, 1.6f });
    }
    // main table
    mbTable.setWidthPercentage(100);

    try {
        final Font font = new Font();
        font.setSize(8);
        mbTable.getDefaultCell().setPadding(3);
        mbTable.getDefaultCell().setBorderWidth(1);
        mbTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        mbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.slno"), font)));
        mbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.schno"), font)));
        mbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.descofwork"), font)));
        if (includeRevisionTypeColumn)
            mbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.revisiontype"), font)));
        mbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.completedmeasurement"), font)));
        mbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.unitrate"), font)));
        mbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.unit"), font)));
        mbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.totalvalueofcomplwork"), font)));

        // start creating tables for previous measurements
        final PdfPTable previousMbTable = createPreviousMbTable();
        final PdfPCell previousMbCell = new PdfPCell(previousMbTable);
        previousMbCell.setColspan(2);
        mbTable.addCell(previousMbCell);

        mbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.currentmeasurement"), font)));

        // last column
        mbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.currentcost"), font)));
    } catch (final RuntimeException e) {
        throw new ApplicationRuntimeException(MEASUREMENTBOOK_PDF_ERROR, e);
    }
    return mbTable;
}