arrow_back_iosQuestions
help

How to write formulas for prices?

check_circle
When creating discounts and allowances, you specify the formula for calculating the price. The system calculates it at the time of the order. For discounts, the value must be negative. The formula can be considered as a percentage of the value or in currency. It can contain parameters and functions.

Parameters

In the formula you can use the reservation parameters. The parameters should be enclosed in square brackets. For example: 100 * [PARAMETER].
The names of the parameters are set in the settings of the price component, under the formula.
The parameters of the formula are number of pieces, not the price. For example, the number of tickets booked for a children's fare.
For exclusive price options, the parameter will be 1 if the price option is booked in the order. Otherwise, the parameter will be 0.
Numerical fields of the form are transferred to the formula in the form of a number. The checkbox parameter will be set to 1 if it is selected on the form. Otherwise - 0.
You can also use the [INTERVALS] parameter. It is equal to the number of booked intervals. For example, hours for hourly rent. This option is available if the resource type is rent.

Functions

In addition to the usual arithmetic operations, you can use the following functions:
  • Abs([X]) removes the minus of a negative number.
    Example: Abs(-2) = 2.
  • Ceiling([X]) rounds up to an integer higher.
    Example: Ceiling(7.23) = 8.
  • Floor([X]) rounds up to an integer less.
    Example: Floor(4.75) = 4.
  • Max([X],[Y]) selects the greater of two numbers.
    Example: Max(7,8) = 8.
  • Min([X],[Y]) selects the smaller of two numbers.
    Example: Min(7,8) = 7.
  • Pow([X],2) calculates the first number in the power of the second.
    Example: Pow(3,2) = 9.
  • Round([X]) rounds up the nearest integer.
    Example: Round(3.45) = 3.
  • Round([X],2) rounds off a number indicating accuracy.
    Example: Round(3.4576,2) = 3.46.
  • Sign([X]) for negative numbers returns -1. For positive ones.
    Example: Sign(-99) = -1.
  • Sqrt([X],2) calculates the square root.
    Example: Sqrt(4) = 2.
  • Truncate([X]) truncates the fractional part of a number.
    Example: Truncate(15.7) = 15.
  • if([CONDITION], [X], [Y]) computes the condition and returns [X], if it's true. Иначе возвращает [Y]. In the condition, you can use operations: >,>=,=,<,<=,<>, or, and.
    Example: if([INTERVALS] > 5, 100, 200) = 100 for six intervals.
  • in([X], 1, 2, 3..) determines whether the number is in the sequence. The result can be used in the function condition if.
    Example: in(7,1,7,8) = true.
The system also supports trigonometric and other functions: Sin([X]), Cos([X]), Tan([X]), Log([X],[Y]), Log10([X]), Exp([X]), Asin([X]), Acos([X]), Atan, IEEERemainder(x,y).
Didn't find the answer to your question?
Ask it to us on
mail_outlinesupport@bukza.com