Skip to main content

Scripting Functions for Paycheck Scripts and Calc Codes

Scripting basics

ReadyPay allows you to use Microsoft VBScript in order to perform calculations and comparisons that affect employee paychecks. This article provides basic guidance on how to use ReadyPay specific functions. Although this article contains several examples and descriptions of VBScript logic, it is not a full tutorial on the logic, syntax, and structure of VBScript.

Some VBScript basics

A single quote denotes a comment. Comments are not evaluated by the scripting engine. They are just notes for you to be able to refer to. For example:

'This is a comment on a line by itself.
net = GetGross() - GetTaxes() 'This is a comment after a variable is defined.

Variables are used to store values that will be acted on later in your script. Variables can store a single value that you set, perform basic math operations, retrieve values from the ReadyPay database, and use functions. For example:

ADDRate = .012
'This defines a variable called "ADDRate" and sets its value at 1.2%

ytdReg = EYtdAmount("EReg")
'This defines a variable called "ytdReg" and sets its value using the
'EYtdAmount function using the earning code "Reg".

net = GetGross() - GetTaxes()
'This variable called "net" sets its value by using the function
'"GetGross()" and subtracting the value from the "GetTaxes()" function.

If / Then / Else / End If is used in the logic part of your script to compare single values and do something based on the outcome of the comparison. You can compare a variable against a specific value, or you can compare two variables against each other.

For / Next is used in the logic part of your script when you need to loop through multiple values and look for a specific value, then do something based on finding the specific value you're looking for. For example, you would use a For / Next loop to evaluate which employees had a department override on a pay item where cc1 = '1150'.

Predefined Sub Procedures for use in a PaycheckCalc Script

This section contains the Sub[routines] that you will place your scripts inside of. Sub Procedures tell ReadyPay when in the check creation process to run your script logic.

  • PaycheckCalculator_PrePostRecurring — Post recurring pays takes most of the information from the EEarn page and creates payroll detail records. It does not post entries which are dependent on other entries (% amounts of other earnings).
  • PaycheckCalculator_PreCalculatePay — Calculate pay extends all of the detail records found so far. At this time, the detail records are the entries on the pay screen, plus the posted recurring pays.
  • PaycheckCalculator_PrePostOtherRecurringPay — Post dependent recurring pays takes the information from the EEarn page and creates payroll detail records, but only for entries which are percentages of other amounts.
  • PaycheckCalculator_PrePostSpecialPays — PostSpecialPays posts other types of pay which are not in the EEarn table.
  • PaycheckCalculator_PrePostMatchingDeductions — PostMatchingDeductions posts deductions which match the earning amounts. For example, tips and taxable fringe benefits GTL.
  • PaycheckCalculator_PrePostPretaxDeductionsPostDeductions(TRUE) posts the pretax (401k, s125, etc.) deductions from the EDed page and extends the amounts (% of gross, special calcs), as necessary.
  • PaycheckCalculator_PrePostSpecialDeductions — PostSpecialDeductions posts deductions which are not in the EDed table, for example, 401k.
  • PaycheckCalculator_PreCalculateTaxes — Calculate taxes calculates the taxes, oddly enough.
  • PaycheckCalculator_PrePostDeductionsPostDeductions(FALSE) posts the normal, posttax deductions (not 401k, s125, etc.) from the EDed page and extends the amounts (% of gross, special calcs), as necessary.
  • PaycheckCalculator_PreMakeupShortfall — If we still have a positive net check, MakeupShortfall() tries to make up dropped deductions from prior payrolls.
  • PaycheckCalculator_PreCheckCalculation — CheckCalculation looks for negative checks. If something is wrong, it modifies flags which produce a different result in the calc.
  • PaycheckCalculator_PreDirectDeposits — Calculate Direct Deposits calculates the direct deposit withholdings based on the EDirDep page.
  • PaycheckCalculator_PostCheckCalculation — Check Calculation is when the entire check, including net and dir dep amounts, has been calculated.
  • PaycheckCalculator_PreUpdateBalances
  • PaycheckCalculator_PreUpdateYearToDates
  • PaycheckCalculator_PreEvaluateAccrualUsage
  • PaycheckCalculator_PrePrevailingWage
  • PaycheckCalculator_PreAutoDistribution
  • PaycheckCalculator_PrePostPretaxInsurance
  • PaycheckCalculator_PrePostInsurance
  • PaycheckCalculator_PreDoWC
  • PaycheckCalculator_Pre401kMatch
  • PaycheckCalculator_PreFindAgencies

In order to use the sub procedures listed above, format them as such:

