Base Package SQ Rules

Note: If the algorithms described below are not sufficient for your rating requirements, you must write a new SQ rule algorithm. Refer to How To Add A New SQ Rule for how to do this.
The following table lists and describes the SQ rule algorithms shipped with the product:
SQ Algorithm Alg Type What It Does Parameters Used
Bill days (Days) DY This SQ rule calculates the total number of days in the bill period. This algorithm is necessary if you have charges that are based on the number of days of service (e.g., a minimum charge that varies based on the days of service). Refer to Calculated Minimum Charges and Step Boundaries Based On The Number Of Days Of Usage And The Region In Which The Customer Resides for good examples of when to use such an SQ rule. No parameters are used.
Characteristic Value CV

This SQ rule creates an entry in the SQ array containing the sum of the characteristic values of a given Characteristic Type. The values are accumulated from the entity defined in the parameter list.

Resulting Quantity (expressed in the Output UOM / Sub-UOM / SQI) = the sum of the characteristic values of a given Characteristic Type. Characteristic Source determines the entity that holds the characteristic values:

  • If Characteristic Source is "contract", the characteristic value effective on the bill start date for the Characteristic Type (P1) and contract ID is returned.
  • If Characteristic Source is "ACCOUNT", the characteristic value effective on the bill start date for the Characteristic Type (P1) and Account Id is returned.
  • If Characteristic Source is "LOCATION", the characteristic values are accumulated from all locations linked to the contract ID.
  • If Characteristic Source is "SP", the characteristic values are accumulated from all service points linked to the contract ID.

Param 1 = Characteristic Type

Param 2 = Characteristic Source

Param 3 = Minimum Value

If Minimum Value is greater than zero and the resultant characteristic value is less than the specified Minimum Value, an error is generated.

Contract Quantity CQ

This SQ rule is used to create an entry in the SQ array for a given Contract Quantity Type specified in a contract. If multiple values are effective during a bill period, the Proration Rule determines what happens. (See below).

Resulting Quantity (expressed in the Output UOM / Sub-UOM / SQI) = the value of a given Contract Quantity Type in a contract. If multiple values are effective during a bill period the Proration Rule determines what happens:

  • If Proration Rule is 'Use Contract Quantity effective at Beginning of Bill Period' (i.e., CQBD), SQ Amount = Contract Quantity effective at the start of the bill period.
  • If Proration Rule is 'Use Contract Quantity effective at End of Bill Period' (i.e., CQED), SQ Amount = Contract Quantity effective at the end of the bill period.
  • If Proration Rule is 'Maximum' (i.e., CQMA), SQ Amount = largest Contract Quantity effective in the bill period.

Param 1 = Contract Quantity Type

Param 2 = Proration Rule: CQBD, CQED, CQMA, CQMI, CQPR

  • If Proration Rule is 'Minimum' (i.e., CQMI), SQ Amount = smallest Contract Quantity effective in the bill period
  • If Proration Rule is 'Prorate' (i.e., CQPR), SQ Amount = Sum of all prorated contract quantities (calculate the number of days in the bill period (X); calculate the number of days in the bill period that each contract quantity is effective (Y(i)); prorate each contract quantity (i) = (Contract Quantity(i) * Y(i) /X)).
Direct Access Credits CD

This SQ rule creates a characteristic type / value to handle credits issued to the customer for participating in direct access. These values are used by one or more bill factors in the rate components to vary the amount associated with a given bill line.

Early Pay EP

This SQ rule is only used if you provide customers with early payment discounts via a discount on their next bill segment. This rule works as follows:

  • First, it determines if the prior bill segment's bill was paid before its due date. It does this by retrieving the customer's balance as of the prior bill's due date - 1 day. If this amount is <= zero, it checks if a payment exists with a payment date on or after the bill's bill date and before the bill's due date. If yes, processing continues.
  • A characteristic type / value is created where the value holds the number of days early (and the characteristic type is equal to Char Type - Number of Days Early).

Param 1 = Char Type - Number of Days Early

Param 2 = Char Type - Eligible For Early Pay Disc

Param 3 = Char Value - Eligible For Early Pay Disc

  • In addition, this routine accumulates the sum of the bill lines on the prior bill segment for which the early payment discount is eligible. It does this by accumulating all bill lines that reference a given characteristic type and value (where characteristic type is equal to Char Type - Eligible For Early Pay Disc, and Char Value - Eligible For Early Pay Disc). It populates the total amount in the service quantity defined on the SQ rule. This means that you must define this characteristic type / value on each rate component whose resultant value is eligible to receive an early payment discount.

This rules anticipates the early pay discount being levied using two rate components:

  • The first would be an FCPO rate component that holds the amount eligible to receive the discount. This would be an SQ rate component where the service quantity is the value produced by this SQ rule, and the price would be 1 (or -1). In addition, this rate component would need eligibility rules so that it is only applied if the number of days early (held in the characteristic type / value produced by this algorithm) is > 0.
  • The second would be an "apply to" rate component (where the apply to value is a percentage applied to the first rate component). In addition, this rate component would need eligibility rules so that it is only applied if the number of days early is within a certain tolerance (e.g., > 0). You could create several of these types of rate components if the discount percent differs based on the number of days early.
