Class TransactionCalculator

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String getAllowanceReasonForPercent​(java.math.BigDecimal percent)
      returns a (potentially concatenated) string of allowance reasons, or "Allowances", if none are defined
      protected java.math.BigDecimal getAllowancesForPercent​(java.math.BigDecimal percent)
      returns total of allowances for this tax rate
      java.math.BigDecimal getAllowanceTotal()  
      protected java.lang.String getChargeReasonForPercent​(java.math.BigDecimal percent)
      returns a (potentially concatenated) string of charge reasons, or "Charges" if none are defined
      protected java.math.BigDecimal getChargesForPercent​(java.math.BigDecimal percent)
      returns total of charges for this tax rate
      java.math.BigDecimal getChargeTotal()  
      java.math.BigDecimal getDuePayable()  
      java.math.BigDecimal getGrandTotal()
      the invoice total with VAT, allowances and charges, WITHOUT considering prepaid amount
      java.math.BigDecimal getTaxBasis()
      returns the total net value of the invoice, including charges/allowances on document level
      java.util.Set<VATAmount> getTaxDetails()
      Returns information about every tax that is involved in the current transaction.
      protected java.math.BigDecimal getTotal()
      returns the total net value of all items, without document level charges/allowances
      protected java.math.BigDecimal getTotalPrepaid()
      if something had already been paid in advance, this will get it from the transaction
      java.math.BigDecimal getValue()  
      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 Eur
      void mergeAdding​(VATAmount vatAmount, VATAmount toAdd)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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()
      • getChargeTotal

        public java.math.BigDecimal getChargeTotal()
      • getAllowanceTotal

        public java.math.BigDecimal getAllowanceTotal()
      • getDuePayable

        public java.math.BigDecimal getDuePayable()