Prior orders calculator (frequent customer calculator)

This calculator can be used to apply a price (a discount) based on the history of an aircraft with the FBO.

The calculator checks how many other orders were handled by the FBO having the current order's registration. Based on this count it can apply a special discount. The count is done on actual orders (having actual arrivals or departure dates) and the orders are filtered only by registration code.

Settings:

From (int). Eg: From=5;
This setting indicates the start of the interval for the number of prior orders with the same registration as the current order. This value is inclusive.
For example, when the system has 5 prior orders to the current order, it should apply a discount.

To(int). Eg: To=10;
This setting indicates the end of the interval for the number of prior orders with the same registration as the current order. This value is inclusive.
For example, when the system has 10 prior orders to the current order, it should apply a discount.

StartDate(datetime). Eg StartDate=01Jan2013
This setting indicates how far in the past the calculator should look for prior orders. 

EndDate(datetime/timeSpan) Eg. EndDate= 02Jan2022; or EndDate=StartOfDay("+1d"); or Can be left blank (in this case the EndDate will be taken as the Atd or Ata whichever is closer to current date)
This setting indicates how far from the StartDate the calculator should look 

Examples

Eg: Suppose you would like to apply a 5% discount to clients having a history of 5 to 10 handling orders from 1 Jan 2013 until present.
To achieve this you could  create a product called 'Frequent Customer Discount Ivory' and select this calculator with settings as following:

From=5; To=10;StartDate=01Jan2013

This settings will apply a discount starting with the 6th order up to the 11th order inclusive. This is because with the 6th order, the system contains already 5 prior orders and with the 11th order, the system would have 10 other orders. So the interval specified in the calculator settings would match.



Moreover you need to set a price agreement with a percentage price of 5%.


Lastly, add the product as a child to your Handling Product as Always Auto-Add.

As a result, for the 6th order up to the 11th order (on the same registration) the customer will get a 5% discount.


Example 2:

In case you need to apply a different discount to customers with more than 10th orders, suppose 10% discount, you should create a second product, 'Frequent Customer Gold', with calculator settings  From=11; To=99999;StartDate=01Jan2013.
and a price agreement with 10%.
The result should be that starting with the 12th order and more, the 10% discount product applies.


Example 3: Example with EndDate Specified

Eg: Apply a 10% discount for clients who have between 3 to 6 handlings with us between 01 Jan 2022 &  03 June 2022
To achieve this follow the steps from example 1 but in the config string section add the EndDate parameter as shown below:

From=3; To=6;StartDate=02Jan2022; EndDate=03June2022; or for a time span EndDate=StartMonth("-1m");

These settings will apply a discount from the 4th order to the 7th between the two dates