PRCode calculation expressions

A PRCode calculation expression describes how to calculate an amount on a payroll check.

These expressions are defined in the source, rate, and/or result expressions on a segment item which in turn define expressions on the PRCodes which use the segment item. A check line uses the source, rate, and result expressions (if one exists) from the PRCode of the check line to calculate the check line amounts.

Syntax rules

The syntax of a calculation expression is like a mathematical expression. A calculation expression consists of a string of operators and operands which follows a set of rules (the syntax).

  • PRCode calculation expressions are optional.
  • Terms of a PRCode calculation expression can be combined with ANDs and ORs.
  • PRCode calculation expressions can compare two terms using one of the following operators: =, <>, <, >, <=, >=, LIKE, NOT LIKE.
  • Terms of a PRCode calculation expression can be added or subtracted.
  • Terms of a PRCode calculation expression can be multiplied and divided.
  • Terms consist of factors. A factor can be one of the following:
    • negative factor
    • positive factor
    • grouped expression
    • numeric literal
    • #date literal#
    • "string literal"
    • RATE
    • function
    • parameter

Functions

Function Description Format Examples
AttributeItem Returns the value of an attribute item for an employee. The date can be a literal date, built-in date, or a call to the Date function. AttributeItem('AttributeName',date)

AttributeItem('Position',CheckDate) LIKE 'VP*'

BirthDate Returns the birth date of the employee on the check. BirthDate  
CheckDate Returns the check date of the check. CheckDate  
 
COUNT Functions
CountAll functions
CountAll Returns the number of non-zero lines in history which match the argument, a literal group expression. CountAll('<literal group expression>')

CountAll('loan Result')

