# Ledgers and money

> How Continual counts: a ledger is a running tally of entries, kept two ways, for money in double entry and for every record's status.

A **ledger** keeps a running tally as **entries**, the way a bank statement keeps your balance. Each
entry records one movement, and a balance is the sum of the entries so far. Entries are only ever
added, so the past stays exactly as it was.

## Two kinds of ledger

| Kind            | What it counts                                  | Example                          |
| --------------- | ----------------------------------------------- | -------------------------------- |
| **Financial**   | Money, in double entry, kept in books           | The general ledger, in Finance   |
| **Statistical** | Records by status: how many, how much, how long | Deals by status; tasks by status |

Both work the same way, so every number in Continual, from revenue to open tasks, is a sum of
entries, and opens to the records behind it. Accountants will know statistical ledgers as
statistical key figures: counts kept beside the books, never mixed into them.

## Financial ledgers: double entry, plainly

Every movement of money is recorded twice: where it went, and where it came from. One side is a
**debit** and the other a **credit**, and they are always equal. So every entry balances, and so does
the whole ledger.

### Example: invoice, then payment

You issue Northstar an invoice for $1,000, and Northstar pays it a month later.

| When                  | Account             | Debit  | Credit | What it says                 |
| --------------------- | ------------------- | ------ | ------ | ---------------------------- |
| You issue the invoice | Accounts receivable | $1,000 |        | Northstar owes you $1,000    |
|                       | Revenue             |        | $1,000 | You earned $1,000            |
| Northstar pays        | Bank                | $1,000 |        | You have $1,000 more in cash |
|                       | Accounts receivable |        | $1,000 | Northstar no longer owes it  |

Issuing the invoice posts the first two lines, and receiving the payment posts the next two. Nobody
types these entries: each Document posts its own, in the same moment it is finalized. See
[Documents](/docs/concepts/records/documents).

The receivable stays an **open item** until a payment settles it, so Continual always knows what each
customer still owes, invoice by invoice.

### Ledger accounts

Each line names a **ledger account**, and your chart of accounts lists them all. Every ledger
account is one of five types:

| Type      | What it tracks             | Grows with a | Examples                        |
| --------- | -------------------------- | ------------ | ------------------------------- |
| Asset     | What the business owns     | Debit        | Bank, accounts receivable       |
| Liability | What it owes others        | Credit       | Accounts payable, sales tax due |
| Equity    | What belongs to its owners | Credit       | Owner's capital                 |
| Revenue   | What it earns              | Credit       | Sales, services                 |
| Expense   | What it spends             | Debit        | Rent, software                  |

Some accounts are **control accounts**, such as accounts receivable. They hold what customers owe in
total. Only invoices and payments post to them, each naming its customer, and a hand-entered journal
entry never can. So the total always agrees with the customers behind it.

### Customer and vendor accounts

A **customer account** is your relationship with one customer in Finance: which receivable account
their invoices post to, and their defaults. A **vendor account** is the same for a supplier. Both
name a company, so a customer who is also a vendor is one company with two accounts.

### Books

A **book** keeps the ledger for one legal entity, in that entity's currency. A business with a US
and a UK entity keeps two books. Each entry balances within its own book.

A book has a **lock date**. Once you close a period, entries dated on or before the lock date are
refused, so a late correction posts in the open period, as auditors expect.

### Foreign currency

An invoice in euros posts in the book's currency too, converted at the rate on or before its date.
Continual keeps both amounts. If a payment arrives when the rate has moved, the difference posts as
a realized gain or loss. A rounding difference posts to the book's rounding account.

### Statements

Finance reads three statements straight from the general ledger:

| Statement            | What it shows                                         |
| -------------------- | ----------------------------------------------------- |
| **Trial balance**    | Every account's balance; debits and credits are equal |
| **Income statement** | Revenue less expenses, for a period                   |
| **Balance sheet**    | Assets, liabilities, and equity, at a date            |

Nobody edits a balance by hand. To correct one, you post a
[journal entry](/docs/apps/finance/journal-entries), or void or reverse the Document that posted it.
**Coming:** a void nets out on the original date, while the period is open; a reversal posts on a
date you choose, such as the first open day after a closed period.

Coming: bills from vendors, and bank reconciliation.

## Statistical ledgers: every status, counted

Every record type with a status keeps a statistical ledger, with no setup. Each time a record changes
status, its ledger posts the move: one less in the old status, one more in the new.

From those entries you can read, for any past date:

- **How many** are in each status, such as open tasks last Monday.
- **How many arrived** in a status, such as deals won this month.
- **How long each stayed**, such as how long tasks spend in progress.
- **How old** the records still there are, such as the age of open tasks.

Each count also follows the record's other details, such as its owner, customer, or project. A deal
carries its amount too, so the deal ledger also counts the pipeline in money. Statistical ledgers
never balance and never touch the books.

## Two times on every entry

Every entry keeps two times, as accounting keeps a document date and a posting date:

- **When it counts**: the moment the movement applies, which decides its period.
- **When it was recorded**: the moment Continual learned it.

So you can ask "how many tickets were open on October 5", and also "what did we know about October 5
on October 6", before a late correction arrived.

## Who sees which entries

You see only the entries you may read. Finance's books show only to people with a Finance role. A
statistical ledger counts only the records you can see, so a private project's tasks count for its
members alone.

<Cards cols={3}>
  <Card title="Metrics" href="/docs/concepts/metrics" icon="target">
    The numbers read from ledgers, and goals on them.
  </Card>
  <Card title="Finance" href="/docs/apps/finance" icon="receipt">
    Invoices, payments, and the general ledger.
  </Card>
  <Card title="Documents" href="/docs/concepts/records/documents" icon="book">
    Drafts, finalizing, and corrections.
  </Card>
</Cards>
