Configuration
Three things are read: the configuration file, the ledger, and the tax tables folder. The configuration and the ledger hold real payroll records, so they live outside every checkout, in the data directory:
RACHUBA_HOMEwhen that is set; set and empty is refused;- otherwise, on macOS,
~/Library/Application Support/Rachuba; - otherwise
$XDG_DATA_HOME/rachubawhenXDG_DATA_HOMEis an absolute path, or~/.local/share/rachubawhen it is not set, empty or relative, as the XDG Base Directory Specification says.
--config (default rachuba.toml in the data
directory) and --ledger (default ledger.toml in the
data directory) name another file; a relative path is relative to the current
directory. rachuba location prints where each
is. rachuba init creates the data directory,
readable by its owner alone, and creates both files in it readable and writable
by their owner alone from the first byte.
Earlier versions read rachuba.toml and ledger.toml
from the current directory. When a default file is missing from the data
directory and the current directory holds a file of that name, every command
but location refuses rather than read or write another one, so a
payroll is never computed against an empty ledger.
init copies the invented template from
examples/rachuba.toml in the source repository. The source
repository contains no real payer, employee or household records and ignores
files named rachuba.toml and ledger.toml at any
depth. To keep the records under version control, make the data directory a
private repository, or point RACHUBA_HOME at one.
The template uses 00-0000000 and 0000 as invalid
EIN and SSN-last-four placeholders. Commands that load the configuration
refuse them until you enter the assigned EIN and actual last four digits.
The complete SSN is not stored.
[company]
legal_name,address.ein, written12-3456789.state, a two-letter uppercase postal code; it selectstables/state-<code>-<year>/. Supported:CA,NY.deposit_schedule,monthlyorsemiweekly, as the lookback period decides.sui_rate_ppm, the state unemployment rate from the employer's own rate notice, in parts per million (3.4% is 34000). Required.futa_credit_reduction_ppm, the rate from the tax year's Schedule A (Form 940) for a credit reduction state. Default 0 is not a forecast. For California,runandcheckwarn while the rate is undetermined, even with an estimated value; after determination they warn if the configured value differs from the final rate. Revisit the year's Form 940 liability after updating it.round_withholding_to_dollar, default false.state_annualized_method, default true. Hold it for a whole year.
[employee] and [employee.w4]
name,address,ssn_last4(exactly four digits; the full number is never stored).pay_frequency: weekly, biweekly, semimonthly, monthly, quarterly, semiannually, annually or daily.gross_per_period, positive.age_this_year, optional; it decides the 401(k) catch-up.state_flags(nyc_resident,yonkers_resident),state_allowances,state_estimated_allowances,state_additional_withholding,state_filing_status.[employee.w4]:filing_status(single, married_filing_jointly, married_filing_separately, head_of_household),step2_checkbox,step3_credits,step4a_other_income,step4b_deductions(annual) andstep4c_extra_withholding(per period).
[retirement_401k]
pretax, roth and employer are each
{ none = {} }, { percent = { ppm = 100000 } } or
{ per_period = { amount = "1500.00" } }.
prior_year_ss_wages decides whether catch-up deferrals must be
Roth. A payroll run never defers past the year's ceiling and never pays an
employer contribution past the loaded federal table's
retirement.employer_deduction_ppm share of compensation or the
section 415(c) limit. Payroll, ledger checks and projections use the same declaration.
[household]
Optional, read only by rachuba return:
filing_status; spouse_wages (Form W-2 box 1)
and spouse_medicare_wages (box 5, required when spouse wages
are positive) on a joint return; spouse_covered_by_plan,
spouse_age_this_year;
other_income, interest_and_ordinary_dividends,
qualified_dividends, short_term_capital_gains,
long_term_capital_gains; adjustments,
itemized_deductions, aged_or_blind_boxes,
credits; other_withholding;
prior_year_tax and prior_year_agi (both or neither);
and one [[household.estimated_payment]] block, with
paid_on and amount, per Form 1040-ES payment.
[household.california]
Optional. Present, it states that the employee files Form 540 as a
full-year California resident, and rachuba
return projects that return too: agi_adjustments, the net
Schedule CA adjustment to federal adjusted gross income (negative when it
subtracts); itemized_deductions, California itemized deductions
before the high-income limitation; dependents, the number of
dependent exemptions; credits, nonrefundable California credits;
other_withholding, California income tax withheld outside this
payroll; prior_year_tax and prior_year_agi from last
year's Form 540 (both or neither); and one
[[household.california.estimated_payment]] block, with
paid_on and amount, per Form 540-ES payment. Every
field but agi_adjustments defaults to zero or none and cannot be
negative.
The ledger
ledger.toml holds every committed run in pay-date order with
every figure it produced, and the dates its taxes were deposited and its
deferral remitted. It is the source of year-to-date totals, wage bases and form
lines. Every command except init refuses to run without it:
no payroll ledger at <path>. Run `rachuba init` to write an empty one, or name the committed ledger with --ledger.
The tables folder
The folder holding federal-<year> and
state-<code>-<year> is RACHUBA_TABLES when
that is set, otherwise tables beside the configuration file when
that folder exists, otherwise the tables built into the binary from the
tables folder of the checkout it was built from, named
rachuba:embedded/tables in every message. A binary carries the
figures it was built with, so tables for a new year need either a new build
or a folder beside the configuration file or in RACHUBA_TABLES.
federal-<year> carries Publication 15-T, FICA, FUTA and the
retirement limits, legal-holidays.toml for every due date, and
form-1040.toml and ira.toml for the return
projection.
legal-holidays.toml lists, under [legal_holidays],
the source it was transcribed from, the days it answers for
(covers_from and covers_through), and two lists of
{ name, observed }: federal, the holidays OPM
publishes for each year as observed, and district_of_columbia, the
District's own legal holidays (Emancipation Day and, every fourth year,
Inauguration Day). It must cover the whole payroll year; cover the next year
too, because the year's last deposits and its returns fall due in it. No
holiday is computed in code.
Refusals
Each exits 1 before anything is written.
no configuration at <path>. Run `rachuba init` to write a starting file.
company.state must be a two-letter uppercase postal code, got <value>
company.ein must look like 12-3456789, got <value>
employee.ssn_last4 must be exactly four digits
employee.gross_per_period must be positive
company.sui_rate_ppm cannot be negative
retirement_401k.<field>: <n> ppm is not between 0% and 100%
retirement_401k.<field>: amount cannot be negative
RACHUBA_TABLES names <path>, which is not a directory. Point it at the folder holding federal-<year> and state-<code>-<year>, or unset it to use the tables folder beside the configuration file or the tables built into this rachuba.
no data directory for rachuba: RACHUBA_HOME is not set and neither is HOME. Set RACHUBA_HOME to the directory that holds rachuba.toml and ledger.toml, or name both files with --config and --ledger.
RACHUBA_HOME is set but empty. Set it to the directory that holds rachuba.toml and ledger.toml, or unset it to use the platform default.
<path> does not exist, but the current directory holds <name>, which rachuba reads only when --config or --ledger names it. Move rachuba.toml and ledger.toml into <data directory>, or name them with --config and --ledger.
no federal tax table for <year> at <path>. Tax tables are per-year data folders; transcribe that year's Publication 15-T into section files there before running payroll.
no state engine for <code>. Supported: CA, NY. Adding a state needs both a data folder at <path> and a computation module, because withholding methods differ in shape between states and cannot be derived from a rate table alone.
<path> is not a .toml section file. A table folder holds only the transcribed sections of one year's publications; move anything else out of it.
<key> is defined in both <file> and <file>. A key belongs to exactly one section file; delete one of the two definitions.
legal_holidays covers <date> through <date>, which does not span the payroll year <year>; transcribe that year's published holiday schedules
legal_holidays.federal lists <name> as observed on <date>, a <weekday>; an observed holiday is a weekday, so transcribe the day the published schedule observes it
legal_holidays.federal lists <name> on <date>, outside the table's coverage <date> through <date>
<date> is outside the legal holiday table, which covers <date> through <date> (<source>). Transcribe the published holiday schedules for <year> into tables/federal-<year>/legal-holidays.toml before computing a due date that depends on that day.
The last one comes from any command that computes a due date past the table's last day; the dates already shown stay valid.
The [household] refusals are on
rachuba return.