Functional Weave
Code in Python

payroll.pro-rata-salary@1.0.1

README.md

2,204 bytes · view raw

# payroll.pro-rata-salary

The salary due for a starter's or leaver's partial pay period, and for a
part-time worker, from the full-time salary for the period:

`pay = periodSalary x fteBasisPoints / 10000 x daysCounted / daysInPeriod`

computed exactly and rounded half-up to the penny once, at the end
(math.round-div), so the fraction of a penny is never rounded twice.

Two methods, because employers use both and they give different answers:

- **calendar-days** counts every day: 14 to 30 September is 17 of 30 days.
- **working-days** counts Monday to Friday, less the `holidays` supplied
  (dates.business-days-between): 14 to 30 September 2026 is 13 of 22 days.

Which one applies is a contractual choice, not a legal one. A third common
method, 1/260th or 1/365th of the annual salary per day, is the calendar or
working-days method applied to a year-long period: pass the annual salary with
the tax year as the period.

Both date ranges are inclusive. The employed range must sit inside the pay
period. A working-days period with no working days in it is an error, since the
fraction would be 0/0.

## Before you rely on this

**Not professional advice.** This capability calculates payroll figures from published rules. It is a software component for developers, not tax or legal advice. Rules change and every rate here has an effective date. Check that the dates cover your case. Verify results against the official sources listed above, and have a payroll specialist review how you use it, before anyone relies on the output. Provided "as is" under its licence, without warranty.

**Unreviewed.** This capability's implementations agree in every language and pass its published test vectors, which were worked out from the official sources cited. But no qualified payroll specialist has yet checked those vectors, or confirmed that the capability covers the cases it claims. Treat it as a draft. Do not use it for real people, money or decisions without your own expert review. Once a qualified reviewer signs off, this notice is replaced with their name, qualification and the date. Each new version needs fresh sign-off.

1.0.1 marks it unreviewed. The code and the tests are unchanged.