PACKAGE PAYADJ2 - APPLY ADJUSTMENTS TO PAYROLL EXPORTS

Purpose
- Apply management payroll adjustments to payroll exports.
- Final payroll = calculated payroll + ACTIVE payroll adjustments.
- VOID adjustments are ignored.

Files
- /backoffice/payadj2-payroll-calculator.php
- /backoffice/payroll-working-lunch-export.php
- /backoffice/sage-payroll-export.php
- /sql/verify-payadj2-payroll-adjustment-export.sql
- /README-PAYADJ2.txt

Extract inside
- /home/uent/public_html

What changes
1) Payroll Working Lunch Export
   Shows:
   - calculated normal
   - adjustment normal
   - final normal
   - calculated OT 1.5
   - adjustment OT 1.5
   - final OT 1.5
   - calculated OT 2.0
   - adjustment OT 2.0
   - final OT 2.0

2) Sage Payroll Export
   Exports final values after adjustments:
   - Normal Hours Units
   - Overtime 1.5 Units
   - Overtime 2.0 Units

Payroll day classification
- Uses payroll_rule_set_days:
  day_type
  normal_minutes
  ot_15_start_minutes
  ot_20_start_minutes
  all_hours_ot_20
  is_day_off

Adjustment source
- Uses payroll_adjustments where status = ACTIVE.
- Date range uses adjustment_date between the export date_from and date_to.
- Voided adjustments are excluded.

Important
- Raw attendance records are not changed.
- Management corrections remain auditable in payroll_adjustments.
- If you need Sage columns in a different exact order, adjust the CSV header in /backoffice/sage-payroll-export.php.

Test
1. Add an adjustment on /backoffice/payroll-adjustments.php.
2. Open /backoffice/payroll-working-lunch-export.php for the same date range.
3. Confirm the adjustment appears in the Adj columns and final totals.
4. Open /backoffice/sage-payroll-export.php.
5. Confirm Sage preview and CSV use the final values.
