Clarity provides the ability to have scripted payroll cateogries that can look at payroll, employee, labour as well as HR information for an employee.
Benefit enrollment from HR is one such area that a scripted payroll category can access. Attached is a detailed script with imbedded comments that explains how the connection between the two can be made with ease.
Sample Benefit Script
'*****************************************************'
'*** SCRIPTED PAYROLL CATEGORY ***'
'*** TEMPLATE ***'
'*** DESIGNED FOR USE ***'
'*** WITH HR BENEFITS ***'
'******************************************************'
'*** DEV. BY: TRAVIS DAFOE ***'
'*** DATE: JUNE 18, 2013 ***'
'*** VERSION: 4.80 ***'
'******************************************************'
'--START BY DECLARING ANY NECESSARY VARIABLES
Dim employeeSingleRate
Dim employeeMarriedRate
Dim employeeFamilyRate
Dim contributionRate
Dim contributionAmount
'--SET THE VALUES OF THE VARIABLES ACCORDINGLY
employeeSIngleRate = 22.50
employeeMarriedRate = 28.75
employeeFamilyRate = 32.50
contributionRate = 0.00
contributionAmount = 0.00
'[OPTION 1]
'-- FIRST, WE CHECK IF THE BENEFIT START DATE HAS BEEN REACHED.
'-- THIS CHECKS AS LONG AS THE PAYROLL START DATE IS AFTER THE BENEFIT START DATE
'-- SOME USERS WILL WANT THE BENEFITS TO START THE PAYROLL FOLLOWING THOUGH.
'-- IN THAT CASE USE PAYCARD.ENDDATE INSTEAD.
If Employee.BenefitStartDate("ADnD") < Paycard.StartDate Then
'--SECOND, WE CHECK IF THE BENEFIT END DATE IS SET (0 means no end date)
'--IF it is set we check if the benefit end date is AFTER the payperiod end date
'--IF THE END DATE IS BEFORE THE PERIOD ENDDATE YOU MAY WANT TO PRO-RATE THE CALCULATION.
If Employee.BenefitEndDate("ADnD") =0 Then
'---NO END DATE SET
contributionRate = 100.00
ElseIf Employee.BenefitEndDate("ADnD") > Paycard.EndDate Then
'---END DATE IS AFTER THE PERIOD ENDING DATE
contributionRate = 100.00
ElseIf Employee.BenefitEndDate("ADnD") < Paycard.StartDate Then
'---END DATE IS BEFORE THE PERIOD START DATE (ie: expired)
contributionRate = 0.00
Else
'---END DATE IS BETWEEN START AND END OF PERIOD
'---IN THIS EXAMPLE THE SYSTEM PRO-RATES THE NUMBER OF DAYS THE BENEFIT WAS ACTIVE TO DETERMINE WHAT % OF CONTRIBUTION NEEDS TO OCCUR
contributionRate = Round(DateDiff("d",Paycard.StartDate, Employee.BenefitEndDate("ADnD")) / DateDiff("d", Paycard.StartDate, Paycard.EndDate), 2) * 100
End If
ELSE
'--- CONTRIBUTION DATE HASN'T BEEN REACHED YET SO DO NOT CONTRIBUTE
contributionRate = 0.00
End If
'[OPTION 1 ENDS]
'[OPTION 2]
'--IN THIS WE CHECK IF THE EMPLOYEE AND CHILD ARE ENROLLED = FAMILY PLAN
'--SPOUSE ENROLLED = MARRIED OR
'--EMPLOYEE ONLY = SINGLE
'--IF NONE ARE SELECTED WE TRY TO READ THE AMOUNT FROM THE EMPLOYER CONTRIBUTION SIDE AS ENTERED BY THE USER
'--IF FULL CONTROL WANTS TO BE PLACED ON THOSE SETTINGS AT THE BOTTOM OF THE SCREEN
'--REMOVE THE IF STATEMENT AND LEAVE THE ASSIGNMENT OF THE ELSE PORTION ONLY.
IF Employee.EmployeeEnrolled("ADnD") and Employee.ChildrenEnrolled("ADnD") Then
contributionAmount = employeeFamilyRate
ElseIf Employee.SpouseEnrolled("ADnD") Then
contributionAmount = employeeMarriedRate
ElseIf Employee.EmployeeEnrolled("ADnD") Then
contributionAmount = employeeSingleRate
Else
'-- THIS VALUE MAY BE AT A DIFFERENT FREQUENCY THAN THE EMPLOYEES PAYROLL, SO CALCULATE IT TO A PER-PAY AMOUNT.
contributionAmount = Round(Employee.BenefitEmployerContribution("ADnD") * Employee.BenefitPayFrequency("ADnD") / Employee.PayFrequency, 2)
End If
'[OPTION 2 ENDS]
'[OPTION 3]
'--THIS OPTION IS TO PRO-RATE THE CONTRIBUTION AMOUNT IN CASE THE BENEFIT STARTS/ENDS MID PAYROLL
'--NOT NECESSARY FOR ALL CUSTOMERS.
contributionAmount = contributionAmount * contributionRate * 0.01
'[OPTION 3 ENDS]
Item.Amount = contributionAmount