Field Staff Tracking
Mobile Attendance
Mobile Punch System

Mobile Punch System

The mobile punch system bridges field staff GPS check-ins with the core attendance system. When a staff member starts duty, a punch timing record is created and processed by the background service into the daily attendance table.

Punch Creation Flow

Two-Path Attendance Posting

The system has two distinct paths for converting a mobile punch into a daily attendance record:

Path 1: Immediate Post — When there are zero pending tasks at check-in time, PostAttendanceWhileOnDuty() is called immediately, creating the attendance record in real-time.

Path 2: Deferred Post — When pending tasks exist, the punch record is created with a reason string listing all pending items. The AttendancePostService background job picks this up later once tasks are cleared or the grace period expires.

Punch Timing Record

The punch timing record created by InsertMobilePunchTiming captures:

FieldValueSource
EmployeeIdFrom UM_Users lookupSELECT EmployeeId FROM UM_Users WHERE UserId = @UserId
PunchDateTimeDateTime.NowServer timestamp at check-in
LatitudeStartingLatitudeFrom mobile app GPS
LongitudeStartingLongitudeFrom mobile app GPS
ReasonPending items stringConditionally set if tasks pending

User-to-Employee Mapping

The mobile app works with UserId (login identity), but the attendance system uses EmployeeId (HR identity). The mapping is done via:

SELECT EmployeeId FROM UM_Users WHERE UserId = @UserId

This mapping happens at every check-in to ensure the correct employee record is updated.

Mobile Attendance Record

The MobileAttendance table tracks the full punch-in/punch-out cycle:

The OutDateAndTime being null indicates an active session. The continuous location tracking system uses this check to determine whether to record waypoints.

Source Files

FilePurpose
SiteVisitGPSAPIController.csSaveReportOnDuty - punch creation
PunchTimingsBO.csInsertMobilePunchTiming, UpdateReason
MobileAttendanceBO.csGetMyTodayMobileAttendanceId
MyAttendanceBO.csPostAttendanceWhileOnDuty