// 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;