Math MA

This SQ rule performs mathematical functions on service quantities prior to rate application.

There are three major groups of parameters:

1) Quantity 1 (identified by a service quantity's UOM/Sub-UOM/SQI).

2) Mathematical operand

3) Quantity 2 (identified by a service quantity's UOM/Sub-UOM/SQI or a Bill Factor)

For example, if you want to add together two SQ entries, these values would contain:

1) the unique identifier of one of the SQ's (in parameters 1 through 3)

2) the "+" symbol (in parameter 4)

3) the unique identifier of the other SQ (in parameters 5 through 7)

It should be stressed that Quantity 2 can either reference a bill factor (param 8) or an SQ entry (parameters 5 through 7). If both are specified, the bill factor is used.

The two default values (param 9 and param 10) are only used if Quantity 1 and/or Quantity 2 reference SQ's / bill factor that are not present at billing time. There are three ways to use these default values:

Quantity 1:

Param 1 = UOM of service quantity entry

Param 2 = Sub-UOM of service quantity entry

Param 3 = SQI of service quantity entry

Or

Param 9 = Decimal number

Mathematical Operand:

Param 4 = operand symbol (i.e., +, -, *, /)

Quantity 2:

Param 5 = UOM of service quantity entry

Param 6 = Sub-UOM of service quantity entry

Param 7 = SQI of service quantity entry

Or

Param 8 = Bill factor ID

Or

Param 10 = Decimal number

  • If you want to multiply a SQ by a constant value, define the SQ in Quantity 1 and the constant value in Param 10, i.e., you don't have to specify anything in Param's 5 through 8.
  • If you want a default value used if the system cannot find a SQ that matches the UOM/Sub-UOM/SQI, define this value in Param 9 and/or Param 10.
  • If you use a bill factor to define Quantity 2 (in Param 8) and you want a default value used if the system cannot find a char type / value for a specific customer, the default value is defined in Param 10.

The following mathematical operands use only Quantity 1.

ABS, NEGATE, ROUND, FLOOR (meaning to round down), CEILING (meaning to round up), SIN, ASIN, COS, ACOS, TAN, ATAN, LOG, LOG10, EXP, EXP10, SQRT

The following mathematical operands use both Quantity 1 and Quantity 2:

+, -, *, /, **, MOD, <, <=, >, >=, =, <>, MAX, MIN, AVG

The following mathematical operands use both Quantity 1 and Quantity 2 and return a value of 1 if the comparison is true and a value of 0 if the comparison is false:

<, <=, >, >=, =, <>

Maximum Service Quantity MQ

This SQ rule compares a quantity (either measured or created via a previous SQ rule) against a contract quantity and returns whichever is larger.

Resulting Quantity (expressed in the Output UOM / Sub-UOM / SQI) =

greater of quantity for UOM/ Sub-UOM/ SQI

OR

contract quantity for Contract Quantity Type

Param 1 = UOM

Param 2 = Sub-UOM

Param 3 = SQI

Param 4 = Contract Quantity Type

Required UOM/TOU Validation RP

This SQ rule verifies if one UOM/Sub-UOM quantity is non-zero then the other should be non-zero too.

UOM1/Sub-UOM1/SQI1 is the ID of the first SQ entry. UOM2/Sub-UOM2/SQI2 is the ID of the second SQ entry.

Service Quantity ID1

  • Param 1 = UOM1
  • Param 2 = Sub-UOM1
  • Param 3 = SQI1

Service Quantity ID2

  • Param 4 = UOM2
  • Param 5 = Sub-UOM2
  • Param 6 = SQI2
Sum SM

This SQ rule adds up several quantities (either measured or created via a previous SQ rule). This algorithm would be useful when you need to add together "Sub-Unit of Measure" registers because there are charges in the rate that are for the total amount of consumption regardless of when it was used.

Resulting Quantity (expressed in the Output UOM / Sub-UOM / SQI) =

Quantity for UOM (in param 1) Sub-UOM (in param 2) SQI (in param 3) +

Quantity for UOM (in param 4) Sub-UOM (in param 5) SQI (in param 6) +

Quantity for UOM (in param 7) Sub-UOM (in param 8) SQI (in param 9)

Quantity 1

Param 1 = First UOM

Param 2 = First Sub-UOM

Param 3 = First SQI

Quantity 2

Param 4 = Second UOM

Param 5 = Second Sub-UOM

Param 6 = Second SQI

Quantity 3

Param 7 = Third UOM

Param 8 = Third Sub-UOM

Param 9 = Third SQI

For more information about defining algorithm types, refer to Setting Up Algorithm Types.

Where Used

A Rate Schedule may have zero or more SQ Rules. Refer to Rate Schedule - SQ Rules for more information.