Example usage for com.lowagie.text.pdf PdfPTable getDefaultCell

List of usage examples for com.lowagie.text.pdf PdfPTable getDefaultCell

Introduction

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

Prototype

public PdfPCell getDefaultCell() 

Source Link

Document

Gets the default PdfPCell that will be used as reference for all the addCell methods except addCell(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 PdfPTable createDeductionTypeDataTable() {
    final PdfPTable createcreateDeductionTypeDataTable = new PdfPTable(11);
    createcreateDeductionTypeDataTable.getDefaultCell().setBorderWidth(1);

    // statutory/*from ww  w.  j a  v  a  2s .c o m*/
    if (!sortedStatutorySortedList.isEmpty())
        for (final StatutoryDeductionsForBill egBillPayeedetail : sortedStatutorySortedList) {
            // get tot amt for dedcution for all bill for workorder till bill date
            final BigDecimal totStatutoryAmt = getTotStatoryAmountForDeduction(egBillPayeedetail);
            final String resultTotStatuAmt = getIntDecimalParts(totStatutoryAmt);
            final String[] resultTotStatuAry = resultTotStatuAmt.split(":");

            createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
            final String resultAmt = getIntDecimalParts(
                    egBillPayeedetail.getEgBillPayeeDtls().getCreditAmount());
            final String[] resultAry = resultAmt.split(":");
            createcreateDeductionTypeDataTable.getDefaultCell().setColspan(7);
            createcreateDeductionTypeDataTable
                    .addCell(egBillPayeedetail.getEgBillPayeeDtls().getRecovery().getType());
            createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
            createcreateDeductionTypeDataTable.getDefaultCell().setColspan(1);
            createcreateDeductionTypeDataTable.addCell(resultTotStatuAry[0]);// Rs. amt all bill for workorder till billdate
            createcreateDeductionTypeDataTable.addCell(resultTotStatuAry[1]);// Pa, amt all bill for workorder till billdate
            createcreateDeductionTypeDataTable.addCell(resultAry[0]); // Rs. amt for this deduction specific to bill
            createcreateDeductionTypeDataTable.addCell(resultAry[1]);// pa. amt for this deduction specific to bill
        }
    final String type = "advanceAjustment";
    if ("advanceAjustment".equalsIgnoreCase(type)) {
        final BigDecimal totAmt = getTotAmountForAdvanceAdjustment();
        final String resultTotAmt = getIntDecimalParts(totAmt);
        final String[] resultTotAry = resultTotAmt.split(":");
        createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);

        final String resultAmt = getIntDecimalParts(advanceAdjustment);
        final String[] resultAry = resultAmt.split(":");

        createcreateDeductionTypeDataTable.getDefaultCell().setColspan(7);
        createcreateDeductionTypeDataTable.addCell("Advance adjustment ");
        createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
        createcreateDeductionTypeDataTable.getDefaultCell().setColspan(1);

        createcreateDeductionTypeDataTable.addCell(resultTotAry[0]);
        createcreateDeductionTypeDataTable.addCell(resultTotAry[1]);

        createcreateDeductionTypeDataTable.addCell(resultAry[0]); // Rs. amt for this deduction specific to bill
        createcreateDeductionTypeDataTable.addCell(resultAry[1]);// pa. amt for this deduction specific to bill
    }

    // standard deduction
    if (!sortedStandardDeductionList.isEmpty())
        for (final DeductionTypeForBill deductionTypeForBill : sortedStandardDeductionList) {
            final BigDecimal totStandardAmt = getTotStandardAmountForDeduction(deductionTypeForBill);
            final String resultTotStandardAmt = getIntDecimalParts(totStandardAmt);
            final String[] resultTotStandardAry = resultTotStandardAmt.split(":");
            createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
            final String resultAmt = getIntDecimalParts(deductionTypeForBill.getCreditamount());
            final String[] resultAry = resultAmt.split(":");
            createcreateDeductionTypeDataTable.getDefaultCell().setColspan(7);
            createcreateDeductionTypeDataTable.addCell(deductionTypeForBill.getDeductionType());
            createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
            createcreateDeductionTypeDataTable.getDefaultCell().setColspan(1);
            createcreateDeductionTypeDataTable.addCell(resultTotStandardAry[0]);// Rs. amt all bill for workorder till
            // billdate
            createcreateDeductionTypeDataTable.addCell(resultTotStandardAry[1]);// Pa, amt all bill for workorder till
            // billdate
            createcreateDeductionTypeDataTable.addCell(resultAry[0]); // Rs. amt for this deduction for this bill
            createcreateDeductionTypeDataTable.addCell(resultAry[1]);// Pa. amt for this deduction for this bill
        }

    if (!customDeductionList.isEmpty())
        for (final EgBilldetails egBilldetails : customDeductionList) {
            final BigDecimal totCustomAmt = getTotStandardAmountForDeduction(egBilldetails);
            final String resultTotCustomAmt = getIntDecimalParts(totCustomAmt);
            final String[] resultTotCustomAry = resultTotCustomAmt.split(":");
            createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
            final String resultAmt = getIntDecimalParts(egBilldetails.getCreditamount());
            final String[] resultAry = resultAmt.split(":");
            createcreateDeductionTypeDataTable.getDefaultCell().setColspan(7);
            createcreateDeductionTypeDataTable.addCell(chartOfAccountsHibernateDAO
                    .findById(Long.valueOf(egBilldetails.getGlcodeid().toString()), false).getName());
            createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
            createcreateDeductionTypeDataTable.getDefaultCell().setColspan(1);
            createcreateDeductionTypeDataTable.addCell(resultTotCustomAry[0]);// Rs. amt all bill for workorder till billdate
            createcreateDeductionTypeDataTable.addCell(resultTotCustomAry[1]);// Pa, amt all bill for workorder till billdate
            createcreateDeductionTypeDataTable.addCell(resultAry[0]); // amt for this deduction specific to bill
            createcreateDeductionTypeDataTable.addCell(resultAry[1]);
        }

    return createcreateDeductionTypeDataTable;
}

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 PdfPTable createNetPayableTable() {
    final String resultAmt = getIntDecimalParts(netPayableAmount);
    final String[] resultAry = resultAmt.split(":");
    final PdfPTable createNetPayableData = new PdfPTable(11);
    createNetPayableData.getDefaultCell().setBorderWidth(1);
    createNetPayableData.getDefaultCell().setColspan(9);
    createNetPayableData.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
    createNetPayableData.addCell(makePara(
            pdfLabel.get("contractorbill.pdf.netamount") + ":\t" + getNetPayAmtInWords(), Font.UNDERLINE));
    createNetPayableData.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
    createNetPayableData.getDefaultCell().setColspan(1);
    createNetPayableData.addCell(resultAry[0]);
    createNetPayableData.addCell(resultAry[1]);
    return createNetPayableData;
}

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 PdfPTable createWorkValueDataTable() {
    final PdfPTable createWorkValueData = new PdfPTable(11);
    createWorkValueData.getDefaultCell().setBorderWidth(1);
    createWorkValueData.getDefaultCell().setColspan(7);
    createWorkValueData.addCell(makePara(pdfLabel.get("contractorbill.pdf.valueofworkdone")));

    createWorkValueData.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
    createWorkValueData.getDefaultCell().setColspan(1);
    final BigDecimal totalBillAmtUptBill = contractorBillService.getTotalValueWoForUptoBillDate(
            egBillRegister.getBilldate(), workOrderId, mbHeader.getWorkOrderEstimate().getId());

    if (totalBillAmtUptBill.compareTo(BigDecimal.ZERO) > 0) {
        final String totalBillAmt = toCurrency(totalBillAmtUptBill.doubleValue());
        try {/*www .  jav  a  2  s .co  m*/
            createWorkValueData
                    .addCell(rightPara(blankSpace + totalBillAmt.substring(0, totalBillAmt.indexOf('.'))));
            createWorkValueData.addCell(centerPara(
                    blankSpace + totalBillAmt.substring(totalBillAmt.indexOf('.') + 1, totalBillAmt.length())));
        } catch (final StringIndexOutOfBoundsException e) {
            logger.error("----totalBillAmt has no fractional part----" + e.getMessage());
            createWorkValueData.addCell(centerPara(blankSpace + totalBillAmt));
            createWorkValueData.addCell("00");
        }

    } else {
        createWorkValueData.addCell(" ");
        createWorkValueData.addCell(" ");
    }

    BigDecimal billAmount = BigDecimal.ZERO;
    if (egBillRegister.getBillamount() != null)
        billAmount = egBillRegister.getBillamount();

    if (billAmount.compareTo(BigDecimal.ZERO) > 0) {
        final String billAmt = toCurrency(billAmount.doubleValue());
        try {
            createWorkValueData.addCell(centerPara(blankSpace + billAmt.substring(0, billAmt.indexOf('.'))));
            createWorkValueData.addCell(
                    centerPara(blankSpace + billAmt.substring(billAmt.indexOf('.') + 1, billAmt.length())));
        } catch (final StringIndexOutOfBoundsException e) {
            logger.error("---billAmt has no fractional part---" + e.getMessage());
            createWorkValueData.addCell(centerPara(blankSpace + billAmt));
            createWorkValueData.addCell("");
        }
    } else {
        createWorkValueData.addCell(" ");
        createWorkValueData.addCell(" ");
    }
    return createWorkValueData;
}

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 ww  w  . j  ava2  s . c om
    contractorBillMainTable.addCell(WorkValueLabelCell);

}

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

