User Definable Functions (UDFs)
The following user defined functions are available.
This function calculates a tax generate based on a user-specified rate code (e.g., published rate) that may be different than the rate code explicitly assigned to the reservation (charged rate).
Note: The Luxury Tax on Published Rate calculates the tax based on the rate detail amount (for the published-rate RATE_CODE) for each date of the reservation and the number of adults and children attached to the reservation each day of the stay.
LuxuryTax_on_published_rate (RESV_NAME_ID, 'RATE_CODE', percent)
Parameter |
Description |
RESV_NAME_ID |
System-assigned reservation ID. Provided by the function. |
'RATE_CODE' |
Rate code on which tax is to be based. |
percent |
Tax percent. |
To calculate a 5.25% tax based on the published rack rate (RACK) rather than on the guest's charged rate:
LuxuryTax_on_published_rate (RESV_NAME_ID, 'RACK', 5.25)
This function accepts a number (e.g., a package price or allowance) and multiplies it against the number of adults associated with the reservation.
generate_on_adults (RESV_NAME_ID,number)
Parameter |
Description |
RESV_NAME_ID |
System-assigned reservation ID. Provided by the function. |
number |
A number (e.g., a package price or allowance) |
Assume that a meal allowance on a transaction code is based on the number of adults on the reservation. If the meal allowance is 140 per adult, use this function as follows to determine the allowance:
generate_on_adults (RESV_NAME_ID,140)
This function calculates an accommodation tax that depends on the net room rate per adult as described below.
Default "threshold" net room rate values and the resulting per-adult tax amounts are hard coded into the function; however, the function (gen_tax_udf.fun) may be edited to change these values.
Note: When the room charge is routed, the Cashiering>Tax Type Calculation application setting must be set to RESERVATION in order for the number of adults to be based on the source reservation rather than the target (PM) reservation.
udf_city_tax(RESV_NAME_ID, BASE)
Parameter |
Description |
RESV_NAME_ID |
System-assigned reservation ID. Provided by the function. |
BASE |
Net room rate per adult (excluding tax, service charges, package elements). |
Two guests are sharing a room, each with a (split) rate of 8000 (total 16,000). Zero tax is applicable since the rate per person (16,000/2) is less than 10,000. If the sharing guest has a zero rate (the primary guest has a 16,000 rate and the sharer has a 0 rate), the rate per adult is still less than 10,000 (16,000/2) and the tax is 0.
If the net room rate is 12,500 for each of 2 sharing guests (the per-adult rate is between 10,000 and 15,000), a tax of 100 would be posted to each guest. If the sharing guest has a zero rate (the primary guest has a 25,000 rate and the sharer has a 0 rate), the rate per adult is 12,500 (25,000/2) the tax is 200.
This function calculates a generate amount on a room charge that has an inclusive tax component, when the inclusive component is not to be considered in the generate calculation. This function might be used, for example, where a room service tax must be calculated for a room charge that has an inclusive tax.
perc_city_tax('RESV_NAME_ID',tax,inclusive_tax)
Parameter |
Description |
RESV_NAME_ID |
System-assigned reservation ID. Provided by the function. |
tax |
Tax to be applied to room charge after removing inclusive tax. |
inclusive_tax |
Inclusive tax included in room charge. |
Assume you have Room Charge transaction code 0010 which has an inclusive generate of 10% (transaction code 0195). You wish to calculate a 5% Room Service Tax (transaction code 0199) as an exclusive generate on 0010.
1. Create package RMSERVICE with transaction code 0195. Specify UDF formula:
perc_city_tax('RESV_NAME_ID',5,10)
and Add Rate Separate Line selected.
2. Create rate code ABCD with transaction code 0010 (Inclusive Tax check box selected).
3. Add package RMSERVICE to rate code ABCD. The wrapper transaction code (to which room and tax is posted) is 8002. The Rate Detail amount = $100.
The following postings are displayed on the folio:
Room Charge - Transaction code 8002 $100
Room Service Tax - Transaction code 0199 $4.55
Database details would reveal the following values underlying these postings:
Trn. Code |
Amount |
0010 |
90.91 |
0195 |
9.09 |
0199 |
4.55 |
Note: When a rate code includes a package that uses the Perc City Tax formula, the Rate Info screen accessed via the Rate Query (F5) screen or from the Reservation screen will reflect the Perc City Tax calculation.
This function calculates a tax on the full amount of a rate code if (and only if) a reservation has a package attached either to the rate code or directly on the reservation. The function will check if a package exists on the reservation, and if so, calculate the specified percentage over the full amount. This function should be configured as a generate on the lodging transaction code.
gen_tax_udf_full(RESV_NAME_ID,BASE,get_tax)
Parameter |
Description |
RESV_NAME_ID |
System-assigned reservation ID. Provided by the function. |
BASE |
Rate amount (excluding other taxes and service charges). Rate amount includes packages. |
get_tax |
Tax to be applied to full amount of the rate code |
All generates are configured as Tax Exclusive.
Rate for Rate Code TEST for 1 person is 500.00 (which includes a package for Breakfast for 20.00). Sales tax is 7.25% and TAT (Transient Accommodation Tax) is 7.25% on Room only. GET (General Excise Tax) is 4.166%.
The Sales tax, TAT and GET are configured using generates on their transaction codes.
GET generate employs gen_tax_udf_full function to calculate 4.166% over 500.
gen_tax_udf_full(resv_name_id,base,4.166)
Create a reservation with the rate and check it in. Post room and tax. The postings are as follows:
A function for taxes has been created for all properties located in Vienna (or other locations, as appropriate) to ensure the correct calculation of the city tax. The VIENNATAX function takes the number of adults on a reservation and multiplies it by the amount of the packages. This amount is then subtracted from the share amount and the new amount is multiplied by a factor that corresponds to the tax percentage; The default factor is .021655 which corresponds to a 15% tax. The formula used is (SHARE_AMOUNT - ( ADULTS * (sum of all the inclusive package prices)) ) * 0.021655).
Note: When the Reservations>Room Type To Charge application parameter is set to Y, the Vienna Tax function takes into account the changed room type shown in the RTC field on the reservation.
VIENNATAX(RESV_NAME_ID,OPERATION_NAME,POSTED_AMOUNT,calculation_rule_amount)
Parameter |
Description |
RESV_NAME_ID |
System-assigned reservation ID. Provided by the function. The default is null. |
OPERATION_NAME |
Posting routine (e.g., End of Day processing) |
POSTED_AMOUNT |
Posted amount on which the tax is to be calculated. |
calculation_rule_amount |
The multiplication factor as determined by the taxing entity. The default is 0.021655 (which corresponds to 15%). Other commonly used factors are 0.022517 (10.5%); 0.022126 (12.5%); 0.024823 (0%). |
When configuring a room charge transaction code, the function would be added via the UDF Function for the generate attached to the room transaction code as:
VIENNATAX(RESV_NAME_ID,OPERATION_NAME,POSTED_AMOUNT,0.021655)
If, as in this case, the default calculation_rule_amount is being used, you might also specify:
VIENNATAX(RESV_NAME_ID,OPERATION_NAME,POSTED_AMOUNT)
Create a tax transaction code (i.e., 555)
Created a new room charge transaction code (i.e., 666)
Select the room charge transaction code (666) and select the Generates button.
Select the appropriate tax transaction code, (i.e., 555), and via the UDF Function radio button, add the UDF function as VIENNATAX(RESV_NAME_ID,OPERATION_NAME,POSTED_AMOUNT,0.021655)
Create a rate code of VIENNA (tax inclusive), using the room charge transaction code of 666, with a price 300.00.
Following are a few examples of the tax calculation for different scenarios, based on the configuration described above:
Scenario #1
Walk in reservation with 2 adults, rate code = VIENNA. Add same day package element (i.e., AB = 10.00 per person) to the reservation. Generate an Advanced Bill.
Postings are as follows:
20.00 (package element)
280.00 for room (which is the 300.00 minus the package (net = 273.9366, tax = 6.0634)
Scenario #2
Check-in guest. No package on reservation.
Postings are as follows:
300.00 for room (which is the 300.00 rate less the package (net = 293.5035, tax = 6.4965)
Scenario #3
Change rate code to be tax exclusive. Check guest in and generate an Advanced Bill.
Add same day package element (i.e., AB = 10.00 per person) to the reservation.
Postings are as follows:
Allowance created of 20.00
280.00 for room (which is the 300.00 rate less the package (net = 273.9366, tax = 6.0634)
This function adds a flat amount to the rate code when the number of children associated with a reservation equals or exceeds a specified threshold. The function is attached to a package element that is, in turn, attached to the rate code.
Added_child_charge (RESV_NAME_ID,flat_amount,threshold)
Parameter |
Description |
RESV_NAME_ID |
System-assigned reservation ID. Provided by the function. |
flat_amount |
Amount added when threshold is reached. |
threshold |
When this number of children per room is equal to or greater than this number, the flat_amount is added to the package. |
To add $5 to the rate when 2 or more children are associated with the reservation for rate code ABC:
1. Create a package (e.g., CHILDBRKFST) which includes the following UDF formula:
Added_child_charge (RESV_NAME_ID,5,2)
2. Attach the CHILDBRKFST package to the rate code ABC.
This function provides a way to add a charge for extra persons when prevailing rates functionality is being used. This function is attached to a package element that is, in turn, attached to the prevailing-rate rate code. The package header must have Add Rate Combined Line selected. When associated with the prevailing rate code's rate header, the rate query DORA screen properly reflects the rate detail amount plus the additional overage for the number of adults above the base number defined in the package's formula definition.
added_adult_charge (in_resv_name_id, XXX, YYY)
Parameter |
Description |
in_resv_name_id |
System-assigned reservation ID. Provided by the function. The default is null. |
XXX |
Base number of adults. |
YYY |
Amount to be charged for each adult over the number specified by XXX. |
If the package formula entered is:
added_adult_charge (in_resv_name_id,2,30)
any adult over 2 adults will add $30 to the rate query amount.
This function provides for package allowance with a Flat Amount calculation rule and a Floating Allowance per Stay posting rhythm if the number of persons is greater than 0. If the number of persons is 0, no package allowance is posted.
float_flat_allowance_person (RESV_NAME_ID, in_price, in_allowance)
Parameter |
Description |
RESV_NAME_ID |
System-assigned reservation ID. Provided by the function. |
in_price |
The package price. |
in_allowance |
The allowance amount. If the allowance value is not entered, or if the allowance value entered is less than the price, the allowance is set equal to the price. |
If the package formula entered is:
float_flat_allowance_person (RESV_NAME_ID, 10, 20)
and the reservation has 1 adult, the package has a 20 allowance. If the reservation has 0 adults and 0 children, no allowance is posted.
Note: When this UDF is entered in the Formula field on the Package Code screen, the Allowance check box is automatically selected and the Posting Rhythm is automatically set to Floating Allowance Per Stay. For proper functionality of this feature, the Calculation Rule is automatically set to Per Person even though the amount posted will be a flat amount.
This function calculates the package inclusive rate for a number of adults greater than a base number, per stated room types. Any price information provided in the Package Details is overridden by this function.
rt_extra_adult (in_resv_name_id, X, Y, 'rmtype_1,rmtype_2,...rmtype_n')
Parameter |
Description |
in_resv_name_id |
System-assigned reservation ID. Provided by the function. The default is null. |
X |
Base number of adults. |
Y |
Amount to be added for each adult over the base number specified by X. |
rmtype_1...rmtype_n |
Room types to which this calculation applies. Comma separated list. |
Rate code LEISURE, which includes a package, is priced at $150. If the package formula entered is:
rt_extra_adult (in_resv_name_id, 7, 15, 'DLX,STD')
any adult over 7 adults will add $15 to the rate query amount for the LEISURE rate on room types DLX and STD. For 8 adults, the rate would be priced at $165 rather than $150.
This function calculates the package inclusive rate for a total number of adults plus children in child bucket 1 that is greater than a base number, per stated room types. Any price information provided in the Package Details is overridden by this function. This function will automatically refresh the total rate value shown in the Reservation screen Total field when the number of adults and/or children in child bucket 1 is changed.
rt_extra_adult_n_bucket1 (in_resv_name_id, X, Y, 'rmtype_1,rmtype_2,...rmtype_n')
Parameter |
Description |
in_resv_name_id |
System-assigned reservation ID. Provided by the function. The default is null. |
X |
Base number of adults plus number of children in child bucket 1. |
Y |
Amount to be added for each person over the base number specified by X. |
rmtype_1...rmtype_n |
Room types to which this calculation applies. Comma separated list. |
Rate code LEISURE, which includes a package, is priced at $150. If the package formula entered is:
rt_extra_adult_n_bucket1(in_resv_name_id, 7, 15, 'DLX,STD')
Any person over 7 adults plus children in child bucket 1 will add $15 to the rate query amount for the LEISURE rate on room types DLX and STD. For 5 adults and 3 children in child bucket 1, the rate would be priced at $165 rather than $150.
This function calculates the package inclusive rate for a total number of adults plus children in child bucket 2 that is greater than a base number, per stated room types. Any price information provided in the Package Details is overridden by this function. This function will automatically refresh the total rate value shown in the Reservation screen Total field when the number of adults and/or children in child bucket 2 is changed.
rt_extra_adult_n_bucket2 (in_resv_name_id, X, Y, 'rmtype_1,rmtype_2,...rmtype_n')
Parameter |
Description |
in_resv_name_id |
System-assigned reservation ID. Provided by the function. The default is null. |
X |
Base number of adults plus number of children in child bucket 2. |
Y |
Amount to be added for each person over the base number specified by X. |
rmtype_1...rmtype_n |
Room types to which this calculation applies. Comma separated list. |
Rate code LEISURE, which includes a package, is priced at $150. If the package formula entered is:
rt_extra_adult_n_bucket2 (in_resv_name_id, 7, 15, 'DLX,STD')
Any person over 7 adults plus children in child bucket 2 will add $15 to the rate query amount for the LEISURE rate on room types DLX and STD. For 5 adults and 3 children in child bucket 2, the rate would be priced at $165 rather than $150.
This function adds a flat fee to Billing screen window 1 when posting a package under the following conditions:
direct_bill_fee(resv_name_id,fee_amount)
Parameter |
Description |
in_resv_name_id |
System-assigned reservation ID. Provided by the function. The default is null. |
fee_amount |
Fee to be posted when the direct bill payment method is selected as payment method. |
direct_bill_fee(resv_name_id,20)
Posts a fee of 20 to Billing screen window 1 if UDFC08 is set to Y and the payment method for window 1 is direct bill.
Note: If no resv_name_id exists, the function returns 0. Therefore, a rate query without a reservation will not include the Direct Bill Fee amount.
•When creating a reservation the function returns a 0 until the reservation is saved and a resv_name_id becomes available.
•If a package is set up as Add To Rate Combined Line and attached to a rate code or directly to a reservation, the package amount would be 0 and the reservation would therefore not include the Direct Bill Fee.
•After the user saves the reservation he should refresh rates in order for the reservation to show the correct rate.
See Also