contents.gifindex.gifprev1.gifnext1.gif

Rt_Charge

Purpose

Calculates an amount charged based on a rate.

Arguments

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.
)


Notes

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>.

Finally, the rounding technique specified in <round result> is applied to the result, where null means no rounding.

Example

Rt_Charge( 17281 , $16.53 , Per , 100

, null , null , "Round" )

16.53/100 = .1653

.1653 * 17281 = 2856.5493

Round(2856.5493) = $2856.55