Skip to content
KINTAccountsSign in

Accounting Rules

Basis: accrual, double entry . Base currency: UGX . KINT is not VAT registered .

Basis: accrual, double-entry. Base currency: UGX. KINT is not VAT registered.

Status: the ledger, receivables, payables, expenses and banking are implemented and tested (Phases 2–4). Items marked (confirm) are defaults that still need KINT's accountant to confirm them (PROJECT_AUDIT.md §6).


1. Invariants (enforced in code and in the database)

# Rule Database enforcement
1 Every posted journal has at least two lines, and Σ debits = Σ credits. Deferred constraint triggers journals_balanced / journal_lines_balanced, checked at commit
2 Each line is either a debit or a credit, never negative, never both. CHECK constraints on journal_lines
3 Posted journals and their lines are never updated or deleted. Corrections are reversal journals. journals_guard / journal_lines_guard triggers
4 A journal can be reversed at most once, and a reversal cannot be dated before the original. Unique reverses_journal_id; service check
5 Nothing posts into a closed period, or a date with no period. Trigger refuses posting when the period is closed
6 Lines post only to active, postable accounts of the same organisation. Headings never receive postings. Trigger
7 Each source document posts at most once per purpose. Unique (organisation_id, source_type, source_id, posting_purpose)
8 Every multi-step financial operation runs in one database transaction. The document's status change, its number, its journal, its stored PDF record, its audit entry and its outbox event commit together or not at all. —
9 Balances shown anywhere (accounts, bank accounts, suppliers, client statements, dashboard) come only from posted journal lines. —
10 Money is computed with decimal.js and stored as numeric. Floating point is never authoritative. numeric(20,2) columns
11 Recorded payments, allocations, approved bills, approved expenses and completed reconciliations are immutable. Only the fields of a reversal (or, for bills, the settlement fields) may change. payments_protect, allocations_protect, supplier_bills_protect, expenses_protect, append-only rows

The integration test suite proves each of these against the real database, including direct SQL attempts to bypass the application (see TESTING.md).

2. Monetary precision and rounding (confirm Q2)

  • Storage: amounts numeric(20,2); quantities and rates numeric(20,6).
  • Currency minor units from ISO 4217: UGX = 0, USD = 2.
  • Line total = round(quantity × unit price − line discount, minor units, half-up).
  • Document total = Σ rounded line totals (+ tax per line, rounded, when VAT is enabled).
  • When a credit note reduces an invoice that had several revenue lines, the credit is split across those revenue accounts in proportion to the invoice's postings, using the largest-remainder method so the parts always add up exactly.
  • API representation: decimal strings with two decimals ("1500000.00").

3. Posting rules (as implemented)

Account codes refer to the seeded chart (§7). Accounts are found by their system key, not their code, so renumbering the chart never breaks posting.

