Example: round, roundTo

Rounding is the optional parameter.

To apply rounding to percentages, use SUM as the parent operator to add the percentage discount values and apply the total discount.

  • If the child type is MULT, the discounts will be multiplied and returned for addition in SUM.

  • If MULT is used separately, the calculation formula is 1 – (1– % result_previous_step)*(1 – % discount)

Round: item

Input Conditions JSON Discount Calculation Flow

Unit of Measure = Percent

Product List Price = 100$

4 Calculation Types are created for the Pricing Procedure:

  1. Calculation Method = Decrease and Structural 2%

  2. Calculation Method = Decrease and Contract 3%

  3. Calculation Method = Decrease and Promo 4%

  4. Calculation Method = Decrease and Season 5%

{
  "procedure": {
    "type": "MULT",
    "round": "item",
    "roundTo": "3",
    "items": [
      {
        "calculationType": "structural" = 2%
      },
      {
        "calculationType": "contract" = 3%
      },
      {
        "calculationType": "promo" = 4%
      },
      {
        "calculationType": "season" = 5%
      }
    ]
  }
}

Calculating maximum discount according to the formula:

  1. 100*(1 – 0.02) = 98 RoundTo: 3 = 98

  2. 98*(1 – 0.03) = 95.06 RoundTo: 3 = 95.06

  3. 95.06*(1 – 0.04) = 91.2576 RoundTo: 3 = 91.258

  4. 91.258*(1 – 0,05) =86.6951 RoundTo: 3 = 86.695

Total price for an Order Line Item = 86.70$

The rounding is presented with two decimals as by default the field format allows only two digits after the decimal point.

Round: group

Input Conditions JSON Discount Calculation Flow

Unit of Measure = Percent

Product List Price = 100$

4 Calculation Types are created for the Pricing Procedure:

  1. Calculation Method = Decrease and Structural 2%

  2. Calculation Method = Decrease and Contract 3%

  3. Calculation Method = Decrease and Promo 4%

  4. Calculation Method = Decrease and Season 5%

{
  "procedure": {
    "type": "MULT",
    "round": "group",
    "roundTo": "3",
    "items": [
      {
        "calculationType": "structural" = 2%
      },
      {
        "calculationType": "contract" = 3%
      },
      {
        "calculationType": "promo" = 4%
      },
      {
        "calculationType": "season" = 5%
      }
    ]
  }
}

Calculating maximum discount according to the formula:

  1. 100*(1 – 0.02) = 98

  2. 98*(1 – 0.03) = 95.06

  3. 95.06*(1 – 0.04) = 91.2576

  4. 91.258*(1 – 0,05) =86.69472 RoundTo: 3 = 86.695

Total price for an Order Line Item = 86.70$

The rounding is presented with two decimals as by default the field format allows only two digits after the decimal point.

``