Example Pricing Algorithm, Part 9, Calculate Shipping
Learn how pricing algorithms calculate shipping.
Here are some example set ups you can do on your algorithms to calculate shipping that meet your specific requirements.
-
Apply an adjustment according to a matrix. For example, create shipping charges according to the weight of the item, then calculate shipping charge adjustments according to a matrix rule.
-
Create flat rate shipping charges according to the value that the Order Entry Specialist enters in an extensible flexfield on the order header or order line. Your algorithm can use the value as an input when calculating the charge.
For our example, we are almost done. Let's see how shipping works in the sales order when you manually adjust the shipping charge.
Try it.
-
Open your sales order in Order Management.
-
Click Shipment Details, then set the Shipping method.
-
Notice the order line.
-
Notice that the order line contains a charge for Freight of $5 each, and an extended value in the Amount column of 10 because Quantity is 2.
-
Notice the order total is $610.
-
Click the pencil next to Freight in the Your Price column.
-
In the Price Adjustments dialog, add an amount discount for $2, set Reason to Price Match, then click Save and Close.
Note
-
The value for Freight in the Your Price column is now 3.
-
The extended value in the Amount column is now 6.
-
The order total is $606.
-
Here are the SDOs.
Note
-
The output SDO from the Calculate Cost and Margin step provides the input SDO.
-
The algorithms store details in charge components in the freight charge on the output SDO. They use a separate component for each of.
-
Base list price
-
List price
-
Manual adjustments
-
Net price
-
Exclusive tax
-
Net price plus tax
-
Here's what the algorithms do.
What the Algorithms Do |
How the Algorithms Do It |
---|---|
1. Get shipping charge lists. |
Examine the shipping charge list that the pricing strategy references. Make sure it includes at least one charge for the item. Calculate the shipping charge for each order line. |
2. Convert currency on the order line. |
If the shipping charge list doesn't use the same currency that the sales order uses, then convert it so it does use the same currency. For example, if the sales order uses RMB but the shipping charge list uses USD, then covert USD to RMB on the shipping charge list. |
3. Create candidates for shipping charges. |
Create a separate candidate for each shipping charge that the shipping charge list specifies. Pricing doesn't come predefined to apply flat rate shipping charges. The predefined set up only applies shipping charges for each item. |
4. Create charge components for the base list price. |
Create a charge component for each shipping charge on the order line according to the base list price that the shipping charge list specifies. |
5. Create charge component for the list price. |
Create a charge component for each shipping charge on the order line according to the list price that the shipping charge list specifies. |
6. Apply manual adjustments. |
If the Order Entry Specialist applies a manual adjustment to the shipping charge on the sales order, then the algorithm creates and calculates the charge components it needs to apply the adjustment. It does this for each adjustment that you apply. |
7. Create charge component for the net price. |
- |
8. Calculate tax. |
Apply tax rates to the charges. |
9. Calculate currency amounts for the order header. |
Calculate the order total. Use the currency that the sales order specifies. |
Here are some of the functions you can use with the algorithms. All these functions are view object lookups, except for createChargeComponent and getPartialPeriodDuration, which are scripts.
Algorithm Name |
Function Name |
Description |
---|---|---|
Calculate Shipping Charges |
checkAllowedCurrency |
Validate the currency against the list of currencies that the pricing strategy allows. |
- |
createChargeComponent |
Create a charge component. |
- |
getChargeDefinitionName |
Get the name of the charge definition. |
- |
getOKCUomMappings |
Query the corresponding mappings in the okc_ contracts tables to call the contracts API. |
- |
getPartialPeriodDuration |
Use the Service Start Date and Service End Date on the order line to get the partial price period. |
- |
getShippingChargeLists |
Get the shipping charge lists for the item in the pricing strategy. |
- |
getShippingCharges |
Get the shipping charges. |
- |
getUomTranslation |
Query the unit of measure table for the UOM code, such as Ea. |
Process Line Currency Conversion |
checkAllowedCurrency |
Validate the currency on the order line against the list of currencies that the pricing strategy allows. |
Create Charge Component with Running Unit Price Apply Manual Adjustments For Goods And Services Compute Sales Taxes |
- |
See the earlier sections in this topic that describe these algorithms. |
Compute Extended Amounts in Header Currency |
getCurrencyPrecision |
Get the precision for the currency. |