Sub Procedure Name()
' Put script here
End Sub

For example:

Sub PaycheckCalculator_PostCheckCalculation()
' Put script here
End Sub
note

Scripts are most often run in the PaycheckCalculator_PostCheckCalculation() Sub because the change you want to make needs to happen after the employee's check has been fully calculated.

Predefined Script Functions

Script functions run within a Sub Procedure. All predefined Script Functions are available for use with both Paycheck Scripting and Calc Codes. Due to the nature of Calc Codes, however, not all predefined Script Functions will return the amount you expect when used with Calc Codes. This is because of the order in which items on a check are calculated.

Each function returns a specific type of data:

  • Double — A number is returned.
  • Bool — A boolean value is returned. This is always a number and most often a 0 (false) or 1 (true). Some taxes may have additional boolean values of 2, 3, etc.
  • Variant — A string which can be letters, numbers, symbols, or a combination of two or more of these.
  • Date — A date is returned in the format MMDDYYYY. Additional VB scripting functions are available if you need to convert the date returned to a different date format.
  • Long — A number is returned. This is a variation of the Double data type.

All scripts follow the same basic structure. First, set your variables. Second, perform logic operations on your variables. Third, end your script. The rest of this article provides many examples.

Retrieve Information from Current Paycheck

GetGross

Returns the total gross for the current paycheck.

  • Returns: Double
  • Syntax: GetGross()

GetTaxes

Returns the total for all employee taxes on the current paycheck.

  • Returns: Double
  • Syntax: GetTaxes()

GetTotalHours

Returns the total number of hours worked for a specified deduction / earning / tax code or code group.

  • Returns: Double
  • Syntax: GetTotalHours("code")
  • code: The deduction, earning, tax code, or code group. If you are entering a single deduction, earning, or tax code, precede the code by a D, E, or T depending on the type of code (D = deduction, E = Earning, T = Tax); and then enclose it in one pair of quotation marks. If you are entering a code group, enter the code group name; and then enclose it in two pairs of quotation marks. For example, earning code ER401 would be entered as "EER401", and code group 401k Earns would be entered as ""401k Earns"".

Example:

Sub PaycheckCalculator_PostCheckCalculation
eeTotalHours = GetTotalHours("401k Eligible Earns")
eeRegHours = GetTotalHours("EReg")
msgBox "Regular earnings(Reg) consisted of " + CStr((eeRegHours * 100) / eeTotalHours) + "% of 401k eligible hours for this employee"
End Sub

GetTotalAmount

Returns the total dollar amount associated with a specified deduction / earning / tax code or code group.

  • Returns: Double
  • Syntax: GetTotalAmount("code")
  • code: The deduction, earning, tax code, or code group. If you are entering a single deduction, earning, or tax code, precede the code by a D, E, or T depending on the type of code. If you are entering a code group, just enter the code group name. For example, earning code ER401 would be entered as ""EER401"", and code group 401k Earns would be entered as ""401k Earns"".

GetDedTypeAmount

Returns the total of deductions of a given deduction type.

  • Syntax: GetDedTypeAmount("DedType"). Replace DedType with the ded type you need.

GetDedTypeHours

GetEarnTypeAmount

Returns the total of earnings of a given earn type.

  • Syntax: GetEarnTypeAmount("EarnType"). Replace EarnType with the Earn Type you need.

GetEarnTypeHours

GetCheckDate

Returns the check date for the current paycheck.

  • Returns: Date
  • Syntax: GetCheckDate()

GetCheckAutoPayFlag

Returns the state of the auto pay flag for the current paycheck. If the flag is TRUE, the employee is set to automatically receive salary or hourly pay.

  • Returns: Bool
  • Syntax: GetCheckAutoPayFlag()

GetCheckAttributes

Returns the check type (Regular, Manual, etc.) for the current paycheck.

  • Returns: Variant
  • Syntax: GetCheckAttributes()

GetCheckBeginDate

Returns the pay period begin date for the current paycheck.

  • Returns: Date
  • Syntax: GetCheckBeginDate()

GetBatch

Returns the batch for the current paycheck. For example, to determine if a check is in the Voids/Manuals batch it would return VM.

  • Returns: Variant
  • Syntax: GetBatch
  • Example: strBatch = GetBatch()

GetCalcOrder

Returns the calc order for the current paycheck. The calc order is the position the current check will be processed in an employee's collection of checks within a given batch. For example, an employee's first calculated check is 1, any additional check is incremented by 1. So the second check is 2, third is 3. This number coincides with the Pay 1, Pay 2, or Pay 3 that you would see in a given employee's payroll entry. This is per batch, not per payroll.

  • Returns: Variant
  • Syntax: GetCalcOrder
  • Example: nCheck = GetCalcOrder()

