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

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

Introduction

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

Prototype

public void setSpacingBefore(float spacing) 

Source Link

Document

Sets the spacing before this table.

Usage

From source file:com.qcadoo.mes.costCalculation.print.CostCalculationPdfService.java

License:Open Source License

@Override
protected void buildPdfContent(final Document document, final Entity entity, final Locale locale)
        throws DocumentException {
    String documentTitle = translationService.translate("costCalculation.costCalculationDetails.report.title",
            locale);//from   www. j  a  v  a  2 s . c o  m
    String documentAuthor = translationService.translate("qcadooReport.commons.generatedBy.label", locale);

    pdfHelper.addDocumentHeader(document, "", documentTitle, documentAuthor, new Date());

    DataDefinition dataDefCostCalculation = dataDefinitionService
            .get(CostCalculationConstants.PLUGIN_IDENTIFIER, CostCalculationConstants.MODEL_COST_CALCULATION);
    Entity costCalculation = dataDefCostCalculation.find("where id = " + entity.getId().toString())
            .uniqueResult();

    PdfPTable leftPanelColumn = addLeftPanelToReport(costCalculation, locale);

    PdfPTable rightPanelColumn = addRightPanelToReport(costCalculation, locale);

    PdfPTable panelTable = pdfHelper.createPanelTable(2);

    panelTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
    panelTable.addCell(leftPanelColumn);
    panelTable.addCell(rightPanelColumn);
    panelTable.setSpacingAfter(20);
    panelTable.setSpacingBefore(20);

    panelTable.setTableEvent(null);
    panelTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);

    document.add(panelTable);

    document.add(new Paragraph(
            translationService.translate("costCalculation.costCalculationDetails.report.paragraph", locale),
            FontUtils.getDejavuBold11Dark()));
    PdfPTable materialsTable = addMaterialsTable(costCalculation, locale);
    document.add(materialsTable);

    document.add(Chunk.NEWLINE);
    document.add(new Paragraph(
            translationService.translate("costCalculation.costCalculationDetails.report.paragraph2", locale),
            FontUtils.getDejavuBold11Dark()));

    CalculateOperationCostMode calculateOperationCostMode = CalculateOperationCostMode
            .parseString(costCalculation.getStringField(CostCalculationFields.CALCULATE_OPERATION_COSTS_MODE));

    if (CalculateOperationCostMode.HOURLY.equals(calculateOperationCostMode)) {
        document.add(addHourlyCostsTable(costCalculation, locale));
    } else if (CalculateOperationCostMode.PIECEWORK.equals(calculateOperationCostMode)) {
        document.add(addTableAboutPieceworkCost(costCalculation, locale));
    } else {
        throw new IllegalStateException("Unsupported CalculateOperationCostMode");
    }

    printMaterialAndOperationNorms(document, costCalculation, locale);
}

From source file:com.qcadoo.mes.costCalculation.print.CostCalculationPdfService.java

License:Open Source License

