Package org.mustangproject.ZUGFeRD
Class TransactionCalculator
- java.lang.Object
-
- org.mustangproject.ZUGFeRD.TransactionCalculator
-
- All Implemented Interfaces:
IAbsoluteValueProvider
public class TransactionCalculator extends java.lang.Object implements IAbsoluteValueProvider
The Transactioncalculator e.g. adds the line totals and applies VAT on whole invoices- See Also:
LineCalculator
-
-
Field Summary
Fields Modifier and Type Field Description protected IExportableTransactiontrans
-
Constructor Summary
Constructors Constructor Description TransactionCalculator(IExportableTransaction trans)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringgetAllowanceReasonForPercent(java.math.BigDecimal percent)returns a (potentially concatenated) string of allowance reasons, or "Allowances", if none are definedprotected java.math.BigDecimalgetAllowancesForPercent(java.math.BigDecimal percent)returns total of allowances for this tax ratejava.math.BigDecimalgetAllowanceTotal()protected java.lang.StringgetChargeReasonForPercent(java.math.BigDecimal percent)returns a (potentially concatenated) string of charge reasons, or "Charges" if none are definedprotected java.math.BigDecimalgetChargesForPercent(java.math.BigDecimal percent)returns total of charges for this tax ratejava.math.BigDecimalgetChargeTotal()java.math.BigDecimalgetDuePayable()java.math.BigDecimalgetGrandTotal()the invoice total with VAT, allowances and charges, WITHOUT considering prepaid amountjava.math.BigDecimalgetTaxBasis()returns the total net value of the invoice, including charges/allowances on document leveljava.util.Set<VATAmount>getTaxDetails()Returns information about every tax that is involved in the current transaction.protected java.math.BigDecimalgetTotal()returns the total net value of all items, without document level charges/allowancesprotected java.math.BigDecimalgetTotalPrepaid()if something had already been paid in advance, this will get it from the transactionjava.math.BigDecimalgetValue()protected java.util.List<VATAmount>getVATAmountList()protected java.util.HashMap<java.math.BigDecimal,VATAmount>getVATPercentAmountMap()which taxes have been used with which amounts in this transaction, empty for no taxes, or e.g. 19:190 and 7:14 if 1000 Eur were applicable to 19% VAT (=190 EUR VAT) and 200 EUR were applicable to 7% (=14 EUR VAT) 190 EurvoidmergeAdding(VATAmount vatAmount, VATAmount toAdd)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.mustangproject.ZUGFeRD.IAbsoluteValueProvider
getQuantity
-
-
-
-
Field Detail
-
trans
protected IExportableTransaction trans
-
-
Constructor Detail
-
TransactionCalculator
public TransactionCalculator(IExportableTransaction trans)
- Parameters:
trans- the invoice (or IExportableTransaction) to be calculated
-
-
Method Detail
-
getTotalPrepaid
protected java.math.BigDecimal getTotalPrepaid()
if something had already been paid in advance, this will get it from the transaction- Returns:
- prepaid amount
-
getGrandTotal
public java.math.BigDecimal getGrandTotal()
the invoice total with VAT, allowances and charges, WITHOUT considering prepaid amount- Returns:
- the invoice total including taxes
-
getChargesForPercent
protected java.math.BigDecimal getChargesForPercent(java.math.BigDecimal percent)
returns total of charges for this tax rate- Parameters:
percent- a specific rate, or null for any rate- Returns:
- the total amount
-
getTaxDetails
public java.util.Set<VATAmount> getTaxDetails()
Returns information about every tax that is involved in the current transaction.- Returns:
- transaction taxes.
-
getChargeReasonForPercent
protected java.lang.String getChargeReasonForPercent(java.math.BigDecimal percent)
returns a (potentially concatenated) string of charge reasons, or "Charges" if none are defined- Parameters:
percent- a specific rate, or null for any rate- Returns:
- the space separated String
-
getAllowanceReasonForPercent
protected java.lang.String getAllowanceReasonForPercent(java.math.BigDecimal percent)
returns a (potentially concatenated) string of allowance reasons, or "Allowances", if none are defined- Parameters:
percent- a specific rate, or null for any rate- Returns:
- the space separated String
-
getAllowancesForPercent
protected java.math.BigDecimal getAllowancesForPercent(java.math.BigDecimal percent)
returns total of allowances for this tax rate- Parameters:
percent- a specific rate, or null for any rate- Returns:
- the total amount
-
getTotal
protected java.math.BigDecimal getTotal()
returns the total net value of all items, without document level charges/allowances- Returns:
- item sum
-
getTaxBasis
public java.math.BigDecimal getTaxBasis()
returns the total net value of the invoice, including charges/allowances on document level- Returns:
- item sum +- charges/allowances
-
getVATPercentAmountMap
protected java.util.HashMap<java.math.BigDecimal,VATAmount> getVATPercentAmountMap()
which taxes have been used with which amounts in this transaction, empty for no taxes, or e.g. 19:190 and 7:14 if 1000 Eur were applicable to 19% VAT (=190 EUR VAT) and 200 EUR were applicable to 7% (=14 EUR VAT) 190 Eur- Returns:
- which taxes have been used with which amounts in this invoice
-
getVATAmountList
protected java.util.List<VATAmount> getVATAmountList()
-
getValue
public java.math.BigDecimal getValue()
- Specified by:
getValuein interfaceIAbsoluteValueProvider
-
getChargeTotal
public java.math.BigDecimal getChargeTotal()
-
getAllowanceTotal
public java.math.BigDecimal getAllowanceTotal()
-
getDuePayable
public java.math.BigDecimal getDuePayable()
-
-