# Calculation

## Responsibility

Calculation groups items which define the calculation formula.

## Input

Depending on yield setup NetNet price (CalcultateOn=BasePrice) or Total price (CalculateOn=CalculatedPrice).

## Process

- Calculation items are sorted by
DaysBeforeFrom and ToAmount values if the item is a cancellation formula

ToAmount otherwise

The first item that has a ToAmount value higher than the price is used for calculation

- The calculated result is mathematically rounded to the nearest hundredth

## Output

- Fee

## Constraints

- At least one calculation item must be defined per rule.

## Config

- Name (Text) - Calculation item name
ToAmount (Money) - Exclusive-upper-bound price limit for which the calculation will be carried out

Fee1Amount (Money) - Amount or percent to add to the price

bFee1Percent (

**0**/**1**) - Controls how Fee1Amount will be treated: as a money to add (**0**) or percentage (**1**)Fee2Amount (Money) - Amount or percent to add to the price

bFee2Percent (

**0**/**1**) - Controls how Fee2Amount will be treated: as a money to add (**0**) or percentage (**1**)- Post-processing
MinFee (Money) - The calculation result will be adjusted to this value if below

MaxFee(Money) - The calculation result will be adjusted to this value if above

CountDayBeforeFrom (Number) - Inclusive-lower-bound number of days before check-in, minimum 0

CountDayBeforeTo (Number) - Inclusive-upper-bound number of days before check-in, maximum 9999

CancellationType (Code) - Cancellation type

**NULL**-Calculation|**NIGHT**-Percentage calculations per 1 hotel night|**STAY**-Percentage calculations per entire hotel stay

- Example (From,To Type): 0,1 STAY; 2,2 NIGHT; 3,9999 NIGHT