public void addOptionTablePrintOperationNormsHourly(final Document document, final Entity costCalculation,
        final Locale locale) throws DocumentException {
    List<String> optionTableHeader = Lists.newArrayList();

    for (String translate : Arrays.asList(
            L_COST_CALCULATION_COST_CALCULATION_DETAILS_REPORT_COLUMN_HEADER_NUMBER,
            L_COST_CALCULATION_COST_CALCULATION_DETAILS_REPORT_COLUMN_HEADER_NAME)) {
        optionTableHeader.add(translationService.translate(translate, locale));
    }/*from   w ww .  j a v a 2 s  . c o m*/

    List<Entity> calculationOperationComponents = entityTreeUtilsService.getSortedEntities(
            costCalculation.getTreeField(CostCalculationFields.CALCULATION_OPERATION_COMPONENTS));

    for (Entity calculationOperationComponent : calculationOperationComponents) {
        PdfPTable panelTableHeader = pdfHelper.createPanelTable(2);
        PdfPTable panelTableContent = pdfHelper.createPanelTable(2);
        panelTableHeader.setSpacingBefore(10);
        panelTableContent.getDefaultCell().setBackgroundColor(null);
        panelTableContent.setTableEvent(null);

        Entity technologyOperationComponent = calculationOperationComponent
                .getBelongsToField(CalculationOperationComponentFields.TECHNOLOGY_OPERATION_COMPONENT);
        Entity operation = calculationOperationComponent
                .getBelongsToField(CalculationOperationComponentFields.OPERATION);

        panelTableHeader
                .addCell(new Phrase(
                        translationService.translate(
                                L_COST_CALCULATION_COST_CALCULATION_DETAILS_REPORT_COLUMN_HEADER_NUMBER, locale)
                                + ": " + operation.getStringField(OperationFields.NUMBER),
                        FontUtils.getDejavuRegular7Dark()));

        panelTableHeader
                .addCell(new Phrase(
                        translationService.translate(
                                L_COST_CALCULATION_COST_CALCULATION_DETAILS_REPORT_COLUMN_HEADER_NAME, locale)
                                + ": " + operation.getStringField(OperationFields.NAME),
                        FontUtils.getDejavuRegular7Dark()));

        addTableCellAsTwoColumnsTable(panelTableContent,
                translationService.translate(
                        "costCalculation.costCalculationDetails.report.columnHeader.productionSetUpTime.label",
                        locale) + ":",
                timeConverterService.convertTimeToString(technologyOperationComponent
                        .getIntegerField(TechnologyOperationComponentFieldsTNFO.TPZ)) + " (g:m:s)");

        addTableCellAsTwoColumnsTable(panelTableContent,
                translationService.translate(
                        "costCalculation.costCalculationDetails.report.columnHeader.machineUtilization.label",
                        locale) + ":",
                numberService.format(technologyOperationComponent
                        .getDecimalField(TechnologyOperationComponentFieldsTNFO.MACHINE_UTILIZATION)));

        addTableCellAsTwoColumnsTable(panelTableContent, translationService.translate(
                "costCalculation.costCalculationDetails.report.columnHeader.productionTimeForOneCycle.label",
                locale) + ":",
                timeConverterService.convertTimeToString(
                        technologyOperationComponent.getIntegerField(TechnologyOperationComponentFieldsTNFO.TJ))
                        + " (g:m:s)");

        addTableCellAsTwoColumnsTable(panelTableContent,
                translationService.translate(
                        "costCalculation.costCalculationDetails.report.columnHeader.laborUtilization.label",
                        locale) + ":",
                numberService.format(technologyOperationComponent
                        .getDecimalField(TechnologyOperationComponentFieldsTNFO.LABOR_UTILIZATION)));

        addTableCellAsTwoColumnsTable(panelTableContent,
                translationService.translate(
                        "costCalculation.costCalculationDetails.report.columnHeader.additionalTime.label",
                        locale) + ":",
                timeConverterService
                        .convertTimeToString(technologyOperationComponent
                                .getIntegerField(TechnologyOperationComponentFieldsTNFO.TIME_NEXT_OPERATION))
                        + " (g:m:s)");

        addTableCellAsTwoColumnsTable(panelTableContent,
                translationService.translate(
                        "costCalculation.costCalculationDetails.report.columnHeader.machineHourlyCost.label",
                        locale) + ":",
                numberService.format(technologyOperationComponent
                        .getDecimalField(TechnologyOperationComponentFieldsCNFO.MACHINE_HOURLY_COST)));

        addTableCellAsTwoColumnsTable(panelTableContent, "", "");

        addTableCellAsTwoColumnsTable(panelTableContent,
                translationService.translate(
                        "costCalculation.costCalculationDetails.report.columnHeader.laborHourlyCost.label",
                        locale) + ":",
                numberService.format(technologyOperationComponent
                        .getDecimalField(TechnologyOperationComponentFieldsCNFO.LABOR_HOURLY_COST)));

        document.add(panelTableHeader);
        document.add(panelTableContent);
    }
}

From source file:com.qcadoo.mes.costCalculation.print.CostCalculationPdfService.java

License:Open Source License

