Package com.plainsource.commons.text

Examples of com.plainsource.commons.text.NumberWrapper


                            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)) {
                    NumberWrapper taxRate =
                            DefaultInvoiceRenderer
                                    .getTaxRateAsFormattedNumber(invoiceLineType, pdfInvoice.getLocale());
                    table.addValueCell(taxRate, invoiceRendererBean.getInvoiceLineFont());
                }
View Full Code Here


* @since \$Date$
*/
public class PDFNumberCell extends PDFCellWrapper {

    public PDFNumberCell(Number number) {
        super(PDFPhraseWrapper.createValuePhrase(new NumberWrapper(number).format()));
        setHorizontalAlignment(Element.ALIGN_RIGHT);
    }
View Full Code Here

        super(PDFPhraseWrapper.createValuePhrase(new NumberWrapper(number).format()));
        setHorizontalAlignment(Element.ALIGN_RIGHT);
    }

    public PDFNumberCell(Number number, PDFFontWrapper pdfFontWrapper) {
        super(PDFPhraseWrapper.createValuePhrase(new NumberWrapper(number).format(), pdfFontWrapper));
        setHorizontalAlignment(Element.ALIGN_RIGHT);
    }
View Full Code Here

            // Item Quantity
            QuantityConverter quantityConverter =
                    convertInvoiceQuantityIfRequired(invoiceLineType.getInvoicedQuantity(),
                            invoiceLineType.getPrice(), locale, ubl4JConfigurationBean);
            if (quantityConverter.getInvoicedQuantityType() != null) {
                NumberWrapper quantity = new NumberWrapper(quantityConverter.getInvoicedQuantityType().getValue());
                quantity.setLocale(locale);

                // Adding the unit code either as a field in the invoice line or as a single token.
                // It is more practical to add the unit code as a single toke when all invoice lines
                // share the same unit code; or when there is only one invoice line
                String unitCode = quantityConverter.getInvoicedQuantityType().getUnitCode();
                if (ubl4JConfigurationBean.isIncludeQuantityUnitInInvoiceLine()) {
                    invoiceLineTokens.addToken(new Token(
                            TextLabel.INV_ITEM_UNIT.toLowerCase(), unitCode));
                } else {
                    template.addToken(new Token(TextLabel.INV_ITEM_UNIT.toLowerCase(), unitCode));
                }
                invoiceLineTokens.addToken(new Token(
                        TextLabel.INV_ITEM_QUANTITY.toLowerCase(), quantity.format()));
            }

            // Item Price
            PriceType price = quantityConverter.getPriceType();
            PriceAmountType priceAmount = null;
View Full Code Here

    }

    public static NumberWrapper getTaxRateAsNumber(InvoiceLineType invoiceLineType) {
        TaxCategoryType taxCategoryType = invoiceLineType.getItem().getClassifiedTaxCategory().get(0);
        BigDecimal taxRatePercentValue = taxCategoryType.getPercent().getValue();
        return new NumberWrapper(taxRatePercentValue);
    }
View Full Code Here

        BigDecimal taxRatePercentValue = taxCategoryType.getPercent().getValue();
        return new NumberWrapper(taxRatePercentValue);
    }

    public static NumberWrapper getTaxRateAsFormattedNumber(InvoiceLineType invoiceLineType, Locale locale) {
        NumberWrapper taxRatePercent = getTaxRateAsNumber(invoiceLineType);
        taxRatePercent.setLocale(locale);
        taxRatePercent.setFormatAsPercent(true);
        return taxRatePercent;
    }
View Full Code Here

TOP

Related Classes of com.plainsource.commons.text.NumberWrapper

Copyright © 2018 www.massapicom. 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.