Modify Pricing Totals for Order Management

Modify the pricing totals that the Order Management work area displays.

Assume you need to add total cost and total margin to the price breakdown, and include the charge amount of each return line in the tax total.

Here's an example that includes pricing for a sales order that includes only return lines.

example that includes pricing for a sales order that includes only return lines

Summary of the Setup

  1. Set up your new totals.

  2. Set up the calculate sales totals pricing algorithm.

  3. Set up the identify usage totals pricing algorithm.

  4. Set up the compute simple totals pricing algorithm.

  5. Test your setup.

Set Up Your New Totals

  1. Sign into Oracle Order Management with administrative privileges.

  2. Go to the Setup and Maintenance work area, then go to the task.

    • Offering: Order Management

    • Functional Area: Pricing

    • Task: Manage Pricing Totals

  3. On the Manage Pricing Totals page, use Actions > Add Row to create your new totals.

    Total

    Name

    Description

    TOTAL_COST

    Total Cost

    Total cost for price and shipping charges on the order line.

    TOTAL_MARGIN

    Total Margin

    Total of the margin for price and shipping charges on the order line.

    Make sure you enable these options when you add the totals.

    • Transaction Enabled

    • Return Not Null

    Leave the Process Name attribute empty.

  4. Click Save.

Set Up the Calculate Sales Totals Pricing Algorithm

Set up the algorithm that calculates sales totals and specifies how to display them in the price breakdown.

  1. Sign out, then sign into Oracle Applications with the privileges that you need to administer pricing.

  2. Go to the Pricing Administration work area, then click Tasks > Manage Algorithms.

  3. On the Manage Algorithms page, click Query By Example, then search the Name column for Calculate Sales Totals.

  4. Click the row that contains the highest value in the Version column, then click Actions > Create Version.

  5. On the Edit Algorithm page, click the Post Process Totals step.

  6. In the Conditional Actions area, examine the TotalAnnotation property for each total.

    examine the TotalAnnotation property for each total

    The annotation uses dot notation to specify how each total displays in the price breakdown.

    section.sequence.font

    where

    • section specifies a section in the price breakdown.

    • sequence specifies where to display the total in the top to bottom sequence of lines in the price breakdown

    • font specifies the font style. Use 0 (zero) for font that isn't bold and 1 for bold.

    For example:

    If This Condition Is True

    Then Do This Action

    'QP_TOTAL_PAY_NOW' == Total.TotalCode

    Total.TotalAnnotation = '3.7.1'

    This condition states to place the Pay Now total in the third section, 7th in the sequence of totals, and to use bold font.

    The screen print doesn't include PrimaryFlag, for brevity. If you add a row, make sure you add PrimaryFlag under Total.TotalAnnotation. Set it to false for all rows except Pay Now. Set it true for Pay Now.

  7. In the Conditional Actions area, click Add Row, set the values, then click Save and Close.

    If This Condition Is True

    Then Do These Actions

    'TOTAL_COST' == Total.TotalCode

    Total.TotalAnnotation = '3.8.0'

    Total.PrimaryFlag =false

    'TOTAL_MARGIN' == Total.TotalCode

    Total.TotalAnnotation = '4.9.0'

    Total.PrimaryFlag =false

  8. On the Manage Algorithms page, click the row that contains the algorithm you just edited, then click Actions > Publish.

  9. Verify that the status on the row changes to Published.

Set Up the Identify Usage Totals Pricing Algorithm

Set up the algorithm that identifies the usage totals you want to display in the price breakdown for the sales order.

  1. On the Manage Algorithms page, click Query By Example, then search the Name column for Identify Usage Totals.

  2. Click the row that contains the highest value in the Version column, then click Actions > Create Version.

  3. On the Edit Algorithm page, click the Create Usage Total Entities step.

  4. In the Conditional Actions area, add actions for your new totals. Add them to the row that contains the 'ORA_SALES_ORDER' == Header.TotalUsageCode condition.

    Add the bold code.

    If This Condition Is True

    Then Do These Actions

    'ORA_SALES_ORDER' == Header.TotalUsageCode

    UsageTotal.insert([TotalCodeForUsage:'QP_TOTAL_LIST_PRICE', HeaderId:Header.HeaderId])

    UsageTotal.insert([TotalCodeForUsage:'QP_TOTAL_DISCOUNT', HeaderId:Header.HeaderId])

    UsageTotal.insert([TotalCodeForUsage:'QP_TOTAL_NET_PRICE', HeaderId:Header.HeaderId])

    UsageTotal.insert([TotalCodeForUsage:'QP_TOTAL_SHIP_CHARGE', HeaderId:Header.HeaderId])

    UsageTotal.insert([TotalCodeForUsage:'QP_TOTAL_TAX', HeaderId:Header.HeaderId])

    UsageTotal.insert([TotalCodeForUsage:'QP_TOTAL_CREDIT', HeaderId:Header.HeaderId])

    UsageTotal.insert([TotalCodeForUsage:'QP_TOTAL_PAY_NOW', HeaderId:Header.HeaderId])

    UsageTotal.insert([TotalCodeForUsage: 'TOTAL_COST', HeaderId:Header.HeaderId])

    UsageTotal.insert([TotalCodeForUsage:'TOTAL_MARGIN', HeaderId:Header.HeaderId])

  5. Click Save and Close.

  6. On the Manage Algorithms page, click the row that contains the algorithm you just edited, then click Actions > Publish.