public PdfPTable addOptionTablePrintOperationNormsPiecework(final Entity costCalculation, final Locale locale) {
    List<String> optionTableHeader = Lists.newArrayList();

    for (String translate : Arrays.asList(
            L_COST_CALCULATION_COST_CALCULATION_DETAILS_REPORT_COLUMN_HEADER_NUMBER,
            L_COST_CALCULATION_COST_CALCULATION_DETAILS_REPORT_COLUMN_HEADER_NAME,
            "costCalculation.costCalculationDetails.report.columnHeader.pieceworkCost",
            "costCalculation.costCalculationDetails.report.columnHeader.forNumberOfOperations")) {
        optionTableHeader.add(translationService.translate(translate, locale));
    }/*w  w  w.java2 s .  c o  m*/

    List<Entity> calculationOperationComponents = entityTreeUtilsService.getSortedEntities(
            costCalculation.getTreeField(CostCalculationFields.CALCULATION_OPERATION_COMPONENTS));

    PdfPTable operationNormsTable = pdfHelper.createTableWithHeader(optionTableHeader.size(), optionTableHeader,
            false);
    operationNormsTable.setSpacingBefore(10);

    for (Entity calculationOperationComponent : calculationOperationComponents) {
        Entity operation = calculationOperationComponent
                .getBelongsToField(CalculationOperationComponentFields.OPERATION);

        operationNormsTable.addCell(new Phrase(operation.getStringField(OperationFields.NUMBER),
                FontUtils.getDejavuRegular7Dark()));

        operationNormsTable.addCell(
                new Phrase(operation.getStringField(OperationFields.NAME), FontUtils.getDejavuRegular7Dark()));

        BigDecimal pieceworkCost = calculationOperationComponent
                .getDecimalField(CalculationOperationComponentFields.PIECEWORK_COST);

        operationNormsTable
                .addCell(new Phrase((pieceworkCost == null) ? "" : numberService.format(pieceworkCost),
                        FontUtils.getDejavuRegular7Dark()));

        Integer numberOfOperations = calculationOperationComponent
                .getIntegerField(CalculationOperationComponentFields.NUMBER_OF_OPERATIONS);

        operationNormsTable
                .addCell(new Phrase((numberOfOperations == null) ? "" : numberOfOperations.toString(),
                        FontUtils.getDejavuRegular7Dark()));
    }

    return operationNormsTable;
}

From source file:com.qcadoo.mes.deliveries.print.DeliveryReportPdf.java

License:Open Source License

private void createHeaderTable(final Document document, final Entity delivery, final Locale locale)
        throws DocumentException {
    PdfPTable dynaminHeaderTable = pdfHelper.createPanelTable(3);

    dynaminHeaderTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);

    PdfPTable firstColumnHeaderTable = new PdfPTable(1);
    PdfPTable secondColumnHeaderTable = new PdfPTable(1);
    PdfPTable thirdColumnHeaderTable = new PdfPTable(1);

    setSimpleFormat(firstColumnHeaderTable);
    setSimpleFormat(secondColumnHeaderTable);
    setSimpleFormat(thirdColumnHeaderTable);

    dynaminHeaderTable.setSpacingBefore(7);

    Map<String, Object> firstColumn = createFirstColumn(delivery);
    Map<String, Object> secondColumn = createSecondColumn(delivery);
    Map<String, Object> thirdColumn = createThirdColumn(delivery, locale);

    int maxSize = pdfHelper.getMaxSizeOfColumnsRows(Lists.newArrayList(
            Integer.valueOf(firstColumn.values().size()), Integer.valueOf(secondColumn.values().size()),
            Integer.valueOf(thirdColumn.values().size())));

    for (int i = 0; i < maxSize; i++) {
        firstColumnHeaderTable = pdfHelper.addDynamicHeaderTableCell(firstColumnHeaderTable, firstColumn,
                locale);/*from w w  w.  j  a  va 2s  .  c  o m*/
        secondColumnHeaderTable = pdfHelper.addDynamicHeaderTableCell(secondColumnHeaderTable, secondColumn,
                locale);
        thirdColumnHeaderTable = pdfHelper.addDynamicHeaderTableCell(thirdColumnHeaderTable, thirdColumn,
                locale);
    }

    dynaminHeaderTable.addCell(firstColumnHeaderTable);
    dynaminHeaderTable.addCell(secondColumnHeaderTable);
    dynaminHeaderTable.addCell(thirdColumnHeaderTable);

    document.add(dynaminHeaderTable);
}

From source file:com.qcadoo.mes.deliveries.print.OrderReportPdf.java

License:Open Source License