Event Debit Credit Notes
Invoice issued 1300 Accounts receivable (client) — total Revenue per line — the service's revenue account, else 4100 Output VAT (2330) only once VAT is registered and enabled
Credit note issued Revenue, split in proportion to the invoice's revenue postings 1300 Accounts receivable (client) Never more than the invoice's outstanding balance
Receipt — applied to invoices Bank/cash account — amount received; 1310 WHT receivable (client) — tax withheld by the client 1300 Accounts receivable (client) — amount applied Receipt KINT/RCT/YYYY/NNNN, PDF stored
Receipt — not applied (on account) Bank/cash account 2200 Unapplied customer receipts (client) Held on the client's account
Receipt applied later 2200 Unapplied customer receipts (client) 1300 Accounts receivable (client) Dated the day it is applied (open period)
Receipt reversed Reversal of the receipt journal and of every later application Allocations marked reversed; invoices reopened
Supplier bill approved Expense or asset account per line 2100 Accounts payable (supplier) Bill KINT/BILL/YYYY/NNNN
Supplier payment 2100 Accounts payable (supplier) — bills settled Bank/cash account — amount paid; 2320 WHT payable (supplier) — tax withheld by KINT Voucher KINT/PV/YYYY/NNNN, PDF stored
Supplier payment reversed Reversal of the payment journal Bills reopened
Expense approved Expense account (project/department dimensions kept) Bank/cash account it was paid from KINT/EXP/YYYY/NNNN
Manual journal posted as entered as entered Control accounts (1300, 2100, 2200) refused
Opening-balance journal posted as entered as entered Control accounts allowed, but each such line must name the client or supplier
Journal reversed every credit of the original every debit of the original Manual and opening-balance journals only; documents are reversed through the document
Refund of money on account 2200 Unapplied customer receipts (client) Bank/cash account refunded from KINT/RFD/YYYY/NNNN; never more than the payment's unapplied amount
Supplier debit note 2100 Accounts payable (supplier) The bill's cost accounts, in proportion to the bill's debits (6990 for a bill brought forward) KINT/DN/YYYY/NNNN; never more than the bill's outstanding balance
Depreciation run (monthly) Each asset's depreciation expense account (default 6800) Each asset's accumulated depreciation account One journal per month for all assets; months in order; reversible (latest run only)
Asset disposal Accumulated depreciation (all of it); bank/cash — proceeds; 6980 Loss on disposal Asset cost account — cost; 4910 Gain on disposal Gain or loss = proceeds − net book value
Year-end close Each income account's balance for the year Each expense account's balance for the year The difference (profit or loss) to 3200 Retained earnings; dated the last day of the year
Invoice brought forward (go-live) 1300 Accounts receivable (client) — outstanding amount 3900 Opening balance equity Original number kept; dated before the opening date; no PDF is produced
Bill brought forward (go-live) 3900 Opening balance equity 2100 Accounts payable (supplier) — outstanding amount Dated before the opening date

Purchase orders have no ledger effect: they are commitments. The supplier's bill posts.

Invoices

  • Drafts have no number and no ledger effect. A number (KINT/INV/YYYY/NNNN) is assigned on issue, in the posting transaction. The year is the calendar year of the invoice date.
  • Issuing needs an open accounting period for the invoice date. If there is none, nothing is issued and no number is used.
  • Issuing recalculates the lines at the issue date, freezes the client's billing details, stores the PDF and posts the journal. An invoice cannot be issued with a future date.
  • Issued invoices are immutable (database trigger). Errors are corrected with a credit note and, if needed, a new invoice.
  • Overdue is derived from the due date and balance, never set by hand.
  • Invoices state "This is not a fiscal document issued through URA EFRIS" until EFRIS is configured and confirmed (Q5). While KINT is not VAT registered, they also state that no VAT has been charged.
  • Documents are in the base currency (UGX) only, until exchange rates are supported.

Credit notes

  • Issued in one step against an issued invoice, numbered KINT/CRN/YYYY/NNNN, posted and immutable.
  • A credit note uses the invoice's tax rate and can never exceed the invoice's outstanding balance (total − credited − paid). The check runs under a row lock, so concurrent credit notes cannot over-credit.
  • "Credit in full" is allowed only before any credit or payment.
  • A credit note cannot be dated before its invoice, or in the future.

Quotations

  • Numbered on creation (KINT/QTN/YYYY/NNNN); no ledger effect.
  • Approval at or above the threshold by a user with quotations:approve who is neither the preparer nor the submitter (unless self-approval is allowed). Revisions keep append-only snapshots. Conversion of an accepted quotation creates a draft invoice.

