Examples of QuantityConverter


Examples of org.openinvoice.ubl4j.core.common.text.QuantityConverter

            // If the conversion enabled, it converts the WorkTimeUnit to the specified
            //  WorkTimeUnit in the UBL4J configuration file. It also adapts the
            // price accordingly.
            if (ubl4JConfigurationBean.isWorkTimeUnitConversionEnabled()) {
                QuantityConverter quantityConverter = new QuantityConverter(invoicedQuantityType, invoiceLineTypePrice);
                quantityConverter.convert(ubl4JConfigurationBean.getPersistenceWorkTimeUnit(), ubl4JConfigurationBean.getWorkHourPerDay());
                invoiceLineTypePrice.setPriceAmount(quantityConverter.getPriceType().getPriceAmount());
                invoiceLineType.setInvoicedQuantity(invoicedQuantityType);

                // Convert Base Quantity
                invoiceLineTypePrice.setBaseQuantity(org.openinvoice.ubl4j.core.invoice.InvoiceTypeHelper
                        .createBaseQuantityType(invoicedQuantityType.getUnitCode(), BigDecimal.ONE));
View Full Code Here

Examples of org.openinvoice.ubl4j.core.common.text.QuantityConverter

        InvoiceLineTable table = createInvoiceHeaders();


        for (InvoiceLineType invoiceLineType : pdfInvoice.getInvoiceType().getInvoiceLine()) {
            QuantityConverter quantityConverter =
                    DefaultInvoiceRenderer
                            .convertInvoiceQuantityIfRequired(invoiceLineType.getInvoicedQuantity(),
                                    invoiceLineType.getPrice(), pdfInvoice.getLocale(),
                                    pdfInvoice.getUbl4JConfigurationBean());
            for (org.openinvoice.ubl4j.core.common.text.TextLabel label : invoiceRendererBean.getInvoiceLineLabelsToDisplay()) {
                // Description
                if (label == org.openinvoice.ubl4j.core.common.text.TextLabel.INV_ITEM_DESCRIPTION) {
                    table.addValueCell(getInvoiceLineItemDescription(invoiceLineType),
                            invoiceRendererBean.getInvoiceLineFont());
                }

                // Unit of the quantity
                if (label == org.openinvoice.ubl4j.core.common.text.TextLabel.INV_ITEM_UNIT) {
                    table.addValueCell(quantityConverter.getInvoicedQuantityType().getUnitCode(),
                            invoiceRendererBean.getInvoiceLineFont());
                }

                // Quantity
                if (label == org.openinvoice.ubl4j.core.common.text.TextLabel.INV_ITEM_QUANTITY) {
                    NumberWrapper quantity = new NumberWrapper(quantityConverter.getInvoicedQuantityType().getValue());
                    quantity.setLocale(pdfInvoice.getLocale());
                    table.addValueCell(quantity, invoiceRendererBean.getInvoiceLineFont());
                }

                // Item price
                if (label == org.openinvoice.ubl4j.core.common.text.TextLabel.INV_ITEM_PRICE) {
                    table.addValueCell(createLinePriceAmount(quantityConverter.getPriceType().getPriceAmount()),
                            invoiceRendererBean.getInvoiceLineFont());
                }

                // Tax rate
                if (label.equals(org.openinvoice.ubl4j.core.common.text.TextLabel.INV_ITEM_VAT_RATE)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.