GetCheckDedBlocks

Returns the list of blocked deductions for the current paycheck. The list contains all blocked deductions separated by commas with a comma after the last item.

  • Returns: Variant
  • Syntax: GetCheckDedBlocks()

GetCheckDedMultiplier

Returns the deduction multiplier for the current paycheck.

  • Returns: Long
  • Syntax: GetCheckDedMultiplier()

GetCheckDirDepBlockedFlag

Returns the block direct deposits flag for the current paycheck. If this flag is TRUE, all direct deposits on the check will be blocked.

  • Returns: Bool
  • Syntax: GetCheckDirDepBlockedFlag()

GetCheckDistributionsBlockedFlag

Returns the block distributions flag for the current paycheck. If this flag is TRUE, all distributions on the check will be blocked.

  • Returns: Bool
  • Syntax: GetCheckDistributionsBlockedFlag()

GetCheckEarnBlocks

Returns the list of blocked earnings for the current paycheck. The list contains all blocked earnings separated by commas with a comma after the last item.

  • Returns: Variant
  • Syntax: GetCheckEarnBlocks()

GetCheckEndDate

Returns the pay period end date for the current paycheck.

  • Returns: Date
  • Syntax: GetCheckEndDate()

GetCheckSpecialFlag

Returns the special check flag for the current paycheck. If this flag is TRUE, the check will be treated as a special check.

  • Returns: Bool
  • Syntax: GetCheckSpecialFlag()

GetCheckstubMemo

Returns the checkstub memo for the current paycheck.

  • Returns: Variant
  • Syntax: GetCheckstubMemo()

GetCheckTaxFrequency

Returns the override tax frequency for the current paycheck.

  • Returns: Variant
  • Syntax: GetCheckTaxFrequency()

GetCheckUseOverrideOptions

Returns the use override options flag for the current paycheck. If this flag is TRUE, the override check type properties will be used. If it is FALSE, the company default properties will be used.

  • Returns: Bool
  • Syntax: GetCheckUseOverrideOptions()

GetCheckUserMemo

Returns the user memo for the current paycheck.

  • Returns: Variant
  • Syntax: GetCheckUserMemo()

Retrieve Information from Current Pay Detail Item

For all functions below that reference an index, the index is a number associated with the selected pay detail item. Every line item on a paycheck (deductions, earnings, and taxes) has its own unique index number. The index number for the first item is 0.

GetAccount

Returns the account code entered for the pay detail item specified by the index.

  • Returns: Variant
  • Syntax: GetAccount(index)

GetAmount

Returns the dollar amount entered for the pay detail item specified by the index.

  • Returns: Double
  • Syntax: GetAmount(index)

GetBeginDate

Returns the pay period begin date for the current paycheck.

  • Returns: Date
  • Syntax: GetBeginDate(index)

GetCC1

Returns the organization level 1 override entered for the pay detail item specified by the index.

  • Returns: Variant
  • Syntax: GetCC1()

GetCC2

Returns the organization level 2 override entered for the pay detail item specified by the index.

  • Returns: Variant
  • Syntax: GetCC2()

GetCC3

Returns the organization level 3 override entered for the pay detail item specified by the index.

  • Returns: Variant
  • Syntax: GetCC3()

GetCC4

Returns the organization level 4 override entered for the pay detail item specified by the index.

  • Returns: Variant
  • Syntax: GetCC4()

GetCC5

Returns the organization level 5 override entered for the pay detail item specified by the index.

  • Returns: Variant
  • Syntax: GetCC5()

GetComment

Returns the comment entered for the pay detail item specified by the index.

  • Returns: Variant
  • Syntax: GetComment(index)

GetDet

Returns the Det Code ("D"=Deduction, "E"=Earning, "T"=Tax) for the pay detail item specified by the index.

  • Returns: Variant
  • Syntax: GetDet(index)

GetDetCode

Returns the deduction, earning, or tax code of the pay detail item specified by the index.

  • Returns: Variant
  • Syntax: GetDetCode(index)

GetDirDepTransit

Returns the direct deposit transit number entered for the pay detail item specified by the index.

  • Returns: Variant
  • Syntax: GetDirDepTransit(index)

GetEndDate

Returns the pay period end date for the current paycheck.

  • Returns: Date
  • Syntax: GetEndDate(index)

GetHours