CountAll.Source Returns the number of non-zero sources in history which match the argument, a PRCode items expression. CountAll.Source('<PRCode items expression>')  
CountAll.Rate Returns the number of non-zero rates in history which match the argument, a PRCode items expression. CountAll.Rate(<PRCode items expression>')  
CountAll.Result Returns the number of non-zero results in history which match the argument, a PRCode items expression. CountAll.Result(<PRCode items expression>')  
CountAnnual function
CountAnnual Returns the number of check lines for the year of the check date that match the group expression argument. CountAnnual('<literal group expression>')

 

CountCheck functions
CountCheck Returns the number of lines on the check with a non-zero amount which match the group expression argument. It has two optional date arguments which, if passed, are compared to the work date. Only check lines with a work date in the range are considered. CountCheck('<literal group expression>',[begin date],[end date])

CountCheck('Garnishment Result')

CountCheck('Garnishment Result',#1/1/2023#,#1/31/2023#)

CountCheck.Source Returns the number of lines on the check with a non-zero source which match the PRCode items expression argument. It has two optional date arguments which, if passed, are compared to the work date. Only check lines with a work date in the range are considered. CountCheck.Source('<PRCode items expression>',[begin date],[end date])  
CountCheck.Rate Returns the number of lines on the check with a non-zero rate which match the PRCode items expression argument. It has two optional date arguments which, if passed, are compared to the work date. Only check lines with a work date in the range are considered. CountCheck.Rate('<PRCode items expression>',[begin date],[end date])  
CountCheck.Result Returns the number of lines on the check with a non-zero result which match the PRCode items expression argument. It has two optional date arguments which, if passed, are compared to the work date. Only check lines with a work date in the range are considered. CountCheck.Result('<PRCode items expression>',[begin date],[end date])  
CountHistory functions - The check calculator expressions referenced in the Format column represent a begin date and an end date, respectively.
CountHistory Returns the number of check lines between the check dates in history that match the group expression argument. CountHistory('<literal group expression>', <check calculator expression>, <check calculator expression>)

CountHistory('Days Number', Date(CheckDate, 'Begin of Month'), CheckDate)

Here, "Number" is the user-defined name for the result on the "Days" group.

CountHistory.Source Returns the number of non-zero sources between the check dates in history that match the PRCodes items expression argument. CountHistory.Source('<PRCode items expression>', <check calculator expression>, <check calculator expression>)  
CountHistory.Rate Returns the number of non-zero rates between the check dates in history that match the PRCodes items expression argument. CountHistory.Rate('<PRCode items expression>', <check calculator expression>, <check calculator expression>)  
CountHistory.Result Returns the number of non-zero results between the check dates in history that match the PRCodes items expression argument. CountHistory.Result('<PRCode items expression>', <check calculator expression>, <check calculator expression>)  
CountWork functions - The check calculator expressions referenced in the Format column represent a begin date and an end date, respectively.
CountWork Returns the number of all non-zero check lines between the work dates in history that match the group expression argument. CountWork('<literal group expression>', <check calculator expression>, <check calculator expression>)  
CountWork.Source Returns the number of all non-zero check sources between the work dates in history that match the PRCode items expression argument. CountWork.Source('<PRCode items expression>', <check calculator expression>, <check calculator expression>)  
CountWork.Rate Returns the number of all non-zero check rates between the work dates in history that match the PRCode items expression argument. CountWork.Rate('<PRCode items expression>', <check calculator expression>, <check calculator expression>)  
CountWork.Result Returns the number of all non-zero check results between the work dates in history that match the PRCode items expression argument. CountWork.Result('<PRCode items expression>', <check calculator expression>, <check calculator expression>)  
CountYTD functions
CountYTD Returns the year-to-date number of non-zero lines in history which match the group expression argument. CountYTD('<literal group expression>')

CountYTD('uiUSA Source')

Note ↑

In normal processing where checks are processed in increasing date order, YTD calculations include all matching check lines on checks within the year simply because there are not check lines on checks dated later in the year. However, in unusual circumstances where a check is dated before existing checks, the function may calculate a total that does not include lines from the later-dated checks. In this instance, the function returns a warning similar to this:

There is/are n check line(s) that belong(s) to a check dated later in the year that was/were not included in the year to date total.

The warning does not prevent a check from being processed in any way, it simply serves as a notice to the operator to examine the results for accuracy.

CountYTD.Source Returns the year-to-date number of non-zero sources in history which match the PRCode items expression argument. CountYTD.Source('<PRCode items expression>')  
CountYTD.Rate Returns the year-to-date number of non-zero rates in history which match the PRCode items expression argument. CountYTD.Rate('<PRCode items expression>')  
CountYTD.Result Returns the year-to-date number of non-zero results in history which match the PRCode items expression argument. CountYTD.Result('<PRCode items expression>')  
 
Date Returns a date using the base date as a starting point and evaluating the string constant which is a date expression.

The base date can be a date keyword (e.g., BirthDate, CheckDate, WorkDate) or a date parameter.

Date(base date,'<literal date expression>')

Date(CheckDate, 'Begin of Month')

Date(WorkDate, 'begin of period of calendar "Fair"')

 
Err For generating user-defined errors during payroll check calculation. If the function is evaluated, it returns the error message specified in the first argument.

While the value argument is optional, a value must be present to determine the data type. Omitting the value argument is equivalent to providing a value of "NULL".

Err(<string expression>,[value])

Note

If any portion of the string expression evaluates to null, the message will be null.

IF(IsNull(segment:item:parameter), Err("segment:item:parameter is null. Every employee should have a value.",segment:item:parameter),segment:item:parameter)

Err("The value of parameter segment:item:parameter must be 'A', 'B', or 'C'. However, its value is " + IsNull(segment:item:parameter,"NULL") + ".")

 
False A literal false value. False  
FirstHired Returns the date the employee was first hired. FirstHired  
 
FUTA functions
FUTA.AdjustmentRate Returns the adjustment rate for the specified year. FUTA.AdjustmentRate([date])

If no date is specified, the check date is used.

FUTA.AdjustmentRate (FUTA adjustment rate using the check date)

FUTA.AdjustmentRate(#1/1/2023#) (FUTA adjustment rate for 2023 [.054])

FUTA.MaxWages Returns the FUTA maximum wages for the specified year. FUTA.MaxWages([date])

If no date is specified, the check date is used.

FUTA.MaxWages (FUTA maximum wages using the check date)

FUTA.MaxWages(#1/1/2023#) (FUTA maximum wages for 2023 [$7000])

FUTA.Rate Returns the FUTA rate before adjustments. FUTA.Rate([date])

If no date is specified, the check date is used.

FUTA.Rate (FUTA rate using the check date)

FUTA.Rate(#1/1/2023#) (FUTA rate for 2023 [.006])

 
Garnishment functions
Garnishment.ChildSupportArrearsAmount Returns the per check amount of arrears. Garnishment.ChildSupportArrearsAmount  
Garnishment.ChildSupportCurrentAmount Returns the per check amount for the child support garnishment associated with the check line. (Should not typically be used to calculate the garnishment amount. See "Garnishment.Deduction".) Garnishment.ChildSupportCurrentAmount  
Garnishment.MaximumPercentage Returns the maximum percentage for the garnishment associated with the check line. Maximum percentage applies to child support, student loan, state, local, and civil garnishments. Garnishment.MaximumPercentage  
Garnishment.CheckAmount Returns the check amount for the garnishment associated with the check line. Check amount applies to student loan, state, local, and civil garnishments. For child support garnishments, see Garnishment.ChildSupportCurrentAmount. For IRS garnishments, see Garnishment.IRSCheckAmount. Garnishment.CheckAmount  
Garnishment.TotalAmount Returns the total amount value for the garnishment associated with the check line. Total amount applies to all garnishment types except child support and IRS levies. Garnishment.TotalAmount  
Garnishment.Type Returns the type of garnishment associated with the check line. Possible values are "CS" (child support), "I" (IRS), "SL" (student loan), "S" (state), "L" (local), or "C" (civil). Garnishment.Type  
Garnishment.State Returns the two-character postal code of the state of the garnishment associated with the check line. Garnishment.State  
Garnishment.CaseNumber Returns the case number of the garnishment associated with the check line. Garnishment.CaseNumber  
Garnishment.StartDate Returns the start date of the garnishment associated with the check line. Garnishment.StartDate  
Garnishment.StopDate Returns the stop date of the garnishment associated with the check line. Garnishment.StopDate  
Garnishment.RecordNumber Returns the record number of the garnishment associated with the check line. Garnishment.RecordNumber  
Garnishment.ReceivedDate Returns the date the garnishment order for the garnishment associated with the check line was received. Garnishment.ReceivedDate  
Garnishment.IRSType Returns the type of IRS garnishment associated with the check line. Valid values are "L" (levy) and "A" (agreement). Garnishment.IRSType  
Garnishment.IRSCheckAmount Returns the per check amount of the IRS garnishment associated with the check line. Garnishment.IRSCheckAmount  
Garnishment.IRSYear Returns the year of the IRS garnishment associated with the check line. Garnishment.IRSYear  
Garnishment.IRSFilingStatus Returns the employee filing status for the IRS garnishment associated with the check line. Valid values are "S" (single), "MJ" (married filing jointly or qualifying widow(er)), "H" (head of household), or "MS" (married filing separately). Garnishment.IRSFilingStatus  
Garnishment.IRSExemptions Returns the number of exemptions claimed by the employee with the IRS garnishment associated with the check line. Garnishment.IRSExemptions  
Garnishment.IRSAdditionalExemptions Returns the number of additional exemptions claimed by the employee with the IRS garnishment associated with the check line. Garnishment.IRSAdditionalExemptions  
Garnishment.Deduction Returns the calculated deduction amount for the garnishment associated with the check line. This function can only be used in a result expression.
  • For child support check lines, the source amount is disposable earnings, the rate is the maximum percentage (which prorates the deduction amount by a specified ratio), and the Garnishment.Deduction expression produces the result.
  • For IRS levies, the source amount is disposable earnings.
  • For IRS agreements, the deduction is the per check amount.
  • For state tax levies, the source is disposable earnings and the rate is the maximum percentage. If a check amount is specified, it is used as the source; otherwise, the deduction amount is source times rate. The deduction amount is minimized to the amount of disposable earnings left after other garnishments with a higher priority are subtracted. State tax levies are not minimized to the Consumer Credit Protection Act limit.
  • For student loan, local, and civil garnishments, the source is disposable earnings and the rate is the maximum percentage. If a check amount is specified, it is used as the source; otherwise, the deduction amount is source times rate. The deduction is minimized to the state multiplier times the state minimum wage and to the Consumer Credit Protection Act limit (25% of disposable earnings).
Garnishment.Deduction Child support example:

Source expression: SumCheck('DispPay Result') - SumCheck('DispDed Result')

Rate expression: Garnishment.MaximumPercentage

Result expression: Garnishment.Deduction

 
If Checks the condition and returns the first result if the condition is true; the second, if the condition is false. If(condition, result if true, result if false)

Both results must be of the same data type.

If (tax:usa:exempt, 0, SumCheck('CompUSA Result')-SumCheck('PreTax Result'))

IN Checks for an item's membership in a specified group; i.e., allows for mixing of group membership tests with PRCode item conditions. IN(group expression, tax entity, EE|ER)

Pay=Reg AND IN(Compensation)

(Pay=Reg AND IN(Compensation)) OR (Pay=Ovt OR NOT IN(Compensation))

(Second example is for demonstrating syntax only; it is not a practical example.)

IsNull Returns the first argument if the argument is not null; otherwise, returns the second argument. IsNull(test, alternative)

IsNull(F401:5I:Amt, SumCheck('GrossWages Amount'))

IsNull(Pay:b, Pay:a)

LastHired Returns the date when the employee was last hired. LastHired  
LedgerAccrual Returns the total of all accruals to a leave ledger between the dates specified. The dates can be a literal date, a built-in date, or a call to the Date function. LedgerAccrual(LeaveLedger,begin_date, end_date)  
LedgerBalance Returns the balance of a leave ledger. The date can be a literal date, a built-in date, or a call to the Date function. LedgerBalance(LeaveLedger,date)

LedgerBalance('Service Months',CheckDate)

LedgerUsage Returns the total of all usages of a leave ledger between the dates specified. The dates can be a literal date, a built-in date, or a call to the Date function. LedgerUsage(LeaveLedger,begin_date,end_date)  
 
Max Functions
Max Returns the maximum of all arguments passed to the function. There must be at least two arguments. Max(argument1,argument2,...)

Max(0, Tax:FUTA:Max-SumYTD('Medicare Wages'))

MaxAll functions
MaxAll Returns the maximum value of all lines in history which match the group expression argument. MaxAll('<literal group expression>')  
MaxAll.Source Returns the maximum source of all lines in history which match the PRCode items expression. MaxAll.Source('<PRCode items expression>')  
MaxAll.Rate Returns the maximum rate of all lines in history which match the PRCode items expression. MaxAll.Rate('<PRCode items expression>')  
MaxAll.Result Returns the maximum result of all lines in history which match the PRCode items expression. MaxAll.Result('<PRCode items expression>')  
MaxAnnual function
MaxAnnual Returns the maximum value from all check lines for the year of the check date that match the group expression argument. MaxAnnual('<literal group expression>')

 

MaxCheck functions
MaxCheck Returns the maximum value of lines on the check which match the group expression argument. It has two optional date arguments which, if passed, are compared to the work date. Only check lines with a work date in the range are considered. MaxCheck('<literal group expression>',[begin date],[end date])

MaxCheck('xyz Source')

MaxCheck('xyz Source',#1/1/2023#,#1/31/2023#)

MaxCheck.Source Returns the maximum source of lines on the check which match the PRCode items expression argument. It has two optional date arguments which, if passed, are compared to the work date. Only check lines with a work date in the range are considered. MaxCheck.Source('<PRCode items expression>',[begin date],[end date])  
MaxCheck.Rate Returns the maximum rate of lines on the check which match the PRCode items expression argument. It has two optional date arguments which, if passed, are compared to the work date. Only check lines with a work date in the range are considered. MaxCheck.Rate('<PRCode items expression>',[begin date],[end date])  
MaxCheck.Result Returns the maximum result of lines on the check which match the PRCode items expression argument. It has two optional date arguments which, if passed, are compared to the work date. Only check lines with a work date in the range are considered. MaxCheck.Result('<PRCode items expression>',[begin date],[end date])  
MaxHistory functions - The check calculator expressions referenced in the Format column represent a begin date and an end date, respectively.
MaxHistory Returns the maximum value from all check lines between the check dates in history that match the group expression argument. MaxHistory('<literal group expression>',<check calculator expression>,<check calculator expression>)  
MaxHistory.Source Returns the maximum source from all check lines between the check dates in history that match the PRCode items expression argument. MaxHistory.Source('<PRCode items expression>',<check calculator expression>,<check calculator expression>)  
MaxHistory.Rate Returns the maximum rate from all check lines between the check dates in history that match the PRCode items expression argument. MaxHistory.Rate('<PRCode items expression>',<check calculator expression>,<check calculator expression>)  
MaxHistory.Result Returns the maximum result from all check lines between the check dates in history that match the PRCode items expression argument. MaxHistory.Result('<PRCode items expression>',<check calculator expression>,<check calculator expression>)  
MaxWork functions - The check calculator expressions referenced in the Format column represent a begin date and an end date, respectively.
MaxWork Returns the maximum value of all check lines between the work dates in history that match the group expression argument. MaxWork('<literal group expression>',<check calculator expression>,<check calculator expression>)

MaxWork('Hours Number', Date(CheckDate, 'Begin of Month'), CheckDate)

Here, "Number" is the user-defined name for the result on the "Hours" group.

MaxWork.Source Returns the maximum source of all check lines between the work dates in history that match the PRCode items expression argument. MaxWork.Source('<PRCode items expression>',<check calculator expression>,<check calculator expression>)  
MaxWork.Rate Returns the maximum rate of all check lines between the work dates in history that match the PRCode items expression argument. MaxWork.Rate('<PRCode items expression>',<check calculator expression>,<check calculator expression>)  
MaxWork.Result Returns the maximum result of all check lines between the work dates in history that match the PRCode items expression argument. MaxWork.Result('<PRCode items expression>',<check calculator expression>,<check calculator expression>)  
MaxYTD functions
MaxYTD Returns the maximum year-to-date value of all lines in history which match the group expression argument. MaxYTD('<literal group expression>')  

Note ↑

In normal processing where checks are processed in increasing date order, YTD calculations include all matching check lines on checks within the year simply because there are not check lines on checks dated later in the year. However, in unusual circumstances where a check is dated before existing checks, the function may calculate a total that does not include lines from the later-dated checks. In this instance, the function returns a warning similar to this:

There is/are n check line(s) that belong(s) to a check dated later in the year that was/were not included in the year to date total.

The warning does not prevent a check from being processed in any way, it simply serves as a notice to the operator to examine the results for accuracy.

MaxYTD.Source Returns the maximum year-to-date source of all lines in history which match the PRCode items expression argument. MaxYTD.Source('<PRCode items expression>')  
MaxYTD.Rate Returns the maximum year-to-date rate of all lines in history which match the PRCode items expression argument. MaxYTD.Rate('<PRCode items expression>')  
MaxYTD.Result Returns the maximum year-to-date result of all lines in history which match the PRCode items expression argument. MaxYTD.Result('<PRCode items expression>')  
 
Min Functions
Min Returns the minimum of all arguments passed to the function. There must be at least two arguments. Min(argument1,argument2,...)

Min(deduction:repay:amount, SumAll('loan Result')-SumAll('repay Result'))

MinAll functions
MinAll Returns the minimum value of all lines in history which match the group expression argument. MinAll('<literal group expression>')  
MinAll.Source Returns the minimum source of all lines in history which match the PRCode items expression. MinAll.Source('<PRCode items expression>')  
MinAll.Rate Returns the minimum rate for all lines in history which match the PRCode items expression. MinAll.Rate('<PRCode items expression>')  
MinAll.Result Returns the minimum result for all lines in history which match the PRCode items expression. MinAll.Result('<PRCode items expression>')  
MinAnnual function
MinAnnual Returns the minimum value from all check lines for the year of the check date that match the group expression argument. MinAnnual('<literal group expression>')  
MinCheck functions
MinCheck Returns the minimum value of lines on the check which match the group expression argument. It has two optional date arguments which, if passed, are compared to the work date. Only check lines with a work date in the range are considered. MinCheck('<literal group expression>',[begin date],[end date])  
MinCheck.Source Returns the minimum source of lines on the check which match the PRCode items expression argument. It has two optional date arguments which, if passed, are compared to the work date. Only check lines with a work date in the range are considered. MinCheck.Source('<PRCode items expression>',[begin date],[end date])  
MinCheck.Rate Returns the minimum rate of lines on the check which match the PRCode items expression argument. It has two optional date arguments which, if passed, are compared to the work date. Only check lines with a work date in the range are considered. MinCheck.Rate('<PRCode items expression>',[begin date],[end date])  
MinCheck.Result Returns the minimum result of lines on the check which match the PRCode items expression argument. It has two optional date arguments which, if passed, are compared to the work date. Only check lines with a work date in the range are considered. MinCheck.Result('<PRCode items expression>',[begin date],[end date])  
MinHistory functions - The check calculator expressions referenced in the Format column represent a begin date and an end date, respectively.
MinHistory Returns the minimum value from all check lines between the check dates in history that match the group expression argument. MinHistory('<literal group expression>',<check calculator expression>,<check calculator expression>)  
MinHistory.Source Returns the minimum source from all check lines between the check dates in history that match the PRCode items expression argument. MinHistory.Source('<PRCode items expression>',<check calculator expression>,<check calculator expression>)  
MinHistory.Rate Returns the minimum rate from all check lines between the check dates in history that match the PRCode items expression argument. MinHistory.Rate('<PRCode items expression>',<check calculator expression>,<check calculator expression>)  
MinHistory.Result Returns the minimum result from all check lines between the check dates in history that match the PRCode items expression argument. MinHistory.Result('<PRCode items expression>',<check calculator expression>,<check calculator expression>)  
MinWork functions - The check calculator expressions referenced in the Format column represent a begin date and an end date, respectively.
MinWork Returns the minimum value of all check lines between the work dates in history that match the group expression argument. MinWork('<literal group expression>',<check calculator expression>,<check calculator expression>)  
MinWork.Source Returns the minimum source of all check lines between the work dates in history that match the PRCode items expression argument. MinWork.Source('<PRCode items expression>',<check calculator expression>,<check calculator expression>)  
MinWork.Rate Returns the minimum rate of all check lines between the work dates in history that match the PRCode items expression argument. MinWork.Rate('<PRCode items expression>',<check calculator expression>,<check calculator expression>)  
MinWork.Result Returns the minimum result of all check lines between the work dates in history that match the PRCode items expression argument. MinWork.Result('<PRCode items expression>',<check calculator expression>,<check calculator expression>)  
MinYTD functions
MinYTD Returns the minimum year-to-date value of all lines in history which match the group expression argument. MinYTD('<literal group expression>')

MinYTD('Medicare Result USA EE')

Note ↑

In normal processing where checks are processed in increasing date order, YTD calculations include all matching check lines on checks within the year simply because there are not check lines on checks dated later in the year. However, in unusual circumstances where a check is dated before existing checks, the function may calculate a total that does not include lines from the later-dated checks. In this instance, the function returns a warning similar to this:

There is/are n check line(s) that belong(s) to a check dated later in the year that was/were not included in the year to date total.

The warning does not prevent a check from being processed in any way, it simply serves as a notice to the operator to examine the results for accuracy.

MinYTD.Source Returns the minimum year-to-date source of all lines in history which match the PRCode items expression argument. MinYTD.Source('<PRCode items expression>')  
MinYTD.Rate Returns the minimum year-to-date rate of all lines in history which match the PRCode items expression argument. MinYTD.Rate('<PRCode items expression>')  
MinYTD.Result Returns the minimum year-to-date result of all lines in history which match the PRCode items expression argument. MinYTD.Result('<PRCode items expression>')  
 
MinimumWage Returns the minimum wage of a specified state as of an effective date, or as of the check line work date if no effective date is specified. MinimumWage(state[,date])

MinimumWage('TX')

MinimumWage('CA',#1/1/2023#)

 
NULL Returns the null value. The data type is inferred from the context. If the data type cannot be inferred from context, the expression is not allowed.

Examples

Because all PRCode calculation expressions are ultimately numeric, the expression "NULL" is inferred to be numeric.

Since subexpressions can be of any data type, the data type of NULL is determined by context:

  • NULL + 1. Numeric.
  • NULL + "ABC". String.
  • #1/1/2023# > NULL. Date.
  • TRUE = NULL. True/false.
  • IF(NULL,1,2). True/false because NULL is the condition of an IF function.
NULL  
 
Number Converts the string passed to the function and returns a number. Number(string)

Number(AttributeItem('Scheduled Hours', CheckDate))

PayPeriodsPerYear Returns the pay periods per year as defined on the check. PayPeriodsPerYear  
PeriodBeginDate Returns the pay period begin date of the check. PeriodBeginDate  
PeriodEndDate Returns the pay period end date of the check. PeriodEndDate  
Position Returns the pay rate for a position with the given unit of pay as of the work date on the check line or as of a specified date.

If no position is specified, the position is chosen from the PRCode if it is position-specific. If the PRCode is not position-specific, the position is the primary position or the one the employee occupies on the given date. Once the position is chosen, the value is selected from the employee pay rates if one is defined for the date; otherwise, the pay rate is selected from position-specific pay rates.

If a position is specified, the expression returns the specified pay rate from the specified position as of the work date (if no date is specified), or as of the date specified.

Position(["literal position"],"literal unit of pay",[date])

Position("HourlyRate")

Position("AnnualSalary")

Position("Salary",CheckDate)

Position.Code or Position.Code(date) Returns the code of the position specified on the PRCode or, if no position is specified, the code of the primary position of the employee as of the work date of the line or as of the specified date. Position.Code

Position.Code(date)

Position.Code

Position.Code(CheckDate)

Rate Returns the rate from the check line. Rate  
Round Rounds the value passed in the first argument to the number of decimal places specified in the second argument.

Example

ValueDigitsResult
8765.567838765.568
8765.567828765.57
8765.567818765.6
8765.567808766
8765.5678-18770
8765.5678-28800
Round(numeric expression,digit expression)

Round(Type:Pay:Rate,0)

Source Returns the source of the check line. This function can only be used in the result expression of a PRCode. Source  
String Returns the argument of the function as a string.

Most useful when used in conjunction with the Err and Warn functions to display the information in the error and warning messages.

String()

Warn(String(SumCheck("Hours")) + ' hours exceeds 80. Defaulting to 80.',80)

Substring Returns the substring determined by taking the string supplied in the first argument, moving to the start position specified by the second argument, and taking every character from the start position to the right for the number of characters specified in the third argument.

If the start expression and/or length expression do not result in a whole number, only the integer part is considered.

If the string is null, the result is null. If the start or length is null, an error results.

The leftmost position in the string is considered to be position 1. If the start expression evaluates to a value less than or equal to 1, it will be treated as if it is 1.

If the start position is beyond the end of the string, the result is a zero length string.

Substring(string expression,start expression,length expression)

Substring("12345",1,5) returns "12345"

Substring("12345",1,100) returns "12345"

Substring("12345",1,3) returns "123"

Substring("12345",3,2) returns "34"

Substring("12345",6,1) returns ""

 
StateW4 Functions - The "state" argument in the functions below takes a literal, quoted string which must be the name of the state (such as "New Mexico") or the two-letter postal code (such as "NM").
StateW4.Withholding Returns the calculated withholding for the employee for the specified state. StateW4.Withholding("state")

StateW4.Withholding("TX")

StateW4.Withholding("Texas")

StateW4.Date Returns the date of the employee's state W-4 record for the specified state. StateW4.Date("state")  
StateW4.ExpirationDate Returns the expiration date of the employee's state W-4 record for the specified state. StateW4.ExpirationDate("state")  
StateW4.Exempt Returns the employee's exempt status from the employee's state W-4 record for the specified state. StateW4.Exempt("state")  
StateW4.FlatPercent Returns the flat percent withholding rate from the employee's state W-4 record for the specified state. StateW4.FlatPercent("state")  
StateW4.FilingStatus Returns the employee's filing status from the employee's state W-4 record for the specified state. StateW4.FilingStatus("state")  
StateW4.Allowances Returns the number of exemptions claimed from the employee's state W-4 record for the specified state. StateW4.Allowances("state")  
StateW4.NumberOfDependents Returns the number of dependents claimed from the employee's state W-4 record for the specified state. StateW4.NumberOfDependents("state")  
StateW4.ExtraExemptionAmount Returns the extra exemption amount from the employee's state W-4 record for the specified state. StateW4.ExtraExemptionAmount("state")  
StateW4.CountyCode Returns the county code from the employee's state W-4 record for the specified state. StateW4.CountyCode("state")  
StateW4.TwoJobs Returns the employee's two job status from the employee's state W-4 record for the specified state. StateW4.TwoJobs("state")  
StateW4.DependentsTotalAmount Returns the dependents total amount from the employee's state W-4 record for the specified state. StateW4.DependentsTotalAmount("state")  
StateW4.OtherIncomeAmount Returns the other income amount from the employee's state W-4 record for the specified state. StateW4.OtherIncomeAmount("state")  
StateW4.DeductionsAmount Returns the deductions amount from the employee's state W-4 record for the specified state. StateW4.DeductionsAmount("state")  
StateW4.ExtraWithholding Returns the extra withholding amount from the employee's state W-4 record for the specified state as of the check date. Specifying "True" in the optional True/False argument returns zero if the state W-4 is expired or missing; "False" returns NULL if the state W-4 is expired or missing. StateW4.ExtraWithholding("state",[True/False])  
StateW4.LocalWithholding Returns the local withholding amount calculated based on the employee's state W-4 record for the specified state as of the check date. State W-4 records for states which calculate local withholding (New York, Indiana, Michigan, for example) indicate the locality for the employee. For states with no local withholding, the function returns zero. StateW4.LocalWithholding("state")  
StateW4.ExtraLocalWithholding Returns the extra local withholding for the locality where the employee resides based on the state W-4 record for the specified state as of the check date. Specifying "True" in the optional True/False argument returns NULL if the state W-4 is expired or missing; "False" returns zero if the state W-4 is expired or missing.

Local extra withholding applies to Indiana counties as well as to New York City and Yonkers, New York.

StateW4.ExtraLocalWithholding("state",[True/False])

StateW4.ExtraLocalWithholding('IN')

StateW4.ExtraLocalWithholding('NY')

 
Sum Functions
SumAll functions
SumAll Returns the sum of all lines in history which match the group expression argument. SumAll('<literal group expression>')

SumAll('loan Result')

SumAll.Source Returns the sum of all sources in history which match the PRCode items expression argument. SumAll.Source('<PRCode items expression>')  
SumAll.Rate Returns the sum of all rates in history which match the PRCode items expression argument. SumAll.Rate('<PRCode items expression>')  
SumAll.Result Returns the sum of all results in history which match the PRCode items expression argument. SumAll.Result('<PRCode items expression>')  
SumAnnual function
SumAnnual Returns the sum of all check lines for the year of the check date that match the group expression argument. SumAnnual('<literal group expression>')  
SumCheck functions
SumCheck Returns the sum of lines on the check which match the group expression argument. It has two optional date arguments which, if passed, are compared to the work date. Only check lines with a work date in the range are considered. SumCheck('<literal group expression>',[begin date],[end date])  
SumCheck.Source Returns the sum of sources on the check which match the PRCode items expression argument. It has two optional date arguments which, if passed, are compared to the work date. Only check lines with a work date in the range are considered. SumCheck.Source('<PRCode items expression>',[begin date],[end date])  
SumCheck.Rate Returns the sum of rates on the check which match the PRCode items expression argument. It has two optional date arguments which, if passed, are compared to the work date. Only check lines with a work date in the range are considered. SumCheck.Rate('<PRCode items expression>',[begin date],[end date])  
SumCheck.Result Returns the sum of results on the check which match the PRCode items expression argument. It has two optional date arguments which, if passed, are compared to the work date. Only check lines with a work date in the range are considered. SumCheck.Result('<PRCode items expression>',[begin date],[end date])  
SumHistory functions - The check calculator expressions referenced in the Format column represent a begin date and an end date, respectively.
SumHistory Returns the sum of all check lines between the check dates in history that match the group expression argument. SumHistory('<literal group expression>',<check calculator expression>,<check calculator expression>)

SumHistory('Days Number', Date(CheckDate, 'Begin of Month'), CheckDate)

Here, "Number" is the user-defined name for the result on the "Days" group.

SumHistory.Source Returns the sum of all check line sources between the check dates in history that match the PRCode items expression argument. SumHistory.Source('<PRCode items expression>',<check calculator expression>,<check calculator expression>)  
SumHistory.Rate Returns the sum of all check line rates between the check dates in history that match the PRCode items expression argument. SumHistory.Rate('<PRCode items expression>',<check calculator expression>,<check calculator expression>)  
SumHistory.Result Returns the sum of all check line results between the check dates in history that match the PRCode items expression argument. SumHistory.Result('<PRCode items expression>',<check calculator expression>,<check calculator expression>)  
SumWork functions - The check calculator expressions referenced in the Format column represent a begin date and an end date, respectively.
SumWork Returns the sum of all check lines between the work dates in history that match the group expression argument. SumWork('<literal group expression>',<check calculator expression>,<check calculator expression>)  
SumWork.Source Returns the sum of all check line sources between the work dates in history that match the PRCode items expression argument. SumWork.Source('<PRCode items expression>',<check calculator expression>,<check calculator expression>)  
SumWork.Rate Returns the sum of all check line rates between the work dates in history that match the PRCode items expression argument. SumWork.Rate('<PRCode items expression>',<check calculator expression>,<check calculator expression>)  
SumWork.Result Returns the sum of all check line results between the work dates in history that match the PRCode items expression argument. SumWork.Result('<PRCode items expression>',<check calculator expression>,<check calculator expression>)  
SumYTD functions
SumYTD Returns the year-to-date sum of lines in history which match the group expression argument. SumYTD('<literal group expression>')

SumYTD('uiUSA Source')

Note ↑

In normal processing where checks are processed in increasing date order, YTD calculations include all matching check lines on checks within the year simply because there are not check lines on checks dated later in the year. However, in unusual circumstances where a check is dated before existing checks, the function may calculate a total that does not include lines from the later-dated checks. In this instance, the function returns a warning similar to this:

There is/are n check line(s) that belong(s) to a check dated later in the year that was/were not included in the year to date total.

The warning does not prevent a check from being processed in any way, it simply serves as a notice to the operator to examine the results for accuracy.

SumYTD.Source Returns the year-to-date sum of sources in history which match the PRCode items expression argument. SumYTD.Source('<PRCode items expression>')  
SumYTD.Rate Returns the year-to-date sum of rates in history which match the PRCode items expression argument. SumYTD.Rate('<PRCode items expression>')  
SumYTD.Result Returns the year-to-date sum of results in history which match the PRCode items expression argument. SumYTD.Result('<PRCode items expression>')  
 
SUTA Functions
SUTA.MaxWages Returns the maximum wage base for unemployment insurance.
All 50 states plus the District of Columbia (DC), Puerto Rico (PR), and the Virgin Islands (VI) are supported.
SUTA.MaxWages("state",[date])
If no date is specified, the check date is used.
The "state" argument takes a literal, quoted string which must be the name of the state (such as "New Mexico") or the two-letter postal code (such as "NM").

SUTA.MaxWages("West Virginia") (The SUTA maximum wage base for West Virginia on the check date)

SUTA.MaxWages("DC") (The SUTA maximum wage base for the District of Columbia on the check date)

SUTA.MaxWages("NM",#1/1/2023#) (The SUTA maximum wage base for New Mexico in 2023)

SUTA.MaxWages("Oklahoma",#1/1/2023#) (The SUTA maximum wage base for Oklahoma in 2023)

 
Tax Functions - Tax functions calculate an amount of income tax withholding. For more information, see "Payroll tax functions".
TerminationDate Returns the date the employee was terminated. TerminationDate  
True A literal true value. True  
Truncate Truncates the value passed in the first argument to the number of decimal places specified in the second argument. Truncate(numeric expression,digit expression)

Truncate(SumAll("401K Amount"),0)

 
W-4 functions
W4.Allowances Returns the number of allowances indicated on the employee's W-4 as of the check date. W4.Allowances  
W4.Date Returns the date of the most recent W-4 for the employee as of the check date. W4.Date  
W4.Exempt Returns the exempt indicator from the employee's W-4 as of the check date. W4.Exempt  
W4.ExtraWithholding Returns any extra withholding amount specified on the employee's W-4 as of the check date. Specifying "True" in the optional True/False argument returns zero if the W-4 is expired or missing; "False" returns NULL if the W-4 is expired or missing. W4.ExtraWithholding([True/False])  
W4.FilingStatus Returns the filing status indicated on the employee's W-4 as of the check date. W4.FilingStatus  
W4.MandatoryRate Returns the mandatory withholding rate used to calculate withholding for supplemental amounts over the threshold. W4.MandatoryRate  
W4.OptionalRate Returns the optional supplemental withholding rate used to calculate withholding for supplemental amounts which do not exceed the yearly threshold. W4.OptionalRate  
W4.Threshold Returns the amount of the current yearly threshold for supplemental pay when the mandatory fixed rate is in effect. W4.Threshold  
W4.Withholding Calculates USA withholding using the source as the basis and withholding supplemental pay according to the method specified. The method must be "Aggregate" or "FixedRate".

Becauses it uses the line source as the basis for calculating withholding, the function can only be used in the PRCode's result expression.

Withholding on regular wages and supplemental wages is calculated separately. If the result of the "Supplemental" group minus the amount of the "PreIncomeTaxSupp" group is negative, ActivityHD zeros out the supplemental pay (this also applies to supplemental year-to-date pay) so that negative supplemental withholding does not occur and the total withholding is not reduced erroneously.

The filing status, allowances, and exemption come from the W-4 that is on file and in effect for the employee on the check date. If no W-4 is in effect on the check date, single filing status, zero allowances, and "not exempt" are used.

W4.Withholding(method)

W4.Withholding(Aggregate)

W4.Withholding(FixedRate)

Note ↑

In normal processing where checks are processed in increasing date order, YTD calculations include all matching check lines on checks within the year simply because there are not check lines on checks dated later in the year. However, in unusual circumstances where a check is dated before existing checks, the function may calculate a total that does not include lines from the later-dated checks. In this instance, the function returns a warning similar to this:

There is/are n check line(s) that belong(s) to a check dated later in the year that was/were not included in the year to date total.

The warning does not prevent a check from being processed in any way, it simply serves as a notice to the operator to examine the results for accuracy.

 
Warn For generating user-defined warnings during payroll check calculation. If the function is evaluated, it returns the warning message specified in the first argument.

While the value argument is optional, a value must be present to determine the data type. Omitting the value argument is equivalent to providing a value of "NULL".

Warn(<string expression>,[value])

Note

If any portion of the string expression evaluates to null, the message will be null.

Warn("PRCode Pay.Reg.TX is deprecated and should no longer be used.",source*rate)

Warn("The value of parameter segment:item:parameter must be 'A', 'B', or 'C'. However, its value is " + IsNull(segment:item:parameter,"NULL") + ".")

 
WorkDate Returns the work date on the check line. WorkDate  
WorkDays Returns the number of work days in the GL period which contains the date passed in the second argument in the calendar passed in the first argument.

The date can be a literal date, a built-in date, or a call to the Date function.

WorkDays(GLCalendar,date)

WorkDays('PRHol',WorkDate)

WorkDays('WizDuty',Date(WorkDate,'End of period 1 of calendar "WizDuty"')

×

PRCode items expressions

PRCode items expressions are similar to segment items expressions except they determine payroll information based on PRCode segment items in their PRCode segments. The general form of a PRCode items expression is:

[PRCODESEGMENT <operator> PRCODEITEM]

The <operator> is one of the following: =, <>, <, >, <=, >=, LIKE, NOT LIKE.

Examples

  • Pay=REG
  • Tax=SUTA
  • Deduction=HI AND HIProvider=BC

Syntax rules

  • PRCode items expressions are optional.
  • PRCode items expressions can be combined with ANDs and ORs as in the third example above.
  • PRCode items expressions can be grouped using parentheses.
  • Example

    (Pay=REG OR Pay=SAL) AND Ded=401K

  • PRCode items expressions can be negated.
  • Example

    NOT Ded=DENTAL

  • PRCode items expressions support the IN function. The IN function allows you to mix group assignment tests with other operations. The argument of the IN function is a group expression minus the amount.
  • Example

    IN(Compensation) AND Pay=REG

    "Compensation" is the name of a check line group.