Package com.plainsource.commons.text

Examples of com.plainsource.commons.text.CurrencyDecimal


                                    .getTaxRateAsFormattedNumber(invoiceLineType, pdfInvoice.getLocale());
                    table.addValueCell(taxRate, invoiceRendererBean.getInvoiceLineFont());
                }

                // Invoice Line extension amount
                CurrencyDecimal lineExtensionAmount =
                        createLineExtensionAmount(invoiceLineType.getLineExtensionAmount());
                if (label.equals(org.openinvoice.ubl4j.core.common.text.TextLabel.INV_ITEM_SUBTOTAL)) {
                    table.addValueCell(lineExtensionAmount, invoiceRendererBean.getInvoiceLineFont());
                }

                // Invoice Line tax total amount
                CurrencyDecimal lineTaxTotal = createLineTaxAmount(invoiceLineType.getTaxTotal().get(0));
                if (label == org.openinvoice.ubl4j.core.common.text.TextLabel.INV_ITEM_VAT) {
                    table.addValueCell(lineTaxTotal, invoiceRendererBean.getInvoiceLineFont());
                }

                // Invoice Line total amount
                if (label == org.openinvoice.ubl4j.core.common.text.TextLabel.INV_ITEM_TOTAL) {
                    CurrencyDecimal lineTotalAmount = lineExtensionAmount.add(lineTaxTotal);
                    table.addValueCell(includeCurrencySymbolOrCode(lineTotalAmount),
                            invoiceRendererBean.getInvoiceLineFont());
                }
            }
        }
View Full Code Here


    private InvoiceLineTable createTotalRows(InvoiceLineTable table) {

        MonetaryTotalType monetaryTotalType = pdfInvoice.getInvoiceType().getLegalMonetaryTotal();

        CurrencyDecimal total = createGrandTotal(monetaryTotalType);
        CurrencyDecimal subtotal = createSubTotal(monetaryTotalType);
        CurrencyDecimal totalTax = total.subtract(subtotal);

        String subtotalLabel = org.openinvoice.ubl4j.core.common.text.TextLabel.INV_SUBTOTAL_LABEL.toString(pdfInvoice.getLocale());
        String totalLabel = org.openinvoice.ubl4j.core.common.text.TextLabel.INV_TOTAL_LABEL.toString(pdfInvoice.getLocale());
        String taxTotalLabel = org.openinvoice.ubl4j.core.common.text.TextLabel.INV_TAX_TOTAL_LABEL.toString(pdfInvoice.getLocale());
View Full Code Here

        String currencyCode = lineExtensionAmount.getCurrencyID().value();
        return createCurrencyDecimal(value, currencyCode);
    }

    private CurrencyDecimal createCurrencyDecimal(BigDecimal amount, String currencyCode) {
        return new CurrencyDecimal(amount, Currency.getInstance(currencyCode), pdfInvoice.getLocale());
    }
View Full Code Here

*/
public class PDFDecimalCell extends PDFCellWrapper {

    public PDFDecimalCell(BigDecimal decimal, org.openinvoice.ubl4j.core.common.text.pdf.common.PDFFontWrapper pdfFontWrapper) {
        super(PDFPhraseWrapper
                .createValuePhrase(new CurrencyDecimal(decimal).format(), pdfFontWrapper));
        setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
    }
View Full Code Here

        setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
    }

    public PDFDecimalCell(BigDecimal decimal) {
        super(PDFPhraseWrapper
                .createValuePhrase(new CurrencyDecimal(decimal).format()));
        setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
    }
View Full Code Here

*/
public class PDFTotalDecimalCell extends PDFCellWrapper {

    public PDFTotalDecimalCell(BigDecimal decimal) {
        super(org.openinvoice.ubl4j.core.common.text.pdf.common.PDFPhraseWrapper
                .createBoldValuePhrase(new CurrencyDecimal(decimal).format()));
        setHorizontalAlignment(Element.ALIGN_RIGHT);
    }
View Full Code Here

        setHorizontalAlignment(Element.ALIGN_RIGHT);
    }

    public PDFTotalDecimalCell(BigDecimal decimal, org.openinvoice.ubl4j.core.common.text.pdf.common.PDFFontWrapper pdfFontWrapper) {
        super(org.openinvoice.ubl4j.core.common.text.pdf.common.PDFPhraseWrapper
                .createValuePhrase(new CurrencyDecimal(decimal).format(), pdfFontWrapper));
        setHorizontalAlignment(Element.ALIGN_RIGHT);
    }
View Full Code Here

                InvoiceTypeParser.parseOrderReferenceID(invoiceType.getOrderReference())));
    }

    private void addGrandTotalTokens() {
        BigDecimal total = invoiceType.getLegalMonetaryTotal().getPayableAmount().getValue();
        CurrencyDecimal totalCurrency = new CurrencyDecimal(total, invoiceTypeCurrency, locale);
        template.addToken(new Token(TextLabel.INV_TOTAL_LABEL.toLowerCase(),
                TextLabel.INV_TOTAL_LABEL.toString(locale)));
        template.addToken(new Token(TextLabel.INV_TOTAL.toLowerCase(), totalCurrency.format()));
    }
View Full Code Here

            TaxTotalType taxTotalType = invoiceType.getTaxTotal().get(0);
            BigDecimal totalTax = taxTotalType.getTaxAmount().getValue();
            template.addToken(new Token(TextLabel.INV_TAX_TOTAL_LABEL.toLowerCase(),
                    TextLabel.INV_TAX_TOTAL_LABEL.toString(locale)));
            template.addToken(new Token(TextLabel.INV_TAX_TOTAL.toLowerCase(),
                    new CurrencyDecimal(totalTax, invoiceTypeCurrency, locale).format()));
        }
    }
View Full Code Here

    private void addSubTotalTokens() {
        BigDecimal subtotal = invoiceType.getLegalMonetaryTotal().getLineExtensionAmount().getValue();
        template.addToken(new Token(TextLabel.INV_SUBTOTAL_LABEL.toLowerCase(),
                TextLabel.INV_SUBTOTAL_LABEL.toString(locale)));
        template.addToken(new Token(TextLabel.INV_SUBTOTAL.toLowerCase(),
                new CurrencyDecimal(subtotal, invoiceTypeCurrency, locale).format()));
    }
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.