Using Calculated Expressions for Rate Transaction Values

Top  Previous  Next

 

 

(This is a continuation of the Edit Rate Definition Dialog documentation -- see that topic for more information.)

 

 

NOTE: This is an advanced feature!  Using calculated expressions not recommended except in very extremely complex situations -- normally the transaction "Each" values will be fixed amounts, where you have multiple rate definitions so the amount charged is determined by which rate definition applies.  However if you absolutely need to calculate a value (e.g. for cases where the normal "Applies if..." conditions for rates cannot handle your rate structure), it's possible to use the Advanced Customization functionality of Expressions to calculate the rate.  Keep in mind that technical support is not included for using calculated values, as this is a customization/programming function.

 

Expression for "Each"

 

To enter a calculated expression for the "Each" value of a transaction, enter an equal sign ("=") in the "Each" column and press the Tab key.  This will open the Expression Creator dialog where you can enter the expression.  The expression should of course result in a numeric value, which will be used as the Each amount for the rate when it's used for a reservation.

 

Once an expression is entered, the Each column for the transaction will show "<EXPR>", indicating that a fixed value is not known.  To view or edit the expression, click on "<EXPR>" in the Each column to highlight it, and click again to open the Expression Creator (or press the "=" key).  If you decide that you don't want it to be an expression, you need to completely clear out the expression in the Expression Creator dialog and click Save.  It will change back to blank, so you can enter a fixed amount.

 

Note that whenever this rate is shown in the Rates Setup list or Select Rates, it will also show <EXPR> as the amount.  It can only calculate the expression to determine the actual amount after it's Added in select rates, or when it's automatically added to a reservation.

 

While the typical use of calculated expressions would be for rental rates or add-on rates, it can also be used for metered rates -- for instance to use a complex formula for electric meter charges.  In addition to ThisResv() and ThisCust() context when calculating the rate, these special context functions are available for rates:

 ThisRate() -- The Rate record itself

 ThisRateSites() -- The number of sites the rate is being calculated for (if applicable)

 ThisRatePeriods() -- The number of days, weeks, etc. the period is being calculated for

 ThisRateQtyExtra() -- The "Qty" value, if an extra quantity value is applicable (e.g. for add-ons)

 ThisRateQtyTotal() -- The total quantity being calculated for (e.g. sites x periods x extra qty)

  These additional functions are used only for Meter reading rates:

 ThisRateQtyMeter() -- The number of units being calculated for

 ThisRateMeterPrev() -- The previous meter reading

 ThisRateMeterNew() -- The new meter reading

 ThisRateMeterDatePrev() -- The date of the previous reading (as per Site Details)

 ThisRateMeterDate() -- The date of this reading ("Actual date of reading" on the report dialog)

 

Important -- If the rate is being calculated for multiple synchronized sites, ThisResv() could be any one of the synchronized reservations.  If you need separate information from each linked reservation (e.g. Site Types), it would be up to you to traverse the linked reservations in the expression.

 

Expression for "Qty"

 

You can also enter an expression for Qty, by entering an "=" as described above.  Note that an expression here will completely override the normal rate multiplier of sites, periods, and other quantity (e.g. for add-ons or meters).  Thus the context functions need to be used if the qty should take those into account.

 

Expression for "Description"

 

You can enter the description as an expression also, for instance to include information from the customer or reservation in the description.  As with the Each and Qty, starting the description with an "=" will denote it as an expression -- however the expression builder is not opened in this case.  You can enter the expression manually in the line, or build it elsewhere and paste it here (using normal copy/paste).  Just be sure it still has the "=" at the beginning, with no space after the "=".  For example, to show the reservation type as the description, it would be shown as:

 =Resv:Resv_Type

 

 

 

Other Rate Definition Topics:

 

Rate Transactions

 

Taxes

 

Multipliers and Filtering

 

Rate Dates

 

 

Rate Setup Examples

 

Be sure to go through the Rate Setup Examples for help with basic rates setup.  We don't recommend attempting to set up your rates without working through some of the examples first!

 

Further Topics:

 

 Rates Setup Dialog

 

 Rate Types

 

 Auto-Rates Setup

 

 Rate Setup Examples

 

 

 


Page URL https://CampgroundMaster.com/help/using-calculated-expressions-f.html

Campground Master Home