OD Attendance Approval
On-Duty (OD) attendance requires manager approval. When field staff check in via GPS, their attendance record enters a pending state until a manager reviews the GPS data, route, and photos before approving or rejecting.
Approval Flow
Approval SQL
The approval operation updates four fields in a single atomic UPDATE:
UPDATE t_SiteVisit_GPS
SET IsApproved = @IsApproved,
ApprovalBy = @ApprovalBy,
ApprovalOn = GETDATE(),
Reason = @Reason
WHERE SiteVisitGPSID = @SiteVisitGPSIDApproval List API
The AttendanceAPIController provides endpoints for the approval workflow:
| Endpoint | Method | Purpose |
|---|---|---|
GetAttendanceApprovalList | GET | Fetch pending approvals with filters |
GetMobileAttendanceById | GET | Get details of a specific attendance record |
SaveAttendanceApproval | POST | Submit approval/rejection decision |
GetAttendanceApprovalStatus | GET | Get list of valid approval status types |
Approval List Parameters
GET /webapi/Attendance/GetAttendanceApprovalList
?UserId=1234
&PeriodFrom=2025-01-01
&PeriodTo=2025-01-31
&ReportType=AllThe ReportType parameter controls the scope — "All" shows all records; other values filter by specific report categories.
Approval Data Model
The MobileAttendanceApprovalModel includes:
| Field | Description |
|---|---|
| GMUserName | Staff name (sorted ascending by default) |
| PeriodFrom / PeriodTo | Date range filter |
| ApprovedAttendance | Selected attendance type |
| ApprovalRemarks | Manager's notes |
| MobileAttendanceId | Record identifier |
Web-Based Approval (MVC)
The MobileAttendanceController provides a web interface for approval:
The web approval page defaults to showing the previous day's records. Managers can change the date to review older entries.
Source Files
| File | Purpose |
|---|---|
SitevisitGPSBO.cs | ApprovalODAttendance SQL operation |
AttendanceAPIController.cs | API approval endpoints |
MobileAttendanceController.cs | Web approval UI |
MobileAttendanceBO.cs | Approval business logic |