.jpg)
Manufacturing plants, logistics hubs, and construction sites run 24 hours because the work demands it. The shifts that make this possible, night shifts starting at 22:00, early morning shifts from 04:00, rotating schedules that change weekly, create an attendance management problem that does not exist in standard office environments: the punch-in and punch-out for the same shift can happen on two different calendar dates.
Most attendance systems are not designed with this in mind. They record a timestamp and a date, and when a worker's shift crosses midnight, the system either creates two separate records that someone has to manually link, or attributes the late-night punch to the wrong date entirely. Over the course of a month, these small errors add up into payroll discrepancies that are time-consuming to investigate and often go uncorrected.
This article explains how a QR code-based attendance system built in Clappia solves this problem at the point of scan. The key mechanism is a single flag on the scanner that tells the system a punch happened after midnight, so it should be attributed to the previous day's shift. Combined with a structured daily ledger that tracks up to three in/out segments and an automatic monthly wages rollup, the system produces accurate shift records for any pattern of working hours without requiring manual correction.
In a factory running three eight-hour shifts, the third shift might run from 22:00 to 06:00. A worker clocking out at 06:15 the next morning is completing work that started on the previous calendar day. If the attendance system records their clock-out against the date shown on the clock (Tuesday), but their clock-in was on Monday, Monday's shift record is incomplete and Tuesday has an unexplained clock-out with no corresponding clock-in.
In logistics and distribution centres, the problem is compounded by split shifts and short breaks. A driver who starts a run at 23:00, takes a mandatory rest break at 02:00, resumes at 04:00, and finishes at 08:00 has worked across two calendar dates with an interruption in the middle. Recording that accurately requires tracking three distinct time periods, two of which cross midnight, and attributing all of them to the same shift date.
Construction sites with security and overnight equipment monitoring face similar challenges. The workers responsible for site overnight may clock in at 20:00 and clock out in phases through the night depending on task completion, with the shift formally belonging to the day it started even when most of the hours happen after midnight.
The date a punch happens and the date a shift belongs to are not always the same thing. Any attendance system that cannot distinguish between these two will produce inaccurate records for any worker doing night shifts or rotating schedules.
Each employee carries a unique QR code, typically printed on their ID badge or a card issued with their employment documents. To record a punch, a supervisor or the worker themselves scans the code using the Clappia mobile app on any Android or iOS device. The scan takes a few seconds and does not require any manual data entry beyond a single confirmation step.
When a QR code is scanned, the app retrieves the employee's details from the Employee Master, the central employee database that powers the system. The following fields populate on screen without the operator typing anything:
All of these are read-only on the scan screen. The operator sees them as confirmation that the right employee was scanned, not as fields they need to fill in. The attendance date defaults to today and the attendance time defaults to the current device time, both of which the operator can correct if needed.
The single most important field on the scanner is the After Midnight confirmation. This is a Yes/No question that the operator answers at the time of each scan. When they answer Yes, it tells the system that this punch, even though the device clock shows it as today's date, should be attributed to yesterday's shift.
Consider a concrete example. A worker starts a shift at 22:30 on a Monday. Their first scan happens at 22:30: the After Midnight flag is No, because 22:30 is still Monday. They take a break and return at 01:15 on Tuesday. Their second scan happens at 01:15: the After Midnight flag is Yes, because they are scanning after midnight, but this punch belongs to Monday's shift. The system receives the Yes flag, attributes the 01:15 punch to Monday's attendance record, and the ledger for Monday now shows a complete in/out record spanning 22:30 to 01:15.
Without this flag, the 01:15 scan would either be attributed to Tuesday (wrong date) or left unattributed. With it, the system makes the correct decision automatically.
Every employee has one attendance ledger record per working day. The ledger is built automatically by the scanner's automation; the operator does not fill it in manually. It supports up to three in/out segments per day, which covers the most complex realistic shift patterns including a main working period, a break, and a return.
The first scan of a day creates the ledger record and records the clock-in time as Segment 1 time-in. Each subsequent scan updates the same record:
| Scan Number | What It Records | After Midnight Flag? |
|---|---|---|
| 1st scan (clock in) | Segment 1 time-in. Ledger record created. | No for standard start; Yes if starting after midnight on a prior-day shift |
| 2nd scan (clock out or break out) | Segment 1 time-out. Exit date and exit time stamped. | Yes if this punch is after midnight |
| 3rd scan (break in) | Segment 2 time-in. | Yes if after midnight |
| 4th scan (break out) | Segment 2 time-out. Exit date and exit time updated. | Yes if after midnight |
| 5th scan (return in) | Segment 3 time-in. | Yes if after midnight |
| 6th scan (final clock out) | Segment 3 time-out. Exit date and exit time updated to final values. | Yes if after midnight |
Each segment that involves a clock-out or return after midnight also stores a companion date field. The companion date captures the correct calendar day for that specific punch, separate from the ledger's date field which holds the shift's attributed date. This is what allows the hour calculations to work correctly when times span two different calendar days.
The ledger uses Formula blocks to calculate worked hours and minutes for each segment. The formula for each segment takes the time-in, the time-out, and the companion date to calculate the correct duration even when the two times are on different calendar days. In Clappia, field values in formulas are referenced using curly braces:
Segment 1: time difference between {Segment 1 Time In} and {Segment 1 Time Out}, adjusted using companion date if time-out is after midnight
Segment 2: time difference between {Segment 2 Time In} and {Segment 2 Time Out}, adjusted using companion date if time-out is after midnight
Segment 3: time difference between {Segment 3 Time In} and {Segment 3 Time Out}, adjusted using companion date if time-out is after midnight
Each formula outputs a separate hours value and a minutes value. The daily total adds the three segments, with minutes rolling over into hours when they exceed 59. For a shift with three segments of 3 hours 40 minutes, 1 hour 50 minutes, and 2 hours 15 minutes, the daily total is 7 hours 45 minutes, not 7 hours 105 minutes.
How Exit Date and Time Update After Each Clock-Out
The ledger maintains a single Exit Date and Exit Time that always reflects the most recent clock-out. As segments are completed, the exit fields update to the latest segment's clock-out time and date. After the second scan, the exit time is the Segment 1 time-out. After the fourth scan, it updates to the Segment 2 time-out. After the sixth scan, it reflects the final clock-out. This gives supervisors a clear, single exit record for each employee's day without having to read through all six time fields.
Detecting Suspicious Rapid Re-Scans
The scanner's automation includes a parallel check that runs immediately on every scan. It finds the earliest scan recorded for the same employee and date combination and checks whether the gap between that earlier scan and the current scan is less than ten time units. If the gap is very small, it flags the current scan.
This check does not reject the scan or block the attendance record. It creates a read-only flag that appears in the submission data and can be monitored by supervisors. In manufacturing and construction contexts, rapid re-scans within seconds or a few minutes of each other can indicate proxy scanning (one person scanning for an absent colleague) or a device malfunction causing repeated scans. The flag surfaces these patterns without disrupting normal operations.
For a workforce of any size, reviewing flagged scans periodically is more practical than reviewing all records. The flag acts as a filter that draws attention to the small number of records worth investigating.
How Monthly Worked Hours Accumulate in the Wages Sheet
The Wages Sheet holds the running monthly total of worked hours and minutes for each employee. It is updated automatically as each day's ledger closes and does not require any manual data entry or export process.
As each day's attendance is completed in the ledger, that day's total hours and minutes are added to the employee's running monthly total. The sheet also tags each record with the month and year in a human-readable format, making it easy to filter by period for payroll processing.
Correction-Safe Monthly Recalculation
When a historical ledger record is corrected, the monthly total needs to update to reflect the corrected value, not add to the previous one. The system handles this for records on the 9th and 10th of each month by storing those days' hours in dedicated fields alongside the running total. When either of those records is edited, the monthly total recalculates as:
Updated monthly hours = previous monthly hours + corrected day hours - original day hours
This means a supervisor can correct a wrong time entry on the 9th of the month and the monthly wages total will immediately reflect the corrected value, without requiring anyone to manually adjust the running total or recalculate from scratch.
The system works across multiple roles with different levels of access, configured through Clappia's user permission settings. For a shift-based operation, the typical structure is:
| Role | Access | What They Can Do |
|---|---|---|
| Shift Operator or Gate Supervisor | Submit Only on Scanner app | Scan employee QR codes to record punches; view their own scan history |
| Floor Supervisor or HR Officer | View and Edit on Attendance Ledger | Review and correct daily ledger records; see total hours per employee |
| Payroll Team | View on Wages Sheet | Access monthly totals for wage calculation; filter by department or period |
| Admin | Full Access on all apps | Manage employee master records; configure settings; access all data |
The separation between the scanner (Submit Only) and the ledger (View and Edit) is important for shift operations. The people scanning QR codes at the gate do not need to see or modify the calculated hours; they just need to record the punch. The people responsible for payroll accuracy have access to the ledger where corrections can be made, but they do not have access to change the scanner submissions, which are the source records.
Manufacturing floors, warehouse interiors, and construction sites frequently have unreliable mobile data coverage. The Clappia mobile app supports offline mode, which means scans can be recorded and queued locally when there is no network signal. The punch is saved to the device and syncs to the server when connectivity returns, at which point the automation processes it and updates the ledger and wages sheet.
For the QR code lookup to work offline, the Employee Master data needs to be available on the device. This happens automatically when the Clappia app is opened on Wi-Fi. For sites where supervisors move between areas with and without coverage, opening the scanner app in a connected area before the shift starts ensures the employee data is cached and available for offline scans throughout the shift.
QR code attendance tracking in Clappia handles the midnight crossing problem that makes shift worker attendance difficult to manage accurately. The After Midnight flag on each scan tells the system which calendar day a punch belongs to, regardless of when the clock says the scan happened. The attendance ledger records up to three in/out segments per day, calculates hours for each segment correctly even when they span two calendar dates, and maintains a single exit record that updates as segments are completed. Monthly totals accumulate automatically and recalculate correctly when historical records are corrected.
For manufacturing, logistics, and construction operations running night shifts, rotating schedules, or any pattern where workers cross midnight regularly, this removes the manual reconciliation work that consumes HR and payroll time every month. The data is accurate from the moment of each scan, and the monthly totals reflect what workers actually worked rather than what someone managed to reconstruct from a paper register.
The system runs on standard mobile devices and can be deployed without any specialist hardware. To explore building it for your operation, visit Clappia.
L374, 1st Floor, 5th Main Rd, Sector 6, HSR Layout, Bengaluru, Karnataka 560102, India
3500 S DuPont Hwy, Dover,
Kent 19901, Delaware, USA

3500 S DuPont Hwy, Dover,
Kent 19901, Delaware, USA
L374, 1st Floor, 5th Main Rd, Sector 6, HSR Layout, Bengaluru, Karnataka 560102, India



.avif)




