BGI HRMS Payroll & Attendance - Phase 4
========================================

This patch adds:
1. Increment History
2. Effective-date Basic Salary update
3. Automatic Arrear Generation
4. Manual Arrear Entry
5. Arrear Approval
6. Overtime Rules
7. Auto Overtime from Attendance Register
8. Manual Overtime Entry
9. Staff Overtime Apply
10. Overtime Approval
11. Arrear Report CSV Export
12. Overtime Report CSV Export
13. Phase 3 Payroll Bridge for approved OT + arrear

Install Steps:
1. Take full database backup.
2. Make sure Phase 1 and Phase 3 are already installed.
3. Import phase4_schema.sql.
4. Upload all folders to project root.
5. Important: admin/hrms/_phase3_functions.php and admin/hrms/salary_sheet.php are intentionally included as patched replacements.
   They allow Phase 3 salary process to include approved overtime/arrear and mark them Paid when salary month is locked.
6. Open /admin/hrms/phase4_dashboard.php
7. Set overtime rules from /admin/hrms/overtime_rules.php
8. Add/approve increment from /admin/hrms/increment_history.php
9. Approve arrear from /admin/hrms/arrear_management.php
10. Generate and approve overtime from /admin/hrms/overtime_entries.php and /admin/hrms/overtime_approvals.php
11. Process salary again from Phase 3 salary process page.

Payroll Bridge Rule:
Only Approved overtime and Approved arrear are included in Phase 3 salary process.
After salary process, included records become Processed and are locked from normal approval pages.

Cron Examples:
php cron/hrms_generate_arrears.php
php cron/hrms_overtime_recalculate.php 2026-07-01 2026-07-31
php cron/hrms_overtime_recalculate.php 2026-07-01 2026-07-31 15

Notes:
- PHP code is written in English and PHP 5.6-compatible style.
- No PHP 7+ null coalescing syntax is used.
- CSV export is used for Excel-compatible downloads.
