Class InvoiceWorker

java.lang.Object
org.apache.ofbiz.accounting.invoice.InvoiceWorker

public final class InvoiceWorker extends Object
InvoiceWorker - Worker methods of invoices
  • Method Details

    • getInvoiceTotal

      public static BigDecimal getInvoiceTotal(Delegator delegator, String invoiceId)
      Return the total amount of the invoice (including tax) using the the invoiceId as input.
      Parameters:
      delegator - the delegator
      invoiceId - the invoice id
      Returns:
      Return the total amount of the invoice
    • getInvoiceTotal

      public static BigDecimal getInvoiceTotal(Delegator delegator, String invoiceId, Boolean actualCurrency)
      Return the total amount of the invoice (including tax) using the the invoiceId as input. with the ability to specify if the actual currency is required.
      Parameters:
      delegator - the delegator
      invoiceId - the invoice Id
      actualCurrency - true: provide the actual currency of the invoice (could be different from the system currency) false: if required convert the actual currency into the system currency.
      Returns:
      Return the total amount of the invoice
    • getInvoiceItemTotal

      public static BigDecimal getInvoiceItemTotal(GenericValue invoiceItem)
      Method to return the total amount of an invoice item i.e. quantity * amount
      Parameters:
      invoiceItem - GenericValue object of the invoice item
      Returns:
      the invoice total as BigDecimal
    • getInvoiceItemDescription

      public static String getInvoiceItemDescription(LocalDispatcher dispatcher, GenericValue invoiceItem, Locale locale) throws GenericEntityException
      Method to return the invoice item description with following step 1. take the item description field 2. if tax associate, resolve the taxAuthorityRateProduct description 3. if product associate, call content wrapper to resolve PRODUCT_NAME or take the brandName 4. take the item Type line description
      Parameters:
      dispatcher -
      invoiceItem -
      locale -
      Returns:
      the item description
      Throws:
      GenericEntityException
    • getTaxableInvoiceItemTypeIds

      public static List<String> getTaxableInvoiceItemTypeIds(Delegator delegator) throws GenericEntityException
      Method to get the taxable invoice item types as a List of invoiceItemTypeIds. These are identified in Enumeration with enumTypeId TAXABLE_INV_ITM_TY.
      Throws:
      GenericEntityException
    • getInvoiceTaxTotal

      public static BigDecimal getInvoiceTaxTotal(GenericValue invoice)
    • getInvoiceNoTaxTotal

      public static BigDecimal getInvoiceNoTaxTotal(GenericValue invoice)
    • getInvoiceTotal

      public static BigDecimal getInvoiceTotal(GenericValue invoice)
      Method to return the total amount of an invoice
      Parameters:
      invoice - GenericValue object of the Invoice
      Returns:
      the invoice total as BigDecimal
    • getInvoiceTotal

      public static BigDecimal getInvoiceTotal(GenericValue invoice, Boolean actualCurrency)
      Return the total amount of the invoice (including tax) using the the invoice GenericValue as input. with the ability to specify if the actual currency is required.
      Parameters:
      invoice - GenericValue object of the Invoice
      actualCurrency - true: provide the actual currency of the invoice (could be different from the system currency) false: if required convert the actual currency into the system currency.
      Returns:
      Return the total amount of the invoice
    • getBillToParty

      public static GenericValue getBillToParty(GenericValue invoice)
      Method to obtain the bill to party for an invoice. Note that invoice.partyId is the bill to party.
      Parameters:
      invoice - GenericValue object of the Invoice
      Returns:
      GenericValue object of the Party
    • getBillFromParty

      public static GenericValue getBillFromParty(GenericValue invoice)
      Convenience method to obtain the bill from party for an invoice. Note that invoice.partyIdFrom is the bill from party.
    • getSendFromParty

      public static GenericValue getSendFromParty(GenericValue invoice)
      Method to obtain the send from party for an invoice
      Parameters:
      invoice - GenericValue object of the Invoice
      Returns:
      GenericValue object of the Party
    • getShippingAddress

      public static GenericValue getShippingAddress(GenericValue invoice)
      Method to obtain the shipping address from an invoice first resolve from InvoiceContactMech and if not found try from Shipment if present
      Parameters:
      invoice - GenericValue object of the Invoice
      Returns:
      GenericValue object of the PostalAddress
    • getBillToAddress

      public static GenericValue getBillToAddress(GenericValue invoice)
      Method to obtain the billing address for an invoice
      Parameters:
      invoice - GenericValue object of the Invoice
      Returns:
      GenericValue object of the PostalAddress
    • getSendFromAddress

      public static GenericValue getSendFromAddress(GenericValue invoice)
      Method to obtain the sending address for an invoice
      Parameters:
      invoice - GenericValue object of the Invoice
      Returns:
      GenericValue object of the PostalAddress
    • getInvoiceAddressByType

      public static GenericValue getInvoiceAddressByType(GenericValue invoice, String contactMechPurposeTypeId)
    • getInvoiceAddressByType

      public static GenericValue getInvoiceAddressByType(GenericValue invoice, String contactMechPurposeTypeId, boolean fetchPartyAddress)
    • getInvoiceNotApplied

      public static BigDecimal getInvoiceNotApplied(Delegator delegator, String invoiceId, Boolean actualCurrency)
      Method to return the total amount of an invoice which is not yet applied to a payment
      Parameters:
      delegator - the delegator
      invoiceId - the invoice id
      actualCurrency - the currency
      Returns:
      the invoice total as BigDecimal
    • getInvoiceNotApplied

      public static BigDecimal getInvoiceNotApplied(Delegator delegator, String invoiceId)
    • getInvoiceNotApplied

      public static BigDecimal getInvoiceNotApplied(GenericValue invoice)
    • getInvoiceNotApplied

      public static BigDecimal getInvoiceNotApplied(GenericValue invoice, Boolean actualCurrency)
    • getInvoiceNotApplied

      public static BigDecimal getInvoiceNotApplied(GenericValue invoice, Timestamp asOfDateTime)
      Returns amount not applied (i.e., still outstanding) of an invoice at an asOfDate, based on Payment.effectiveDate <= asOfDateTime
      Parameters:
      invoice - GenericValue object of the invoice
      asOfDateTime - the date to use
      Returns:
      Returns amount not applied of the invoice
    • getInvoiceApplied

      public static BigDecimal getInvoiceApplied(Delegator delegator, String invoiceId)
      Method to return the total amount of an invoice which is applied to a payment
      Parameters:
      delegator - the delegator
      invoiceId - the invoice id
      Returns:
      the invoice total as BigDecimal
    • getInvoiceApplied

      public static BigDecimal getInvoiceApplied(Delegator delegator, String invoiceId, Timestamp asOfDateTime, Boolean actualCurrency)
      Returns amount applied to invoice before an asOfDateTime, based on Payment.effectiveDate <= asOfDateTime
      Parameters:
      delegator - the delegator
      invoiceId - the invoice id
      asOfDateTime - - a Timestamp
      Returns:
      returns amount applied to invoice before an asOfDateTime
    • getInvoiceApplied

      public static BigDecimal getInvoiceApplied(GenericValue invoice)
      Method to return the total amount of an invoice which is applied to a payment
      Parameters:
      invoice - GenericValue object of the invoice
      Returns:
      the applied total as BigDecimal
    • getInvoiceApplied

      public static BigDecimal getInvoiceApplied(GenericValue invoice, Boolean actualCurrency)
      Return the amount applied to the invoice
      Parameters:
      invoice - GenericValue object of the invoice
      actualCurrency - the currency of the invoice
      Returns:
      returns the amount applied to the invoice
    • getInvoiceApplied

      public static BigDecimal getInvoiceApplied(GenericValue invoice, Timestamp asOfDateTime)
    • getInvoiceItemApplied

      public static BigDecimal getInvoiceItemApplied(Delegator delegator, String invoiceId, String invoiceItemSeqId)
      Method to return the amount of an invoiceItem which is applied to a payment
      Parameters:
      delegator - the delegator
      invoiceId - the invoice id
      invoiceItemSeqId - the invoice item id
      Returns:
      the invoice total as BigDecimal
    • getInvoiceItemApplied

      public static BigDecimal getInvoiceItemApplied(GenericValue invoiceItem)
      Method to return the total amount of an invoiceItem which is applied to a payment
      Parameters:
      invoiceItem - GenericValue object of the invoice item
      Returns:
      the applied total as BigDecimal
    • getInvoiceCurrencyConversionRate

      public static BigDecimal getInvoiceCurrencyConversionRate(GenericValue invoice)
    • getInvoiceCurrencyConversionRate

      public static BigDecimal getInvoiceCurrencyConversionRate(Delegator delegator, String invoiceId)
    • getInvoiceTaxByTaxAuthGeoAndParty

      @Deprecated public static Map<String,Object> getInvoiceTaxByTaxAuthGeoAndParty(GenericValue invoice)
      Deprecated.
      Return a list of taxes separated by Geo and party and return the tax grand total
      Parameters:
      invoice - Generic Value
      Returns:
      Map taxByTaxAuthGeoAndPartyList(List) and taxGrandTotal(BigDecimal)
    • getInvoiceTaxAuthPartyAndGeos

      public static Map<String,Set<String>> getInvoiceTaxAuthPartyAndGeos(GenericValue invoice)
      Returns a List of the TaxAuthority Party and Geos for the given Invoice.
      Parameters:
      invoice - GenericValue object representing the Invoice
      Returns:
      A Map containing the each taxAuthPartyId as a key and a Set of taxAuthGeoIds for that taxAuthPartyId as the values. Note this method will not account for tax lines that do not contain a taxAuthPartyId
    • getInvoiceTaxTotalForTaxAuthPartyAndGeo

      public static BigDecimal getInvoiceTaxTotalForTaxAuthPartyAndGeo(GenericValue invoice, String taxAuthPartyId, String taxAuthGeoId)
      Parameters:
      invoice - GenericValue object representing the invoice
      taxAuthPartyId -
      taxAuthGeoId -
      Returns:
      The invoice tax total for a given tax authority and geo location
    • getInvoiceUnattributedTaxTotal

      public static BigDecimal getInvoiceUnattributedTaxTotal(GenericValue invoice)
      Returns the invoice tax total for unattributed tax items, that is items which have no taxAuthPartyId value
      Parameters:
      invoice - GenericValue object representing the invoice
      Returns:
      Returns the invoice tax total for unattributed tax items