List of usage examples for com.lowagie.text Element ALIGN_RIGHT
int ALIGN_RIGHT
To view the source code for com.lowagie.text Element ALIGN_RIGHT.
Click Source Link
From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java
License:Open Source License
private void addZoneYearHeader(final AbstractEstimate estimate, final CFinancialYear financialYear) throws DocumentException { document.add(spacer());//w w w. jav a 2s.c om final PdfPTable headerTable = new PdfPTable(2); headerTable.setWidthPercentage(100); headerTable.setWidths(new float[] { 1f, 1f }); Paragraph financialYearPara = new Paragraph(); if (financialYear != null) financialYearPara = makePara("Budget Year: " + financialYear.getFinYearRange(), Element.ALIGN_RIGHT); addRow(headerTable, false, makePara("Estimate Number: " + estimate.getEstimateNumber(), Element.ALIGN_LEFT), financialYearPara); document.add(headerTable); if (estimate.getWard() != null && "Ward".equalsIgnoreCase(estimate.getWard().getBoundaryType().getName()) && estimate.getWard().getParent() != null && estimate.getWard().getParent().getName() != null) document.add(makePara("Ward: " + estimate.getWard().getName() + " / Zone: " + estimate.getWard().getParent().getName(), Element.ALIGN_RIGHT)); else if (estimate.getWard() != null && "Zone".equalsIgnoreCase(estimate.getWard().getBoundaryType().getName()) && estimate.getWard().getParent() != null && estimate.getWard().getParent().getName() != null) document.add(makePara("Zone: " + estimate.getWard().getName() + " / Region: " + estimate.getWard().getParent().getName(), Element.ALIGN_RIGHT)); else if (estimate.getWard() != null) document.add(makePara("Jurisdiction: " + estimate.getWard().getName() + "(" + estimate.getWard().getBoundaryType().getName() + ")", Element.ALIGN_RIGHT)); document.add(spacer()); }
From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java
License:Open Source License
private void addZoneYearHeaderWithOutEstimateNo(final AbstractEstimate estimate, final CFinancialYear financialYear) throws DocumentException { final PdfPTable headerTable = new PdfPTable(2); headerTable.setWidthPercentage(100); headerTable.setWidths(new float[] { 1f, 1f }); Paragraph financialYearPara = new Paragraph(); if (financialYear != null) financialYearPara = makePara("Budget Year: " + financialYear.getFinYearRange(), Element.ALIGN_RIGHT); addRow(headerTable, false, new Paragraph(), financialYearPara); document.add(headerTable);/*from w w w .j av a 2 s. c om*/ if (estimate.getWard() != null && "Ward".equalsIgnoreCase(estimate.getWard().getBoundaryType().getName()) && estimate.getWard().getParent() != null && estimate.getWard().getParent().getName() != null) document.add(makePara("Ward: " + estimate.getWard().getName() + " / Zone: " + estimate.getWard().getParent().getName(), Element.ALIGN_RIGHT)); else if (estimate.getWard() != null && "Zone".equalsIgnoreCase(estimate.getWard().getBoundaryType().getName()) && estimate.getWard().getParent() != null && estimate.getWard().getParent().getName() != null) document.add(makePara("Zone: " + estimate.getWard().getName() + " / Region: " + estimate.getWard().getParent().getName(), Element.ALIGN_RIGHT)); else if (estimate.getWard() != null) document.add(makePara("Jurisdiction: " + estimate.getWard().getName() + "(" + estimate.getWard().getBoundaryType().getName() + ")", Element.ALIGN_RIGHT)); document.add(spacer()); }
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;//from w w w . j a va 2 s .c om 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
public void generatePDF() { nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(10);/*from w w w . j ava 2 s . co m*/ final List<String> tenderTypeList = worksService.getTendertypeList(); if (tenderTypeList != null && !tenderTypeList.isEmpty()) percTenderType = tenderTypeList.get(0); final String headerText = pdfLabel.get("tenderNegotiationpdf.header"); try { final Paragraph headerTextPara = new Paragraph( new Chunk(headerText, new Font(Font.UNDEFINED, LARGE_FONT, Font.BOLD))); headerTextPara.setAlignment(Element.ALIGN_CENTER); document.add(headerTextPara); document.add(makePara(cityName, Element.ALIGN_RIGHT)); if (tenderResponse != null && tenderResponse.getTenderEstimate() != null && tenderResponse.getTenderEstimate().getWorksPackage() != null) { worksPackgeReq = YES; worksPackage = tenderResponse.getTenderEstimate().getWorksPackage(); } String deptName = ""; if (YES.equalsIgnoreCase(worksPackgeReq)) { deptName = tenderResponse.getTenderEstimate().getWorksPackage().getDepartment().getName(); document.add(makePara(deptName, Element.ALIGN_RIGHT)); if (getWardList(worksPackage) != null) document.add(makePara( pdfLabel.get("tenderNegotiationpdf.ward") + "/" + pdfLabel.get("tenderNegotiationpdf.zone") + getWardList(worksPackage), Element.ALIGN_LEFT)); } else { if (tenderResponse != null && tenderResponse.getTenderEstimate() != null && tenderResponse.getTenderEstimate().getAbstractEstimate().getExecutingDepartment() != null && tenderResponse.getTenderEstimate().getAbstractEstimate().getExecutingDepartment() .getName() != null) deptName = tenderResponse.getTenderEstimate().getAbstractEstimate().getExecutingDepartment() .getName(); document.add(makePara(deptName, Element.ALIGN_RIGHT)); if (tenderResponse != null && tenderResponse.getTenderEstimate() != null && tenderResponse.getTenderEstimate().getAbstractEstimate().getWard().getParent() != null && tenderResponse.getTenderEstimate().getAbstractEstimate().getWard() != null) document.add(makePara(pdfLabel.get("tenderNegotiationpdf.ward") + "/" + pdfLabel.get("tenderNegotiationpdf.zone") + tenderResponse.getTenderEstimate().getAbstractEstimate().getWard().getName() + "/" + tenderResponse.getTenderEstimate().getAbstractEstimate().getWard().getParent() .getName(), Element.ALIGN_LEFT)); } if (YES.equalsIgnoreCase(worksPackgeReq)) document.add(makePara( pdfLabel.get("tenderNegotiationpdf.nameofwork") + tenderResponse.getTenderEstimate().getWorksPackage().getName(), Element.ALIGN_LEFT)); else if (tenderResponse != null && tenderResponse.getTenderEstimate() != null) document.add(makePara( pdfLabel.get("tenderNegotiationpdf.nameofwork") + tenderResponse.getTenderEstimate().getAbstractEstimate().getName(), Element.ALIGN_LEFT)); if (tenderResponse != null && tenderResponse.getTenderEstimate() != null && tenderResponse.getTenderEstimate().getTenderHeader() != null && tenderResponse.getTenderEstimate().getTenderHeader().getTenderNo() != null) document.add(makePara( pdfLabel.get("tenderNumber") + tenderResponse.getTenderEstimate().getTenderHeader().getTenderNo(), Element.ALIGN_LEFT)); if (tenderResponse != null && tenderResponse.getTenderEstimate() != null && tenderResponse.getTenderEstimate().getWorksPackage() != null) document.add(makePara( pdfLabel.get("tenderFileNo") + tenderResponse.getTenderEstimate().getWorksPackage().getTenderFileNumber(), Element.ALIGN_LEFT)); document.add(spacer()); String tenderDate = ""; if (tenderResponse != null && tenderResponse.getTenderEstimate() != null && tenderResponse.getTenderEstimate().getTenderHeader() != null && tenderResponse.getTenderEstimate().getTenderHeader().getTenderDate() != null) tenderDate = sdf.format(tenderResponse.getTenderEstimate().getTenderHeader().getTenderDate()); document.add( makePara(pdfLabel.get("tenderNegotiationpdf.tenderdate") + tenderDate, Element.ALIGN_RIGHT)); document.add(spacer()); PdfPTable contractorTable = null; if (tenderResponse != null) { contractorTable = createContractorTable(tenderResponse); document.add(contractorTable); } document.add(spacer()); if (tenderResponse != null && tenderResponse.getTenderEstimate().getTenderType().equalsIgnoreCase(percTenderType)) { PdfPTable negotiationTable = null; negotiationTable = createNegotiationTable(tenderResponse, tenderResponse.getTenderResponseContractors().get(0).getContractor()); document.add(negotiationTable); document.add(spacer()); if (negotiationTable != null && negotiationTable.getRows().size() > 8) document.newPage(); } else if (tenderResponse != null && !tenderResponse.getTenderEstimate().getTenderType().equalsIgnoreCase(percTenderType)) createNegotiationTableForContractors(tenderResponse); if (tenderResponse != null && tenderResponse.getNegotiationPreparedBy() != null && tenderResponse.getNegotiationPreparedBy().getEmployeeName() != null) document.add(makePara(pdfLabel.get("tenderNegotiationpdf.preparedby") + " " + tenderResponse.getNegotiationPreparedBy().getEmployeeName())); document.add(spacer()); document.add(spacer()); document.add(makePara(pdfLabel.get("tenderNegotiationpdf.checkedby"))); document.newPage(); PdfPTable approvaldetailsTable = null; if (tenderResponse != null) approvaldetailsTable = createApprovalDetailsTable(tenderResponse); if (approvaldetailsTable != null && approvaldetailsTable.getRows().size() != 1) { document.add(makePara(pdfLabel.get("tenderNegotiationpdf.approvaldetails"))); document.add(spacer()); document.add(approvaldetailsTable); } document.close(); } catch (final DocumentException e) { throw new ApplicationRuntimeException(TENDER_PDF_ERROR, e); } }
From source file:org.egov.works.web.actions.tender.TenderNegotiationPDFGenerator.java
License:Open Source License
/** * view workpackage pdf// ww w .j a va 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))); } } } }
From source file:org.egov.works.web.actions.tender.TenderNegotiationPDFGenerator.java
License:Open Source License
/** * view estimate pdf/*from www .j a v a 2s . c o m*/ */ public void createNegotiationTableData(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(); for (final TenderResponseActivity tenderResponseActivity : tenderResponse.getTenderResponseActivities()) { String schNo = ""; String description = ""; Double quantity = 0.0; double rate = 0.0; String per = ""; double befNegRate = 0.0; double befNegAmount; double aftNegRate = 0.0; double aftNegAmount; MarketRate marketRateObj; double marketRate = 0.0; double marketRateAmount = 0.0; negotiationTable.addCell(makePara(++i)); 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()); if (tenderResponseActivity.getActivity() != null && tenderResponseActivity.getActivity().getSchedule() != null && tenderResponseActivity.getActivity().getSchedule().getCode() != null) schNo = tenderResponseActivity.getActivity().getSchedule().getCode(); negotiationTable.addCell(centerPara(schNo)); negotiationTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); if (tenderResponseActivity.getActivity() != null && tenderResponseActivity.getActivity().getSchedule() != null && tenderResponseActivity.getActivity().getSchedule().getDescription() != null) description = tenderResponseActivity.getActivity().getSchedule().getDescription(); if (tenderResponseActivity.getActivity() != null && tenderResponseActivity.getActivity().getNonSor() != null && tenderResponseActivity.getActivity().getNonSor().getDescription() != null) description = tenderResponseActivity.getActivity().getNonSor().getDescription(); negotiationTable.addCell(makePara(description, Element.ALIGN_LEFT)); negotiationTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); if (tenderResponseActivity.getActivity() != null && tenderResponseActivity.getActivity().getQuantity() != 0) quantity = tenderResponseActivity.getActivity().getQuantity(); negotiationTable.addCell(centerPara(quantity)); negotiationTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); if (tenderResponseActivity.getActivity() != null && tenderResponseActivity.getActivity().getSchedule() != null && tenderResponseActivity.getActivity().getRate() != 0 && tenderResponseActivity.getActivity().getSORCurrentRate() != null) rate = tenderResponseActivity.getActivity().getSORCurrentRate().getValue(); if (tenderResponseActivity.getActivity() != null && tenderResponseActivity.getActivity().getNonSor() != null && tenderResponseActivity.getActivity().getRate() != 0) rate = tenderResponseActivity.getActivity().getRate(); negotiationTable.addCell(rightPara(formatter.format(rate))); negotiationTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); if (tenderResponseActivity.getActivity().getSchedule() != null && tenderResponseActivity.getActivity().getSchedule().getUom() != null && tenderResponseActivity.getActivity().getSchedule().getUom().getUom() != null) per = tenderResponseActivity.getActivity().getSchedule().getUom().getUom(); if (tenderResponseActivity.getActivity().getNonSor() != null && tenderResponseActivity.getActivity().getNonSor().getUom() != null && tenderResponseActivity.getActivity().getNonSor().getUom().getUom() != null) per = tenderResponseActivity.getActivity().getNonSor().getUom().getUom(); negotiationTable.addCell(centerPara(per)); final double amount = quantity * rate / uomFactor; totalAmt = totalAmt + amount; negotiationTable.addCell(rightPara(formatter.format(amount))); /** 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(); final double quotedQty = tenderResponseQuotes.getQuotedQuantity(); negotiationTable.addCell(rightPara(formatter.format(befNegRate))); befNegAmount = quotedQty * befNegRate / uomFactor; totalBefNegAmt = totalBefNegAmt + befNegAmount; negotiationTable.addCell(rightPara(formatter.format(befNegAmount))); } if (tenderResponseActivity.getNegotiatedRate() != 0.0) aftNegRate = tenderResponseActivity.getNegotiatedRate(); final double negotiatedQty = tenderResponseActivity.getNegotiatedQuantity(); negotiationTable.addCell(rightPara(formatter.format(aftNegRate))); aftNegAmount = negotiatedQty * 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; } else if (tenderResponseActivity.getActivity() != null && tenderResponseActivity.getActivity().getSchedule() != null) { marketRate = tenderResponseActivity.getActivity().getSORCurrentRate().getValue(); final double marketQty = tenderResponseActivity.getActivity().getQuantity(); marketRateAmount = marketQty * marketRate / uomFactor; } else 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))); } } }
From source file:org.egov.works.web.actions.tender.TenderNegotiationPDFGenerator.java
License:Open Source License
public void createNegotiationTableFooter(final PdfPTable negotiationTable) { negotiationTable.addCell(" "); negotiationTable.addCell(" "); final PdfPTable tenderTotalTable = createTenderTotalTable(); final PdfPCell tenderTotalTableCell = new PdfPCell(tenderTotalTable); tenderTotalTableCell.setColspan(3);/*from w w w . j a va 2s .c o m*/ negotiationTable.addCell(tenderTotalTableCell); negotiationTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); negotiationTable.addCell(" "); negotiationTable.addCell(rightPara(formatter.format(totalAmt))); negotiationTable.addCell(" "); negotiationTable.addCell(rightPara(formatter.format(totalBefNegAmt))); negotiationTable.addCell(" "); negotiationTable.addCell(rightPara(formatter.format(totalAftNegAmt))); negotiationTable.addCell(" "); negotiationTable.addCell(rightPara(formatter.format(totalMarketRateAmt))); }
From source file:org.egov.works.web.actions.tender.TenderNegotiationPDFGenerator.java
License:Open Source License
public void addRowFooter(final PdfPTable negotiationTable) { negotiationTable.addCell(" "); negotiationTable.addCell(" "); final PdfPTable tenderPercentageTable = createTenderPercentageTable(); final PdfPCell tenderPercentageTableCell = new PdfPCell(tenderPercentageTable); tenderPercentageTableCell.setColspan(5); negotiationTable.addCell(tenderPercentageTableCell); negotiationTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); final PdfPTable befTenderNegFormulaTable = createBefTenderNegFormulaTable(); final PdfPCell befTenderNegFormulaTableCell = new PdfPCell(befTenderNegFormulaTable); befTenderNegFormulaTableCell.setColspan(2); negotiationTable.addCell(befTenderNegFormulaTableCell); final PdfPTable aftTenderNegFormulaTable = createAftTenderNegFormulaTable(); final PdfPCell aftTenderNegFormulaTableCell = new PdfPCell(aftTenderNegFormulaTable); aftTenderNegFormulaTableCell.setColspan(2); negotiationTable.addCell(aftTenderNegFormulaTableCell); final PdfPTable marketTenderNegFormulaTable = createMarketTenderNegFormulaTable(); final PdfPCell marketTenderNegFormulaTableCell = new PdfPCell(marketTenderNegFormulaTable); marketTenderNegFormulaTableCell.setColspan(2); negotiationTable.addCell(marketTenderNegFormulaTableCell); }
From source file:org.egov.works.web.actions.tender.TenderNegotiationPDFGenerator.java
License:Open Source License
public void addTotalQuotedFooter(final PdfPTable negotiationTable) { negotiationTable.addCell(" "); negotiationTable.addCell(" "); final PdfPTable tenderQuotedTable = createTotalQuotedValueTable(); final PdfPCell tenderQuotedTableCell = new PdfPCell(tenderQuotedTable); tenderQuotedTableCell.setColspan(5); negotiationTable.addCell(tenderQuotedTableCell); negotiationTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); final PdfPTable befTenderNegQuotedTable = createBefTenderNegQuotedTable(); final PdfPCell befTenderNegQuotedTableCell = new PdfPCell(befTenderNegQuotedTable); befTenderNegQuotedTableCell.setColspan(2); negotiationTable.addCell(befTenderNegQuotedTableCell); final PdfPTable aftTenderNegQuotedTable = createAftTenderNegQuotedTable(); final PdfPCell aftTenderNegQuotedTableCell = new PdfPCell(aftTenderNegQuotedTable); aftTenderNegQuotedTableCell.setColspan(2); negotiationTable.addCell(aftTenderNegQuotedTableCell); final PdfPTable marketTenderNegTable = createMarketTenderNegTable(); final PdfPCell marketTenderNegTableCell = new PdfPCell(marketTenderNegTable); marketTenderNegTableCell.setColspan(2); negotiationTable.addCell(marketTenderNegTableCell); }
From source file:org.egov.works.web.actions.tender.TenderNegotiationPDFGenerator.java
License:Open Source License
public PdfPTable createBefTenderNegFormulaTable() { final double totTenderBefNegPer = tenderResponse.getPercQuotedRate(); final PdfPTable befTenderNegFormulaTable = new PdfPTable(2); befTenderNegFormulaTable.getDefaultCell().setBorderWidth(1); befTenderNegFormulaTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); befTenderNegFormulaTable.getDefaultCell().setColspan(2); String formated_perc = null;// w w w. j a v a2 s. com if (tenderResponse.getTenderEstimate().getTenderType().equalsIgnoreCase(percTenderType)) formated_perc = nf.format(totTenderBefNegPer); else formated_perc = formatter.format(Math.abs(totTenderBefNegPer)); befTenderNegFormulaTable .addCell(makePara((totTenderBefNegPer > 0 ? POSITIVE_SIGN : NEGATIVE_SIGN) + formated_perc + "%")); return befTenderNegFormulaTable; }