Help on writing calculators

Attendance Monitoring Setup / Attendance Capture Setup

For company wide setup goto

Attendance Settings Attendance Flags Calculator 

The result expression should combine flags with |

To override company settings for an employee

Workforce Administration Profile Employment Attendance Flags Grid

Use Flags

{attendance.flags.AttendanceMonitored} If attendance Monitored
{attendance.flags.NoPenalty} If attendance monitored bu no penalty like leave without pay etc.
{attendance.flags.WorkPunch} If Work Punch from mobile app
{attendance.flags.PunchSnapMatch} face matching from mobile app

To allow punch from mobile

Attendance will also record geo coordinates and address. To fix address of your office locations, add the geo coordinates in the Workforce Employment Locations grid

{attendance.flags.ManualAttendance} If attendance to be updated manually
{attendance.flags.NoRegularization} If attendance regularization not allowed
{attendance.flags.WebCheckin} If can check in from web browser after login to HRMates
{attendance.flags.AttendanceNoTime} Only Present Absent without time
{attendance.flags.PunchSnap} If capture face from mobile punch
{attendance.flags.ByPresence} Only Present Absent without time
{attendance.flags.RestrictOutofGeoFence} Punch not allowed outside geofence



Setup Biometric Devices

Make Method
ZKTeco all Models Set Server IP and Port
ESSL, Biomax all Models Set Server IP and Port
From Attendance Database Support Team will setup pull punches process from database

HRMates Attendance App

Android download HRMates app from play store
iOS download HRMates app from app store
Huawei use APK sent by support team

Attendance Regularization

Set number of working days allowed to Employee and Admins to request regularization from

Attendance Settings Working Days for Employee Attendance Regularization / Working Days for Admin Attendance Regularization

Approval Process for Leave Attendance Regularization

Attendance → Settings → Leave Attendance Overtime Approvals

See Leave, Attendance, Overtime Approval Process

Total In Time Calculation

Open Attendance Settings Total In Time Calculator.
In the calculator you can use variables,

  • In Time 
  • Out Time 
  • Shift Start Time
  • Shift End Time
  • Break Time

And other variable as available in calculator options.



Description Calculator
if holiday then total time calculation between shift start and end time else intersection of sift start,end time,In time, out time

case when Holiday<>0




Late & Early Calculation

Late / Early Minutes Calculation

Open Attendance Settings → Attendance Late Minutes Calculator / Attendance Early Minutes Calculator

Calculate minutes based on punch time and shift time


Early Going

Description Calculator
if employee goes  ealy 15 min befor shift end time case when {attendance.ShiftEndTime} is not null and {attendance.OutTime}<{attendance.ShiftEndTime} then
case when TIMESTAMPDIFF(minute,{attendance.OutTime},{attendance.ShiftEndTime}) <15 then 0 else TIMESTAMPDIFF(minute,{attendance.OutTime},{attendance.ShiftEndTime}) end
else 0 end

 Late Coming

Description Calculator
if employee come late 15 min after shift start time case when {attendance.ShiftStartTime} is not null and {attendance.InTime}>{attendance.ShiftStartTime} then
case when TIMESTAMPDIFF(minute,{attendance.ShiftStartTime},{attendance.InTime})<(
case when {shift.MinimumHours} <=8 then 15 else 15 end
) then 0 else TIMESTAMPDIFF(minute,{attendance.ShiftStartTime},{attendance.InTime}) end
else 0 end

                                                                                                                                                                                                                                Attendance Late Minutes to Slabs                                                                                                                                                       Open Attendance Settings → Attendance Late Minutes to Slabs                                                                                     If needed calculate slabs based on late minutes                                                                                                                                       Attendance Lates to Leave Days Calculator                                                                                                                                   Open Attendance Settings → Attendance Lates to Leave Days Calculator                                                                   If needed calculate number of leave days to adjust from leave balances based on late and early minutes or slabs.                    Order of leave type is based on Payroll Settings Auto Leave Application                                                                                                                                                                                                                                                                                                                                                                                                                        

Present Calculation

                                                                                                                                                                                                                                                                                    Calculate Present status of employee for the day based on Total in time, Shift details Open Attendance Settings Present Calculator Example:                                                                                                                                                                                                                                                                                     


Description Calculator
If no intime and out time then Absent ,less than half time of Shift total time then Absent .Less then shift total intime than Half Day else full day

CASE WHEN {attendance.OutTime} is null or {attendance.InTime} is null then {enum.Present.Absent} WHEN {attendance.TotalInTime}<{shift.MinimumHours}/2 then {enum.Present.Absent} WHEN {attendance.TotalInTime}<{shift.MinimumHours} THEN {enum.Present.HalfDay} ELSE {enum.Present.FullDay} END



Overtime Calculation

Create overtime types and set calculator for the time using raw over time hours

Open Attendance menu Settings menuOvertime Calculators grid

Add a new row and enter name of overtime type.

Description Calculator
Workday Post

CASE WHEN {overtime.Hours.Workday Post}>=(40.0/60.0) THEN {overtime.Hours.Workday Post} ELSE 0 END




Important: Overtime approvals will be regenerated if from calculation overtime is more then previous calculation, So its important that any change in policy should use the date of policy change in calculator

Unauthorized Absence Penalty

Unauthorized absense is defined as employee Present Status not matching with Holidays and leaves applied for the day. For example employee if present for half day and he has no leave or holiday for the day, then its taken as half day unauthorized absence.

use Payroll Settings Auto Leave Application

enter order of leave types by which unauthorized attendance days are offset against the leave balances

Attendance Freeze Dates

Leave and Attendance changes are not allowed before Freeze Date.

    1. Last date of salary generated which is not in Regenerate status
    2. As per Settings in Attendance Settings → Apply Day / Freeze Day

Admin is allowed case 2

Weekoffs control

Set maximum weeksoffs an employee can have for attendance month. Settings maximum weekoffs for a month will apply to subsequent months unless changed.

Attendance → Roster Management→ Monthly Weekoffs grid

Weekoffs are counted as

Days marked as weekoff in employee attendance from Roster Upload or Modify Shift


Number of days having shift with .5 leave days multiplied by .5

Attendance Days window for Salary Month

use this to set up the dates of attendance to be considered for salary month. For example for Nov salary consider attendance from 25th Oct to 24th Nov

Attendance  Settings  Salary Start Day

    Update Leave Balances

    Intially Leave balance of employees need to be updated as on Attendance Go Live Date in HRMates.

      1. Use Attendance Settings → Download Leave Balances Template to download template
      2. Add Leave Balnaces to the template
      3. Upload using Attendance Settings → Upload Leave Balances