Returns the hours entered for the pay detail item specified by the index.

  • Returns: Double
  • Syntax: GetHours(index)

GetIsTimeImport

Tells you if something was imported via time import.

  • Returns: Bool
  • Syntax: GetIsTimeImport(index)

Example:

Sub PaycheckCalculator_PostCheckCalculation
For index = 0 to GetTransactionCount() - 1
strIs = GetIsTimeImport(index)
if CStr(strIs) = "1" or CStr(strIs) = "true" then
MPIMessageBox "Yes" & " " & CStr(strIs) & " " & GetDetCode(index)
else
MPIMessageBox "No" & " " & CStr(strIs) & " " & GetDetCode(index)
end if
next
End Sub

GetJobCode

Returns the job code entered for the pay detail item specified by the index.

  • Returns: Variant
  • Syntax: GetJobCode(index)

GetRate

Returns the pay rate entered for the pay detail item specified by the index.

  • Returns: Double
  • Syntax: GetRate(index)

GetRateCode

Returns the rate code entered for the pay detail item specified by the index.

  • Returns: Variant
  • Syntax: GetRateCode(index)

GetShift

Returns the shift code entered for the pay detail item specified by the index.

  • Returns: Variant
  • Syntax: GetShift(index)

GetTCode1

Returns the first override tax code entered for the pay detail item specified by the index.

  • Returns: Variant
  • Syntax: GetTCode1(index)

GetTCode2

Returns the second override tax code entered for the pay detail item specified by the index.

  • Returns: Variant
  • Syntax: GetTCode2(index)

GetTCode3

Returns the third override tax code entered for the pay detail item specified by the index.

  • Returns: Variant
  • Syntax: GetTCode3(index)

GetTCode4

Returns the fourth override tax code entered for the pay detail item specified by the index.

  • Returns: Variant
  • Syntax: GetTCode4(index)

GetWcc

Returns the workers comp. code entered for the pay detail item specified by the index.

  • Returns: Variant
  • Syntax: GetWcc(index)

GetTransactionCount

Returns the number of line items on the current paycheck.

note

The indexes for the pay detail items range from 0 to the transaction count minus 1.

  • Returns: Long
  • Syntax: GetTransactionCount()

Retrieve Employee Month to Date Information

For all functions below:

  • Month: the number code representing the desired month:
    • 1 = January
    • 2 = February
    • 3 = March
    • 4 = April
    • 5 = May
    • 6 = June
    • 7 = July
    • 8 = August
    • 9 = September
    • 10 = October
    • 11 = November
    • 12 = December
  • Code: The deduction, earning, tax code, or code group. If you are entering a single deduction, earning, or tax code, precede the code by a D, E, or T depending on the type of code. If you are entering a code group, just enter the code group name. For example, earning code ER401 would be entered as "EER401", and code group 401k Earns would be entered as "401k Earns".
  • Year: The four digit year. For example 1998, 2000, or 2015.
  • The information returned is for the month and year entered.

EMonthAmount

Returns the month to date dollar amount for a specified deduction code, earning code, tax code, or code group.

  • Returns: Double
  • Syntax: EMonthAmount("code", month)

EMonthHours

Returns the month to date hours worked for a specified deduction code, earning code, tax code, or code group.

  • Returns: Double
  • Syntax: EMonthHours("code", year, month)

EMonthTaxable

Returns the month to date taxable income for a specified deduction code, earning code, tax code, or code group.

  • Returns: Double
  • Syntax: EMonthTaxable("taxCode", month)
  • taxCode: The desired tax code. This can be any valid tax code set up on the company.

EYMonthAmount

Returns the month to date dollar amount for a specified deduction code, earning code, tax code, or code group.

  • Returns: Double
  • Syntax: EYMonthAmount("code", year, month)

EYMonthHours

Returns the month to date hours worked for a specified deduction code, earning code, tax code, or code group.

  • Returns: Double
  • Syntax: EYMonthHours("code", month)

EYMonthTaxable

Returns the month to date taxable income for a specified deduction code, earning code, tax code, or code group.

  • Returns: Double
  • Syntax: EYMonthTaxable(""taxCode"", year, month)
  • taxCode: The desired tax code. This can be any valid tax code set up on the company.

Retrieve Employee Year to Date Information

For all functions below:

  • code: The deduction, earning, tax code, or code group. If you are entering a single deduction, earning, or tax code, precede the code by a D, E, or T depending on the type of code. If you are entering a code group, just enter the code group name. For example, earning code ER401 would be entered as "EER401", and code group 401k Earns would be entered as "401k Earns".
  • year: The four digit year. For example 1998, 2000, or 2015.
  • The information returned is for the current year unless the function has the year variable in which case it will return the specified year.

