Class InvoiceWorker
java.lang.Object
org.apache.ofbiz.accounting.invoice.InvoiceWorker
InvoiceWorker - Worker methods of invoices
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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, String contactMechPurposeTypeId) static GenericValue
getInvoiceAddressByType
(GenericValue invoice, String contactMechPurposeTypeId, boolean fetchPartyAddress) static BigDecimal
getInvoiceApplied
(Delegator delegator, String invoiceId) Method to return the total amount of an invoice which is applied to a paymentstatic BigDecimal
getInvoiceApplied
(Delegator delegator, String invoiceId, Timestamp asOfDateTime, Boolean actualCurrency) Returns amount applied to invoice before an asOfDateTime, based on Payment.effectiveDate <= asOfDateTimestatic BigDecimal
getInvoiceApplied
(GenericValue invoice) Method to return the total amount of an invoice which is applied to a paymentstatic BigDecimal
getInvoiceApplied
(GenericValue invoice, Boolean actualCurrency) Return the amount applied to the invoicestatic BigDecimal
getInvoiceApplied
(GenericValue invoice, Timestamp asOfDateTime) static BigDecimal
getInvoiceCurrencyConversionRate
(Delegator delegator, String invoiceId) static BigDecimal
static BigDecimal
getInvoiceItemApplied
(Delegator delegator, String invoiceId, String invoiceItemSeqId) Method to return the amount of an invoiceItem which is applied to a paymentstatic BigDecimal
getInvoiceItemApplied
(GenericValue invoiceItem) Method to return the total amount of an invoiceItem which is applied to a paymentstatic String
getInvoiceItemDescription
(LocalDispatcher dispatcher, GenericValue invoiceItem, Locale locale) Method to return the invoice item description with following step 1.static BigDecimal
getInvoiceItemTotal
(GenericValue invoiceItem) Method to return the total amount of an invoice item i.e.static BigDecimal
getInvoiceNotApplied
(Delegator delegator, String invoiceId) 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 paymentstatic BigDecimal
getInvoiceNotApplied
(GenericValue invoice) static BigDecimal
getInvoiceNotApplied
(GenericValue invoice, Boolean actualCurrency) 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 <= asOfDateTimestatic BigDecimal
getInvoiceNoTaxTotal
(GenericValue invoice) Returns a List of the TaxAuthority Party and Geos for the given Invoice.Deprecated.static BigDecimal
getInvoiceTaxTotal
(GenericValue invoice) static BigDecimal
getInvoiceTaxTotalForTaxAuthPartyAndGeo
(GenericValue invoice, String taxAuthPartyId, String taxAuthGeoId) static BigDecimal
getInvoiceTotal
(Delegator delegator, String invoiceId) Return the total amount of the invoice (including tax) using the the invoiceId as input.static BigDecimal
getInvoiceTotal
(Delegator delegator, String invoiceId, Boolean actualCurrency) Return the total amount of the invoice (including tax) using the the invoiceId as input.static BigDecimal
getInvoiceTotal
(GenericValue invoice) Method to return the total amount of an invoicestatic BigDecimal
getInvoiceTotal
(GenericValue invoice, Boolean actualCurrency) Return the total amount of the invoice (including tax) using the the invoice GenericValue as input.static BigDecimal
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 presentgetTaxableInvoiceItemTypeIds
(Delegator delegator) Method to get the taxable invoice item types as a List of invoiceItemTypeIds.
-
Method Details
-
getInvoiceTotal
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 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 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
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
-
getInvoiceNoTaxTotal
-
getInvoiceTotal
Method to return the total amount of an invoice- Parameters:
invoice
- GenericValue object of the Invoice- Returns:
- the invoice total as BigDecimal
-
getInvoiceTotal
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
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
Convenience method to obtain the bill from party for an invoice. Note that invoice.partyIdFrom is the bill from party. -
getSendFromParty
Method to obtain the send from party for an invoice- Parameters:
invoice
- GenericValue object of the Invoice- Returns:
- GenericValue object of the Party
-
getShippingAddress
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
Method to obtain the billing address for an invoice- Parameters:
invoice
- GenericValue object of the Invoice- Returns:
- GenericValue object of the PostalAddress
-
getSendFromAddress
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 delegatorinvoiceId
- the invoice idactualCurrency
- the currency- Returns:
- the invoice total as BigDecimal
-
getInvoiceNotApplied
-
getInvoiceNotApplied
-
getInvoiceNotApplied
-
getInvoiceNotApplied
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
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 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 delegatorinvoiceId
- the invoice idasOfDateTime
- - a Timestamp- Returns:
- returns amount applied to invoice before an asOfDateTime
-
getInvoiceApplied
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
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
-
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 delegatorinvoiceId
- the invoice idinvoiceItemSeqId
- the invoice item id- Returns:
- the invoice total as BigDecimal
-
getInvoiceItemApplied
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
-
getInvoiceCurrencyConversionRate
-
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
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 invoicetaxAuthPartyId
-taxAuthGeoId
-- Returns:
- The invoice tax total for a given tax authority and geo location
-
getInvoiceUnattributedTaxTotal
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
-