Manual Punch Attendance Documentation
Create professional documentation using Nextra (.mdx) for the Manual Punch Attendance module in the Worksphere application.
Audience: Admin / Super Admin
Style: Atomic CRM–style documentation
Scope: Add, View, Edit, Delete
Exclude: Separate list page, implementation details, code logic, screenshots
MODULE: MANUAL PUNCH ATTENDANCE MANAGEMENT
Navigation Path
Company → Attendance → Manual Punch Attendance
Manual Punch Attendance Page
URL
/attendance/manual-punch-attendance
Page Description
- Used to add manual attendance records for employees
- Works as a single-page module
- Attendance records are retrieved by searching Employee Code
- Existing records are displayed in a table below the form
- Records can be edited or deleted from the same page
1. Attendance Entry Form
Form Fields
| Field Name | Type | Description |
|---|---|---|
| Month | Dropdown | Select attendance month |
| Year | Dropdown | Select attendance year |
| Unit | Select / Create | Select employee unit |
| Unit Code | Text | Displays unit code |
| Employee Code | Text Input | Enter employee code |
| Employee Name | Text | Auto-filled employee name |
| Designation | Dropdown | Select designation |
| Duty Type | Dropdown | Main Duty / Other |
| Attendance Days | Number | Enter attendance days |
| Month Days | Number | Total days in month |
| OT Days | Number | Overtime days |
| OT Rate | Number | Overtime rate |
| OT Hours | Number | Overtime hours |
| NFH Days | Number | National festival holiday days |
| Weekoff Duty Days | Number | Weekoff duty days |
| Remarks | Text Input | Enter remarks |
2. Search Employee Attendance
Search Flow
- Select Month, Year, and Unit
- Enter Employee Code
- Click Search
Search Result
- If attendance exists:
- Records are displayed in a table below
- Form fields are populated for edit
- If no record exists:
- Form remains empty for new entry
3. Attendance Records Table
Table Description
- Displays manual attendance records for the selected employee
- Appears below the form after successful search
Table Columns
| Column Name | Description |
|---|---|
| Month | Attendance month |
| Year | Attendance year |
| Duty Type | Duty type |
| Attendance Days | Total attendance |
| OT Days | Overtime days |
| OT Hours | Overtime hours |
| NFH Days | National holiday days |
| Weekoff Duty Days | Weekoff duty days |
| Actions | Edit / Delete |
4. Row Actions
Edit Attendance
- Triggered by clicking Edit button
- Selected record details are populated into the form
- Admin can modify values and click Update
Delete Attendance
- Triggered by clicking Delete button
- Opens a confirmation alert
5. Delete Confirmation Alert
Alert Content
- Confirmation message before deletion
Actions:
- Confirm / Yes → Deletes the attendance record
- Cancel → Closes the alert without action
6. Actions
| Action | Behavior |
|---|---|
| Save | Saves new attendance entry |
| Update | Updates existing attendance record |
| Reset | Clears form fields |
| Cancel | Navigates away from the page |
Validation Rules
- Month and Year must be selected
- Employee Code is mandatory
- Attendance Days cannot exceed Month Days
- Numeric fields accept only valid numbers
Field Definitions, Usage, and Calculation Logic
This section provides a deep dive into the technical properties, business validation, and logic governing the Manual Punch Attendance module.
1. Field Definitions
| Field Name | Data Type | Description | Example Value |
|---|---|---|---|
month | Number | The numerical month of attendance (1-12) | 10 (October) |
year | Number | The four-digit year of attendance | 2024 |
unit | ObjectId | Reference ID of the Unit the employee belongs to | 60d5f... |
unitCode | String | Unique code assigned to the unit (Auto-assigned) | BLR-01 |
employeeId | ObjectId | Reference ID of the employee (from Master) | 60d6a... |
empCode | String | Unique code of the employee (Auto-assigned) | EMP102 |
employeeName | String | Full name of the employee (Auto-assigned) | John Doe |
designationId | ObjectId | Reference ID of the employee's designation | 60d7b... |
attendanceDays | Number | Total days the employee was present | 26 |
monthDays | Number | The division factor/total days in the month | 30 |
otdays | Number | Overtime recorded in days | 2 |
othrs | Number | Overtime recorded in hours | 16 |
leaveWithoutPay | Number | Days of unpaid leave (Calculated) | 4 |
nfhDays | Number | National Festival Holiday days | 1 |
weeklyDutyDays | Number | Total weekoff days where duty was performed | 2 |
isProcessed | Boolean | Status indicating if salary is already processed | false |
2. Field Usage & Validation
| Field | Usage Location | Required | Validation Rules |
|---|---|---|---|
| Month/Year | UI Search, API, DB | Yes | Must be current or previous month only. |
| Attendance Days | UI Form, API, DB | Yes | attendanceDays <= monthDays. Cannot be < 0. |
| OT Days/Hours | UI Form, API, DB | Optional | attendanceDays + otdays max 50 (System Limit). |
| Unit/Employee | UI Search, API, DB | Yes | Must have active access permissions to the unit. |
| Month Days | API, DB | Yes | Must be one of: 22, 24, 25, 26, 27, 28, 29, 30, 31. |
3. Relationships & Dependencies
- Employee Master Dependency:
empCodeandemployeeNameare read-only in this module and are automatically synchronized from the Salary Employee Master based on theemployeeId. - Unit Dependency:
unitCode,unitName, andbranchare synchronized from the Unit Master. If the Unit'smonthDaysis set, it defaults as the Division Factor. - Salary Process Dependency: If an attendance record is linked to a locked Salary Process, it cannot be edited or deleted until the process is unlocked.
- Joining Date Restriction: Attendance cannot be recorded for any month prior to the employee's Date of Joining.
4. Calculation Logic
A. Leave Without Pay (LWP)
LWP is automatically calculated to ensure data integrity during payroll generation.
Formula:
LWP = Month Days (Division Factor) - Attendance Days
B. Overtime (OT) Conversion
If a user enters attendance days that exceed the actual calendar days of the month (e.g., 32 days in January), the system may trigger a validation error or (in bulk imports) attempt to adjust excess days into the OT category depending on configuration.
C. Division Factor (Month Days)
- System checks for a predefined
monthDaysvalue in the Unit Master. - If null, it defaults to the actual number of days in the calendar month for that specific year.
5. Business Purpose
- LWP Accuracy: Automating LWP calculation prevents manual entry errors that could lead to overpayment or underpayment.
- Audit Compliance: Auto-assigning Unit and Employee details from Masters ensures that attendance is always mapped to the correct cost center and legal identity.
- Financial Controls: The 50-day cumulative limit (Attendance + OT) acts as a safety barrier against extreme data entry errors.
6. Data Flow & System Integration
7. Integration with Payroll Processing
The Manual Punch Attendance module is the primary data feeder for the Payroll Engine.
- Salary Auto Process: When an administrator initiates the salary generation process, the system queries the
SalaryAttendanceDetailscollection for the specified month and year. - Financial Calculations:
- Gross Pay: Calculated by multiplying the effective attendance days by the employee's daily rate.
- Overtime: OT days and hours are multiplied by the
OTMultiple(e.g., 1.5x or 2.0x) defined in the Unit Config. - Deductions: LWP days are used to reduce the total earnings before PF and ESI calculations.
- Record Locking: Once a salary process is "Locked" or "Verified," the corresponding attendance record's
isProcessedflag is set totrue, and further modifications are restricted through API-level validation.
8. Versioning & Audit Trail
To maintain high financial integrity, the system tracks every change made to processed data.
- Salary Versioning: When a salary record needs to be updated (e.g., due to an attendance correction), the existing processed record is archived in the Salary Versioning collection before a new one is created.
- Traceability: Each version is linked to the original
attendanceId. This allows auditors to see the full "paper trail" of how an employee's pay changed as a result of attendance adjustments. - Revert Logic: Administrators can "Revert" a process, which resets the
isProcessedflag on the attendance record, allowing for corrections before the next processing run.
API Endpoints
The Salary Attendance Details module interacts with the following API endpoints:
Base URL
export const SALARYATTENDENCEDETAILS_URL = '/api/salaryAttendanceDetails'
Endpoints
| Endpoint | Method | Description | Parameters/Body |
|---|---|---|---|
${SALARYATTENDENCEDETAILS_URL} | POST | Create a new attendance record | Body: data |
${SALARYATTENDENCEDETAILS_URL} | GET | Get all attendance records with pagination | Query: page, limit |
${SALARYATTENDENCEDETAILS_URL}/:attendenceId | GET | Get attendance record by ID | Path: attendenceId |
${SALARYATTENDENCEDETAILS_URL}/:attendenceId | PATCH | Update an existing attendance record | Path: attendenceId, Body: body |
${SALARYATTENDENCEDETAILS_URL}/delete/:attendenceId | PATCH | Delete an attendance record (soft delete) | Path: attendenceId |
${SALARYATTENDENCEDETAILS_URL}/export/attend | GET | Export all attendance records to Excel | Returns: Excel file |
${SALARYATTENDENCEDETAILS_URL}/export/attend/blank | GET | Export blank attendance schema template | Returns: Excel template file |
${SALARYATTENDENCEDETAILS_URL}/import/attend | POST | Import attendance records | Body: data (file/data) |
${SALARYATTENDENCEDETAILS_URL}/search/attend | POST | Search attendance records with filters | Body: searchParams, page, limit |
${SALARYATTENDENCEDETAILS_URL}/search/attend/export | POST | Search and export attendance records | Body: searchParams, Returns: Excel file (blob) |
${SALARYATTENDENCEDETAILS_URL}/import/from-exported-sheet | POST | Import attendance from exported sheet | Body: data (file/data) |
${SALARYATTENDENCEDETAILS_URL}/bulk/attend/delete | POST | Bulk delete attendance records | Body: data (array of attendance IDs) |
RTK Query Hooks
The following hooks are available for frontend integration:
useCreateSalaryAttendenceMutationuseGetAllSalaryAttendencesQueryuseGetSalaryAttendenceByIdQueryuseUpdateSalaryAttendenceMutationuseDeleteSalaryAttendenceMutationuseExportToExcelQueryuseExportSchemaToExcelQueryuseImportAttendenceMutationuseSearchSalaryAttendenceDetailsMutationuseSearchAndExportToExcelAttendenceMutationuseImportAttendanceFromExportedSheetMutationuseBulkattendenceDeleteMutation
End of Documentation