Files
HRM-System/docs/PLAN-rdot-resignation.md

3.1 KiB

Project Plan: Remove RDOT and Hide Resigned Employees

1. Overview

This plan addresses two main adjustments requested by the client:

  1. RDOT Computation: Remove the "Rest Day Over Time" (RDOT) rule from the payroll computation.
  2. Attendance Calendar Visibility: Hide employees from the attendance record calendar if their resignation process is completed.

2. Context & Discovery Findings

  • RDOT Computation: app/Services/PayrollService.php calculates $regularOtTotal and processes rest days. Currently, rest day premiums are removed, but regular overtime includes all OT. We need to clarify if "removing RDOT" means completely ignoring any OT hours logged on a Rest Day, or removing a specific line item.
  • Attendance Calendar Visibility: app/Http/Controllers/AttendanceRecordController.php@calendar queries the User model where employee_status is 'active'. The Resignation model tracks the resignation process (status completed or approved). We will add a whereDoesntHave clause to exclude users who have a completed resignation.

3. Socratic Gate (Open Questions for User)

To ensure the implementation exactly matches the business requirements, we need clarification on the following:

  1. RDOT Rule: When you say "remove the rdot rule", do you mean that if an employee works overtime on their Rest Day, they should NOT receive any overtime pay for it? Or is there a specific multiplier/line item that should be removed?
  2. Resignation Status: In the database, what is the exact string used for a completed resignation? Is it completed, approved, or something else in the Resignation model? Should we also automatically update the employee_status to resigned when a resignation is completed?

4. Proposed Task Breakdown

Phase 1: Attendance Calendar Adjustment

  • Target File: app/Http/Controllers/AttendanceRecordController.php
  • Action: Modify the $query in the calendar method.
  • Implementation Details:
    • Add a clause: ->whereDoesntHave('resignations', function($q) { $q->where('status', 'completed'); }) (or the equivalent correct relationship/status based on answers).
    • Ensure it doesn't break branch or department filtering.

Phase 2: Payroll Computation Adjustment (RDOT)

  • Target File: app/Services/PayrollService.php
  • Action: Update the overtime calculation loop.
  • Implementation Details:
    • Identify when $isRestDay is true.
    • Prevent otHours from being added to $regularOtTotal if it's a Rest Day (pending user clarification).
    • Update any UI/payslip arrays if the RDOT line item was previously explicitly shown.

Phase 3: Verification & Testing

  • Run the application and verify the calendar view no longer shows the resigned employee.
  • Simulate a payroll calculation for an employee with Rest Day OT to ensure the RDOT is correctly removed.
  • Run php artisan test or standard verification checklist.

5. Agent Assignments

  • Backend Specialist: To update AttendanceRecordController.php and PayrollService.php.
  • Orchestrator: To verify the payroll logic aligns with the requested rule change.