Receipts (customer payments)

  • A receipt is recorded once, with its date, the bank/cash account it went into, method and reference. The receipt number is assigned and the PDF stored in the same transaction.
  • Allocation invariants, checked under row locks so concurrent receipts cannot break them:
    • Σ active allocations of a receipt ≤ amount received + withholding tax.
    • An allocation never exceeds the invoice's outstanding balance (total − credited − paid).
    • invoice.amount_paid = Σ active allocations to it. Invoice status follows: issued → partially_paid → paid (or credited when settled by credit only).
    • Only issued or part-paid invoices of the same client can receive allocations.
  • Anything not applied stays on account (2200) and can be applied later or refunded from the payment (payments:refund). A payment that has refunds cannot be reversed; reverse the refund's effect by recording a new receipt if needed.
  • Withholding tax (WHT) deducted by a client is recorded only when Tax configuration → Withholding tax is switched on. It settles the invoice like cash and becomes a tax credit in 1310 (confirm Q7). Keep the client's WHT certificate as an attachment on the receipt.
  • A wrong receipt is reversed (reason required), never edited or deleted. Reversal posts reversing journals dated on the reversal date, marks every allocation reversed and reopens the invoices. Reversing twice is refused.

Client statements

  • Built from the ledger: 1300 and 2200 lines carrying the client, netted per journal. A positive balance is what the client owes; a negative balance is money held for the client.

Suppliers, purchase orders and bills

  • Suppliers are numbered S-0001. A supplier's balance is the credit balance of 2100 for that supplier.
  • Purchase orders: draft → submitted → (approved automatically below the threshold, else by a different approver) → issued (PDF stored) → closed, or cancelled with a reason.
  • Supplier bills: entered as drafts; each line coded to an active, postable, non-control expense or asset account. A supplier's invoice number can be entered only once per supplier (database unique key). Approving a bill (by someone other than the person who entered it, unless self-approval is allowed) posts it and freezes it. Drafts can be deleted; approved bills cannot.
  • Supplier payments settle one or more approved bills of the same supplier. A payment never exceeds a bill's outstanding amount (row-locked). WHT withheld by KINT as a withholding agent is credited to 2320 when the tax setting allows WHT (confirm Q7). A wrong payment is reversed, which reopens the bills.

Expenses

  • For costs paid directly from a bank, mobile-money or cash account without a supplier bill. Lines must use an active expense account. A registered supplier or a named payee is required. Expenses cannot be dated in the future.
  • Lifecycle: draft → submitted → approved (posted) or returned with a reason → edited → resubmitted. Below the expense approval threshold, submission approves and posts at once. Otherwise the approver must differ from the preparer and submitter (unless self-approval is allowed).
  • Submitting checks the period is open, so a closed month is caught before an approver spends time on it.
  • Approved expenses are immutable. A mistake is corrected with a manual journal (e.g. Dr bank / Cr the expense account), referencing the expense.

Banking and reconciliation

  • Each bank, mobile-money or cash account owns one ledger account (created under 1200, or 1101–1199 for cash, or linked to an existing cash account). Its cashbook is that account's general ledger.
  • Statement import: CSV with a date, description, optional reference, and either a signed amount or money-in / money-out columns. The same file (by SHA-256) cannot be imported twice. Bad lines are reported by line number and nothing is imported.
  • Matching: a statement line can be matched only to one posted ledger line on the same bank account with exactly the same signed amount. A ledger line can be matched once. Lines that will never appear in the books can be ignored with a reason (audited).
  • Reconciliation: the user enters the statement's closing balance at a date. The system records the ledger balance at that date and the difference, and locks every matched or ignored line up to that date into the reconciliation. Reconciliations are append-only; reconciled lines cannot be unmatched.
  • Bank charges and interest that appear only on the statement are recorded first (expense or manual journal), then matched.

