public class Invoice
extends java.lang.Object
The EN16931 format is an European Standard that establishes a semantic data model of the core elements of an electronic invoice. The semantic model includes only the essential information elements that an electronic invoice needs to ensure legal (including fiscal) compliance and to enable interoperability for cross-border, cross sector and for domestic trade.
Constructor and Description |
---|
Invoice(java.lang.String invoiceId,
java.lang.String currency,
boolean importedFromXml) |
Modifier and Type | Method and Description |
---|---|
void |
addLine(InvoiceLine line)
Adds an invoice line to the invoice
|
java.lang.String |
dateToString(java.util.Date date)
Returns a string representation of a date
in ISO-8601 format.
|
Entity |
getBuyerParty()
Returns the entity playing the role of
seller party in the transaction represented
by the invoice.
|
javax.money.MonetaryAmount |
getChargeAmount()
Returns the Charge amount of the invoice.
|
java.lang.String |
getChargeBaseAmount()
Returns the Charge base amount of the invoice.
|
double |
getChargePercent()
Returns the Charge percent of the invoice
|
javax.money.CurrencyUnit |
getCurrency()
Returns the currency of the invoice.
|
javax.money.MonetaryAmount |
getDiscountAmount()
Returns the discount amount of the invoice.
|
java.lang.String |
getDiscountBaseAmount()
Returns the discount base amount of the invoice.
|
double |
getDiscountPercent()
Returns the discount percentage of the invoice.
|
java.util.Date |
getDueDate()
Return the due date of the invoice.
|
java.lang.String |
getInvoiceId()
Returns the invoice identifier.
|
java.util.Date |
getIssueDate()
Returns the issued date of the invoice.
|
java.lang.String |
getLineExtensionAmount()
Returns the line extension amount of the invoice.
|
java.util.ArrayList<InvoiceLine> |
getLines()
Returns an ArrayList with the invoice lines
|
java.lang.String |
getOriginalXml()
Returns the original XML if the Invoice was created from
an XML file.
|
java.lang.String |
getPayableAmount()
Returns the payable amount of the invoice.
|
java.lang.String |
getPaymentMeansCode()
Returns the payment means code for the transaction
represented by the invoice.
|
Entity |
getSellerParty()
Returns the entity playing the role of
seller party in the transaction represented
by the invoice.
|
java.lang.String |
getStringChargePercent()
Returns a suitabñle string representation of the
Charge percent of the invoice.
|
java.lang.String |
getStringDiscountPercent()
Returns a suitable string representation of the discount
percentage of the invoice.
|
java.lang.String |
getTaxExclusiveAmount()
Returns the tax exclusive amount of the invoice.
|
java.lang.String |
getTaxInclusiveAmount()
Returns the tax inclusive amount of the invoice.
|
javax.money.MonetaryAmount |
grossSubtotal(Tax tax)
Returns the gross subtotal of the invoice.
|
boolean |
isChargeSet()
Returns true if the invoice has a charge.
|
boolean |
isDiscountSet()
Returns true if the invoice has a discount sent.
|
java.util.ArrayList<InvoiceLine> |
linesWithTaxes(Tax tax)
Returns an ArrayList with all InvoiceLines that have the
tax passed as argument.
|
java.lang.String |
moneyToString(javax.money.MonetaryAmount amount)
Returns a suitable string representation of
a monetary amount.
|
void |
save(java.lang.String path)
Saves the XML representation of the Invoice to a file.
|
void |
setBuyerParty(Entity buyerParty)
Sets the entity playing the role of
seller party in the transaction represented
by the invoice.
|
void |
setChargeAmount(double chargeAmount)
Sets the charge amount of the invoice.
|
void |
setChargePercent(double percent)
Sets the Cherge percentage
|
void |
setCurrency(java.lang.String currency)
Sets the currency of the invoice.
|
void |
setDiscountAmount(double discountAmount)
Sets the discount amount of the invoice.
|
void |
setDiscountPercent(double percent)
Sets the dicount percentage of the invoice.
|
void |
setDueDate(java.util.Date dueDate)
Sets the due date of the invoice
|
void |
setInvoiceId(java.lang.String invoiceId)
Sets the invoice identifier.
|
void |
setIssueDate(java.util.Date issueDate)
Sets the issue date of the invoice.
|
void |
setLineExtensionAmount(java.lang.String lineExtensionAmount)
Sets the line extension amount of the invoice.
|
void |
setOriginalXml(java.lang.String originalXml)
Sets the original XML file.
|
void |
setPayableAmount(java.lang.String payableAmount)
Sets the payable amount of the invoice.
|
void |
setPaymentMeansCode(java.lang.String paymentMeansCode)
Sets the payment means code for the transaction represented by
the invoice.
|
void |
setSellerParty(Entity sellerParty)
Sets the the entity playing the role of
seller party in the transaction represented
by the invoice.
|
void |
setTaxExclusiveAmount(java.lang.String taxExclusiveAmount)
Sets the tax exclusive amount of the invoice.
|
void |
setTaxInclusiveAmount(java.lang.String taxInclusiveAmount)
Sets the tax inclusive amount of the invoice.
|
javax.money.MonetaryAmount |
subtotal(Tax tax)
Returns the subtotal of the invoice.
|
javax.money.MonetaryAmount |
taxableBase(Tax tax)
Returns the taxable base of the invoice.
|
javax.money.MonetaryAmount |
taxAmount(Tax tax)
Returns the monetary amount of the invoice.
|
javax.money.MonetaryAmount |
total()
Returns the total for the invoice
|
java.lang.String |
toXml()
Returns the XML representation in EN16931 format
of the invoice.
|
java.util.ArrayList<Tax> |
uniqueTaxes()
Returns a HashSet with all taxes in the invoice.
|
public Invoice(java.lang.String invoiceId, java.lang.String currency, boolean importedFromXml)
invoiceId
- the invoice identificationcurrency
- the currency in 3-letter ISO-4217importedFromXml
- whether the invoice was imported from an XML filepublic java.lang.String getOriginalXml()
public void setOriginalXml(java.lang.String originalXml)
originalXml
- the original XML file as a String.public java.lang.String toXml()
public void save(java.lang.String path)
path
- string with a valid pathpublic java.lang.String getInvoiceId()
public void setInvoiceId(java.lang.String invoiceId)
invoiceId
- the invoice identificationpublic javax.money.CurrencyUnit getCurrency()
public void setCurrency(java.lang.String currency)
currency
- a three character string representing
the invoice in ISO-4217public java.util.Date getIssueDate()
public void setIssueDate(java.util.Date issueDate)
issueDate
- the issue datepublic java.util.Date getDueDate()
public void setDueDate(java.util.Date dueDate)
dueDate
- the due datepublic java.lang.String dateToString(java.util.Date date)
date
- the date to be convertedpublic Entity getSellerParty()
public void setSellerParty(Entity sellerParty)
sellerParty
- an Entitypublic Entity getBuyerParty()
public void setBuyerParty(Entity buyerParty)
buyerParty
- an Entitypublic java.lang.String getPaymentMeansCode()
public void setPaymentMeansCode(java.lang.String paymentMeansCode)
It must be one of:
paymentMeansCode
- the codepublic java.util.ArrayList<InvoiceLine> getLines()
public void addLine(InvoiceLine line)
line
- an InvoiceLinepublic double getChargePercent()
public java.lang.String getStringChargePercent()
public void setChargePercent(double percent)
percent
- a percentage valuepublic javax.money.MonetaryAmount getChargeAmount()
public boolean isChargeSet()
public void setChargeAmount(double chargeAmount)
chargeAmount
- the charge amountpublic java.lang.String getChargeBaseAmount()
public double getDiscountPercent()
public java.lang.String getStringDiscountPercent()
public void setDiscountPercent(double percent)
percent
- the discount percentagepublic javax.money.MonetaryAmount getDiscountAmount()
public boolean isDiscountSet()
public void setDiscountAmount(double discountAmount)
discountAmount
- the discount amountpublic java.lang.String getDiscountBaseAmount()
public java.util.ArrayList<InvoiceLine> linesWithTaxes(Tax tax)
If the tax is null, all lines are returned
tax
- a Taxpublic javax.money.MonetaryAmount grossSubtotal(Tax tax)
if a Tax is passed as argument, the gross subtotal for all lines with that Tax.
tax
- a Taxpublic javax.money.MonetaryAmount taxableBase(Tax tax)
if a Tax is passed as argument, returns the taxable base for all lines with that tax.
tax
- a Taxpublic java.util.ArrayList<Tax> uniqueTaxes()
public javax.money.MonetaryAmount taxAmount(Tax tax)
if a Tax is passed as argument, the monetary amount for all lines with that Tax
tax
- a Taxpublic javax.money.MonetaryAmount subtotal(Tax tax)
if a Tax is passed as argument, the subtotal for all lines with that Tax.
tax
- a Taxpublic javax.money.MonetaryAmount total()
public java.lang.String moneyToString(javax.money.MonetaryAmount amount)
amount
- the amount of money to be convertedpublic java.lang.String getLineExtensionAmount()
If the Invoice object was imported from an XML this quantity is not computed but extracted directly from the original XML.
public void setLineExtensionAmount(java.lang.String lineExtensionAmount)
lineExtensionAmount
- an amount of moneypublic java.lang.String getTaxExclusiveAmount()
If the Invoice object was imported from an XML this quantity is not computed but extracted directly from the original XML.
public void setTaxExclusiveAmount(java.lang.String taxExclusiveAmount)
taxExclusiveAmount
- an amount of moneypublic java.lang.String getTaxInclusiveAmount()
If the Invoice object was imported from an XML this quantity is not computed but extracted directly from the original XML.
public void setTaxInclusiveAmount(java.lang.String taxInclusiveAmount)
taxInclusiveAmount
- an amount of moneypublic java.lang.String getPayableAmount()
If the Invoice object was imported from an XML this quantity is not computed but extracted directly from the original XML.
public void setPayableAmount(java.lang.String payableAmount)
payableAmount
- an amount of money