# Documents — overview of types

A document is the system's central unit: a recorded fact about what happened
to goods or money (who, when, how much, from where, to where). The general
mechanics — draft/processed, lot accounting, rollback — aren't repeated
here, they're covered in depth in [Concept](concept_en.md) and
[Subsystems](subsystems_en.md#documents). This page is a catalog: which
document types exist and what each one means.

## Where types come from

A document's type is defined by the operations reference — not a hardcoded
list, but a configurable one: every operation has a direction (receiving,
expenditure, cash, order) and its own name. Receiving alone can have several
kinds — "Receiving from supplier," "Receiving return," "Receiving free of
charge" — the system tells them apart by operation name, but processes them
all with the same direction logic.

**A return isn't a separate document type.** A return from a customer is
entered as an ordinary receiving document with the operation "Return"; a
return to a supplier is an ordinary expenditure document with the operation
"Return to supplier." There's no separate "Return" form — the document's
meaning is entirely defined by the operation chosen in its header, not by
which form created it.

## Catalog of directions

- **Receiving** — goods arrived into stock: from a supplier, a customer return, or free of charge. More: [Receiving](receiving_en.md)
- **Expenditure / Transfer** — goods left stock with no sale involved: a transfer between warehouses, a shipment with no revenue, a return to a supplier. More: [Expenditure and transfer](expenditure_en.md)
- **Selling** — goods left stock to a customer, with revenue recorded. More: [Selling](selling_en.md)
- **Cash / Bank** — money movement, not goods. More: [Cash and bank](cash_en.md)
- **Manufacture** — a product assembled from components by recipe, component expenditure and product receiving in one document. More: [Manufacture](manufacture_en.md)
- **Order** (intention) — a customer ordered from us / we're ordering from a supplier, moves neither goods nor money, just a checkpoint. More: [Customer orders](orders_en.md), [Supplier orders](projects_en.md)

Discount and stock correction are also separate operations in the same
reference, but aren't covered by a dedicated page here (discount is a price
change with no goods movement; correction is a direct "was/became" edit of a
warehouse lot, used rarely, to bring the database in line with reality after
a stocktake).

## Common to every type

- **A document's date can't fall inside a closed accounting period** — if
  the period is closed, processing is rejected regardless of document type.
  A warehouse can also be closed up to a given date on its own: then no
  document touching that warehouse (receiving, expenditure, selling,
  manufacture, discount, stock correction, a POS sale) can be processed with
  a date on or before it.
- **A document number is unique within its type and date.** Two documents of
  the same type can't share a number on the same day — even if one of them
  was deleted (a deleted document keeps its number). The same number on a
  different date, or for a different type, is allowed.
- **Quantities can't be negative.** A line with a negative quantity is
  rejected both when it's entered and on processing: a return is a separate
  document with its own operation (see above), not a "minus" line.
- **Access is set per document type.** If a user's rights don't include a
  given document type, the server refuses to process, roll back or delete
  documents of that type for them — the restriction isn't just a hidden
  button.
- **Two users can work on the same goods at the same time.** If two
  documents write off the same lot simultaneously, the second one waits for
  the first to finish and then sees the actual remaining quantity — it can't
  write off goods the first one has already taken. Creating documents and
  viewing data never wait.
- **Before processing, a document is a draft**, lines are freely editable;
  after processing — only through a rollback.
- **The header comment is only editable in the source document.** For
  documents that reference another one (e.g. a payment on an expenditure
  document referencing a receiving document), the comment is shown
  read-only.
