-
Mahmoud Aglan authored
onPayrollPaid read total_gross and total_net off hr_payroll_runs and grouped hr_payroll_components_log by component_type. None of those columns exist: hr_payroll_runs has gross_earnings / net_salary hr_payroll_components_log has `type`, not component_type hr_payroll_periods has period_code, not period_name Confirmed with SHOW COLUMNS on the live database. The handler threw "Unknown column" on its first query, and the listener only logs, so payroll silently posted NOTHING — no salary expense, no employer insurance share, no withheld tax anywhere in the ledger. It also had the grain wrong. PayrollController dispatches hr.payroll.paid once PER EMPLOYEE; an hr_payroll_runs row is a single payslip, not a whole run, and the period lives in hr_payroll_periods. Every amount needed is on the payslip. Rewritten against the real schema: Dr Salary Expense gross_earnings Dr Employer Insurance Expense insurance_employer Cr Bank net_salary Cr Insurance Payable insurance_employee + insurance_employer Cr Tax Payable tax_amount Cr Employee Loans loan_deduction Cr Other Deductions Payable penalty + absence + other Balances by construction: the payslip satisfies gross - total_deductions = net and the deduction buckets sum to total_deductions. Verified on all three live payslips — e.g. run 1: Dr 15,000.00 + 2,362.50 = Cr 4,402.20 + 3,748.50 + 9,211.80 = 17,362.50. A salary-deducted loan instalment credits the employee-advances receivable rather than being treated as income. Penalties and absence deductions are parked in accrued expenses and registered as a configurable pointer, because whether they belong there or as a reduction of salary expense is a decision for the accountants, not a constant in code. Co-Authored-By:Claude Opus 5 (1M context) <noreply@anthropic.com>
7313a539
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| migrations | ||
| seeds | ||
| schema.sql |