private void createHeaderTable(final Document document, final Entity delivery, final Locale locale)
        throws DocumentException {
    PdfPTable dynaminHeaderTable = pdfHelper.createPanelTable(3);
    dynaminHeaderTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);

    PdfPTable firstColumnHeaderTable = new PdfPTable(1);
    PdfPTable secondColumnHeaderTable = new PdfPTable(1);
    PdfPTable thirdColumnHeaderTable = new PdfPTable(1);

    setSimpleFormat(firstColumnHeaderTable);
    setSimpleFormat(secondColumnHeaderTable);
    setSimpleFormat(thirdColumnHeaderTable);

    dynaminHeaderTable.setSpacingBefore(7);

    Map<String, Object> firstColumn = createFirstColumn(delivery);
    Map<String, Object> secondColumn = createSecondColumn(delivery);
    Map<String, Object> thirdColumn = createThirdColumn(delivery);

    int maxSize = pdfHelper.getMaxSizeOfColumnsRows(Lists.newArrayList(
            Integer.valueOf(firstColumn.values().size()), Integer.valueOf(secondColumn.values().size()),
            Integer.valueOf(thirdColumn.values().size())));

    for (int i = 0; i < maxSize; i++) {
        firstColumnHeaderTable = pdfHelper.addDynamicHeaderTableCell(firstColumnHeaderTable, firstColumn,
                locale);//  w ww.j  a  v  a 2 s .com
        secondColumnHeaderTable = pdfHelper.addDynamicHeaderTableCell(secondColumnHeaderTable, secondColumn,
                locale);
        thirdColumnHeaderTable = pdfHelper.addDynamicHeaderTableCell(thirdColumnHeaderTable, thirdColumn,
                locale);
    }

    dynaminHeaderTable.addCell(firstColumnHeaderTable);
    dynaminHeaderTable.addCell(secondColumnHeaderTable);
    dynaminHeaderTable.addCell(thirdColumnHeaderTable);

    document.add(dynaminHeaderTable);
    document.add(Chunk.NEWLINE);
}

From source file:com.qcadoo.mes.genealogies.print.GenealogyForProductView.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.dateFrom.label", locale));
    Paragraph productTitle = new Paragraph(new Phrase(
            translationService.translate("genealogies.genealogyForProduct.report.paragrah.product", locale),
            FontUtils.getDejavuBold11Light()));
    productTitle.setSpacingBefore(20);//  w w w .  j a  va 2s  .c om
    document.add(productTitle);
    PdfPTable headerData = pdfHelper.createPanelTable(3);
    headerData.setSpacingBefore(7);
    Entity product = entity.getBelongsToField(ORDER_FIELD).getBelongsToField(PRODUCT_FIELD);
    pdfHelper.addTableCellAsOneColumnTable(headerData,
            translationService.translate("basic.product.number.label", locale), product.getField(NUMBER_FIELD));
    pdfHelper.addTableCellAsOneColumnTable(headerData,
            translationService.translate("basic.product.name.label", locale), product.getField(NAME_FIELD));
    pdfHelper.addTableCellAsOneColumnTable(headerData,
            translationService.translate("genealogies.genealogy.batch.label", locale),
            entity.getField(BATCH_FIELD));
    document.add(headerData);
    Paragraph orderTitle = new Paragraph(new Phrase(
            translationService.translate("genealogies.genealogyForProduct.report.paragrah.order", locale),
            FontUtils.getDejavuBold11Light()));
    orderTitle.setSpacingBefore(20);
    document.add(orderTitle);
    List<Entity> orders = getOrders(entity);
    Collections.sort(orders, new EntityNumberComparator());
    addOrderSeries(document, orders, orderHeader);
    if (pluginManager.isPluginEnabled(GENEALOGIES_FOR_COMPONENTS_PLUGIN)) {
        addComponentSeries(document, orders, locale);
    }
}

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//ww  w .  j av a  2  s . c  o m
            .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.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 . java  2  s .c  om
    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 addPanel(final Document document, final Entity materialRequirement, final Locale locale)
        throws DocumentException {
    PdfPTable panelTable = pdfHelper.createPanelTable(2);
    pdfHelper.addTableCellAsOneColumnTable(
            panelTable, translationService
                    .translate("materialRequirements.materialRequirement.report.panel.number", locale),
            materialRequirement.getStringField(MaterialRequirementFields.NUMBER));
    pdfHelper.addTableCellAsOneColumnTable(panelTable,
            translationService.translate("materialRequirements.materialRequirement.report.panel.name", locale),
            StringUtils.isEmpty(materialRequirement.getStringField(MaterialRequirementFields.NAME)) ? ""
                    : materialRequirement.getStringField(MaterialRequirementFields.NAME));
    pdfHelper.addTableCellAsOneColumnTable(panelTable,
            translationService.translate("materialRequirements.materialRequirement.report.panel.mrpAlgorithm",
                    locale),//w ww . j a  v a  2s.c om
            translationService.translate(
                    "materialRequirements.materialRequirement.mrpAlgorithm.value."
                            + materialRequirement.getStringField(MaterialRequirementFields.MRP_ALGORITHM),
                    locale));
    pdfHelper.addTableCellAsOneColumnTable(panelTable, "", "");
    panelTable.setSpacingAfter(20);
    panelTable.setSpacingBefore(20);
    document.add(panelTable);
}

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.  java 2  s. c o m
    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);
    }
}