Functional Weave
Code in Python

legal.time-billing@1.0.0

README.md

1,429 bytes · view raw

# legal.time-billing

The time charges for a bill: every time entry rounded to whole billing units
and priced at its fee earner's hourly rate from a rate card.

**Units.** Law firms record and bill in units of 6 minutes (a tenth of an
hour), and the usual engagement-letter term is that a part unit is charged as
a whole one: a 20-minute call is 4 units, 24 minutes. The unit and the rounding
are arguments (`unitMinutes`, `mode`), so 15-minute units or rounding to the
nearest unit work too. The rounding is time.round-to-increment's, applied to
**each entry**, never to the day's or the matter's total: seven 1-minute
emails are seven units, not two. That is what "each item of work is recorded
in units" means, and why totalling first gives a smaller, wrong bill.

**Fees.** Each line's fee is billed minutes x hourly rate / 60, rounded half-up
to the minor unit, and the bill total is the sum of the lines, so the lines on
the bill add up to its total exactly. The summary per fee earner (units and fee)
is in order of each fee earner's first entry.

**Rate card.** One rate per fee earner code, all in one currency; a duplicate
code, an entry with no rate, a negative rate or mixed currencies is an error.
A rate card that changes during a matter is the caller's job: split the
entries by the date the new rates took effect and bill each part with its own
card. VAT is not added here; pass the total to finance.tax.add-vat.