EYtdAmount

Returns the year to date dollar amount for a specified deduction code, earning code, tax code, or code group.

  • Returns: Double
  • Syntax: EYtdAmount("code")

EYtdHours

Returns the year to date hours worked for a specified deduction code, earning code, tax code, or code group.

  • Returns: Double
  • Syntax: EYtdHours("code")

EYtdTaxable

Returns the year to date taxable income for a specified deduction code, earning code, tax code, or code group.

  • Returns: Double
  • Syntax: EYtdTaxable("taxCode")
  • taxCode: The desired tax code. This can be any valid tax code set up on the company.

EYYtdAmount

Returns the year to date dollar amount for a specified deduction code, earning code, tax code, or code group.

  • Returns: Double
  • Syntax: EYYtdAmount("code", year)

EYYtdHours

Returns the year to date hours worked for a specified deduction code, earning code, tax code, or code group.

  • Returns: Double
  • Syntax: EYYtdHours("code", year)

EYYtdTaxable

Returns the year to date taxable income for a specified deduction code, earning code, tax code, or code group.

  • Returns: Double
  • Syntax: EYYtdTaxable("taxCode")
  • taxCode: The desired tax code. This can be any valid tax code set up on the company.

Retrieve Employee Accrual Info

For all functions below:

  • benefitCode: The accrual code. This can be any valid accrual code set up on the company.

EAccrAvailableDollars

Returns the available dollars for the specified accrual code.

  • Returns: Double
  • Syntax: EAccrAvailableDollars("benefitCode")

Example:

Sub PaycheckCalculator_PostCheckCalculation()
vacDollars = GetTotalAmount("EVac")
balance = EAccrAvailableDollars("VACH")
If vacDollars > balance Then
msgBox "Employee has exceeded available vacation balance"
End If
End Sub

EAccrAvailableHours

Returns the available hours for the specified accrual code.

  • Returns: Double
  • Syntax: EAccrAvailableHours(""benefitCode"")

Example:

Sub PaycheckCalculator_PostCheckCalculation()
vacDollars = GetTotalHours("EVac")
balance = EAccrAvailableHours("VACH")
If vacDollars > balance Then
msgBox "Employee has exceeded available vacation balance"
End If
End Sub

EAccrUsedDollars

Returns the used dollars for the specified accrual code.

  • Returns: Double
  • Syntax: EAccrUsedDollars("benefitCode")

Example:

Sub PaycheckCalculator_PostCheckCalculation()
If EAccrUsedDollars("SICK") > 1000 Then
msgBox "The employee has used more than $1000 worth of sick time"
End If
End Sub

EAccrUsedHours

Returns the used hours for the specified accrual code.

  • Returns: Double
  • Syntax: EAccrUsedHours("benefitCode")

Example:

Sub PaycheckCalculator_PostCheckCalculation()
If EAccrUsedHours("SICK") > 80 Then
msgBox "The employee has used more than 2 weeks of sick time"
End If
End Sub

Retrieve Employee Information

Einfo

This function is used to extract information from the EInfo table for the current employee.

  • Returns: Variant
  • Syntax: EInfo("field")
  • field: The database field name for the desired piece of information. For example, the employee's last name is stored in the field lastName located in the EInfo table of the company database.

EInsurance

Modify Information on Current Pay Detail Item

For all functions below:

  • index: The index number associated with the selected pay detail item. Every line item on a paycheck (deductions, earnings, and taxes) has its own unique index number. The index number for the first item is 0.

SetAccount

Sets the account code for the pay detail item specified by the index.

  • Syntax: SetAccount(index, "account")
  • account: The account field on the pay detail record. This field stores the code for any third party check associated with the pay detail item.

SetAmount

Sets the dollar amount for the pay detail item specified by the index.

  • Syntax: SetAmount(index, amount)
  • amount: The pay amount associated with the selected code.

SetBeginDate

Sets the pay period begin date for the current paycheck.

  • Syntax: SetBeginDate(index, beginDate)
  • beginDate: The payroll period begin date.

SetCC1

Sets the organization level 1 override for the pay detail item specified by the index.

  • Syntax: SetCC1(index, "organizationLevel")
  • organizationLevel: The code for the "department" within the desired organization level.

SetCC2

Sets the organization level 2 override for the pay detail item specified by the index.

  • Syntax: SetCC2(index, "organizationLevel")

SetCC3