4. Periods and financial years

  • Financial years have twelve monthly periods, starting in the organisation's start month (default July, confirm Q1). Years must be contiguous; the database also refuses overlapping years or periods.
  • The start month cannot be changed once any financial year exists.
  • Closing a period (periods:manage) blocks all posting dated in it. It is refused while draft journals are dated in that period. Re-opening needs a reason and is audited.
  • Year-end close (periods:manage) is refused unless every earlier year is closed, no draft journals are dated in the year, and the last month is still open (the closing journal is dated in it). It posts one closing journal (source year_end_close) that brings every income and expense account to nil for the year and moves the net to 3200 Retained earnings, then closes all twelve months.
  • Reopen year is refused while a later year is closed. It reopens the last month and reverses the closing journal; close the year again after adjusting. Each close after a reopen is a new journal (close-2, close-3, …).
  • Reports: the profit and loss excludes closing journals and their reversals, so a closed year still shows its income and expenses. The balance sheet includes them, so retained earnings carry the profit of closed years; for a year not yet closed, the profit to date is shown as current-year earnings.

Fixed assets and depreciation

  • Registering an asset records it in the register without posting; the purchase is recorded as a supplier bill or a journal to the asset account.
  • Depreciation starts in the month chosen (the first of a month, not before acquisition). Straight line spreads the remaining depreciable amount (cost − residual − accumulated) over the remaining months, so rounding never leaves a residue. Reducing balance applies the annual rate monthly to net book value and stops at the residual value.
  • A run covers one month for every active asset. Months must be run in order (SKIPPED_PERIOD), one live run per month (ALREADY_RUN, also a database constraint). Only the latest run can be reversed, and not if it includes an asset disposed of since.
  • After the first depreciation, an asset's cost, dates, life, residual and method cannot be changed (ALREADY_DEPRECIATED); dispose of it and register a corrected one if needed.
  • Disposal requires depreciation up to the disposal month and posts the gain or loss.

Opening items (go-live)

  • Invoices and bills still open in the previous books are brought forward individually (Opening Balances), dated before the opening date (AFTER_OPENING_DATE), so later receipts and payments can be applied to them. Invoices keep their original number; the numbering sequence moves past imported numbers so a new invoice can never reuse one.
  • Their combined effect on 3900 is offset by the opening-balance journal for 1300 and 2100, so 3900 still ends at nil (§5).

5. Manual and opening-balance journals

  • Drafts have no number and can be edited or deleted. Posting (journals:post) assigns KINT/JNL/YYYY/NNNN, requires balance and an open period, and is permanent.
  • Manual journals cannot touch the control accounts 1300, 2100 or 2200, so subledgers (clients, suppliers) always reconcile to the ledger.
  • Opening balances are entered once, at go-live, as opening_balance journals dated the day before the first live period. Receivable and payable lines must name the client or supplier, so statements and supplier balances start correctly. Any difference goes to 3900 Opening balance equity, which must be nil once all opening balances are in.

6. Tax configuration

  • vatRegistered = false, vatEnabled = false by default. VAT is never applied automatically. The Output VAT account (2330) is seeded archived.
  • Enabling VAT requires an administrator, a TIN, an effective date and a rate. It applies only to documents dated on or after the effective date.
  • Withholding tax recording is off by default and no rate is assumed. When on, it applies both to WHT deducted by clients (1310) and to WHT KINT deducts from suppliers (2320) (confirm Q7).
  • EFRIS: not_configured. No fiscal document numbers, verification codes or QR codes are ever generated locally.

7. Seeded chart of accounts (confirm Q4)

Seeded once per organisation (56 accounts). Later seed runs only restore missing system accounts; they never overwrite KINT's edits. System accounts cannot be archived (except Output VAT). Accounts with postings or a balance cannot be archived.

