Reservation cost logic
Calculation algorithm
The tariff count is given by the maximum number for which DateCharged < End date along with the following.
• For the first calculation highest applicable period: DateCharged = (StartDate-1day) + TariffCount * <period>
• For the subsequent calculations (lower applicable periods): DateCharged = DateCharged (after previous period) + TariffCount * <period>
The following are some of the other points to be considered.
• The DateCharged is the date through which the costs are charged. Initially the DateCharged = StartDate - 1 day.
• In case the DateCharged is not a valid date (for example; Feb 30), the DateCharged is set to the previous valid day (for example; Feb 28).
• For a year, month or week calculation, only full days (both chargeable AND non-chargeable) are taken into account. This means that the StartTime and EndTime of the reservation are not considered.
• For a day, daypart (morning/afternoon/night) or hour tariff calculation, only chargeable days are taken into account. This means nonchargeable days are not incorporated.
• A period is applicable when a tariff is defined for that period.
Example:
When you rent a car on February 1 for 1 month, you need to return it before March 1, 0:00 hours. If the end date/time of the reservation is before this time, then you have rented the car for less than 1 month. This means the reservation ends before March 1, 0:00 hours. Now, the rent cannot be charged for full month and the MonthlyTariffCount = 0.
These images helps you to understand the reservation cost flow in detail.
Calculation flow
Calculation on start day flow
Calculation of remaining full days flow