Sets the organization level 3 override for the pay detail item specified by the index.

  • Syntax: SetCC3(index, "organizationLevel")

SetCC4

Sets the organization level 4 override for the pay detail item specified by the index.

  • Syntax: SetCC4(index, "organizationLevel")

SetCC5

Sets the organization level 5 override for the pay detail item specified by the index.

  • Syntax: SetCC5(index, "organizationLevel")

SetComment

Sets the comment for the pay detail item specified by the index.

  • Syntax: SetComment(index, "comment")
  • comment: The comment associated with the selected pay detail item.

SetDet

Sets the det ("D"=Deduction, "E"=Earning, "T"=Tax) for the pay detail item specified by the index.

  • Syntax: SetDet(index, "det")
  • det: A single character code used to specify the type of pay detail item being referred to. D = deduction, E = Earning, or T = tax.

SetDetCode

Sets the deduction, earning, or tax for the pay detail item specified by the index.

  • Syntax: SetDet(index, "detCode")
  • detCode: The deduction, earning, or tax code. This can be any valid deduction, earning or tax code set up on the company.

SetDirDepTransit

Sets the direct deposit transit number for the pay detail item specified by the index.

  • Syntax: SetDirDepTransit(index, "transit")
  • transit: The ABA transit number associated with the bank being used for the direct deposit. This should be a 9 digit number.

SetEndDate

Sets the pay period end date for the current paycheck.

  • Syntax: SetEndDate(index, endDate)
  • endDate: The payroll period end date.

SetHours

Sets the hours for the pay detail item specified by the index.

  • Syntax: SetHours(index, hours)
  • hours: The number of hours associated with the selected code.

SetJobCode

  • Syntax: SetJobCode(index, "jobCode")
  • jobCode: The job code associated with the selected pay item. This can be any valid job code set up on the company.

SetRate

Sets the pay rate for the pay detail item specified by the index.

  • Syntax: SetRate(index, rate)
  • rate: The pay rate associated with the selected pay detail item.

SetRateCode

  • Syntax: SetRateCode(index, "rateCode")
  • rateCode: The rate code associated with the selected pay detail item. This can be any valid rate code set up on the company.

SetShift

Sets the shift code for the pay detail item specified by the index.

  • Syntax: SetShift(index, "shift")
  • shift: The shift code associated with the selected pay detail item. This can be any valid shift code set up on the company.

SetTCode1

Sets the first override tax code for the pay detail item specified by the index.

  • Syntax: SetTCode1(index, "overrideTaxCode")
  • overrideTaxCode: The override tax code associated with the current pay detail item. This can be any valid tax code set up on the company.

SetTCode2

Sets the second override tax code for the pay detail item specified by the index.

  • Syntax: SetTCode2(index, "overrideTaxCode")

SetTCode3

Sets the third override tax code for the pay detail item specified by the index.

  • Syntax: SetTCode3(index, "overrideTaxCode")

SetTCode4

Sets the fourth override tax code for the pay detail item specified by the index.

  • Syntax: SetTCode4(index, "overrideTaxCode")

SetWcc

Sets the workers comp code for the pay detail item specified by the index.

  • Syntax: SetWcc(index, "wcc")
  • wcc: The workers comp code associated with the selected pay detail item. This can be any valid workers comp code set up on the company.

Modify Information for Current Pay Check

AddTransaction

This function is used to add a new pay detail item to the current check. The function returns an integer that is the index number of the added pay detail line. This index number can be used to set additional fields (override dept, job code, wcc) for the new code.

  • Syntax: AddTransaction("det", "detCode", hours, amount)
  • det: A single character code used to specify the type of pay detail item being referred to. D = deduction, E = Earning, or T = tax.
  • detCode: The deduction, earning, or tax code. This can be any valid deduction, earning or tax code set up on the company.
  • hours: The number of hours associated with the selected code.
  • amount: The pay amount associated with the selected code.

Example:

Sub PaycheckCalculator_PostCheckCalculation()
eeContrip = GetTotalAmount("D401")
erMatch = eeContrib * .5
Call AddTransaction("E", "ER401", 0, erMatch)
End Sub

AddAllocatedTransaction

Allocates an amount according to the employee's labor allocation settings. This goes through each Labor Allocation for an employee (that is active), and multiplies the HOURS and the AMOUNT by the percentage (divided by 100). When there are no settings on the labor allocation tab it will allocate 100% to the employee's home department. Uses the same syntax as AddTransaction.

  • Syntax: AddAllocatedTransaction("det", "detCode", "hours", "rate", "amount", "comment", "agency")
  • det: A single character code used to specify the type of pay detail item being referred to. D = deduction, E = Earning, or T = tax.
  • detCode: The deduction, earning, or tax code. This can be any valid deduction, earning or tax code set up on the company.
  • hours: The number of hours associated with the selected code.
  • rate:
  • amount: The pay amount associated with the selected code.
  • comment:

SetCheckAttributes

Sets the check type (Regular, Manual, etc.) for the current paycheck.

  • Syntax: SetCheckAttributes("checkAttributes")
  • checkAttributes: The check type used for the selected paycheck. This can be any Millennium standard check types ("Regular", "Manual") or any user defined check type.

SetCheckAutoPayFlag

Sets the auto pay flag for the current paycheck. If this flag is set to TRUE, the employee will automatically receive salary or hourly pay.

  • Syntax: SetCheckAutoPayFlag(autoPay)
  • autoPay: The setting of the auto pay check box on the current paycheck. If this is set to TRUE, the employee will receive auto pay; if it is FALSE, the employee will not.

SetCheckBeginDate

Sets the pay period begin date for the current paycheck.

  • Syntax: SetCheckBeginDate(beginDate)
  • beginDate: The payroll period begin date.

SetCheckDate

Sets the check date for the current paycheck.

  • Syntax: SetCheckDate(checkDate)
  • checkDate: The check date associated with the currently selected paycheck.

SetCheckDedBlocks

Sets the list of blocked deductions for the current paycheck. The list should contain all blocked deductions separated by commas with a comma after the last item.

  • Syntax: SetCheckDedBlocks("blockedDeductions")
  • blockedDeductions: A comma separated list of deductions to block for the current check. A comma is required after the last item in the list.

SetCheckDedMultiplier

Sets the deduction multiplier for the current paycheck.

  • Syntax: SetCheckDedMultiplier(deductionMultiplier)
  • deductionMultiplier: The deduction multiplier for the current paycheck. All deduction amounts will be multiplied by this number before being added to the check.

SetCheckDirDepBlockedFlag

Sets the block direct deposits flag for the current paycheck. If this flag is TRUE, all direct deposits on the check will be blocked.

  • Syntax: SetCheckDirDepBlockedFlag(dirDepBlocked)
  • dirDepBlocked: The state of the block direct deposits check box for this paycheck. If this is set to TRUE the direct deposits will be blocked. If this is FALSE they will not.

SetCheckDistributionsBlockedFlag

Sets the block distributions for the current paycheck. If this flag is TRUE, all distributions on the check will be blocked.

  • Syntax: SetCheckDistributionsBlockedFlag(distBlocked)
  • distBlocked: The state of the block labor/job distribution check box for this paycheck. If this is set to TRUE the distribution will be blocked. If this is FALSE it will not.

SetCheckEarnBlocks

Sets the list of blocked earnings for the current paycheck. The list should contain all blocked earnings separated by commas with a comma after the last item.

  • Syntax: SetCheckEarnBlocks(blockedEarnings)
  • blockedEarnings: A comma separated list of all earnings to block for the current check. A comma is required after the last item in the list.

SetCheckEndDate

Sets the pay period end date for the current paycheck.

  • Syntax: SetCheckEndDate(endDate)
  • endDate: The payroll period end date.

SetCheckSpecialFlag

Sets the special check flag for the current paycheck. If this flag is TRUE, the check will be treated as a special check.

  • Syntax: SetCheckSpecialFlag(specialCheck)
  • specialCheck: The state of the special payment check box for this paycheck. If this is set to TRUE the check will be treated as a special payment. If this is FALSE it will not.

SetCheckstubMemo

Sets the check stub memo for the current paycheck.

  • Syntax: SetCheckstubMemo("checkstubMemo")
  • checkstubMemo: The check stub memo.

SetCheckTaxFrequency

Sets the override tax frequency for the current paycheck.

  • Syntax: SetCheckTaxFrequency("taxFrequency")
  • taxFrequency: The frequency code used for the tax frequency on the current paycheck. This can be any valid frequency set up on the company.

SetCheckUseOverrideOptions

Sets the use override options flag for the current paycheck. If this flag is TRUE, the override check type properties will be used. If it is FALSE, the company default properties will be used.

  • Syntax: SetCheckUseOverrideOptions(useOverrides)
  • useOverrides: The state of the use overrides flag for the current paycheck. If this is set to TRUE the check type will use any override properties that are set. If it is FALSE the company default properties will be used.

SetCheckUserMemo

