Class InvoiceWorker
- java.lang.Object
-
- org.apache.ofbiz.accounting.invoice.InvoiceWorker
-
public final class InvoiceWorker extends java.lang.Object
InvoiceWorker - Worker methods of invoices
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
module
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static GenericValue
getBillFromParty(GenericValue invoice)
Convenience method to obtain the bill from party for an invoice.static GenericValue
getBillToAddress(GenericValue invoice)
Method to obtain the billing address for an invoicestatic GenericValue
getBillToParty(GenericValue invoice)
Method to obtain the bill to party for an invoice.static GenericValue
getInvoiceAddressByType(GenericValue invoice, java.lang.String contactMechPurposeTypeId)
static GenericValue
getInvoiceAddressByType(GenericValue invoice, java.lang.String contactMechPurposeTypeId, boolean fetchPartyAddress)
static java.math.BigDecimal
getInvoiceApplied(Delegator delegator, java.lang.String invoiceId)
Method to return the total amount of an invoice which is applied to a paymentstatic java.math.BigDecimal
getInvoiceApplied(Delegator delegator, java.lang.String invoiceId, java.sql.Timestamp asOfDateTime, java.lang.Boolean actualCurrency)
Returns amount applied to invoice before an asOfDateTime, based on Payment.effectiveDate <= asOfDateTimestatic java.math.BigDecimal
getInvoiceApplied(GenericValue invoice)
Method to return the total amount of an invoice which is applied to a paymentstatic java.math.BigDecimal
getInvoiceApplied(GenericValue invoice, java.lang.Boolean actualCurrency)
Return the amount applied to the invoicestatic java.math.BigDecimal
getInvoiceApplied(GenericValue invoice, java.sql.Timestamp asOfDateTime)
static java.math.BigDecimal
getInvoiceCurrencyConversionRate(Delegator delegator, java.lang.String invoiceId)
static java.math.BigDecimal
getInvoiceCurrencyConversionRate(GenericValue invoice)
static java.math.BigDecimal
getInvoiceItemApplied(Delegator delegator, java.lang.String invoiceId, java.lang.String invoiceItemSeqId)
Method to return the amount of an invoiceItem which is applied to a paymentstatic java.math.BigDecimal
getInvoiceItemApplied(GenericValue invoiceItem)
Method to return the total amount of an invoiceItem which is applied to a paymentstatic java.lang.String
getInvoiceItemDescription(LocalDispatcher dispatcher, GenericValue invoiceItem, java.util.Locale locale)
Method to return the invoice item description with following step 1.static java.math.BigDecimal
getInvoiceItemTotal(GenericValue invoiceItem)
Method to return the total amount of an invoice item i.e.static java.math.BigDecimal
getInvoiceNotApplied(Delegator delegator, java.lang.String invoiceId)
static java.math.BigDecimal
getInvoiceNotApplied(Delegator delegator, java.lang.String invoiceId, java.lang.Boolean actualCurrency)
Method to return the total amount of an invoice which is not yet applied to a paymentstatic java.math.BigDecimal
getInvoiceNotApplied(GenericValue invoice)
static java.math.BigDecimal
getInvoiceNotApplied(GenericValue invoice, java.lang.Boolean actualCurrency)
static java.math.BigDecimal
getInvoiceNotApplied(GenericValue invoice, java.sql.Timestamp asOfDateTime)
Returns amount not applied (i.e., still outstanding) of an invoice at an asOfDate, based on Payment.effectiveDate <= asOfDateTimestatic java.math.BigDecimal
getInvoiceNoTaxTotal(GenericValue invoice)
static java.util.Map<java.lang.String,java.util.Set<java.lang.String>>
getInvoiceTaxAuthPartyAndGeos(GenericValue invoice)
Returns a List of the TaxAuthority Party and Geos for the given Invoice.static java.util.Map<java.lang.String,java.lang.Object>
getInvoiceTaxByTaxAuthGeoAndParty(GenericValue invoice)
Deprecated.static java.math.BigDecimal
getInvoiceTaxTotal(GenericValue invoice)
static java.math.BigDecimal
getInvoiceTaxTotalForTaxAuthPartyAndGeo(GenericValue invoice, java.lang.String taxAuthPartyId, java.lang.String taxAuthGeoId)
static java.math.BigDecimal
getInvoiceTotal(Delegator delegator, java.lang.String invoiceId)
Return the total amount of the invoice (including tax) using the the invoiceId as input.static java.math.BigDecimal
getInvoiceTotal(Delegator delegator, java.lang.String invoiceId, java.lang.Boolean actualCurrency)
Return the total amount of the invoice (including tax) using the the invoiceId as input.static java.math.BigDecimal
getInvoiceTotal(GenericValue invoice)
Method to return the total amount of an invoicestatic java.math.BigDecimal
getInvoiceTotal(GenericValue invoice, java.lang.Boolean actualCurrency)
Return the total amount of the invoice (including tax) using the the invoice GenericValue as input.static java.math.BigDecimal
getInvoiceUnattributedTaxTotal(GenericValue invoice)
Returns the invoice tax total for unattributed tax items, that is items which have no taxAuthPartyId valuestatic GenericValue
getSendFromAddress(GenericValue invoice)
Method to obtain the sending address for an invoicestatic GenericValue
getSendFromParty(GenericValue invoice)
Method to obtain the send from party for an invoicestatic 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 presentstatic java.util.List<java.lang.String>
getTaxableInvoiceItemTypeIds(Delegator delegator)
Method to get the taxable invoice item types as a List of invoiceItemTypeIds.
-
-
-
Method Detail
-
getInvoiceTotal
public static java.math.BigDecimal getInvoiceTotal(Delegator delegator, java.lang.String invoiceId)
Return the total amount of the invoice (including tax) using the the invoiceId as input.- Parameters:
delegator
- the delegatorinvoiceId
- the invoice id- Returns:
- Return the total amount of the invoice
-
getInvoiceTotal
public static java.math.BigDecimal getInvoiceTotal(Delegator delegator, java.lang.String invoiceId, java.lang.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 delegatorinvoiceId
- the invoice IdactualCurrency
- 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 java.math.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 java.lang.String getInvoiceItemDescription(LocalDispatcher dispatcher, GenericValue invoiceItem, java.util.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 java.util.List<java.lang.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 java.math.BigDecimal getInvoiceTaxTotal(GenericValue invoice)
-
getInvoiceNoTaxTotal
public static java.math.BigDecimal getInvoiceNoTaxTotal(GenericValue invoice)
-
getInvoiceTotal
public static java.math.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 java.math.BigDecimal getInvoiceTotal(GenericValue invoice, java.lang.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 InvoiceactualCurrency
- 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, java.lang.String contactMechPurposeTypeId)
-
getInvoiceAddressByType
public static GenericValue getInvoiceAddressByType(GenericValue invoice, java.lang.String contactMechPurposeTypeId, boolean fetchPartyAddress)
-
getInvoiceNotApplied
public static java.math.BigDecimal getInvoiceNotApplied(Delegator delegator, java.lang.String invoiceId, java.lang.Boolean actualCurrency)
Method to return the total amount of an invoice which is not yet applied to a payment- Parameters:
delegator
- the delegatorinvoiceId
- the invoice idactualCurrency
- the currency- Returns:
- the invoice total as BigDecimal
-
getInvoiceNotApplied
public static java.math.BigDecimal getInvoiceNotApplied(Delegator delegator, java.lang.String invoiceId)
-
getInvoiceNotApplied
public static java.math.BigDecimal getInvoiceNotApplied(GenericValue invoice)
-
getInvoiceNotApplied
public static java.math.BigDecimal getInvoiceNotApplied(GenericValue invoice, java.lang.Boolean actualCurrency)
-
getInvoiceNotApplied
public static java.math.BigDecimal getInvoiceNotApplied(GenericValue invoice, java.sql.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 invoiceasOfDateTime
- the date to use- Returns:
- Returns amount not applied of the invoice
-
getInvoiceApplied
public static java.math.BigDecimal getInvoiceApplied(Delegator delegator, java.lang.String invoiceId)
Method to return the total amount of an invoice which is applied to a payment- Parameters:
delegator
- the delegatorinvoiceId
- the invoice id- Returns:
- the invoice total as BigDecimal
-
getInvoiceApplied
public static java.math.BigDecimal getInvoiceApplied(Delegator delegator, java.lang.String invoiceId, java.sql.Timestamp asOfDateTime, java.lang.Boolean actualCurrency)
Returns amount applied to invoice before an asOfDateTime, based on Payment.effectiveDate <= asOfDateTime- Parameters:
delegator
- the delegatorinvoiceId
- the invoice idasOfDateTime
- - a Timestamp- Returns:
- returns amount applied to invoice before an asOfDateTime
-
getInvoiceApplied
public static java.math.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 java.math.BigDecimal getInvoiceApplied(GenericValue invoice, java.lang.Boolean actualCurrency)
Return the amount applied to the invoice- Parameters:
invoice
- GenericValue object of the invoiceactualCurrency
- the currency of the invoice- Returns:
- returns the amount applied to the invoice
-
getInvoiceApplied
public static java.math.BigDecimal getInvoiceApplied(GenericValue invoice, java.sql.Timestamp asOfDateTime)
-
getInvoiceItemApplied
public static java.math.BigDecimal getInvoiceItemApplied(Delegator delegator, java.lang.String invoiceId, java.lang.String invoiceItemSeqId)
Method to return the amount of an invoiceItem which is applied to a payment- Parameters:
delegator
- the delegatorinvoiceId
- the invoice idinvoiceItemSeqId
- the invoice item id- Returns:
- the invoice total as BigDecimal
-
getInvoiceItemApplied
public static java.math.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 java.math.BigDecimal getInvoiceCurrencyConversionRate(GenericValue invoice)
-
getInvoiceCurrencyConversionRate
public static java.math.BigDecimal getInvoiceCurrencyConversionRate(Delegator delegator, java.lang.String invoiceId)
-
getInvoiceTaxByTaxAuthGeoAndParty
@Deprecated public static java.util.Map<java.lang.String,java.lang.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 java.util.Map<java.lang.String,java.util.Set<java.lang.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 java.math.BigDecimal getInvoiceTaxTotalForTaxAuthPartyAndGeo(GenericValue invoice, java.lang.String taxAuthPartyId, java.lang.String taxAuthGeoId)
- Parameters:
invoice
- GenericValue object representing the invoicetaxAuthPartyId
-taxAuthGeoId
-- Returns:
- The invoice tax total for a given tax authority and geo location
-
getInvoiceUnattributedTaxTotal
public static java.math.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
-
-