Skip to content

Domain deep dive — Payroll & HR (Singapore)

Single D1 narrative for engineers changing payroll calculations, statutory compliance, or payroll reporting on this app. It ties together:

In scopeOut of scope (link instead)
SG CPF, SHG, SDL, ceilings, contribution tablesNon-SG payroll regimes
Lee Kim Payroll Settings, Singapore Payroll Settings, Company PayrollFull HRIS (leave, attendance product rules) — use ERPNext docs + your site config
Payboy import settingsPayboy SaaS itself
Custom reports under lee_kim_alliance_erp/report/Xero AR — Finance & AR

Use payroll-hr as the index of custom tables: CPF rates/ceilings, payslip presentation, Payboy bridge, salary detail children, etc.

Sub-themeExamples
Statutorysingapore_payroll_settings, cpf_contribution_rates, cpf_ow_ceiling
Lee Kim configlee_kim_payroll_settings, company_payroll, payslip_settings
Integrationspayboy_settings
Detail / reportingsalary_slip_details, lk_salary_detail, pay_item_details, generate_payroll_reports
LayerPrimary locations
Salary Slipscripts/salary_slip.pysetup_payment_days, setup_pay_items, calculate_cpf_v2, calculate_shg, calculate_sdl, recalculate_net_pay, …
Other scriptsscripts/payroll_entry.py, scripts/employee.py, scripts/salary_component.py
Hookshooks.pydoc_events on Salary Slip, Employee, Payroll Entry, Salary Component
Helpershook_methods.py
ReportsReports catalog — CPF advice, payroll summaries, payslip reports

Aligns with the diagram on Payroll & HR; order is load-bearing — do not reorder without full regression.

Salary Slip validate

setup_payment_days

setup_pay_items

calculate_cpf_v2

calculate_shg

calculate_sdl

recalculate_net_pay

payroll_entry.append_salary_slip

Keys are DocType folder names (snake_case). See docs/doctype-overlays/overlays.json and docs/doctype-overlays/README.md.

TierDocType keys (representative)Notes
Baselinelee_kim_payroll_settings, singapore_payroll_settings, company_payroll, payboy_settings, payslip_settings, cpf_contribution_ratesCompany payroll config, statutory tables, payslip UI, Payboy import
Extendedcpf_ow_ceiling, salary_slip_details, lk_salary_detail, pay_item_details, generate_payroll_reports, payroll_report_detailOW ceilings, slip lines, SG settings component picks, batch reporting
FurtherOther payroll-hr DocTypes (e.g. employee_salary_detail, custom_salary_detail)Add overlays when tuning or support load justifies them

After editing overlays, run npm run generate:doctypes from docs/ and commit generated doctype-reference/** if your team tracks them.

SymptomFirst checks
Wrong CPF / net paySingapore Payroll Settings, CPF Contribution Rates, calculate_cpf_v2 inputs; Salary Component assignments
Payslip won’t submitFull validate chain in Doc events — order of methods
Payroll Entry odditiesPayroll Entry override, scripts/payroll_entry.py
Report vs slip mismatchReport query vs Salary Slip stored values; same Company and period

Logs: Frappe Error Log, MariaDB slow queries for heavy reports, bench worker logs for long runs.