# Posting invoices to the ledger

> How an issued invoice or credit note becomes a balanced ledger entry by itself, what the entry contains, why a posting can be refused, how to post by hand, and how to undo a posted invoice under the UAE policy.

Source: /help/en/accounting/posting-invoices-to-the-ledger

Once the ledger is enabled, every invoice and credit note you issue books its own entry in the sales journal. You never write it: the posting function reads the document, applies the organisation's tax posting rules and books the entry; the document stays authoritative for its totals and the ledger raises when the two disagree. Posted entries never change: a changed or archived document is answered with a reversal and, where needed, a fresh entry.

## What is booked

For a standard-rated invoice of AED 1,000 plus VAT to a customer in Dubai:

| Account | Debit | Credit | VAT 201 box |
|---|---|---|---|
| 1200 Trade receivables (or the customer's receivable account) | 1,050.00 | | |
| 4000 Sales (or the line's account, else the item's income account) | | 1,000.00 | 1b, amount 1,000.00 |
| 2100 VAT output tax | | 50.00 | 1b, VAT 50.00 |

- **Receivable** is booked by difference, so the entry balances by construction, and reconciled against the header total: a difference beyond one fil refuses the posting instead of fudging the books. The line carries the customer and the due date for ageing.
- **Revenue** is booked per income account and VAT rate. A line books to the **Account** set on the line itself; without one, to the **Income account** of its item ([Add a product](/help/en/products/add-a-product)); without either, to the sales default under **Settings → Company → Accounting**. Only owners, admins and accountants set the line's account; everyone else sees the account the line will take. The account is yours alone: it is not printed and not sent in the e-invoice (the service accounting code on the line is an e-invoice classification, not a ledger account).
- A **document-level discount** is spread over the lines of its VAT group in proportion to their net amounts, so every revenue account is reported net of the discount it bore; the rounding difference goes to the largest line and the shares add up to the discount exactly. A document-level charge (a delivery fee, say) books to the sales default. The VAT is unchanged: it is booked once per rate from the document, so the VAT return does not move.

For example, an invoice with a rent line of 10,000 (item Office rent, income account 4040 Rental income), a service line of 2,000 (item Maintenance, income account 4010 Sales of services) and a 10 % document discount of 1,200 books: Dr 1200 Trade receivables 11,340.00; Cr 4040 Rental income 9,000.00; Cr 4010 Sales of services 1,800.00; Cr 2100 VAT output tax 540.00. Box 1b reads 10,800.00 and VAT 540.00, as the document says.
- **VAT** is copied from the document, one line per rate, never recomputed from base × rate. The box each line feeds comes from the [tax posting rules](/help/en/accounting/tax-postings-and-vat-boxes): box 1 split by emirate of supply (1a to 1g, the organisation's emirate when the document names none), 4 for zero-rated, 5 for exempt; reverse-charge and out-of-scope supplies book revenue only, as the VAT 201 worksheet shows them for information.
- A **credit note** books the mirror: revenue and VAT debited, the receivable credited, box amounts negative, every ledger amount positive.
- A document in another currency is booked in AED at the document's exchange rate (the Central Bank rate of its date when the document carries none), line by line and rounded half up; every line keeps the original amount and currency.

The entry is dated on the issue date, numbered in the sales journal (`SAL/2026/0001`), named after the document, and the document and the entry point at each other.

## When it posts

- When a document leaves **Draft** (issued), and again when it is submitted or reported if it was skipped. The editor saves the header, the lines and the discounts in one step and the ledger looks at the finished document once, so issuing a corrected draft books one entry, never a stale one and its reversal.
- Never for drafts, test documents, archived documents or documents dated before the ledger start date.
- A **changed** issued document (while still editable) reverses the old entry and books a new one; an identical re-save books nothing. **Archiving** reverses the entry; unarchiving posts again.
- **Settings → Company → Accounting → Posting of documents** switches automatic posting off; then **Post to ledger** on the invoice (or the API) books it.

## The Ledger card on the invoice

An issued invoice shows a **Ledger** card: **Posted** with the entry number (open it), or **Not posted** with the reason the automatic posting gave, for example `tax_unmapped: the tax rate "Zero rated" has no posting rule for a invoice`. **Journal** opens the debit and credit lines with the box of each. **Post to ledger** books the document and raises the real refusal if something is still wrong.

What a refusal means:

| Code | Meaning | Fix |
|---|---|---|
| `document_not_postable` | Draft, test or archived document | Issue it; test and archived documents are never posted |
| `document_before_ledger_start` | Dated before the ledger start date | Nothing to do: history before the start is not in the books |
| `rate_missing` | Foreign currency without an exchange rate | Set the rate on the document or load the Central Bank rates |
| `tax_unmapped` | A line's VAT matches no tax rate, or the rate has no posting rule for this document kind | Add the rate under **Settings → Tax & currency**, or **Add missing rules** under Accounting |
| `ambiguous_tax` | Two tax rates match the line and their rules differ | Set the rate on the line or its exemption reason code |
| `document_total_mismatch` | The header total, the lines and the VAT do not agree | The document is inconsistent; while the editor is still writing lines this clears by itself |
| `period_locked` | The issue date is in a locked period, a locked journal or a filed VAT period | Unlock, or ask an owner or admin |

## Undo a posted invoice

**Undo invoice** on the Ledger card follows the country policy. In the UAE the policy is *reversal only*: an issued tax invoice is never returned to draft or deleted (Federal Decree-Law 8/2017 art. 62; Executive Regulation art. 60). The dialog says so and creates a **draft tax credit note** against the invoice, with its lines, discounts and buyer, the invoice as preceding document and the credit note reason you choose (BTAE-03, *supply cancelled* by default). Review it, validate and send it as any credit note; its posting reverses the invoice in the books, and the invoice itself keeps its number, status and entry. A second undo reuses the draft.

A country pack that declares *unpost if untouched* returns the invoice to draft instead, as long as it was not sent, reported, paid, credited, declared in a filed VAT return or dated in a locked period; the dialog lists what blocks it. The ledger then reverses the invoice's entry by itself.

## Good to know

- Owners, admins and accountants post and undo; approvers and viewers see the card and the journal, and can preview.
- The dry run (API `GET /invoices/{id}/ledger/preview`, assistant tool `preview_invoice_posting`) shows the entry exactly as it would be booked and writes nothing.
- The API offers `POST /invoices/{id}/ledger/post`, `GET /invoices/{id}/undo-policy` and `POST /invoices/{id}/undo`; `GET /invoices/{id}` carries `ledgerEntryId` and `ledgerPostError`. AI assistants use `post_invoice_to_ledger`, `preview_invoice_posting`, `get_invoice_undo_policy` and `undo_invoice`.
- Payments are booked from the next ledger milestone; until then the receivable shows the invoiced amount.

## Related

- [Tax postings and VAT boxes](/help/en/accounting/tax-postings-and-vat-boxes)
- [Manual journals](/help/en/accounting/manual-journals)
- [Period locks and partial unlock](/help/en/accounting/period-locks-and-partial-unlock)
- [Credit notes and corrections](/help/en/invoices/credit-and-debit-notes)