Sets the user memo for the current paycheck.

  • Syntax: SetCheckUserMemo("userMemo")
  • userMemo: The user memo for the current paycheck.

Get or Show Misc System Information

MPIMessageBox

Used to display a message box to the user keying payroll.

  • This is very similar to the MsgBox VB function.
  • This will display once per employee per batch, rather than each time it is called.
  • Syntax: MPIMessageBox(text)
  • text: Text is the content of the message box. It can be passed strings, numbers (which should be wrapped by CStr).

Example:

MPIMessageBox "Employee being calculated is: " & EInfo("id")
note
  • MsgBox calls are replaced with MPIMessageBox as part of payroll processing.
  • Any dialogs that would get shown during processing are put into the ProcessBatch progress log for viewing.
  • The job will show as a warning when this is the case.
  • Only use these when necessary; the larger the amount of use, the slower the processing times will be.

GetCodeLimit

Allows you to better script 401k matches and similar scripts to utilize an ever changing annual rate.

  • Using this function will prevent you from having to update an annual limit in your paycheck scripts.
  • Syntax: GetCodeLimit(text)
  • text: This function accepts a string. The string should represent a Millennium Deduction Type such as:
    • 401k
    • 403b
    • 457b
    • GTL
    • Roth 401k
    • Roth 403b
    • Simple
    • Simple 401k

Example:

n401kLimit = GetCodeLimit("401k")

GetMiscTaxableBenefitFieldValue

Returns a field value from the MiscTaxableBenefits table.

  • Syntax: GetMiscTaxableBenefitFieldValue("benefitCode", "fieldName")
  • Replace benefitCode and fieldName with your specific needs.

GetMinWage

GetFedMinWage

GetVariableD

GetVariableL

GetVariableT

GetVariableDate

Retrieve Company Information

CDed

Gets any field value from the company level CDed Table.

  • Syntax: CDed("dcode", "fieldName"). Replace the dcode and fieldName for the ones you need.

CEarn

Gets any field value from the company level CEarn Table.

  • Syntax: CEarn("ecode", "fieldName"). Replace the ecode and fieldName for the ones you need.

CInsurance

CInfo

CJob

Example:

strCounty = CJob(GetJobCode(index), "county")
strCertified = CJob(GetJobCode(index), "certifiedJob")

Employee Deduction, Earning, and Rate information retrieval functions

Obtaining Employee Deduction, Rate, or Earning information.

The following functions all function the same, and are therefore grouped together. They are used to retrieve information about an employee deduction setup, employee rate setup, or an employee fringe setup.

The functions are as follows:

  • EDed(strCode, strField), EDedIndex(nIndex, strField), EDedCount()
  • EEarn(strCode, strField), EEarnIndex(nIndex, strField), EEarnCount()
  • ERate(strCode, strField), ERateIndex(nIndex, strField), ERateCount()

To use the functions, the syntax differs depending on which method you use.

  • If you are using the non-index functions, you pass in the appropriate code field of the deduction (dcode), rate (rateCode), or earning (eCode). The second argument is the fieldname of the value you want back.
  • For example, if you need the start date, you would ask for the startDate as that is the field in the database.
  • If you need multiple fields, you need to make multiple calls.
  • If you are using the indexed approach of getting the information, you probably will need to use the count functions, and loop through the collection of rates, earnings, or deductions.

Example using non-indexed approach on deductions:

Sub PaycheckCalculator_PostCheckCalculation()
str401kRate = EDed("401k", "rate")
if str401kRate <> "" then
MPIMessageBox "Found 401k Rate"
end if
End Sub

Example using the index approach on an employee's rates:

Sub PaycheckCalculator_PreCalculatePay()
for index = 0 to GetTransactionCount() - 1
' Get All of Our Variables
strDet = GetDet(index)
strDetCode = GetDetCode(index)
strCC1 = GetCC1(index)
strCC2 = GetCC2(index)
strJobCode = GetJobCode(index)

' Loop through the employee's rates based on index(n)
for n = 0 to ERateCount()
strRateCC1 = ERateIndex(n, "cc1")

' If we have a match, override the rateCode
if strRateCC1 = "100" then
strRateCode = "RateCode100"
SetRateCode index, strRateCode
Exit For
end if
next
next
End Sub

Retrieving Custom Tab Data

CompanyCustomValue

Returns Custom Tab Data on the company.

  • Syntax: CompanyCustomValue("TabName", "FieldName")

EmployeeCustomValue

Returns Custom Tab Data on the employee.

  • Syntax: EmployeeCustomValue("TabName", "FieldName")

Questions?

Contact your Payroll Service Provider.