Code Account Type Flags
1000 Assets heading
1100 Cash on hand asset system cash_on_hand
1110 Petty cash asset
1200 Bank and mobile money accounts heading one postable child per bank account
1300 Accounts receivable asset control · system
1310 Withholding tax receivable asset system
1320 Staff advances asset
1400 Prepayments asset
1500 Computer equipment · 1505 accumulated depr. asset
1510 Furniture and fittings · 1515 accumulated depr. asset
1520 Office equipment · 1525 accumulated depr. asset
1530 Motor vehicles · 1535 accumulated depr. asset
2000 Liabilities heading
2100 Accounts payable liability control · system
2150 Accrued expenses liability
2200 Unapplied customer receipts liability control · system
2300 PAYE payable · 2310 NSSF payable liability
2320 Withholding tax payable liability system
2330 Output VAT payable liability system · archived until VAT
2340 Income tax payable liability
2400 Director's loan liability
3000 Equity heading
3100 Share capital equity
3200 Retained earnings equity system
3900 Opening balance equity equity system · must be nil after conversion
4000 Income heading
4100 Consulting and advisory fees income system sales_revenue (default)
4200 Systems and digital solutions income
4300 Research and intelligence services income
4900 Other income · 4910 gain on disposal · 4920 FX gain income 4910 system
6000 Expenses heading
6100 Salaries and wages · 6110 NSSF employer expense
6200 Rent · 6210 Utilities expense
6300 Internet and telephone · 6310 Software expense
6400 Transport and travel expense
6500 Professional fees · 6510 Bank charges · 6520 Mobile money charges expense
6600 Marketing and business development expense
6700 Office supplies and printing expense
6800 Depreciation expense system
6900 Repairs · 6950 Licences and registration fees expense
6980 Loss on disposal · 6985 FX loss expense 6980 system
6990 General and miscellaneous expenses expense system

A service in the catalogue can name its own revenue account (e.g. 4200 for systems work); otherwise its invoice lines post to 4100.

7a. Phase 8 posting rules

Event Debit Credit
Foreign supplier bill approved Cost lines, each converted at the bill rate and rounded to whole UGX 2100 Accounts payable (sum of the converted lines)
Foreign bills paid 2100 at the bills' carrying value (foreign amount × bill rate; the whole balance when the whole foreign balance is paid) Bank (UGX actually paid); the difference to 6985 FX loss (Dr) or 4920 FX gain (Cr)
Payroll approved (dated the last day of the month) 6100 Salaries (gross); 6110 NSSF employer (10%) 2300 PAYE; 2310 NSSF (5% + 10%); 2360 LST; 2350 Net salaries payable
Payroll payment (net pay, PAYE, NSSF or LST) The liability paid Bank
Verified online payment The online-payments clearing account 1300 Receivables (allocated to the invoice; any excess on account, 2200)
Recurring invoice issued As any invoice As any invoice

Budgets never post. Exchange rates are base units per foreign unit; bills keep the rate they were converted at.

7b. Payroll figures to confirm (before the first live payroll)

  • PAYE, monthly chargeable income = gross pay (basic + taxable cash allowances). Resident: nil to 235,000; 10% of 235,001–335,000; 10,000 + 20% of 335,001–410,000; 25,000 + 30% above 410,000; plus 10% of the amount above 10,000,000. Non-resident: 15% up to 335,000; 50,250 + 20% to 410,000; 65,250 + 30% above; plus 10% above 10,000,000.
  • NSSF: 5% employee, 10% employer, on gross pay (settings).
  • LST: off by default. When on, the annual amount for the employee's monthly income band (5,000 for 100,001–200,000 up to 100,000 above 1,000,000) is collected in equal instalments in the first four months of the financial year. Whether LST reduces chargeable income for PAYE is to be confirmed; it does not today.
  • All amounts in whole shillings, half-up. Confirm, then tick Payroll → Settings → rates confirmed.

8. Known gaps (tracked)

Gap Workaround Planned
Foreign-currency sales documents and bank accounts Purchases in foreign currency are supported (ADR-0016); invoices remain UGX When needed
Refunds to KINT from a supplier (cash back rather than a credit) Manual journal: Dr bank / Cr the original cost account (agree with the accountant) When needed
Asset revaluation and impairment Manual journal to the asset account, with the accountant When needed
Ledger entries for invoices issued before Phase 4 (development only) npm run ledger -- post-pending --apply (DEPLOYMENT.md) Done (tool exists)