> Herb 50 Payroll / Example: Expressions

See also

Expressions

Herb 50 Payroll example: Expressions

Here are some examples of commonly used expressions.

Purpose Expression
To add the processing month and year to the subject line of an email payslip.
CompanyDetails.Name + " payslip for " + DateTimeToFormattedString (DateParameters.ProcessDate, "MMMM/yy")
To calculate the total value of all non-statutory payment or deduction types.

Payments:

CurrentPay.PreTaxPay + CurrentPay.PstTaxPay

Deductions:

CurrentPay.PreTaxDed + CurrentPay.PstTaxDed
To show the age of an employee in years and months.

Age in years and months:

CString((TotalMonths(Employees.DateOfBirth, Now()) - ((DateTimeToFormattedString(NOW(), "dd"))<(DateTimeToFormattedString(Employees.DateOfBirth, "dd"))?2:1)) / 12) + " yrs, " + CString((TotalMonths(Employees.DateOfBirth, Now()) - ((DateTimeToFormattedString(NOW(), "dd"))<(DateTimeToFormattedString(Employees.DateOfBirth, "dd"))?2:1)) % 12) + " mths"

Age in years:

(DateParameters.ProcessDate - Employees.DateOfBirth) / 365.25

Age in months:

(DateParameters.ProcessDate - Employees.DateOfBirth) / 30.4375

Tip: To display only full years or months, set the Max decimals setting to 0 (zero). To do this, select the variable, then from the Properties pane, select Formatting from the Appearance area and then click the finder button . On the Formatting window, open the Numeric tab, then set the Max decimals value to 0 (zero).

If you want to ensure the age rounds down to the previous year rather than up, you can also use the following expression.

Age in years:

Floor((DateParameters.ProcessDate - Employees.DateOfBirth) / 365.25)
To show an employee's length of service in years and months.
CString((TotalMonths(Employees.WorkStartDate, Now()) - ((DateTimeToFormattedString(NOW(), "dd"))<(DateTimeToFormattedString(Employees.WorkStartDate, "dd"))?2:1)) / 12) + " yrs, " + CString((TotalMonths(Employees.WorkStartDate, Now()) - ((DateTimeToFormattedString(NOW(), "dd"))<(DateTimeToFormattedString(Employees.WorkStartDate, "dd"))?2:1)) % 12) + " mths"
To show an employee's total holiday entitlement, including any holidays brought or carried forward from a previous year.

Holidays calculated in days:

Employees.HolDaysBF + Employees.HolDaysCF + Employees.EmployeeEntitlement

Holidays calculated in hours:

Employees.HolHoursBF + Employees.HolHoursCF + Employees.EmployeeEntitlement
To show the holidays remaining for an employee.

Holidays calculated in days:

(Employees.HolDaysBF + Employees.HolDaysCF + Employees.EmployeeEntitlement) - ( Employees.HolDaysTaken + Employees.HolDaysBookedThisPayPeriod)

Holidays calculated in hours:

(Employees.HolHoursBF + Employees.HolHoursCF + Employees.EmployeeEntitlement) - (Employees.HolHoursTaken + Employees.HolHoursBookedThisPayPeriod)
To show the full year values from the Information tab of the Enter Payments window.

These values include both the year to date YTD value and the current un-updated value. To show this value on a pre-update report, add the YTD value from the Employees table to the current un-updated value from the CurrentPay table.

To show the value for total gross pay to date:

Employees.TotalGrossTD + CurrentPay.TotalGross

To show the value of student loans repaid this year:

Employees.SLRPaidTD + CurrentPay.SLRPaymentCur + CurrentPay.SLRPaymentHol
To show an employee's projected yearly salary based on their current monthly payment type.

First, you need to know the number assigned to the payment type in your custom report setting. You can check this within Company > Custom Reports.

You can then use the following expression, replacing the number of Total1 with the number of the payment type:

PaymentAnalysis.Total1 * 12
To show the amount of the employee's current net pay payable into their first bank account.
CurrentPay.RndNetPay - CurrentPay.RndNetPaySecAcc
To show an employee's national insurance value net of rebate.

Current values:

CurrentPay.EmployeeNIC - CurrentPay.EmployeeRebate

YTD values:

Employees.EmployeeNICTD - Employees.EmployeeRebate

Historical values:

Updates.EmployeeNIC - Updates.EmployeeRebate
To include employer's pension contributions on a payslip layout.

Current values:

CurrentPay.EmployerPensCur + CurrentPay.EmployerPensHol

YTD values including the current period:

Employees.PensnEmployerTD + CurrentPay.EmployerPensCur + CurrentPay.EmployerPensHol
To show an employee's holiday fund values accrued and carried forward.

To show an accrued fund:

CurrentPay.HolidayFundAccrued + CurrentPay.HolidayFundAccruedHol

To show a fund carried forward to the next pay period:

Employees.HolidayFund + CurrentPay.HolidayFundAccrued + CurrentPay.HolidayFundAccruedHol - CurrentPay.HolidayFundPaid - CurrentPay.HolidayFundPaidHol
To exclude P45 values from gross and tax year to date values.

Total gross pay:

Employees.TotalGrossTD - Employees.P45Gross

Taxable gross pay:

Employees.TaxGrossTD - Employees.P45Gross

PAYE:

Employees.TotalTaxTD - Employees.P45Tax
To show an employee's title, forename and surname without spaces.
Employees.Title + " " + Employees.Forename + " " + Employees.Surname
To show an employee's first forename, excluding any second forename.
Substring(Employees.Forename,0,IndexOf(Employees.Forename," ")) + " "

You can use this within a larger expression, for example:

"Dear " + Substring(Employees.Forename,0,IndexOf(Employees.Forename," ")) + ","
To show the employer's national insurance value net of rebate.

Current:

CurrentPay.EmployerNIC - CurrentPay.EmployerRebate

Year to date:

Employees.EmployerNICTD - Employees.EmployerRebate

Historical:

Updates.EmployerNIC - Updates.EmployerRebate

Go to top