List of usage examples for com.lowagie.text.pdf PdfPTable getDefaultCell
public PdfPCell getDefaultCell()
PdfPCell
that will be used as reference for all the addCell
methods except addCell(PdfPCell)
. From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java
License:Open Source License
protected PdfPTable createDetailsForWorkOrderLabelTable() { final PdfPTable detailsForWorkOrderLabel = new PdfPTable(11); detailsForWorkOrderLabel.getDefaultCell().setBorderWidth(1); detailsForWorkOrderLabel.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); detailsForWorkOrderLabel.getDefaultCell().setColspan(2); detailsForWorkOrderLabel.addCell(pdfLabel.get("contractorbill.pdf.projectcode")); detailsForWorkOrderLabel.addCell(pdfLabel.get("contractorbill.pdf.assetcode")); detailsForWorkOrderLabel.getDefaultCell().setColspan(1); detailsForWorkOrderLabel.addCell(pdfLabel.get("contractorbill.pdf.Mbno")); detailsForWorkOrderLabel.getDefaultCell().setColspan(2); detailsForWorkOrderLabel.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); detailsForWorkOrderLabel.addCell(blankSpace15 + pdfLabel.get("contractorbill.pdf.pages") + "\n" + blankSpace8 + pdfLabel.get("contractorbill.pdf.from") + blankSpace8 + pdfLabel.get("contractorbill.pdf.to")); detailsForWorkOrderLabel.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); detailsForWorkOrderLabel.getDefaultCell().setColspan(4); detailsForWorkOrderLabel.addCell(pdfLabel.get("contractorbill.pdf.estimateno") + " " + estimateNumber); return detailsForWorkOrderLabel; }
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);/*from w w w . ja v a 2 s .c om*/ contractorBillMainTable.addCell(workDescCell); }
From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java
License:Open Source License
protected PdfPTable createWorkDescTable() { final PdfPTable workDescTable = new PdfPTable(11); workDescTable.getDefaultCell().setBorderWidth(1); workDescTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); workDescTable.getDefaultCell().setColspan(7); workDescTable//from w ww . j av a2s. c om .addCell(pdfLabel.get("contractorbill.pdf.workdescription") + newLine + workDescription + newLine); workDescTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); workDescTable.getDefaultCell().setColspan(4); workDescTable.addCell(pdfLabel.get("contractorbill.pdf.workcommencedon") + workcommencedOn + newLine + pdfLabel.get("contractorbill.pdf.workcompleteon") + workCompletedOn + newLine); return workDescTable; }
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);/*w ww . java 2s . c om*/ contractorBillMainTable.addCell(contractorCell); }
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.measurementbook.MeasurementBookPDFGenerator.java
License:Open Source License
private PdfPTable createMbTable() throws DocumentException { PdfPTable mbTable; 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 {/*from w w w . j a v a2s . co m*/ 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; }
From source file:org.egov.works.web.actions.measurementbook.MeasurementBookPDFGenerator.java
License:Open Source License
public PdfPTable createPreviousMbTable() { final PdfPTable previousMbTable = new PdfPTable(2); final Font font = new Font(); font.setSize(8);/*from ww w .j av a 2 s.co m*/ previousMbTable.getDefaultCell().setBorderWidth(1); previousMbTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); previousMbTable.getDefaultCell().setColspan(2); previousMbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.previousmeasurement"), font))); previousMbTable.getDefaultCell().setColspan(1); previousMbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.pageno"), font))); previousMbTable.addCell(new PdfPCell(new Phrase(pdfLabel.get("mbpdf.measurements"), font))); return previousMbTable; }
From source file:org.egov.works.web.actions.measurementbook.MeasurementBookPDFGenerator.java
License:Open Source License
private PdfPTable createMbData(final PdfPTable mbTable, final MBHeader mbHeader) { Integer i = 0;/*w w w . j a v a 2 s . c o m*/ double uomFactor = 0.0; // iterating mbdetails for (final MBDetails mbDetails : mbHeader.getMbDetails()) { String description = ""; String per = ""; String schNo = ""; double currentMeasurement; currentMeasurement = mbDetails.getQuantity(); ++i; mbTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); mbTable.addCell(rightPara(8, i.toString())); final WorkOrderActivity workOrderActivity = mbDetails.getWorkOrderActivity(); final Activity activity = workOrderActivity.getActivity(); if (activity != null) { if (activity.getSchedule() != null && activity.getSchedule().getCode() != null) schNo = activity.getSchedule().getCode(); mbTable.addCell(rightPara(8, schNo)); // start sor/non sor description if (activity.getSchedule() != null && activity.getSchedule().getDescription() != null) description = activity.getSchedule().getDescription(); if (activity.getNonSor() != null && activity.getNonSor().getDescription() != null) description = activity.getNonSor().getDescription(); mbTable.addCell(makeParaWithFont(8, description, Element.ALIGN_LEFT)); // end sor/non sor description } // for completedMeasurement area --------------->Cumulative quantity // including current entry= Cumulative upto previous entry + Current // MB entry // ( cumulative MB measurement for line item) for selected MB // including MB entry if (includeRevisionTypeColumn) { if (activity.getRevisionType() == null) mbTable.addCell(makePara(8, "")); if (activity.getRevisionType() != null && activity.getRevisionType().toString() .equalsIgnoreCase(RevisionType.NON_TENDERED_ITEM.toString())) mbTable.addCell(makePara(8, "Non Tendered")); if (activity.getRevisionType() != null && activity.getRevisionType().toString() .equalsIgnoreCase(RevisionType.LUMP_SUM_ITEM.toString())) mbTable.addCell(makePara(8, "Lump Sum")); } double completedMeasurement; double cumlPrevMb; try { long woaId = 0l; if (workOrderActivity.getId() != null) woaId = workOrderActivity.getId(); cumlPrevMb = measurementBookService.prevCumulativeQuantityIncludingCQ(woaId, mbHeader.getId(), workOrderActivity.getActivity().getId(), mbHeader.getWorkOrder()); } catch (final Exception e) { cumlPrevMb = 0.0; } completedMeasurement = cumlPrevMb + currentMeasurement; mbTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); mbTable.addCell(rightPara(8, completedMeasurement)); double approveRateWo = workOrderActivity.getApprovedRate(); mbTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); mbTable.addCell(rightPara(8, formatter.format(approveRateWo))); // start unit if (activity != null) { // umofactor for conversion of rate and amount uomFactor = activity.getConversionFactor(); if (logger.isDebugEnabled()) logger.debug("----------uomFactor------------" + uomFactor); mbTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); if (activity.getSchedule() != null && activity.getSchedule().getUom() != null && activity.getSchedule().getUom().getUom() != null) per = activity.getSchedule().getUom().getUom(); if (activity.getNonSor() != null && activity.getNonSor().getUom() != null && activity.getNonSor().getUom().getUom() != null) per = activity.getNonSor().getUom().getUom(); mbTable.addCell(centerPara(8, per)); // end start unit } // end of if activity /* * measurementBookService.prevCumulativeAmount(workOrderActivity.getId ()); total work completed------->(completed * mesurement(col 5) * rate) here rate is wo.getAprovedrate added uom factor on april4th 2010 */ final double workCompleted = completedMeasurement * approveRateWo * uomFactor; mbTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); mbTable.addCell(rightPara(8, formatter.format(workCompleted))); // previous measurements a)pageno and b)measurements // a)Page no: for last MB entry for forline item---->page-no call // api Integer frompageNo = null; Integer topageNo = null; final MBHeader resultHeader = workOrderService.findLastMBPageNoForLineItem(workOrderActivity, mbHeader.getId()); if (resultHeader != null) { frompageNo = resultHeader.getFromPageNo(); topageNo = resultHeader.getToPageNo(); } String pageNoInfo = ""; if (frompageNo != null) pageNoInfo = resultHeader.getMbRefNo() + "/" + frompageNo.toString(); if (topageNo != null) pageNoInfo = pageNoInfo + "-" + topageNo; mbTable.addCell(rightPara(8, pageNoInfo)); // b)Cumulative measurement recorded for the previous MB entry for // line item( Cumulative measurements-current MB entry) mbTable.addCell(rightPara(8, cumlPrevMb)); // Current Finalised Measurements a)Current MB entry and b) Column6 // Estimate Percentage // a)Current MB entry---->Measurements (Col5-8) i.e (area-previous // measurement) mbTable.addCell(rightPara(8, currentMeasurement)); // current cost double currentCost; currentCost = currentMeasurement * approveRateWo * uomFactor; mbTable.addCell(rightPara(8, formatter.format(currentCost))); // } //end of if mbDetails } // end of for loop return mbTable; }
From source file:org.egov.works.web.actions.tender.TenderNegotiationPDFGenerator.java
License:Open Source License
/** * create negotiation table main table/*from w ww . j ava 2 s . c o m*/ * * @param tenderResponse * @return * @throws DocumentException * @throws ApplicationException */ private PdfPTable createNegotiationTable(final TenderResponse tenderResponse, final Contractor contractor) throws DocumentException { final PdfPTable negotiationTable = new PdfPTable(13); negotiationTable.setWidthPercentage(100); negotiationTable.setWidths( new float[] { 0.5f, 1f, 3.6f, 1.5f, 1.1f, 0.9f, 1.5f, 1.7f, 1.7f, 1.7f, 1.7f, 1.7f, 1.7f }); try { negotiationTable.getDefaultCell().setPadding(5); negotiationTable.getDefaultCell().setBorderWidth(1); negotiationTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); negotiationTable.addCell(pdfLabel.get("tenderNegotiationpdf.slno")); negotiationTable.addCell(pdfLabel.get("tenderNegotiationpdf.scheduleno")); negotiationTable.addCell(pdfLabel.get("tenderNegotiationpdf.descofwork")); negotiationTable.addCell(pdfLabel.get("tenderNegotiationpdf.quantity")); /** * start creating tables for Estimate, before negotion, after negotiation and marketRate */ final PdfPTable estimateTable = createAsPerEstimateTable(tenderResponse); estimateTable.setWidths(new float[] { 0.45f, 0.37f, 0.62f }); final PdfPCell estimateCell = new PdfPCell(estimateTable); estimateCell.setColspan(3); negotiationTable.addCell(estimateCell); final PdfPTable beforeNegotiationTable = createBeforeNegotiationTable(tenderResponse); final PdfPCell beforeNegotiationCell = new PdfPCell(beforeNegotiationTable); beforeNegotiationCell.setColspan(2); negotiationTable.addCell(beforeNegotiationCell); final PdfPTable afterNegotiationTable = createAfterNegotiationTable(tenderResponse); final PdfPCell afterNegotiationCell = new PdfPCell(afterNegotiationTable); afterNegotiationCell.setColspan(2); negotiationTable.addCell(afterNegotiationCell); final PdfPTable marketRateTable = createMarketRateTable(tenderResponse); final PdfPCell marketRateCell = new PdfPCell(marketRateTable); marketRateCell.setColspan(2); negotiationTable.addCell(marketRateCell); /** * end creating tables for before negotion, after negotiation and marketRate */ if (YES.equalsIgnoreCase(worksPackgeReq)) createNegotiationTableDataForWp(tenderResponse, negotiationTable, contractor); else createNegotiationTableData(tenderResponse, negotiationTable, contractor); createNegotiationTableFooter(negotiationTable); addRowFooter(negotiationTable); addTotalQuotedFooter(negotiationTable); addFinalRow(negotiationTable, tenderResponse); } catch (final DocumentException e) { throw new ApplicationRuntimeException(TENDER_PDF_ERROR, e); } return negotiationTable; }
From source file:org.egov.works.web.actions.tender.TenderNegotiationPDFGenerator.java
License:Open Source License
/** * view workpackage pdf//from www . j a v a 2 s . c o m */ public void createNegotiationTableDataForWp(final TenderResponse tenderResponse, final PdfPTable negotiationTable, final Contractor contractor) { Date asOnDate = null; if (tenderResponse.getNegotiationDate() != null) asOnDate = tenderResponse.getNegotiationDate(); int i = 0; final Map<String, Integer> exceptionaSorMap = worksService.getExceptionSOR(); totalBefNegAmt = 0; totalAmt = 0; totalAftNegAmt = 0; totalMarketRateAmt = 0; for (final TenderResponseActivity tenderResponseActivity : tenderResponse.getTenderResponseActivities()) { String schNo; String description; Double quantity = 0.0; double rate; String per; double befNegRate = 0.0; double befNegAmount; double aftNegRate = 0.0; double aftNegAmount; MarketRate marketRateObj; double marketRate = 0.0; double marketRateAmount = 0.0; double uomFactor = 1; if (tenderResponseActivity != null) { if (tenderResponseActivity.getActivity() != null && tenderResponseActivity.getActivity().getSchedule() != null && tenderResponseActivity.getActivity().getSchedule().getCode() != null && exceptionaSorMap.containsKey(tenderResponseActivity.getActivity().getUom().getUom())) uomFactor = exceptionaSorMap.get(tenderResponseActivity.getActivity().getUom().getUom()); final Map<String, Object> rateQtyMap = processLatestRateAndQtyForLineItem( worksPackage.getActivitiesForEstimate(), tenderResponseActivity.getActivity()); if (rateQtyMap != null && !rateQtyMap.isEmpty()) { negotiationTable.addCell(makePara(++i)); schNo = (String) rateQtyMap.get("sorcode"); negotiationTable.addCell(centerPara(schNo)); negotiationTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); description = (String) rateQtyMap.get("desc"); negotiationTable.addCell(makePara(description, Element.ALIGN_LEFT)); negotiationTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); quantity = (Double) rateQtyMap.get("qty"); negotiationTable.addCell(centerPara(formatter.format(quantity))); negotiationTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); rate = (Double) rateQtyMap.get("rate"); negotiationTable.addCell(rightPara(formatter.format(rate))); negotiationTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); per = (String) rateQtyMap.get("per"); negotiationTable.addCell(centerPara(per)); negotiationTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); final double amount = (Double) rateQtyMap.get("amt"); negotiationTable.addCell(rightPara(formatter.format(amount))); totalAmt = totalAmt + amount; } if (rateQtyMap != null && rateQtyMap.get("slno") != null) { /** * before negotiation */ negotiationTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); for (final TenderResponseQuotes tenderResponseQuotes : tenderResponseActivity .getTenderResponseQuotes()) if (tenderResponseQuotes.getContractor().getId() == contractor.getId()) { if (tenderResponseQuotes.getQuotedRate() != 0.0) befNegRate = tenderResponseQuotes.getQuotedRate(); negotiationTable.addCell(rightPara(formatter.format(befNegRate))); befNegAmount = quantity * befNegRate / uomFactor; totalBefNegAmt = totalBefNegAmt + befNegAmount; negotiationTable.addCell(rightPara(formatter.format(befNegAmount))); } if (tenderResponseActivity.getNegotiatedRate() != 0.0) aftNegRate = tenderResponseActivity.getNegotiatedRate(); negotiationTable.addCell(rightPara(formatter.format(aftNegRate))); aftNegAmount = quantity * aftNegRate / uomFactor; totalAftNegAmt = totalAftNegAmt + aftNegAmount; negotiationTable.addCell(rightPara(formatter.format(aftNegAmount))); if (tenderResponseActivity.getActivity() != null && tenderResponseActivity.getActivity().getSchedule() != null && asOnDate != null && tenderResponseActivity.getActivity().getSchedule().hasValidMarketRateFor(asOnDate)) { marketRateObj = tenderResponseActivity.getActivity().getSchedule() .getMarketRateOn(asOnDate); marketRate = marketRateObj.getMarketRate().getValue(); marketRateAmount = quantity * marketRate / uomFactor; } if (tenderResponseActivity.getActivity() != null && tenderResponseActivity.getActivity().getSchedule() != null && asOnDate != null && !tenderResponseActivity.getActivity().getSchedule() .hasValidMarketRateFor(asOnDate)) { marketRate = tenderResponseActivity.getActivity().getRate(); marketRateAmount = quantity * marketRate; } if (tenderResponseActivity.getActivity() != null && tenderResponseActivity.getActivity().getNonSor() != null) { marketRate = tenderResponseActivity.getActivity().getRate(); final double marketQty = tenderResponseActivity.getActivity().getQuantity(); marketRateAmount = marketQty * marketRate; } negotiationTable.addCell(rightPara(formatter.format(marketRate))); totalMarketRateAmt = totalMarketRateAmt + marketRateAmount; negotiationTable.addCell(rightPara(formatter.format(marketRateAmount))); } } } }