List of usage examples for com.lowagie.text.pdf PdfPTable addCell
public void addCell(Phrase phrase)
From source file:com.qcadoo.mes.genealogiesForComponents.GenealogyForComponentView.java
License:Open Source License
private void addOrderSeries(final Document document, final Entity entity, final List<String> orderHeader) throws DocumentException { PdfPTable table = pdfHelper.createTableWithHeader(4, orderHeader, false); List<Entity> genealogies = getGenealogies(entity); Collections.sort(genealogies, new EntityOrderNumberComparator()); for (Entity genealogy : genealogies) { Entity order = (Entity) genealogy.getField("order"); table.addCell(new Phrase(order.getField("number").toString(), FontUtils.getDejavuRegular9Dark())); table.addCell(new Phrase(order.getField("name").toString(), FontUtils.getDejavuRegular9Dark())); Entity product = (Entity) order.getField("product"); if (product == null) { table.addCell(new Phrase("", FontUtils.getDejavuRegular9Dark())); } else {//w w w . j av a2 s .c o m table.addCell(new Phrase(product.getField("name").toString(), FontUtils.getDejavuRegular9Dark())); } table.addCell( new Phrase(genealogy.getField(BATCH_FIELD).toString(), FontUtils.getDejavuRegular9Dark())); } document.add(table); }
From source file:com.qcadoo.mes.materialFlow.print.pdf.MaterialFlowPdfService.java
License:Open Source License
@Override protected void buildPdfContent(final Document document, final Entity materialsInLocation, final Locale locale) throws DocumentException { Map<Entity, BigDecimal> reportData = materialFlowService .calculateMaterialQuantitiesInLocation(materialsInLocation); String documenTitle = translationService.translate("materialFlow.materialFlow.report.title", locale); String documentAuthor = translationService.translate("qcadooReport.commons.generatedBy.label", locale); pdfHelper.addDocumentHeader(document, "", documenTitle, documentAuthor, (Date) materialsInLocation.getField(TIME), materialsInLocation.getStringField(WORKER)); PdfPTable panelTable = pdfHelper.createPanelTable(2); pdfHelper.addTableCellAsOneColumnTable(panelTable, translationService.translate("materialFlow.materialFlow.report.panel.materialFlowForDate", locale), ((Date) materialsInLocation.getField(MATERIAL_FLOW_FOR_DATE)).toString()); pdfHelper.addTableCellAsOneColumnTable(panelTable, translationService.translate("materialFlow.materialFlow.report.panel.time", locale), ((Date) materialsInLocation.getField(TIME)).toString()); List<Entity> materialsInLocationComponents = materialsInLocation .getHasManyField(MATERIALS_IN_LOCATION_COMPONENTS); List<String> names = new ArrayList<String>(); for (Entity materialsInLocationComponent : materialsInLocationComponents) { Entity location = (Entity) materialsInLocationComponent.getField(LOCATION); names.add(location.getField(NUMBER).toString()); }//from ww w.j a va 2 s.co m pdfHelper.addTableCellAsOneColumnTable(panelTable, translationService.translate("materialFlow.materialFlow.report.panel.locations", locale), names); pdfHelper.addTableCellAsOneColumnTable(panelTable, "", ""); panelTable.setSpacingBefore(20); panelTable.setSpacingAfter(20); document.add(panelTable); List<String> tableHeader = new ArrayList<String>(); Map<String, HeaderAlignment> alignments = Maps.newHashMap(); tableHeader .add(translationService.translate("materialFlow.materialFlow.report.columnHeader.number", locale)); tableHeader.add(translationService.translate("materialFlow.materialFlow.report.columnHeader.name", locale)); tableHeader.add( translationService.translate("materialFlow.materialFlow.report.columnHeader.quantity", locale)); tableHeader.add(translationService.translate("materialFlow.materialFlow.report.columnHeader.unit", locale)); alignments.put(translationService.translate("materialFlow.materialFlow.report.columnHeader.number", locale), HeaderAlignment.LEFT); alignments.put(translationService.translate("materialFlow.materialFlow.report.columnHeader.name", locale), HeaderAlignment.LEFT); alignments.put( translationService.translate("materialFlow.materialFlow.report.columnHeader.quantity", locale), HeaderAlignment.RIGHT); alignments.put(translationService.translate("materialFlow.materialFlow.report.columnHeader.unit", locale), HeaderAlignment.LEFT); PdfPTable table = pdfHelper.createTableWithHeader(4, tableHeader, false, alignments); for (Map.Entry<Entity, BigDecimal> data : reportData.entrySet()) { table.addCell(new Phrase(data.getKey().getStringField(NUMBER), FontUtils.getDejavuRegular7Dark())); table.addCell(new Phrase(data.getKey().getStringField(NAME), FontUtils.getDejavuRegular7Dark())); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(new Phrase(numberService.format(data.getValue()), FontUtils.getDejavuRegular7Dark())); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(new Phrase(data.getKey().getStringField(UNIT), FontUtils.getDejavuRegular7Dark())); } document.add(table); }
From source file:com.qcadoo.mes.materialRequirements.print.pdf.MaterialRequirementPdfService.java
License:Open Source License
private void addTechnologySeries(final Document document, final Entity materialRequirement, final Map<String, HeaderAlignment> headersWithAlignments) throws DocumentException { List<Entity> orders = materialRequirement.getManyToManyField(MaterialRequirementFields.ORDERS); MrpAlgorithm algorithm = MrpAlgorithm .parseString(materialRequirement.getStringField(MaterialRequirementFields.MRP_ALGORITHM)); Map<Long, BigDecimal> neededProductQuantities = productQuantitiesService.getNeededProductQuantities(orders, algorithm, true);//from w ww .j a v a 2 s .c o m // TODO LUPO fix comparator // neededProductQuantities = SortUtil.sortMapUsingComparator(neededProductQuantities, new EntityNumberComparator()); List<String> headers = Lists.newLinkedList(headersWithAlignments.keySet()); PdfPTable table = pdfHelper.createTableWithHeader(headersWithAlignments.size(), headers, true, defaultOrderHeaderColumnWidth, headersWithAlignments); for (Entry<Long, BigDecimal> neededProductQuantity : neededProductQuantities.entrySet()) { Entity product = productQuantitiesService.getProduct(neededProductQuantity.getKey()); table.addCell( new Phrase(product.getStringField(ProductFields.NUMBER), FontUtils.getDejavuRegular7Dark())); table.addCell( new Phrase(product.getStringField(ProductFields.NAME), FontUtils.getDejavuRegular7Dark())); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(new Phrase(numberService.format(neededProductQuantity.getValue()), FontUtils.getDejavuBold7Dark())); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); String unit = product.getStringField(ProductFields.UNIT); if (unit == null) { table.addCell(new Phrase("", FontUtils.getDejavuRegular7Dark())); } else { table.addCell(new Phrase(unit, FontUtils.getDejavuRegular7Dark())); } } document.add(table); }
From source file:com.qcadoo.mes.materialRequirements.print.pdf.MaterialRequirementPdfService.java
License:Open Source License
private void addOrderSeries(final Document document, final Entity materialRequirement, final Map<String, HeaderAlignment> headersWithAlignments) throws DocumentException { List<Entity> orders = materialRequirement.getManyToManyField(MaterialRequirementFields.ORDERS); Collections.sort(orders, new EntityOrderNumberComparator()); List<String> headers = Lists.newLinkedList(headersWithAlignments.keySet()); PdfPTable table = pdfHelper.createTableWithHeader(headersWithAlignments.size(), headers, true, defaultMatReqHeaderColumnWidth, headersWithAlignments); for (Entity order : orders) { table.addCell(new Phrase(order.getStringField(OrderFields.NUMBER), FontUtils.getDejavuRegular7Dark())); table.addCell(new Phrase(order.getStringField(OrderFields.NAME), FontUtils.getDejavuRegular7Dark())); Entity product = (Entity) order.getField(OrderFields.PRODUCT); if (product == null) { table.addCell(new Phrase("", FontUtils.getDejavuRegular7Dark())); BigDecimal plannedQuantity = order.getDecimalField(OrderFields.PLANNED_QUANTITY); plannedQuantity = (plannedQuantity == null) ? BigDecimal.ZERO : plannedQuantity; table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(new Phrase(numberService.format(plannedQuantity), FontUtils.getDejavuRegular7Dark())); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(new Phrase("", FontUtils.getDejavuRegular7Dark())); } else {//from ww w . j a v a 2 s . c om table.addCell( new Phrase(product.getStringField(ProductFields.NAME), FontUtils.getDejavuRegular7Dark())); BigDecimal plannedQuantity = order.getDecimalField(OrderFields.PLANNED_QUANTITY); plannedQuantity = (plannedQuantity == null) ? BigDecimal.ZERO : plannedQuantity; table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(new Phrase(numberService.format(plannedQuantity), FontUtils.getDejavuRegular7Dark())); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); String unit = product.getStringField(ProductFields.UNIT); if (unit == null) { table.addCell(new Phrase("", FontUtils.getDejavuRegular7Dark())); } else { table.addCell(new Phrase(unit, FontUtils.getDejavuRegular7Dark())); } } } document.add(table); }
From source file:com.qcadoo.mes.orders.print.OrderReportPdf.java
License:Open Source License
private void addTableToDocument(Document document, Entity orderEntity, Locale locale, String headerKey, Map<String, String> values) throws DocumentException { document.add(//from ww w. j av a 2 s . com new Paragraph(translationService.translate(headerKey, locale), FontUtils.getDejavuBold10Dark())); Map<String, HeaderAlignment> headerValues = Maps.newLinkedHashMap(); for (String key : values.keySet()) { headerValues.put(translationService.translate(String.format(L_TRANSLATION_PATH, key), locale), HeaderAlignment.LEFT); } PdfPTable table = pdfHelper.createTableWithHeader(values.size(), Lists.newArrayList(headerValues.keySet()), false, headerValues); table.getDefaultCell().disableBorderSide(PdfPCell.RIGHT); table.getDefaultCell().disableBorderSide(PdfPCell.LEFT); table.setHeaderRows(1); for (String value : values.values()) { table.addCell(createCell(value, Element.ALIGN_LEFT)); } table.setSpacingAfter(20); document.add(table); }
From source file:com.qcadoo.mes.productionCounting.print.ProductionBalancePdfService.java
License:Open Source License
@Override protected void buildPdfContent(final Document document, final Entity productionBalance, final Locale locale) throws DocumentException { String documentTitle = translationService.translate("productionCounting.productionBalance.report.title", locale);//from ww w .ja va 2 s .c om String documentAuthor = translationService.translate("qcadooReport.commons.generatedBy.label", locale); pdfHelper.addDocumentHeader(document, "", documentTitle, documentAuthor, productionBalance.getDateField(ProductionBalanceFields.DATE)); PdfPTable leftPanel = createLeftPanel(productionBalance, locale); PdfPTable rightPanel = createRightPanel(productionBalance, locale); PdfPTable panelTable = pdfHelper.createPanelTable(2); panelTable.addCell(leftPanel); panelTable.addCell(rightPanel); panelTable.setSpacingAfter(20); panelTable.setSpacingBefore(20); document.add(panelTable); Entity order = productionBalance.getBelongsToField(ProductionBalanceFields.ORDER); if (order.getBooleanField(OrderFieldsPC.REGISTER_QUANTITY_IN_PRODUCT)) { addInputProductsBalance(document, productionBalance, locale); } if (order.getBooleanField(OrderFieldsPC.REGISTER_QUANTITY_OUT_PRODUCT)) { addOutputProductsBalance(document, productionBalance, locale); } String calculateOperationCostMode = productionBalance .getStringField(ProductionBalanceFields.CALCULATE_OPERATION_COST_MODE); if (productionCountingService.isCalculateOperationCostModeHourly(calculateOperationCostMode)) { if (productionCountingService.isTypeOfProductionRecordingForEach( order.getStringField(OrderFieldsPC.TYPE_OF_PRODUCTION_RECORDING))) { addMachineTimeBalance(document, productionBalance, locale); addLaborTimeBalance(document, productionBalance, locale); } else { addTimeBalanceAsPanel(document, productionBalance, locale); } } else if (productionCountingService.isCalculateOperationCostModePiecework(calculateOperationCostMode)) { addPieceworkBalance(document, productionBalance, locale); } }
From source file:com.qcadoo.mes.productionCounting.print.ProductionBalancePdfService.java
License:Open Source License
private void addTableCellAsTable(final PdfPTable table, final String label, final Object fieldValue, final String nullValue, final Font headerFont, final Font valueFont, final DecimalFormat df) { PdfPTable cellTable = new PdfPTable(2); cellTable.getDefaultCell().setBorder(PdfPCell.NO_BORDER); cellTable.addCell(new Phrase(label, headerFont)); Object value = fieldValue;// w w w .j a v a 2s. c om if (value == null) { cellTable.addCell(new Phrase(nullValue, valueFont)); } else { if (value instanceof BigDecimal && df != null) { cellTable.addCell(new Phrase(df.format(value), valueFont)); } else { cellTable.addCell(new Phrase(value.toString(), valueFont)); } } table.addCell(cellTable); }
From source file:com.qcadoo.mes.productionCounting.print.ProductionBalancePdfService.java
License:Open Source License
public PdfPTable createRightPanel(final Entity productionBalance, final Locale locale) { Entity order = productionBalance.getBelongsToField(ProductionBalanceFields.ORDER); PdfPTable rightPanel = pdfHelper.createPanelTableWithSimpleFormat(1); rightPanel .addCell(new Phrase( translationService.translate( "productionCounting.productionBalance.report.panel.countingParameters", locale), FontUtils.getDejavuBold10Dark())); addTableCellAsTable(rightPanel,//from www . j a v a2 s . c o m L_TABS + translationService.translate( "productionCounting.productionBalance.report.panel.typeOfProductionRecording", locale), translationService.translate("productionCounting.productionBalance.typeOfProductionRecording." + order.getField(OrderFieldsPC.TYPE_OF_PRODUCTION_RECORDING), locale), null, FontUtils.getDejavuBold9Dark(), FontUtils.getDejavuBold9Dark(), null); rightPanel.addCell(new Phrase( L_TABS + translationService.translate( "productionCounting.productionBalance.report.panel.registerQuantityOutProduct", locale) + " " + (order.getBooleanField(OrderFieldsPC.REGISTER_QUANTITY_IN_PRODUCT) ? translationService.translate(L_QCADOO_VIEW_TRUE_LITERAL, locale) : translationService.translate(L_QCADOO_VIEW_FALSE_LITERAL, locale)), FontUtils.getDejavuBold9Dark())); rightPanel.addCell(new Phrase( L_TABS + translationService.translate( "productionCounting.productionBalance.report.panel.registerQuantityInProduct", locale) + " " + (order.getBooleanField(OrderFieldsPC.REGISTER_QUANTITY_OUT_PRODUCT) ? translationService.translate(L_QCADOO_VIEW_TRUE_LITERAL, locale) : translationService.translate(L_QCADOO_VIEW_FALSE_LITERAL, locale)), FontUtils.getDejavuBold9Dark())); rightPanel .addCell(new Phrase( L_TABS + translationService.translate( "productionCounting.productionBalance.report.panel.registerProductionTime", locale) + " " + (order.getBooleanField(OrderFieldsPC.REGISTER_PRODUCTION_TIME) ? translationService.translate(L_QCADOO_VIEW_TRUE_LITERAL, locale) : translationService.translate(L_QCADOO_VIEW_FALSE_LITERAL, locale)), FontUtils.getDejavuBold9Dark())); rightPanel.addCell(new Phrase( L_TABS + translationService .translate("productionCounting.productionBalance.report.panel.registerPiecework", locale) + " " + (order.getBooleanField(OrderFieldsPC.REGISTER_PIECEWORK) ? translationService.translate(L_QCADOO_VIEW_TRUE_LITERAL, locale) : translationService.translate(L_QCADOO_VIEW_FALSE_LITERAL, locale)), FontUtils.getDejavuBold9Dark())); rightPanel .addCell(new Phrase( L_TABS + translationService .translate("productionCounting.productionBalance.report.panel.justOne", locale) + " " + (order.getBooleanField(OrderFieldsPC.JUST_ONE) ? translationService.translate(L_QCADOO_VIEW_TRUE_LITERAL, locale) : translationService.translate(L_QCADOO_VIEW_FALSE_LITERAL, locale)), FontUtils.getDejavuBold9Dark())); rightPanel .addCell(new Phrase( L_TABS + translationService .translate("productionCounting.productionBalance.report.panel.allowToClose", locale) + " " + (order.getBooleanField(OrderFieldsPC.ALLOW_TO_CLOSE) ? translationService.translate(L_QCADOO_VIEW_TRUE_LITERAL, locale) : translationService.translate(L_QCADOO_VIEW_FALSE_LITERAL, locale)), FontUtils.getDejavuBold9Dark())); rightPanel .addCell(new Phrase( L_TABS + translationService .translate( "productionCounting.productionBalance.report.panel.autoCloseOrder", locale) + " " + (order.getBooleanField(OrderFieldsPC.AUTO_CLOSE_ORDER) ? translationService.translate(L_QCADOO_VIEW_TRUE_LITERAL, locale) : translationService.translate(L_QCADOO_VIEW_FALSE_LITERAL, locale)), FontUtils.getDejavuBold9Dark())); return rightPanel; }
From source file:com.qcadoo.mes.productionCounting.print.ProductionBalancePdfService.java
License:Open Source License
public void addInputProductsBalance(final Document document, final Entity productionBalance, final Locale locale) throws DocumentException { List<String> inputProductsTableHeader = Lists.newArrayList(); inputProductsTableHeader.add(translationService .translate("productionCounting.productionBalance.report.columnHeader.number", locale)); inputProductsTableHeader.add(translationService .translate("productionCounting.productionBalance.report.columnHeader.productionName", locale)); inputProductsTableHeader.add(translationService .translate("productionCounting.productionBalance.report.columnHeader.plannedQuantity", locale)); inputProductsTableHeader.add(translationService .translate("productionCounting.productionBalance.report.columnHeader.usedQuantity", locale)); inputProductsTableHeader/*w w w. j a v a2 s . c om*/ .add(translationService.translate(L_PRODUCTION_BALANCE_REPORT_COLUMN_HEADER_BALANCE, locale)); inputProductsTableHeader.add(translationService.translate("basic.product.unit.label", locale)); Map<String, HeaderAlignment> alignments = Maps.newHashMap(); alignments.put(translationService.translate( "productionCounting.productionBalance.report.columnHeader.number", locale), HeaderAlignment.LEFT); alignments.put( translationService.translate( "productionCounting.productionBalance.report.columnHeader.productionName", locale), HeaderAlignment.LEFT); alignments.put( translationService.translate( "productionCounting.productionBalance.report.columnHeader.plannedQuantity", locale), HeaderAlignment.RIGHT); alignments.put( translationService .translate("productionCounting.productionBalance.report.columnHeader.usedQuantity", locale), HeaderAlignment.RIGHT); alignments.put(translationService.translate(PCPBRCHB_LITERAL, locale), HeaderAlignment.RIGHT); alignments.put(translationService.translate("basic.product.unit.label", locale), HeaderAlignment.LEFT); List<Entity> inputProductsList = productionBalance .getHasManyField(ProductionBalanceFields.BALANCE_OPERATION_PRODUCT_IN_COMPONENTS); if (!inputProductsList.isEmpty()) { document.add(new Paragraph( translationService.translate("productionCounting.productionBalance.report.paragraph", locale), FontUtils.getDejavuBold11Dark())); inputProductsList = Lists.newLinkedList(inputProductsList); PdfPTable inputProductsTable = pdfHelper.createTableWithHeader(6, inputProductsTableHeader, false, alignments); for (Entity inputProduct : inputProductsList) { inputProductsTable.addCell( new Phrase(inputProduct.getBelongsToField(BalanceOperationProductInComponentFields.PRODUCT) .getStringField(ProductFields.NUMBER), FontUtils.getDejavuRegular9Dark())); inputProductsTable.addCell( new Phrase(inputProduct.getBelongsToField(BalanceOperationProductInComponentFields.PRODUCT) .getStringField(ProductFields.NAME), FontUtils.getDejavuRegular9Dark())); inputProductsTable.getDefaultCell().setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); inputProductsTable.addCell(new Phrase( numberService.format( inputProduct.getField(BalanceOperationProductInComponentFields.PLANNED_QUANTITY)), FontUtils.getDejavuRegular9Dark())); if (inputProduct.getField(BalanceOperationProductInComponentFields.USED_QUANTITY) == null) { inputProductsTable.addCell(new Phrase(L_N_A, FontUtils.getDejavuRegular9Dark())); inputProductsTable.addCell(new Phrase(L_N_A, FontUtils.getDejavuRegular9Dark())); } else { inputProductsTable.addCell(new Phrase( numberService.format( inputProduct.getField(BalanceOperationProductInComponentFields.USED_QUANTITY)), FontUtils.getDejavuRegular9Dark())); inputProductsTable.addCell(new Phrase( numberService.format( inputProduct.getField(BalanceOperationProductInComponentFields.BALANCE)), FontUtils.getDejavuRegular9Dark())); } inputProductsTable.getDefaultCell().setHorizontalAlignment(PdfPCell.ALIGN_LEFT); inputProductsTable.addCell( new Phrase(inputProduct.getBelongsToField(BalanceOperationProductInComponentFields.PRODUCT) .getStringField(ProductFields.UNIT), FontUtils.getDejavuRegular9Dark())); } document.add(inputProductsTable); } }
From source file:com.qcadoo.mes.productionCounting.print.ProductionBalancePdfService.java
License:Open Source License
public void addOutputProductsBalance(final Document document, final Entity productionBalance, final Locale locale) throws DocumentException { List<String> outputProductsTableHeader = Lists.newArrayList(); outputProductsTableHeader.add(translationService .translate("productionCounting.productionBalance.report.columnHeader.number", locale)); outputProductsTableHeader.add(translationService .translate("productionCounting.productionBalance.report.columnHeader.productionName", locale)); outputProductsTableHeader.add(translationService .translate("productionCounting.productionBalance.report.columnHeader.plannedQuantity", locale)); outputProductsTableHeader.add(translationService .translate("productionCounting.productionBalance.report.columnHeader.producedQuantity", locale)); outputProductsTableHeader/*from w w w. j a v a2 s.c om*/ .add(translationService.translate(L_PRODUCTION_BALANCE_REPORT_COLUMN_HEADER_BALANCE, locale)); outputProductsTableHeader.add(translationService.translate("basic.product.unit.label", locale)); Map<String, HeaderAlignment> alignments = Maps.newHashMap(); alignments.put(translationService.translate( "productionCounting.productionBalance.report.columnHeader.number", locale), HeaderAlignment.LEFT); alignments.put( translationService.translate( "productionCounting.productionBalance.report.columnHeader.productionName", locale), HeaderAlignment.LEFT); alignments.put( translationService.translate( "productionCounting.productionBalance.report.columnHeader.plannedQuantity", locale), HeaderAlignment.RIGHT); alignments.put( translationService.translate( "productionCounting.productionBalance.report.columnHeader.producedQuantity", locale), HeaderAlignment.RIGHT); alignments.put(translationService.translate(PCPBRCHB_LITERAL, locale), HeaderAlignment.RIGHT); alignments.put(translationService.translate("basic.product.unit.label", locale), HeaderAlignment.LEFT); List<Entity> outputProductsList = productionBalance .getHasManyField(ProductionBalanceFields.BALANCE_OPERATION_PRODUCT_OUT_COMPONENTS); if (!outputProductsList.isEmpty()) { document.add(Chunk.NEWLINE); document.add(new Paragraph( translationService.translate("productionCounting.productionBalance.report.paragraph2", locale), FontUtils.getDejavuBold11Dark())); outputProductsList = Lists.newLinkedList(outputProductsList); PdfPTable outputProductsTable = pdfHelper.createTableWithHeader(6, outputProductsTableHeader, false, alignments); for (Entity outputProduct : outputProductsList) { outputProductsTable .addCell( new Phrase( outputProduct .getBelongsToField( BalanceOperationProductOutComponentFields.PRODUCT) .getStringField(ProductFields.NUMBER), FontUtils.getDejavuRegular9Dark())); outputProductsTable .addCell( new Phrase( outputProduct .getBelongsToField( BalanceOperationProductOutComponentFields.PRODUCT) .getStringField(ProductFields.NAME), FontUtils.getDejavuRegular9Dark())); outputProductsTable.getDefaultCell().setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); outputProductsTable.addCell(new Phrase( numberService.format( outputProduct.getField(BalanceOperationProductOutComponentFields.PLANNED_QUANTITY)), FontUtils.getDejavuRegular9Dark())); if (outputProduct.getField(BalanceOperationProductOutComponentFields.USED_QUANTITY) == null) { outputProductsTable.addCell(new Phrase(L_N_A, FontUtils.getDejavuRegular9Dark())); outputProductsTable.addCell(new Phrase(L_N_A, FontUtils.getDejavuRegular9Dark())); } else { outputProductsTable.addCell(new Phrase( numberService.format(outputProduct .getField(BalanceOperationProductOutComponentFields.USED_QUANTITY)), FontUtils.getDejavuRegular9Dark())); outputProductsTable.addCell(new Phrase( numberService.format( outputProduct.getField(BalanceOperationProductOutComponentFields.BALANCE)), FontUtils.getDejavuRegular9Dark())); } outputProductsTable.getDefaultCell().setHorizontalAlignment(PdfPCell.ALIGN_LEFT); outputProductsTable .addCell( new Phrase( outputProduct .getBelongsToField( BalanceOperationProductOutComponentFields.PRODUCT) .getStringField(ProductFields.UNIT), FontUtils.getDejavuRegular9Dark())); } document.add(outputProductsTable); } }