Example usage for com.lowagie.text Phrase Phrase

List of usage examples for com.lowagie.text Phrase Phrase

Introduction

In this page you can find the example usage for com.lowagie.text Phrase Phrase.

Prototype

public Phrase(float leading, String string) 

Source Link

Document

Constructs a Phrase with a certain leading and a certain String.

Usage

From source file:com.qcadoo.mes.genealogiesForComponents.GenealogyForComponentView.java

License:Open Source License

private void addTables(final Document document, final Entity entity, final Locale locale)
        throws DocumentException {
    List<String> orderHeader = new ArrayList<String>();
    orderHeader.add(translationService.translate("orders.order.number.label", locale));
    orderHeader.add(translationService.translate("orders.order.name.label", locale));
    orderHeader.add(translationService.translate("orders.order.product.label", locale));
    orderHeader.add(translationService// www.j a  v  a 2  s  .  c om
            .translate("genealogiesForComponents.genealogyForComponent.report.productBatch", locale));
    Paragraph productTitle = new Paragraph(new Phrase(
            translationService.translate(
                    "genealogiesForComponents.genealogyForComponent.report.paragrah.product", locale),
            FontUtils.getDejavuBold11Light()));
    productTitle.setSpacingBefore(20);
    document.add(productTitle);
    PdfPTable headerData = pdfHelper.createPanelTable(3);
    headerData.setSpacingBefore(7);
    Entity product = entity.getBelongsToField("productInComponent").getBelongsToField("productInComponent")
            .getBelongsToField("product");
    pdfHelper.addTableCellAsOneColumnTable(headerData,
            translationService.translate("basic.product.number.label", locale), product.getField("number"));
    pdfHelper.addTableCellAsOneColumnTable(headerData,
            translationService.translate("basic.product.name.label", locale), product.getField("name"));
    pdfHelper.addTableCellAsOneColumnTable(headerData,
            translationService.translate("genealogiesForComponents.productInBatch.batch.label", locale),
            entity.getField(BATCH_FIELD));
    document.add(headerData);
    Paragraph orderTitle = new Paragraph(
            new Phrase(
                    translationService.translate(
                            "genealogiesForComponents.genealogyForComponent.report.paragrah.order", locale),
                    FontUtils.getDejavuBold11Light()));
    orderTitle.setSpacingBefore(20);
    document.add(orderTitle);
    addOrderSeries(document, entity, orderHeader);
}

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 . jav a 2  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());
    }/* w ww  . j a  v  a2 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  w w.j a va  2s .co  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.jav  a  2 s  . c o m
            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 PdfPCell createCell(String content, int alignment) {
    PdfPCell cell = new PdfPCell();
    float border = 0.2f;
    cell.setPhrase(new Phrase(content, FontUtils.getDejavuRegular7Dark()));
    cell.setHorizontalAlignment(alignment);
    cell.setBorderWidth(border);/*w w  w  . ja v a  2 s  .  c o  m*/
    cell.disableBorderSide(PdfPCell.RIGHT);
    cell.disableBorderSide(PdfPCell.LEFT);
    cell.setPadding(5);
    return cell;
}

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;//from   w w w .ja v a  2 s .  co m
    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// w w w .j ava 2 s.c o  m
            .addCell(new Phrase(
                    translationService.translate(
                            "productionCounting.productionBalance.report.panel.countingParameters", locale),
                    FontUtils.getDejavuBold10Dark()));
    addTableCellAsTable(rightPanel,
            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//from   w  w w. ja va 2s.com
            .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 . ja  v a2 s . c  o  m
            .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);
    }
}