


Rt_Charge
| Rt_Charge(
| // A variant -- integer, floating point, currency.
|
| <quantity>
| // Must be a currency.
|
| , <rate>
| // "Flat", "Per", "Round", "Round up", or "Round down".
|
| , <rate basis>
|
|
| , <rate basis quantity>
| // The quantity, e.g. 100 (lbs.), corresponding to the rate.
|
| , <min>
| // A currency or a null.
|
| , <max>
| // A currency or a null.
|
| , <round result>
| // A string "Round Up", "Round Down", "Round", or null.
|
| )
|
|
The basic formula is:
result = (Quantity) * ( (Rate)/(Rate basis quantity) )
The value of <rate basis> modulates this calculation as follows:
| Flat
| <rate basis quantity> is defined as 1, ignoring the value of the argument.
|
| Per
| The division is perfomed without explicit rounding, producing a four decimal
place currency value quotient which is then multiplied by <quantity>.
|
| Round
| The quotient is rounded to the nearest penny and then multiplied by <quantity>.
|
| Round Up
| The quotient is rounded up to the next higher integer, then multiplied by <quantity>.
|
| Round Down
| The quotient is rounded down to the next lower integer, then multiplied by <quantity>.
|
Example
Rt_Charge( 17281 , $16.53 , Per , 100
, null , null , "Round" )
16.53/100 = .1653
.1653 * 17281 = 2856.5493
Round(2856.5493) = $2856.55