Set Up the Compute Simple Totals Pricing Algorithm

Set up the algorithm that identifies the usage totals you want to display in the price breakdown for the sales order.

  1. On the Manage Algorithms page, click Query By Example, then search the Name column for Compute Simple Totals.

  2. Click the row that contains the highest value in the Version column, then click Actions > Create Version.

    This step iterates the ChargeComponents for each order header.

  3. Declare your variables.

    • Scroll down to the Local Variables area.

    • In the Local Variables area, add variables. Click Add Row to add each variable.

      Variable Name

      Default

      MarginTotalCode

      'TOTAL_MARGIN'

      You must include the single quotation marks.

      RunningMarginSum

      0.0

      MarginTotal

      Leave empty

  4. Add code to calculate the total.

    • In the Steps area, click the Compute Total step.

    • Add code in the Group Each Row Actions area.

      //TotalMargin
      totalUsage = TotalUsage.locate([TotalCodeForUsage: MarginTotalCode])
      if ('ORDER' == Line.LineCategoryCode && Charge.ChargeAppliesTo in ['PRICE', 'SHIPPING'] && ChargeComp.PriceElementCode == 'QP_MARGIN' && null != totalUsage) {
          if (null == MarginTotal) {
              MarginTotal = Total.locate([TotalCode: MarginTotalCode, HeaderId: Header.HeaderId]) TotalDef = getTotalDefinitionFromInternal(TotalDefinition, MarginTotalCode)
              if (TotalDef ? .TransactionEnabledFlag) {
                  TotalId = getNextId()
                  MarginTotal = Total.insert([TotalId: TotalId, TotalCode: MarginTotalCode, EstimatedFlag: IsEstimated, CurrencyCode: Header.AppliedCurrencyCode, HeaderId: Header.HeaderId, ParentEntityId: Header.HeaderId, ParentEntityCode: 'ORA_HEADER'])
      
                  TotalAmount = MarginTotal.createDataObject('TotalAmount')
                  TotalAmount.CurrencyCode = MarginTotal.CurrencyCode
                  TotalAmount.Value = 0.0
              }
          }
          if (null != MarginTotal) {
              RunningMarginSum += ChargeComp.HeaderCurrencyExtendedAmount.Value
              TotalComp.insert([TotalComponentId: getNextId(), TotalId: MarginTotal.TotalId, ChargeComponentId: ChargeComp.ChargeComponentId])
          }
      }

      Here's an explanation.

      Add code in the Group Each Row Actions area.
    • Add code in the Group Last Row Actions area. This code locates the new Total and assigns the calculated Sum value.

      if (null == MarginTotal) MarginTotal = Total.locate([TotalCode: MarginTotalCode, HeaderId: Header.HeaderId])
      
      if (MarginTotal != null) {
          MarginTotal.TotalAmount.Value = RunningMarginSum
      }
  5. Add code to handle a situation where the total is empty.

    • In the Steps area, click the Write Empty Totals step.

    • Add code in the Default Action area.

      //Empty TotalPayNow
      TotalCode = 'TOTAL_MARGIN'
      CheckTotal = Total.locate([TotalCode: TotalCode])
      totalUsage = TotalUsage.locate([TotalCodeForUsage: TotalCode])
      TotalDef = getTotalDefinitionFromInternal(TotalDefinition, TotalCode)
      if (null != totalUsage && null == CheckTotal &&
          TotalDef ? .ReturnNullTotalFlag && TotalDef ? .TransactionEnabledFlag) {
          CheckTotal = Total.insert([TotalCode: TotalCode, TotalId: getNextId(),
              CurrencyCode: Header.AppliedCurrencyCode, EstimatedFlag: IsEstimated
          ])
          TotalAmount = CheckTotal.createDataObject('TotalAmount')
          TotalAmount.CurrencyCode = CheckTotal.CurrencyCode
          TotalAmount.Value = 0.0
      }
  6. Click Save and Close.

  7. On the Manage Algorithms page, click the row that contains the algorithm you just edited, then click Actions > Publish.

Test Your Setup

  1. Open another browser application and sign into Order Management.

  2. Create a sales order and add an order line.

  3. Click Total at the top of the order, then verify the price breakdown includes your new totals and correctly calculates the values.