THE LABS GADGET - PAYROLL V2.2 (FOR FINANCE HR V2.0)
====================================================

PURPOSE
- Detailed Payroll: basic salary, allowances, approved OT hours/rate,
  commission, employee EPF, SOCSO, EIS, PCB, other deductions,
  employer EPF/SOCSO/EIS and printable confidential A4 payslip.
- Edit draft, HR statutory verification, approve, Mark Paid and CSV export.
- Finance transactions only posted for NET PAY when Mark Paid is confirmed.
- Does NOT modify CRM, POS, GPS attendance, weekly shifts or existing PVs.
- Does NOT automatically pay salaries or statutory remittances.

IMPORTANT LIMITATIONS
- Payroll statutory deductions are MANUAL verified amounts, not legal
  auto-calculation. HR must verify official KWSP, PERKESO/EIS and LHDN PCB
  requirements, staff category, wage types, age and eligibility.
- OT hours/rate are entered manually based on approved timesheets and
  current employment rules. GPS attendance does not automatically calculate OT.
- Employer contribution figures are displayed as estimated COMPANY COST but
  not posted as actual bank/outgoing transactions or payment liabilities.
- ONE payroll per staff per month; previous paid payroll cannot be edited.
- Legacy payroll amounts are preserved. Existing manual deduction amounts
  are moved to Other Deductions in the new detailed display.
- If a payslip is pending/approved, it is clearly NOT proof of payment.

SAFE INSTALLATION
1. DO NOT use the main CRM directory; use financehub only.
2. BACK UP Finance database (phpMyAdmin Quick SQL Export).
3. BACK UP financehub/app and existing financehub files.
4. Upload ZIP to financehub and click Extract. Do NOT copy patch/app
   files directly over financehub/app manually.
5. Sign in Finance HR as Owner, then visit
   https://crm.thelabsgadget.com/financehub/upgrade_payroll_v2_2.php
6. Check baseline Finance V2.0 PHP = OK and patch package = OK.
   If baseline is NOT matched, DO NOT install; contact for compatible patch.
7. Click Install Payroll V2.2 ONCE. Take note of any errors.
8. Open Overview > Payroll. Create a DRAFT with carefully marked test data,
   confirm correct gross/net, Print Payslip; DO NOT mark test draft paid.
9. After verification, delete ONLY upgrade_payroll_v2_2.php and
   patch_payroll_v2_2 directory from cPanel File Manager.
   DO NOT delete financehub/app or the Finance database.

ACCESS
- Owner: edit/review/approve/pay payroll.
- HR Full Admin (Mawar): same operational payroll privileges as Owner.
- Accounts: create/edit/review drafts and mark an approved payroll paid.
- Regular staff: only their OWN PAID payslips (direct authenticated link).
- Manager: no salary/payroll access.

STATUTORY REFERENCES (check latest rates and special cases)
KWSP Third Schedule: https://www.kwsp.gov.my/documents/d/guest/third_schedule_from_-1-october-2025
PERKESO contributions: https://www.perkeso.gov.my/en/uncategorised/778-contributions.html
LHDN PCB specifications: https://www.hasil.gov.my/majikan/jadual-pcb-dan-spesifikasi-data/

VERSION CHECK
This patch verifies exact Payroll V2.0 actions.php and views.php hashes.
It is designed for the Finance HR V2.0 + separate CRM Sync V2.1, which adds
files independently. A modified installation may fail closed. Never bypass
file checks, and don't overwrite manually if hashes differ.
