Once total Price is calculated with the normal AIF procedure and the contract rules specified (CNCT, CNSR, CNSU…), special taxes must be applied by using the new structure [ATAX].
In order to determine the taxes that apply over the final price generated, you must apply the first record of every tax type that verifies the following application criteria:
NOTE 1: Application order is already included in ATAX structure, this is, first line is the first tax you must apply, second line is the second tax to apply … Remember that only first record of every tax type must be applied.
NOTE 2: If there are 2 (or more) taxes with the same code but different age range, and paxes in the booking comply both, then both taxes must be applied, as the age range do them different. In the same way, if there are 2 taxes with the same code and different age range (first from 10 to 20 and second from 21 to 30) and the pax in the booking is 25 years old, the second tax must be applied (that comply the conditions) and dismiss the first one.
NOTE 3: The way to calculate included taxes (except for Canadian taxes) is the following: (ServiceAmount/(1+TaxRate/100))*TaxRate/100
Example:
ServiceAmount: 139.47
Tax: 14.42%
Based on the formula above, the way to calculate included taxes would be the following:
((139.47/(1+0.1442))*0.1442)=17.58
NOTE 4: For Canadian taxes, the calculation is different even if they are included in the price too.
The formula is the following: (ServiceAmount*TaxRate)/(100+TotalTaxRate), where TaxRate is the percentage/amount of the single tax and TotalTaxRate is the sum of all the Canadian TaxRates available for the availability requested.
The way to know if taxes in ATAX section are Canadian taxes or not is by checking if they have legal description or not.
Example:
ServiceAmount: 177.07
{ATAX}
20190527:20190602:::TF:Y::::N:N::8.000::A::RSTMA
20190527:20190602:::TF:Y::::N:N::5.000::A::GSTMA
{/ATAX}
Tax1 (RSTMA): 8%
Tax2 (GSTMA): 5%
Based on the formula above, the way to calculate included taxes would be the following:
(177.07*8)/(100+8+5) = 1416.56/113 = 12.53
(177.07*5)/(100+8+5) = 885.35/113 = 7.83
These formulas should be calculated ONLY for included taxes (taxes to pay on arrival will be calculated as usual).
Initial dale  Final date  Room code  Board code  Tax code  Included in price  Max number of nights  Minimum age  Maximum age  Is per night  Is per pax  Amount  Percentage  Currency  Apply over  Country code  Legal Description 
20140101  20150101  DBT    CT  N  7  16  99  Y  Y    1%    A     
20140301  20150101      CT  N  7  16  99  N  Y    1%    A     
20140101  20150101      VA  N  7  16  99  Y  Y  1€  4%  EUR  N     
20140101  20150101  DBT    VA  Y  7  16  99  Y  Y    3%    A     
20190527  20190602      TF  Y        N  N    8%    A    RSTMA 
20190527  20190602      TF  Y        N  N    5%    A    GSTMA 
{ATAX}
20140101:20150101:DBT::CT:N:7:16:99:N:Y::1.0::A:
20140101:20150101:::CT:N:7:16:99:S:Y::1.0::A:
20140101:20150101:::VA:N:7:16:99:N:Y:1.000:4.0:EUR:N:
20140101:20150101:DBT::VA:Y:7:16:99:Y:Y::3.0::A:
20190527:20190602:::TF:Y::::N:N::8.000::A::RSTMA
20190527:20190602:::TF:Y::::N:N::5.000::A::GSTMA
{/ATAX}
(*) Taxes from table in ATAX in AIF file format.
Once taxes applicable are identified, amounts and percentages must be calculated with the objective to group the information in 4 blocks:
Example 1:
Room DBT, board BB, from 16/08/2014 – 17/08/2014, occupancy AD30 and AD30.

Amount 
Percentage 
Included in price  N

1€ x 1 night x 2 paxes = 2€ 
1% + 4% = 5% 
(*) Examples are based on table and ATAX information above
Example 2:
Room SUI, board BB, from 16/08/2014 – 17/08/2014, occupancy AD30 and AD30.

Amount 
Percentage 
Included in price  N

1€ x 1 night x 2 paxes = 2€ 
1% + 4% = 5% 
(*) Examples are based on table and ATAX information above
Example 3:
Room DBT, board BB, from 16/08/2014 – 17/08/2014, occupancy AD30 and AD30.

Amount 
Percentage 
Included in price  Y

(1€/(1+0.3)*0.3) x 1 night x 2 paxes = 0.46€ 
3% 
(*) Examples are based on table and ATAX information above
It is necessary to select all not included taxes and group their percentages and amounts doing the same calculations.
Percentages must be grouped by doing the sum of all the values from Percentage column.
Value Apply over will only be available when tax is a percentage. When this happens, you can receive 2 different values depending if the tax is applied:
 Over Net price (N). It is necessary to apply the tax over the Net price.
 Over Amount (A). It is necessary to apply the tax over Amount.
When tax is applied over Amount ([ATAX].Apply over = A) (for 1 pax):
{CNCT} 20141013:20141231:DBL:ST::(N, 110.000,120.000,41,BB,120.000) {/CNCT} {CNSU} 20141013:20141231:20140730::MA:G:N:N:0:T:10.000::N::::::::::::Y:Y:Y:Y:Y:Y:Y:5.000:5.000 {/CNSU} {ATAX} 0140101:20150101:DBT::CT:N:7:16:N:Y::10.0::A: {/ATAX} In this case, the final price would be 120.000 + 10.000 = 130 + 10% (tax) = 143.000 Calculation would follow the same process as usual (generate the final price based on Amount price) and later apply the tax from [ATAX]. 
When tax is applied over Net price ([ATAX].Apply over = N) (for 1 pax):
{CNCT} 20141013:20141231:DBL:ST::(N, 110.000,120.000,41,BB,120.000) {/CNCT} {CNSU} 20141013:20141231:20140730::MA:G:N:N:0:T:10.000::N::::::::::::Y:Y:Y:Y:Y:Y:Y:9.000:10.000 {/CNSU} {ATAX} 0140101:20150101:DBT::CT:N:7:16:N:Y::10.0::N: {/ATAX}
In this case, the final price would be 120.000 + 10.000 = 130 The tax calculated over net price would be: (110 + 9) *10% (tax) = 11.90 Total price = 130 + 11.9 = 141.90
Calculation of tax must be done over Net price. For doing that it is necessary you complete the calculation for the net price and apply the tax over the total net price (above in red). Once you have the total net price (net price, board supplements, general supplements…), it is necessary to apply the tax percentage and sum it to the total price you would get previously for the binding (Price in blue).

Please remember that the valuation process is composed by:
So it is necessary you complete this calculation BEFORE applying any tax.
Amounts must be grouped bearing in mind the columns: Maximum number of nights, Minimum age, Is per night and Is per pax for doing the calculation.
The way to calculate the amount bearing in mind every case is the following: