Class OrderReadHelper

java.lang.Object
org.apache.ofbiz.order.order.OrderReadHelper

public class OrderReadHelper extends Object
Utility class for easily extracting important information from orders

NOTE: in the current scheme order adjustments are never included in tax or shipping, but order item adjustments ARE included in tax and shipping calcs unless they are tax or shipping adjustments or the includeInTax or includeInShipping are set to N.

  • Constructor Details

    • OrderReadHelper

      protected OrderReadHelper()
    • OrderReadHelper

      public OrderReadHelper(GenericValue orderHeader, List<GenericValue> adjustments, List<GenericValue> orderItems)
      Instantiates a new Order read helper.
      Parameters:
      orderHeader - the order header
      adjustments - the adjustments
      orderItems - the order items
    • OrderReadHelper

      public OrderReadHelper(GenericValue orderHeader)
      Instantiates a new Order read helper.
      Parameters:
      orderHeader - the order header
    • OrderReadHelper

      public OrderReadHelper(List<GenericValue> adjustments, List<GenericValue> orderItems)
      Instantiates a new Order read helper.
      Parameters:
      adjustments - the adjustments
      orderItems - the order items
    • OrderReadHelper

      public OrderReadHelper(Delegator delegator, String orderId)
      Instantiates a new Order read helper.
      Parameters:
      delegator - the delegator
      orderId - the order id
  • Method Details

    • getOrderId

      public String getOrderId()
      Gets order id.
      Returns:
      the order id
    • getWebSiteId

      public String getWebSiteId()
      Gets web site id.
      Returns:
      the web site id
    • getProductStoreId

      public String getProductStoreId()
      Gets product store id.
      Returns:
      the product store id
    • getProductStore

      public GenericValue getProductStore()
      Returns the ProductStore of this Order or null in case of Exception
      Returns:
      the product store
    • getOrderTypeId

      public String getOrderTypeId()
      Gets order type id.
      Returns:
      the order type id
    • getCurrency

      public String getCurrency()
      Gets currency.
      Returns:
      the currency
    • getOrderName

      public String getOrderName()
      Gets order name.
      Returns:
      the order name
    • getExternalId

      public String getExternalId()
      Gets externalId.
      Returns:
      the external id
    • getPriority

      public String getPriority()
      Gets order priority
      Returns:
      the priority
    • getAdjustments

      public List<GenericValue> getAdjustments()
      Gets adjustments.
      Returns:
      the adjustments
    • getPaymentPreferences

      public List<GenericValue> getPaymentPreferences()
      Gets payment preferences.
      Returns:
      the payment preferences
    • getReceivedPaymentTotalsByPaymentMethod

      public Map<String,BigDecimal> getReceivedPaymentTotalsByPaymentMethod()
      Returns a Map of paymentMethodId -> amount charged (BigDecimal) based on PaymentGatewayResponse.
      Returns:
      returns a Map of paymentMethodId -> amount charged (BigDecimal) based on PaymentGatewayResponse.
    • getReturnedTotalsByPaymentMethod

      public Map<String,BigDecimal> getReturnedTotalsByPaymentMethod()
      Returns a Map of paymentMethodId -> amount refunded
      Returns:
      returns a Map of paymentMethodId -> amount refunded
    • getOrderPayments

      public List<GenericValue> getOrderPayments()
      Gets order payments.
      Returns:
      the order payments
    • getOrderPayments

      public List<GenericValue> getOrderPayments(GenericValue orderPaymentPreference)
      Gets order payments.
      Parameters:
      orderPaymentPreference - the order payment preference
      Returns:
      the order payments
    • getOrderStatuses

      public List<GenericValue> getOrderStatuses()
      Gets order statuses.
      Returns:
      the order statuses
    • getOrderTerms

      public List<GenericValue> getOrderTerms()
      Gets order terms.
      Returns:
      the order terms
    • getOrderHeaderNotes

      public List<GenericValue> getOrderHeaderNotes(boolean internalNote)
      Return notes links to this order
      Parameters:
      internalNote -
      Returns:
      order notes
    • getOrderHeaderNotes

      public List<GenericValue> getOrderHeaderNotes()
      Return public notes links to this order
      Returns:
      order public notes
    • getOrderItemAttributes

      public List<GenericValue> getOrderItemAttributes()
      Retrieve order item attributes link to this order, first on this cache object else call delegator to load the cache from OrderItemAttribute entity
      Returns:
      Order item attributes link to this order
    • getOrderTermNetDays

      public Long getOrderTermNetDays()
      Return the number of days from termDays of first FIN_PAYMENT_TERM
      Returns:
      number of days from termDays of first FIN_PAYMENT_TERM
    • getShippingMethod

      public String getShippingMethod(String shipGroupSeqId)
      Gets shipping method.
      Parameters:
      shipGroupSeqId - the ship group seq id
      Returns:
      the shipping method
    • getShippingMethodCode

      public String getShippingMethodCode(String shipGroupSeqId)
      Gets shipping method code.
      Parameters:
      shipGroupSeqId - the ship group seq id
      Returns:
      the shipping method code
    • hasShippingAddress

      public boolean hasShippingAddress()
      Has shipping address boolean.
      Returns:
      the boolean
    • hasPhysicalProductItems

      public boolean hasPhysicalProductItems() throws GenericEntityException
      Has physical product items boolean.
      Returns:
      the boolean
      Throws:
      GenericEntityException - the generic entity exception
    • getOrderItemShipGroup

      public GenericValue getOrderItemShipGroup(String shipGroupSeqId)
      Gets order item ship group.
      Parameters:
      shipGroupSeqId - the ship group seq id
      Returns:
      the order item ship group
    • getOrderItemShipGroups

      public List<GenericValue> getOrderItemShipGroups()
      Gets order item ship groups.
      Returns:
      the order item ship groups
    • getShippingLocations

      public List<GenericValue> getShippingLocations()
      Gets shipping locations.
      Returns:
      the shipping locations
    • getShippingAddress

      public GenericValue getShippingAddress(String shipGroupSeqId)
      Gets shipping address.
      Parameters:
      shipGroupSeqId - the ship group seq id
      Returns:
      the shipping address
    • getShippingAddress

      @Deprecated public GenericValue getShippingAddress()
      Deprecated.
      Gets shipping address.
      Returns:
      the shipping address
    • getBillingLocations

      public List<GenericValue> getBillingLocations()
      Gets billing locations.
      Returns:
      the billing locations
    • getBillingAddress

      @Deprecated public GenericValue getBillingAddress()
      Deprecated.
      Gets billing address.
      Returns:
      the billing address
    • getOrderContactMechs

      public List<GenericValue> getOrderContactMechs(String purposeTypeId)
      Gets order contact mechs.
      Parameters:
      purposeTypeId - the purpose type id
      Returns:
      the order contact mechs
    • getEarliestShipByDate

      public Timestamp getEarliestShipByDate()
      Gets earliest ship by date.
      Returns:
      the earliest ship by date
    • getLatestShipAfterDate

      public Timestamp getLatestShipAfterDate()
      Gets latest ship after date.
      Returns:
      the latest ship after date
    • getCurrentStatusString

      public String getCurrentStatusString()
      Gets current status string.
      Returns:
      the current status string
    • getStatusString

      public String getStatusString(Locale locale)
      Gets status string.
      Parameters:
      locale - the locale
      Returns:
      the status string
    • getBillingAccount

      public GenericValue getBillingAccount()
      Gets billing account.
      Returns:
      the billing account
    • getBillingAccountMaxAmount

      public BigDecimal getBillingAccountMaxAmount()
      Returns the OrderPaymentPreference.maxAmount for the billing account associated with the order, or 0 if there is no billing account or no max amount set
      Returns:
      the billing account max amount
    • getBillToParty

      public GenericValue getBillToParty()
      Returns party from OrderRole of BILL_TO_CUSTOMER
      Returns:
      the bill to party
    • getBillFromParty

      public GenericValue getBillFromParty()
      Returns party from OrderRole of BILL_FROM_VENDOR
      Returns:
      the bill from party
    • getShipToParty

      public GenericValue getShipToParty()
      Returns party from OrderRole of SHIP_TO_CUSTOMER
      Returns:
      the ship to party
    • getPlacingParty

      public GenericValue getPlacingParty()
      Returns party from OrderRole of PLACING_CUSTOMER
      Returns:
      the placing party
    • getEndUserParty

      public GenericValue getEndUserParty()
      Returns party from OrderRole of END_USER_CUSTOMER
      Returns:
      the end user party
    • getSupplierAgent

      public GenericValue getSupplierAgent()
      Returns party from OrderRole of SUPPLIER_AGENT
      Returns:
      the supplier agent
    • getPartyFromRole

      public GenericValue getPartyFromRole(String roleTypeId)
      Gets party from role.
      Parameters:
      roleTypeId - the role type id
      Returns:
      the party from role
    • getDistributorId

      public String getDistributorId()
      Gets distributor id.
      Returns:
      the distributor id
    • getAffiliateId

      public String getAffiliateId()
      Gets affiliate id.
      Returns:
      the affiliate id
    • getShippingTotal

      public BigDecimal getShippingTotal()
      Gets shipping total.
      Returns:
      the shipping total
    • getHeaderTaxTotal

      public BigDecimal getHeaderTaxTotal()
      Gets header tax total.
      Returns:
      the header tax total
    • getTaxTotal

      public BigDecimal getTaxTotal()
      Gets tax total.
      Returns:
      the tax total
    • getItemFeatureSet

      public Set<String> getItemFeatureSet(GenericValue item)
      Gets item feature set.
      Parameters:
      item - the item
      Returns:
      the item feature set
    • getFeatureIdQtyMap

      public Map<String,BigDecimal> getFeatureIdQtyMap(String shipGroupSeqId)
      Gets feature id qty map.
      Parameters:
      shipGroupSeqId - the ship group seq id
      Returns:
      the feature id qty map
    • shippingApplies

      public boolean shippingApplies()
      Shipping applies boolean.
      Returns:
      the boolean
    • taxApplies

      public boolean taxApplies()
      Tax applies boolean.
      Returns:
      the boolean
    • getShippableTotal

      public BigDecimal getShippableTotal(String shipGroupSeqId)
      Gets shippable total.
      Parameters:
      shipGroupSeqId - the ship group seq id
      Returns:
      the shippable total
    • getShippableQuantity

      public BigDecimal getShippableQuantity()
      Gets shippable quantity.
      Returns:
      the shippable quantity
    • getShippableQuantity

      public BigDecimal getShippableQuantity(String shipGroupSeqId)
      Gets shippable quantity.
      Parameters:
      shipGroupSeqId - the ship group seq id
      Returns:
      the shippable quantity
    • getShippableWeight

      public BigDecimal getShippableWeight(String shipGroupSeqId)
      Gets shippable weight.
      Parameters:
      shipGroupSeqId - the ship group seq id
      Returns:
      the shippable weight
    • getItemWeight

      public BigDecimal getItemWeight(GenericValue item)
      Gets item weight.
      Parameters:
      item - the item
      Returns:
      the item weight
    • getShippableSizes

      public List<BigDecimal> getShippableSizes()
      Gets shippable sizes.
      Returns:
      the shippable sizes
    • getOrderPaymentPreferenceTotalByType

      public BigDecimal getOrderPaymentPreferenceTotalByType(String paymentMethodTypeId)
      Get the total payment preference amount by payment type. Specify null to get amount for all preference types. TODO: filter by status as well?
      Parameters:
      paymentMethodTypeId - the payment method type id
      Returns:
      the order payment preference total by type
    • getCreditCardPaymentPreferenceTotal

      public BigDecimal getCreditCardPaymentPreferenceTotal()
      Gets credit card payment preference total.
      Returns:
      the credit card payment preference total
    • getBillingAccountPaymentPreferenceTotal

      public BigDecimal getBillingAccountPaymentPreferenceTotal()
      Gets billing account payment preference total.
      Returns:
      the billing account payment preference total
    • getGiftCardPaymentPreferenceTotal

      public BigDecimal getGiftCardPaymentPreferenceTotal()
      Gets gift card payment preference total.
      Returns:
      the gift card payment preference total
    • getOrderPaymentReceivedTotalByType

      public BigDecimal getOrderPaymentReceivedTotalByType(String paymentMethodTypeId)
      Get the total payment received amount by payment type. Specify null to get amount over all types. This method works by going through all the PaymentAndApplications for all order Invoices that have status PMNT_RECEIVED.
      Parameters:
      paymentMethodTypeId - the payment method type id
      Returns:
      the order payment received total by type
    • getItemSize

      public BigDecimal getItemSize(GenericValue item)
      Gets item size.
      Parameters:
      item - the item
      Returns:
      the item size
    • getItemPiecesIncluded

      public long getItemPiecesIncluded(GenericValue item)
      Gets item pieces included.
      Parameters:
      item - the item
      Returns:
      the item pieces included
    • getShippableItemInfo

      public List<Map<String,Object>> getShippableItemInfo(String shipGroupSeqId)
      Gets shippable item info.
      Parameters:
      shipGroupSeqId - the ship group seq id
      Returns:
      the shippable item info
    • getItemInfoMap

      public Map<String,Object> getItemInfoMap(GenericValue item)
      Gets item info map.
      Parameters:
      item - the item
      Returns:
      the item info map
    • getOrderEmailString

      public String getOrderEmailString()
      Gets order email string.
      Returns:
      the order email string
    • getOrderGrandTotal

      public BigDecimal getOrderGrandTotal()
      Gets order grand total.
      Returns:
      the order grand total
    • getOrderOpenAmount

      public BigDecimal getOrderOpenAmount() throws GenericEntityException
      Gets the amount open on the order that is not covered by the relevant OrderPaymentPreferences. This works by adding up the amount allocated to each unprocessed OrderPaymentPreference and the amounts received and refunded as payments for the settled ones.
      Returns:
      the order open amount
      Throws:
      GenericEntityException - the generic entity exception
    • getOrderHeaderAdjustments

      public List<GenericValue> getOrderHeaderAdjustments()
      Gets order header adjustments.
      Returns:
      the order header adjustments
    • getOrderHeaderAdjustments

      public List<GenericValue> getOrderHeaderAdjustments(String shipGroupSeqId)
      Gets order header adjustments.
      Parameters:
      shipGroupSeqId - the ship group seq id
      Returns:
      the order header adjustments
    • getOrderHeaderAdjustmentsTax

      public List<GenericValue> getOrderHeaderAdjustmentsTax(String shipGroupSeqId)
      Gets order header adjustments tax.
      Parameters:
      shipGroupSeqId - the ship group seq id
      Returns:
      the order header adjustments tax
    • getOrderHeaderAdjustmentsToShow

      public List<GenericValue> getOrderHeaderAdjustmentsToShow()
      Gets order header adjustments to show.
      Returns:
      the order header adjustments to show
    • getOrderHeaderStatuses

      public List<GenericValue> getOrderHeaderStatuses()
      Gets order header statuses.
      Returns:
      the order header statuses
    • getOrderAdjustmentsTotal

      public BigDecimal getOrderAdjustmentsTotal()
      Gets order adjustments total.
      Returns:
      the order adjustments total
    • getOrderAdjustmentTotal

      public BigDecimal getOrderAdjustmentTotal(GenericValue adjustment)
      Gets order adjustment total.
      Parameters:
      adjustment - the adjustment
      Returns:
      the order adjustment total
    • hasSurvey

      public int hasSurvey()
      Has survey int.
      Returns:
      the int
    • getOrderItems

      public List<GenericValue> getOrderItems()
      Gets order items.
      Returns:
      the order items
    • getOrderItemAndShipGroupAssoc

      public List<GenericValue> getOrderItemAndShipGroupAssoc()
      Gets order item and ship group assoc.
      Returns:
      the order item and ship group assoc
    • getOrderItemAndShipGroupAssoc

      public List<GenericValue> getOrderItemAndShipGroupAssoc(String shipGroupSeqId)
      Gets order item and ship group assoc.
      Parameters:
      shipGroupSeqId - the ship group seq id
      Returns:
      the order item and ship group assoc
    • getValidOrderItems

      public List<GenericValue> getValidOrderItems()
      Gets valid order items.
      Returns:
      the valid order items
    • getPastEtaOrderItems

      public boolean getPastEtaOrderItems(String orderId)
      Gets past eta order items.
      Parameters:
      orderId - the order id
      Returns:
      the past eta order items
    • getRejectedOrderItems

      public boolean getRejectedOrderItems()
      Gets rejected order items.
      Returns:
      the rejected order items
    • getPartiallyReceivedItems

      public boolean getPartiallyReceivedItems()
      Gets partially received items.
      Returns:
      the partially received items
    • getValidOrderItems

      public List<GenericValue> getValidOrderItems(String shipGroupSeqId)
      Gets valid order items.
      Parameters:
      shipGroupSeqId - the ship group seq id
      Returns:
      the valid order items
    • getOrderItem

      public GenericValue getOrderItem(String orderItemSeqId)
      Gets order item.
      Parameters:
      orderItemSeqId - the order item seq id
      Returns:
      the order item
    • getValidDigitalItems

      public List<GenericValue> getValidDigitalItems()
      Gets valid digital items.
      Returns:
      the valid digital items
    • getOrderItemAdjustments

      public List<GenericValue> getOrderItemAdjustments(GenericValue orderItem)
      Gets order item adjustments.
      Parameters:
      orderItem - the order item
      Returns:
      the order item adjustments
    • getCurrentOrderItemWorkEffort

      public String getCurrentOrderItemWorkEffort(GenericValue orderItem)
      Gets current order item work effort.
      Parameters:
      orderItem - the order item
      Returns:
      the current order item work effort
    • getCurrentItemStatus

      public String getCurrentItemStatus(GenericValue orderItem)
      Gets current item status.
      Parameters:
      orderItem - the order item
      Returns:
      the current item status
    • getOrderItemPriceInfos

      public List<GenericValue> getOrderItemPriceInfos(GenericValue orderItem)
      Gets order item price infos.
      Parameters:
      orderItem - the order item
      Returns:
      the order item price infos
    • getOrderItemShipGroupAssocs

      public List<GenericValue> getOrderItemShipGroupAssocs(GenericValue orderItem)
      Gets order item ship group assocs.
      Parameters:
      orderItem - the order item
      Returns:
      the order item ship group assocs
    • getOrderItemShipGrpInvResList

      public List<GenericValue> getOrderItemShipGrpInvResList(GenericValue orderItem)
      Gets order item ship grp inv res list.
      Parameters:
      orderItem - the order item
      Returns:
      the order item ship grp inv res list
    • getOrderItemIssuances

      public List<GenericValue> getOrderItemIssuances(GenericValue orderItem)
      Gets order item issuances.
      Parameters:
      orderItem - the order item
      Returns:
      the order item issuances
    • getOrderItemIssuances

      public List<GenericValue> getOrderItemIssuances(GenericValue orderItem, String shipmentId)
      Gets order item issuances.
      Parameters:
      orderItem - the order item
      shipmentId - the shipment id
      Returns:
      the order item issuances
    • getOrderProductIds

      public Collection<String> getOrderProductIds()
      Get a set of productIds in the order. @return the order product ids
    • getOrderReturnItems

      public List<GenericValue> getOrderReturnItems()
      Gets order return items.
      Returns:
      the order return items
    • getOrderItemReturnedQuantities

      public Map<String,BigDecimal> getOrderItemReturnedQuantities()
      Get the quantity returned per order item. In other words, this method will count the ReturnItems related to each OrderItem.
      Returns:
      Map of returned quantities as BigDecimals keyed to the orderItemSeqId
    • getOrderReturnedQuantity

      public BigDecimal getOrderReturnedQuantity()
      Get the total quantity of returned items for an order. This will count only the ReturnItems that are directly correlated to an OrderItem.
      Returns:
      the order returned quantity
    • getOrderReturnedTotalByTypeBd

      public BigDecimal getOrderReturnedTotalByTypeBd(String returnTypeId, boolean includeAll)
      Get the returned total by return type (credit, refund, etc.). Specify returnTypeId = null to get sum over all return types. Specify includeAll = true to sum up over all return statuses except cancelled. Specify includeAll = false to sum up over ACCEPTED, RECEIVED And COMPLETED returns.
      Parameters:
      returnTypeId - the return type id
      includeAll - the include all
      Returns:
      the order returned total by type bd
    • getOrderReturnedCreditTotalBd

      public BigDecimal getOrderReturnedCreditTotalBd()
      Gets the total return credit for COMPLETED and RECEIVED returns. @return the order returned credit total bd
    • getOrderReturnedRefundTotalBd

      public BigDecimal getOrderReturnedRefundTotalBd()
      Gets the total return refunded for COMPLETED and RECEIVED returns. @return the order returned refund total bd
    • getOrderReturnedTotal

      public BigDecimal getOrderReturnedTotal()
      Gets the total return amount (all return types) for COMPLETED and RECEIVED returns. @return the order returned total
    • getOrderReturnedTotal

      public BigDecimal getOrderReturnedTotal(boolean includeAll)
      Gets the total returned over all return types. Specify true to include all return statuses except cancelled. Specify false to include only COMPLETED and RECEIVED returns.
      Parameters:
      includeAll - the include all
      Returns:
      the order returned total
    • getOrderNonReturnedTaxAndShipping

      public BigDecimal getOrderNonReturnedTaxAndShipping()
      Gets order non returned tax and shipping.
      Returns:
      the order non returned tax and shipping
    • getBillingAccountReturnedTotalByTypeBd

      public BigDecimal getBillingAccountReturnedTotalByTypeBd(String returnTypeId)
      Gets the total refunded to the order billing account by type. Specify null to get total over all types.
      Parameters:
      returnTypeId - the return type id
      Returns:
      the billing account returned total by type bd
    • getBillingAccountReturnedCreditTotalBd

      public BigDecimal getBillingAccountReturnedCreditTotalBd()
      Get the total return credited to the order billing accounts @return the billing account returned credit total bd
    • getBillingAccountReturnedRefundTotalBd

      public BigDecimal getBillingAccountReturnedRefundTotalBd()
      Get the total return refunded to the order billing accounts @return the billing account returned refund total bd
    • getReturnedCreditTotalWithBillingAccountBd

      public BigDecimal getReturnedCreditTotalWithBillingAccountBd()
      Gets the total return credited amount with refunds and credits to the billing account figured in @return the returned credit total with billing account bd
    • getReturnedRefundTotalWithBillingAccountBd

      public BigDecimal getReturnedRefundTotalWithBillingAccountBd()
      Gets the total return refund amount with refunds and credits to the billing account figured in @return the returned refund total with billing account bd
    • getOrderBackorderQuantity

      public BigDecimal getOrderBackorderQuantity()
      Gets order backorder quantity.
      Returns:
      the order backorder quantity
    • getItemPickedQuantityBd

      public BigDecimal getItemPickedQuantityBd(GenericValue orderItem)
      Gets item picked quantity bd.
      Parameters:
      orderItem - the order item
      Returns:
      the item picked quantity bd
    • getItemShippedQuantity

      public BigDecimal getItemShippedQuantity(GenericValue orderItem)
      Gets item shipped quantity.
      Parameters:
      orderItem - the order item
      Returns:
      the item shipped quantity
    • getItemShipGroupAssocShippedQuantity

      public BigDecimal getItemShipGroupAssocShippedQuantity(GenericValue orderItem, String shipGroupSeqId)
      Gets item ship group assoc shipped quantity.
      Parameters:
      orderItem - the order item
      shipGroupSeqId - the ship group seq id
      Returns:
      the item ship group assoc shipped quantity
    • getItemReservedQuantity

      public BigDecimal getItemReservedQuantity(GenericValue orderItem)
      Gets item reserved quantity.
      Parameters:
      orderItem - the order item
      Returns:
      the item reserved quantity
    • getItemBackorderedQuantity

      public BigDecimal getItemBackorderedQuantity(GenericValue orderItem)
      Gets item backordered quantity.
      Parameters:
      orderItem - the order item
      Returns:
      the item backordered quantity
    • getItemPendingShipmentQuantity

      public BigDecimal getItemPendingShipmentQuantity(GenericValue orderItem)
      Gets item pending shipment quantity.
      Parameters:
      orderItem - the order item
      Returns:
      the item pending shipment quantity
    • getItemCanceledQuantity

      public BigDecimal getItemCanceledQuantity(GenericValue orderItem)
      Gets item canceled quantity.
      Parameters:
      orderItem - the order item
      Returns:
      the item canceled quantity
    • getTotalOrderItemsQuantity

      public BigDecimal getTotalOrderItemsQuantity()
      Gets total order items quantity.
      Returns:
      the total order items quantity
    • getTotalOrderItemsOrderedQuantity

      public BigDecimal getTotalOrderItemsOrderedQuantity()
      Gets total order items ordered quantity.
      Returns:
      the total order items ordered quantity
    • getOrderItemsSubTotal

      public BigDecimal getOrderItemsSubTotal()
      Gets order items sub total.
      Returns:
      the order items sub total
    • getOrderItemSubTotal

      public BigDecimal getOrderItemSubTotal(GenericValue orderItem)
      Gets order item sub total.
      Parameters:
      orderItem - the order item
      Returns:
      the order item sub total
    • getOrderItemsTotal

      public BigDecimal getOrderItemsTotal()
      Gets order items total.
      Returns:
      the order items total
    • getOrderItemTotal

      public BigDecimal getOrderItemTotal(GenericValue orderItem)
      Gets order item total.
      Parameters:
      orderItem - the order item
      Returns:
      the order item total
    • getOrderItemTax

      public BigDecimal getOrderItemTax(GenericValue orderItem)
      Gets order item tax.
      Parameters:
      orderItem - the order item
      Returns:
      the order item tax
    • getOrderItemShipping

      public BigDecimal getOrderItemShipping(GenericValue orderItem)
      Gets order item shipping.
      Parameters:
      orderItem - the order item
      Returns:
      the order item shipping
    • getOrderItemAdjustmentsTotal

      public BigDecimal getOrderItemAdjustmentsTotal(GenericValue orderItem, boolean includeOther, boolean includeTax, boolean includeShipping)
      Gets order item adjustments total.
      Parameters:
      orderItem - the order item
      includeOther - the include other
      includeTax - the include tax
      includeShipping - the include shipping
      Returns:
      the order item adjustments total
    • getOrderItemAdjustmentsTotal

      public BigDecimal getOrderItemAdjustmentsTotal(GenericValue orderItem)
      Gets order item adjustments total.
      Parameters:
      orderItem - the order item
      Returns:
      the order item adjustments total
    • getOrderItemAdjustmentTotal

      public BigDecimal getOrderItemAdjustmentTotal(GenericValue orderItem, GenericValue adjustment)
      Gets order item adjustment total.
      Parameters:
      orderItem - the order item
      adjustment - the adjustment
      Returns:
      the order item adjustment total
    • getAdjustmentType

      public String getAdjustmentType(GenericValue adjustment)
      Gets adjustment type.
      Parameters:
      adjustment - the adjustment
      Returns:
      the adjustment type
    • getOrderItemStatuses

      public List<GenericValue> getOrderItemStatuses(GenericValue orderItem)
      Gets order item statuses.
      Parameters:
      orderItem - the order item
      Returns:
      the order item statuses
    • getCurrentItemStatusString

      public String getCurrentItemStatusString(GenericValue orderItem)
      Gets current item status string.
      Parameters:
      orderItem - the order item
      Returns:
      the current item status string
    • getOrderItemsByCondition

      public List<GenericValue> getOrderItemsByCondition(EntityCondition entityCondition)
      Fetches the set of order items with the given EntityCondition. @param entityCondition the entity condition
      Returns:
      the order items by condition
    • getProductPromoCodesEntered

      public Set<String> getProductPromoCodesEntered()
      Gets product promo codes entered.
      Returns:
      the product promo codes entered
    • getProductPromoUse

      public List<GenericValue> getProductPromoUse()
      Gets product promo use.
      Returns:
      the product promo use
    • hasPermission

      public boolean hasPermission(Security security, GenericValue userLogin)
      Checks to see if this user has read permission on this order
      Parameters:
      security - the security
      userLogin - The UserLogin value object to check
      Returns:
      boolean True if we have read permission
    • getOrderHeader

      public GenericValue getOrderHeader()
      Getter for property orderHeader.
      Returns:
      Value of property orderHeader.
    • getOrderHeader

      public static GenericValue getOrderHeader(Delegator delegator, String orderId)
      Gets order header.
      Parameters:
      delegator - the delegator
      orderId - the order id
      Returns:
      the order header
    • getOrderItemQuantity

      public static BigDecimal getOrderItemQuantity(GenericValue orderItem)
      Gets order item quantity.
      Parameters:
      orderItem - the order item
      Returns:
      the order item quantity
    • getOrderItemShipGroupQuantity

      public static BigDecimal getOrderItemShipGroupQuantity(GenericValue shipGroupAssoc)
      Gets order item ship group quantity.
      Parameters:
      shipGroupAssoc - the ship group assoc
      Returns:
      the order item ship group quantity
    • getProductStoreFromOrder

      public static GenericValue getProductStoreFromOrder(Delegator delegator, String orderId)
      Gets product store from order.
      Parameters:
      delegator - the delegator
      orderId - the order id
      Returns:
      the product store from order
    • getProductStoreFromOrder

      public static GenericValue getProductStoreFromOrder(GenericValue orderHeader)
      Gets product store from order.
      Parameters:
      orderHeader - the order header
      Returns:
      the product store from order
    • getOrderGrandTotal

      public static BigDecimal getOrderGrandTotal(List<GenericValue> orderItems, List<GenericValue> adjustments)
      Gets order grand total.
      Parameters:
      orderItems - the order items
      adjustments - the adjustments
      Returns:
      the order grand total
    • getOrderHeaderAdjustments

      public static List<GenericValue> getOrderHeaderAdjustments(List<GenericValue> adjustments, String shipGroupSeqId)
      Gets order header adjustments.
      Parameters:
      adjustments - the adjustments
      shipGroupSeqId - the ship group seq id
      Returns:
      the order header adjustments
    • getOrderHeaderStatuses

      public static List<GenericValue> getOrderHeaderStatuses(List<GenericValue> orderStatuses)
      Gets order header statuses.
      Parameters:
      orderStatuses - the order statuses
      Returns:
      the order header statuses
    • getOrderAdjustmentsTotal

      public static BigDecimal getOrderAdjustmentsTotal(List<GenericValue> orderItems, List<GenericValue> adjustments)
      Gets order adjustments total.
      Parameters:
      orderItems - the order items
      adjustments - the adjustments
      Returns:
      the order adjustments total
    • getOrderSurveyResponses

      public static List<GenericValue> getOrderSurveyResponses(GenericValue orderHeader)
      Gets order survey responses.
      Parameters:
      orderHeader - the order header
      Returns:
      the order survey responses
    • getOrderItemSurveyResponse

      public static List<GenericValue> getOrderItemSurveyResponse(GenericValue orderItem)
      Gets order item survey response.
      Parameters:
      orderItem - the order item
      Returns:
      the order item survey response
    • calcOrderAdjustments

      public static BigDecimal calcOrderAdjustments(List<GenericValue> orderHeaderAdjustments, BigDecimal subTotal, boolean includeOther, boolean includeTax, boolean includeShipping)
      Calc order adjustments big decimal.
      Parameters:
      orderHeaderAdjustments - the order header adjustments
      subTotal - the sub total
      includeOther - the include other
      includeTax - the include tax
      includeShipping - the include shipping
      Returns:
      the big decimal
    • calcOrderAdjustment

      public static BigDecimal calcOrderAdjustment(GenericValue orderAdjustment, BigDecimal orderSubTotal)
      Calc order adjustment big decimal.
      Parameters:
      orderAdjustment - the order adjustment
      orderSubTotal - the order sub total
      Returns:
      the big decimal
    • getOrderItemsSubTotal

      public static BigDecimal getOrderItemsSubTotal(List<GenericValue> orderItems, List<GenericValue> adjustments)
      Gets order items sub total.
      Parameters:
      orderItems - the order items
      adjustments - the adjustments
      Returns:
      the order items sub total
    • getOrderItemsSubTotal

      public static BigDecimal getOrderItemsSubTotal(List<GenericValue> orderItems, List<GenericValue> adjustments, List<GenericValue> workEfforts)
      Gets order items sub total.
      Parameters:
      orderItems - the order items
      adjustments - the adjustments
      workEfforts - the work efforts
      Returns:
      the order items sub total
    • getOrderItemSubTotal

      public static BigDecimal getOrderItemSubTotal(GenericValue orderItem, List<GenericValue> adjustments)
      The passed adjustments can be all adjustments for the order, ie for all line items @param orderItem the order item
      Parameters:
      adjustments - the adjustments
      Returns:
      the order item sub total
    • getOrderItemSubTotal

      public static BigDecimal getOrderItemSubTotal(GenericValue orderItem, List<GenericValue> adjustments, boolean forTax, boolean forShipping)
      The passed adjustments can be all adjustments for the order, ie for all line items @param orderItem the order item
      Parameters:
      adjustments - the adjustments
      forTax - the for tax
      forShipping - the for shipping
      Returns:
      the order item sub total
    • getOrderItemsTotal

      public static BigDecimal getOrderItemsTotal(List<GenericValue> orderItems, List<GenericValue> adjustments)
      Gets order items total.
      Parameters:
      orderItems - the order items
      adjustments - the adjustments
      Returns:
      the order items total
    • getOrderItemTotal

      public static BigDecimal getOrderItemTotal(GenericValue orderItem, List<GenericValue> adjustments)
      Gets order item total.
      Parameters:
      orderItem - the order item
      adjustments - the adjustments
      Returns:
      the order item total
    • calcOrderPromoAdjustmentsBd

      public static BigDecimal calcOrderPromoAdjustmentsBd(List<GenericValue> allOrderAdjustments)
      Calc order promo adjustments bd big decimal.
      Parameters:
      allOrderAdjustments - the all order adjustments
      Returns:
      the big decimal
    • getWorkEffortRentalLength

      public static BigDecimal getWorkEffortRentalLength(GenericValue workEffort)
      Gets work effort rental length.
      Parameters:
      workEffort - the work effort
      Returns:
      the work effort rental length
    • getWorkEffortRentalQuantity

      public static BigDecimal getWorkEffortRentalQuantity(GenericValue workEffort)
      Gets work effort rental quantity.
      Parameters:
      workEffort - the work effort
      Returns:
      the work effort rental quantity
    • getAllOrderItemsAdjustmentsTotal

      public static BigDecimal getAllOrderItemsAdjustmentsTotal(List<GenericValue> orderItems, List<GenericValue> adjustments, boolean includeOther, boolean includeTax, boolean includeShipping)
      Gets all order items adjustments total.
      Parameters:
      orderItems - the order items
      adjustments - the adjustments
      includeOther - the include other
      includeTax - the include tax
      includeShipping - the include shipping
      Returns:
      the all order items adjustments total
    • getOrderItemAdjustmentsTotal

      public static BigDecimal getOrderItemAdjustmentsTotal(GenericValue orderItem, List<GenericValue> adjustments, boolean includeOther, boolean includeTax, boolean includeShipping)
      The passed adjustments can be all adjustments for the order, ie for all line items @param orderItem the order item
      Parameters:
      adjustments - the adjustments
      includeOther - the include other
      includeTax - the include tax
      includeShipping - the include shipping
      Returns:
      the order item adjustments total
    • getOrderItemAdjustmentsTotal

      public static BigDecimal getOrderItemAdjustmentsTotal(GenericValue orderItem, List<GenericValue> adjustments, boolean includeOther, boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping)
      The passed adjustments can be all adjustments for the order, ie for all line items @param orderItem the order item
      Parameters:
      adjustments - the adjustments
      includeOther - the include other
      includeTax - the include tax
      includeShipping - the include shipping
      forTax - the for tax
      forShipping - the for shipping
      Returns:
      the order item adjustments total
    • getOrderItemAdjustmentList

      public static List<GenericValue> getOrderItemAdjustmentList(GenericValue orderItem, List<GenericValue> adjustments)
      Gets order item adjustment list.
      Parameters:
      orderItem - the order item
      adjustments - the adjustments
      Returns:
      the order item adjustment list
    • getOrderItemStatuses

      public static List<GenericValue> getOrderItemStatuses(GenericValue orderItem, List<GenericValue> orderStatuses)
      Gets order item statuses.
      Parameters:
      orderItem - the order item
      orderStatuses - the order statuses
      Returns:
      the order item statuses
    • calcItemAdjustments

      public static BigDecimal calcItemAdjustments(BigDecimal quantity, BigDecimal unitPrice, List<GenericValue> adjustments, boolean includeOther, boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping)
      Calc item adjustments big decimal.
      Parameters:
      quantity - the quantity
      unitPrice - the unit price
      adjustments - the adjustments
      includeOther - the include other
      includeTax - the include tax
      includeShipping - the include shipping
      forTax - the for tax
      forShipping - the for shipping
      Returns:
      the big decimal
    • calcItemAdjustmentsRecurringBd

      public static BigDecimal calcItemAdjustmentsRecurringBd(BigDecimal quantity, BigDecimal unitPrice, List<GenericValue> adjustments, boolean includeOther, boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping)
      Calc item adjustments recurring bd big decimal.
      Parameters:
      quantity - the quantity
      unitPrice - the unit price
      adjustments - the adjustments
      includeOther - the include other
      includeTax - the include tax
      includeShipping - the include shipping
      forTax - the for tax
      forShipping - the for shipping
      Returns:
      the big decimal
    • calcItemAdjustment

      public static BigDecimal calcItemAdjustment(GenericValue itemAdjustment, GenericValue item)
      Calc item adjustment big decimal.
      Parameters:
      itemAdjustment - the item adjustment
      item - the item
      Returns:
      the big decimal
    • calcItemAdjustment

      public static BigDecimal calcItemAdjustment(GenericValue itemAdjustment, BigDecimal quantity, BigDecimal unitPrice)
      Calc item adjustment big decimal.
      Parameters:
      itemAdjustment - the item adjustment
      quantity - the quantity
      unitPrice - the unit price
      Returns:
      the big decimal
    • calcItemAdjustmentRecurringBd

      public static BigDecimal calcItemAdjustmentRecurringBd(GenericValue itemAdjustment, BigDecimal quantity, BigDecimal unitPrice)
      Calc item adjustment recurring bd big decimal.
      Parameters:
      itemAdjustment - the item adjustment
      quantity - the quantity
      unitPrice - the unit price
      Returns:
      the big decimal
    • filterOrderAdjustments

      public static List<GenericValue> filterOrderAdjustments(List<GenericValue> adjustments, boolean includeOther, boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping)
      Filter order adjustments list.
      Parameters:
      adjustments - the adjustments
      includeOther - the include other
      includeTax - the include tax
      includeShipping - the include shipping
      forTax - the for tax
      forShipping - the for shipping
      Returns:
      the list
    • getQuantityOnOrder

      public static BigDecimal getQuantityOnOrder(Delegator delegator, String productId)
      Gets quantity on order.
      Parameters:
      delegator - the delegator
      productId - the product id
      Returns:
      the quantity on order
    • hasPermission

      public static boolean hasPermission(Security security, GenericValue userLogin, GenericValue orderHeader)
      Checks to see if this user has read permission on the specified order
      Parameters:
      security - the security
      userLogin - The UserLogin value object to check
      orderHeader - The OrderHeader for the specified order
      Returns:
      boolean True if we have read permission
    • getHelper

      public static OrderReadHelper getHelper(GenericValue orderHeader)
      Gets helper.
      Parameters:
      orderHeader - the order header
      Returns:
      the helper
    • getAvailableOrderHeaderAdjustments

      public List<GenericValue> getAvailableOrderHeaderAdjustments()
      Get orderAdjustments that have no corresponding returnAdjustment It also handles the case of partial adjustment amount. Check OFBIZ-11185 for details
      Returns:
      return the order adjustments that have no corresponding with return adjustment
    • getReturnAdjustmentTotal

      public static BigDecimal getReturnAdjustmentTotal(Delegator delegator, Map<String,Object> condition)
      Get the total return adjustments for a set of key -> value condition pairs. Done for code efficiency.
      Parameters:
      delegator - the delegator
      condition - a map of the conditions to use
      Returns:
      Get the total return adjustments
    • setScaleByType

      public static BigDecimal setScaleByType(boolean isTax, BigDecimal value)
      Sets scale by type.
      Parameters:
      isTax - the is tax
      value - the value
      Returns:
      the scale by type
    • getOrderItemInvoicedQuantity

      public static BigDecimal getOrderItemInvoicedQuantity(GenericValue orderItem)
      Get the quantity of order items that have been invoiced @param orderItem the order item
      Returns:
      the order item invoiced quantity
    • getOrderPaymentStatuses

      public List<GenericValue> getOrderPaymentStatuses()
      Gets order payment statuses.
      Returns:
      the order payment statuses
    • getOrderPaymentStatuses

      public static List<GenericValue> getOrderPaymentStatuses(List<GenericValue> orderStatuses)
      Gets order payment statuses.
      Parameters:
      orderStatuses - the order statuses
      Returns:
      the order payment statuses
    • getOrderItemAttribute

      public String getOrderItemAttribute(String orderItemSeqId, String attributeName)
      When you call this function after a OrderReadHelper instantiation all OrderItemAttributes related to the orderHeader are load on local cache to optimize database call, after we just filter the cache with attributeName and orderItemSeqId wanted.
      Parameters:
      orderItemSeqId - the order item seq id
      attributeName - the attribute name
      Returns:
      order item attribute
    • getOrderItemAttribute

      public static String getOrderItemAttribute(GenericValue orderItem, String attributeName)
      Gets order item attribute.
      Parameters:
      orderItem - the order item
      attributeName - the attribute name
      Returns:
      the order item attribute
    • getOrderAttribute

      public String getOrderAttribute(String attributeName)
      When you call this function after a OrderReadHelper instantiation all OrderAttributes related to the orderHeader are load on local cache to optimize database call, after we just filter the cache with attributeName wanted.
      Parameters:
      attributeName - the attribute name
      Returns:
      order attribute
    • getOrderTaxByTaxAuthGeoAndParty

      public static Map<String,Object> getOrderTaxByTaxAuthGeoAndParty(List<GenericValue> orderAdjustments)
      Gets order tax by tax auth geo and party.
      Parameters:
      orderAdjustments - the order adjustments
      Returns:
      the order tax by tax auth geo and party
    • getOrderItemTaxByTaxAuthGeoAndPartyForDisplay

      public static Map<String,Object> getOrderItemTaxByTaxAuthGeoAndPartyForDisplay(GenericValue orderItem, List<GenericValue> orderAdjustmentsOriginal)
      Gets order item tax by tax auth geo and party for display.
      Parameters:
      orderItem - the order item
      orderAdjustmentsOriginal - the order adjustments original
      Returns:
      the order item tax by tax auth geo and party for display
    • getOrderTaxByTaxAuthGeoAndPartyForDisplay

      public static Map<String,Object> getOrderTaxByTaxAuthGeoAndPartyForDisplay(List<GenericValue> orderAdjustmentsOriginal)
      Gets order tax by tax auth geo and party for display.
      Parameters:
      orderAdjustmentsOriginal - the order adjustments original
      Returns:
      the order tax by tax auth geo and party for display
    • getBillingAccountBalance

      public static BigDecimal getBillingAccountBalance(GenericValue billingAccount) throws GenericEntityException
      Calculates the "available" balance of a billing account, which is the net balance minus amount of pending (not cancelled, rejected, or received) order payments. When looking at using a billing account for a new order, you should use this method.
      Parameters:
      billingAccount - the billing account record
      Returns:
      return the "available" balance of a billing account
      Throws:
      GenericEntityException - the generic entity exception
    • getAccountLimit

      public static BigDecimal getAccountLimit(GenericValue billingAccount) throws GenericEntityException
      Returns the accountLimit of the BillingAccount or BigDecimal ZERO if it is null
      Parameters:
      billingAccount - the billing account
      Returns:
      the account limit
      Throws:
      GenericEntityException - the generic entity exception
    • getShippableSizes

      public List<BigDecimal> getShippableSizes(String shipGrouSeqId)
      Gets shippable sizes.
      Parameters:
      shipGrouSeqId - the ship grou seq id
      Returns:
      the shippable sizes
    • getItemReceivedQuantity

      public BigDecimal getItemReceivedQuantity(GenericValue orderItem)
      Gets item received quantity.
      Parameters:
      orderItem - the order item
      Returns:
      the item received quantity