Package com.plainsource.commons.text

Examples of com.plainsource.commons.text.CurrencyDecimal


            if (price != null) {
                priceAmount = price.getPriceAmount();
                if (priceAmount != null) {
                    invoiceLineTokens.addToken(new Token(
                            TextLabel.INV_ITEM_PRICE.toLowerCase(),
                            new CurrencyDecimal(priceAmount.getValue(), invoiceTypeCurrency, locale).format()));
                }
            }

            BigDecimal lineExtensionAmount = invoiceLineType.getLineExtensionAmount().getValue();
            invoiceLineTokens.addToken(new Token(
                    TextLabel.INV_ITEM_SUBTOTAL.toLowerCase(),
                    new CurrencyDecimal(lineExtensionAmount, invoiceTypeCurrency, locale).format()));

            // Tax rate  (VAT Rate)
            // Adding the VAT rate either as a field in the invoice line or as a single token.
            if (invoiceLineType.getItem().getClassifiedTaxCategory().size() > 0) {
                Token vatRateToken = new Token(TextLabel.INV_ITEM_VAT_RATE.toLowerCase(),
                        getTaxRateAsFormattedNumber(invoiceLineType, locale).format());
                if (ubl4JConfigurationBean.isIncludeVatRateInInvoiceLine()) {
                    invoiceLineTokens.addToken(vatRateToken);
                } else {
                    template.addToken(vatRateToken);
                }
            }

            BigDecimal taxTotal = invoiceLineType.getTaxTotal().get(0).getTaxAmount().getValue();
            invoiceLineTokens.addToken(new Token(TextLabel.INV_ITEM_VAT.toLowerCase(),
                    new CurrencyDecimal(taxTotal, invoiceTypeCurrency, locale).format()));

            BigDecimal total = lineExtensionAmount.add(taxTotal);
            invoiceLineTokens.addToken(new Token(TextLabel.INV_ITEM_TOTAL.toLowerCase(),
                    new CurrencyDecimal(total, invoiceTypeCurrency, locale).format()));
            template.addToken(invoiceLineTokens);
        }
    }
View Full Code Here

TOP

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

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.