Max2: Charging Rules
|[ < Prev | Contents | Next > ]|
[ Charging Rules ]
This chapter contains detailed information which is needed for creating and modifying the rules used to control charging for glider and power flying.
The information given here is also useful when displaying transaction details and to programmers but is not needed for normal operation of Max2.
When reading this chapter you might find it useful to have a look at a real set of charging rules. From the Max2 main window choose themenu and then the item and then to see the window.
Select which rule to look at by using the outline ("tree") control in the left part of thewindow. The top level of the outline selects the field and the second level selects the rule for that field.
More details are given in the procedures chapter: Editing Charging Rules
By their nature the rules are designed to be changed without the same level of control as the main program. For this reason, this section can only give "hypothetical" examples - the actual rules in use in Max2 for any particular month may be somewhat different.
The function of the charging rules is to calculate information which is not stored directly in transactions.
For example, charging rules are used on glider flight transactions to calculate the soaring charge from the input information stored in the transaction, such as the glider number and takeoff and landing times.
The charging rules are used on a transaction in a number of circumstances:
The charging rules are applied as each transaction field is input in order to display the results immediately, to allow quick checking of the input.
When the transaction is applied to the state file, that is, when the transaction is first input to Max2 and when the state file for the month is rebuilt.
When the transaction is displayed or printed the charging rules are sometimes applied.
This depends on the circumstances: in some cases only information stored in the transaction is displayed/printed so the rules do not need to be applied. This saves a considerable amount of time.
The charging rules are organised into rule sets. There are two rule sets in Max2: one for glider flight transactions and one for power flight transactions.
Each of the items of information in a transaction is called a field. In a glider flight transaction the glider number, the takeoff time and the tug registration are all examples of fields.
Each charging rule takes the existing fields in the transaction as input and creates a new field. For example, a rule can take the take-off-time and landing-time fields and calculate the actual-flight-time field.
The rules in a rule set are applied to the transaction in turn so later rules can use fields created by earlier rules, as well as those stored in the transaction. For example, earlier rules can use the basic information in a transaction to calculate the charged-flight-time and the glider-soaring-rate and a later rule can multiply these two numbers together to find the soaring-fee.
Each rule is divided into a condition ("if") part and a consequence ("then") part. The condition determines whether the rule should be applied: for example, testing to see if the takeoff time is before 10 A.M. The consequence is the action that the rule requires, such as "subtract the takeoff time field from the landing time field and use the result to set the actual flight time field".
|[ < Prev | Contents | Next > ]|