License:Open Source License

protected PdfPTable createWorkValueLabelTable() {
    final PdfPTable createWorkValueLabel = new PdfPTable(11);
    createWorkValueLabel.getDefaultCell().setBorderWidth(1);
    createWorkValueLabel.getDefaultCell().setColspan(7);
    createWorkValueLabel.addCell(" ");
    createWorkValueLabel.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    createWorkValueLabel.getDefaultCell().setColspan(2);
    createWorkValueLabel//  w  ww . j  a v  a2 s  . c om
            .addCell(centerPara(pdfLabel.get("contractorbill.pdf.todate") + "\n" + " Rs.       P."));
    createWorkValueLabel
            .addCell(centerPara(pdfLabel.get("contractorbill.pdf.lastbill") + "\n" + " Rs.       P."));
    return createWorkValueLabel;
}

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 createDetailsForWorkOrderData(final PdfPTable contractorBillMainTable) {
    contractorBillMainTable.getDefaultCell().setBorderWidth(1);
    contractorBillMainTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
    if (!mbHeaderList.isEmpty()) {
        int listLen = 0;
        final int mbLen = mbHeaderList.size();
        int assetLen = 0;

        if (flag && assetForBillList.size() > mbHeaderList.size())
            listLen = assetForBillList.size();
        else/*w w  w  .java  2s .  co  m*/
            listLen = mbHeaderList.size();

        if (flag)
            assetLen = assetForBillList.size();

        for (int i = 0; i < listLen; i++) {
            contractorBillMainTable.getDefaultCell().setColspan(2);
            if (i == 0)
                contractorBillMainTable.addCell(centerPara(projectCode));
            else
                contractorBillMainTable.addCell("");

            if (flag && i < assetLen)
                contractorBillMainTable.addCell(assetForBillList.get(i).getAsset().getCode() + "-"
                        + assetForBillList.get(i).getAsset().getName());
            else
                contractorBillMainTable.addCell("");
            contractorBillMainTable.getDefaultCell().setColspan(1);
            if (i < mbLen) {
                String mbRefNo = "";
                String mbFrmPgNo = "";
                String mbToPgNo = "";

                if (mbHeaderList.get(i).getMbRefNo() != null)
                    mbRefNo = mbHeaderList.get(i).getMbRefNo();

                if (mbHeaderList.get(i).getFromPageNo() != null)
                    mbFrmPgNo = mbHeaderList.get(i).getFromPageNo().toString();

                if (mbHeaderList.get(i).getToPageNo() != null)
                    mbToPgNo = mbHeaderList.get(i).getToPageNo().toString();

                contractorBillMainTable.addCell(centerPara("  " + mbRefNo));
                contractorBillMainTable.addCell(centerPara(blankSpace + mbFrmPgNo));
                contractorBillMainTable.addCell(centerPara(blankSpace + mbToPgNo));
            } else {
                contractorBillMainTable.addCell(centerPara(blankSpace));
                contractorBillMainTable.addCell(centerPara(blankSpace));
                contractorBillMainTable.addCell(centerPara(blankSpace));
            }
            contractorBillMainTable.getDefaultCell().setColspan(4);

            if (i == 0)
                contractorBillMainTable.addCell(makePara(
                        pdfLabel.get("contractorbill.pdf.estimateamt") + toCurrency(mbHeader
                                .getWorkOrderEstimate().getEstimate().getWorkValueIncludingTaxes().getValue()),
                        Element.ALIGN_LEFT));
            else
                contractorBillMainTable.addCell("");
        }
    }
}