All Collections
Payroll(HK)
Advanced Settings
How to value the data of abnormal attendance in payroll calculation formula setting?
How to value the data of abnormal attendance in payroll calculation formula setting?

How to value the data of being late, early leave, shift labor and absence during pay run process?

Workstem CS avatar
Written by Workstem CS
Updated over a week ago

Many companies give attendance bonus to employees, so in the attendance process, it is necessary to collect these abnormal attendance records, and then according to the abnormal attendance data, calculate different attendance bonuses for employees.

How does Workstem value these abnormal attendance data?

The system provides the corresponding functions of abnormal attendance data collection:

CountAttendStatusByDay(Status Item, Range in mins)

SumAttendData(Item)

CountAttendDataByDay('beLateLength','0-20','a*10')

Here's how to use these functions in details.

Step 1

[Payroll]>[Settings]>[Pay Items]>[Settings].

Step 2

Click [Settings], go to [Pay Items], find the corresponding item that needs to set the formula, click [Formula], or add new item to formula setup step, and go to [Pay Items] formula setting interface.

Step 3

1. In the attendance period corresponding to the pay run period, the attendance status (late, early leave, actual attendance) will be counted by day (the total number of days with late status within a month), and click [Functions] to find CountAttendStatusByDay(Status Item, Range in mins). Then view the relevant description and example for this function.

Note: [Parameter description]

Status item: beLateLength, leaveEarlyLength, shiftLabor, absenceLength, respectively refer to “Late”, “Early leave”, “Shift Labor”, “Absent”.

Range in mins: refers to “range of minutes”, such as “1-10” mins

The value that CountAttendStatusByDay returned is “number of days”.

Example: Take being late as an example

Assume that the current payroll calculation period is 2020-03-01 to 2020-03-31, and the attendance period is consistent.

An employee was late for 5 days that month. Two of them were less than 10 minutes late, while the other three days were 20 minutes late.

CountAttendStatusByDay('belatelLength', '1-10') value is 2

CountAttendStatusByDay('belatelLength', '10-30') value is 3

CountAttendStatusByDay('belatelLength', '1-30') value is 5

2. Obtain the total minutes of related attendance information (late/early leave/total minutes, working hours, etc.) , and click [Functions] to find SumAttendData(Item). Then view the relevant description and example for this function.

Note: [Parameter description]

Item: beLateLength, leaveEarlyLength, shiftLabor, totalWorkingDaysOrHours, workingOvertimeOnWeekdays, workingOvertimeOnRestDays, workingOvertimeOnStatutoryHolidays, absenceLength.

Refer to total minutes of being late, early leave, shift labor, absence, total attendance hours, working day overtime, rest day overtime, and statutory holiday overtime.

Example:

Assume that the current payroll calculation period is 2020-03-01 to 2020-03-31, and the attendance period is consistent.

An employee was late for 3 days that month, which are 5 minutes late, 8 minutes late and 10 minutes late, respectively.

SumattendData('beLateLength') value is 23 minutes (5+8+10).

3. Obtain the number of times that the time range stated in parameter 2 is met in the related attendance related data (late/early leave/confirmation, working hours, etc.) , and the number of times is calculated by the expression of parameter 3 as the calculation value of the function. Click [Functions] to find CountAttendDataByDay('AttendItemName', 'MinsRange','Expression'). And then view the relevant description and example for this function.

Note: [Parameter description]

Status item: beLateLength, leaveEarlyLength, shiftLabor, absenceLength, totalWorkingDaysOrHours, workingOvertimeOnWeekdays, workingOvertimeOnStatutoryHolidays, workingOvertimeOnRestDays, refer to being late, early leave, shift labor, absence, total working days or hours, working day overtime, statutory holiday overtime, and rest day overtime.

MinsRange: Range of minutes (such as “1-10” mins)

Expression: Expression for number of times, which supports +-*/

Example:

Assume that the current payroll calculation period is 2020-03-01 to 2020-03-31, and the attendance period is consistent.

An employee was late for 5 days that month. Two of them were less than 10 minutes late. The other three days were 20 minutes late

CountAttendDataByDay('beLateLength','1-10','a*10') value is 20

CountAttendDataByDay('beLateLength','11-20','a*50') value is 150

Compatible writing:

var str = 'tempValue' + '+' + BasicSalary + '>=0' + '&&' + 'tempValue'+ '+' + BasicSalary + '<=200000'

CountAttendDataByDay('beLateLength',str,'a*50')

Compatible writing:

var str = 'totalWorkingDaysOrHours' + '+' + 'leaveEarlyLength' + BasicSalary + '>=0' + '&&' + 'totalWorkingDaysOrHours'+ '+' + BasicSalary + '<=200000' CountAttendDataByDay('str','a*10')

Did this answer your question?