From fce397b54ace42c780e6000d9de2fdc5ec9cad0b Mon Sep 17 00:00:00 2001 From: Thomas Da Silva Date: Fri, 9 Oct 2026 22:30:27 +0200 Subject: [PATCH 1/4] docs: describe the accounting exports --- docs/features/accounting-exports.md | 94 +++++++++++++++++++++++++++++ docs/reference/cli/index.md | 2 +- 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 docs/features/accounting-exports.md diff --git a/docs/features/accounting-exports.md b/docs/features/accounting-exports.md new file mode 100644 index 000000000..4dcddb429 --- /dev/null +++ b/docs/features/accounting-exports.md @@ -0,0 +1,94 @@ +--- +title: Accounting Exports +sidebar_position: 11 +--- + +# Accounting Exports + +Added in Thelia 3.3. + +Two exports give the accountant the sales of a period in a file their software loads, instead +of an order export to rework: the **sales journal**, one row per accounting entry, and the +**tax summary**, one row per month and per tax rate. They sit in the Orders category of the +export screen and run from the command line like any export. + +## The chart of accounts + +Set it in the back office, under Configuration > Accounting, before the first export: + +| Setting | Example | Meaning | +| --- | --- | --- | +| Journal code and label | `VE`, `Ventes` | the sales journal; `VE` / `Ventes` when left empty | +| Customer account | `411000` | debited of every invoice | +| Shipping account | `708500` | credited of the shipping, excluding tax | +| One row per tax rate | `20` → `706200`, `445720` | the account of the sales at that rate, and of the tax collected (not needed at 0) | + +They are the `accounting_*` configuration variables, which `thelia:config` reads and writes; +the rates are one variable, `accounting_rate_accounts`, as `20:706200:445720,5.5:706055:445705,0:706000`. +The sales journal refuses to run until the chart is complete, and says what is missing: no +account is ever made up. + +## The sales journal + +The invoices of the period, by **invoice date**: an order placed in January and invoiced in +February is in February. An order without invoice reference has no entry (the report counts +them, the orders placed before the invoice numbering was switched on among them). + +Each invoice is a piece, balanced to the cent: + +- the customer is debited of the total of the invoice; +- the products are credited excluding tax, one line per tax rate; +- an order discount is spread over the rates in proportion of their amount excluding tax; +- the shipping is credited excluding tax, on its own line, at the rate or rates of its tax; +- the tax collected is credited by rate, the shipping's included. + +The amounts are those of the invoice handed to the customer, under the rounding rule the +order was priced with, older orders included: nothing is recomputed. An order in another +currency is booked in the shop currency at the rate of the order, with its own amount and +currency beside it. An order that cannot be booked, for instance taxed at a rate the chart +has no account for, is left out and named in the report. + +## Formats + +The columns of the sales journal are the 18 fields of the French accounting entries file +(fichier des écritures comptables), in their order: + +| Field | Value | +| --- | --- | +| `JournalCode`, `JournalLib` | the sales journal | +| `EcritureNum`, `PieceRef` | the invoice reference | +| `EcritureDate`, `PieceDate`, `ValidDate` | the invoice date | +| `CompteNum`, `CompteLib` | the account and its label | +| `CompAuxNum`, `CompAuxLib` | the customer reference and name, on the customer line only | +| `EcritureLib` | "Facture " (in the language of the export) | +| `Debit`, `Credit` | the amount, in the shop currency | +| `EcritureLet`, `DateLet` | empty | +| `Montantdevise`, `Idevise` | the amount and currency of an order in another currency | + +Choose the **FEC** format to get the file itself: tab separated, the field names on the first +line, dates as YYYYMMDD, amounts with a decimal comma, UTF-8. Choose **CSV** to read it in a +spreadsheet. The labels follow the language chosen for the export. + +## The tax summary + +Per month of invoice and per tax rate: the amount taxed, the tax and the number of invoices. +It is read from the same pieces as the sales journal, so its taxes add up to the tax lines of +the journal, to the cent: the figures to check the tax return against. + +## The report + +After the download, the export screen shows what the export did: the number of pieces and the +totals of debit and credit, the orders left out and why, how many orders of the period have no +invoice reference. On the command line, the report follows the path of the file: + +```shell +php Thelia export thelia.export.sales_journal thelia.fec --start=2026-02-01 --end=2026-02-28 --locale=fr_FR +php Thelia export thelia.export.tax_summary thelia.csv --start=2026-01-01 --end=2026-03-31 +``` + +## Not covered + +- **Credit notes.** No credit note module runs on Thelia 3 yet: refunds and credit notes are + not in the journal, and the report says so. +- Matching (`EcritureLet`), the payments received and the bank reconciliation. +- Sending the exports by mail on a schedule. diff --git a/docs/reference/cli/index.md b/docs/reference/cli/index.md index 1761c0d7b..ffab29b46 100644 --- a/docs/reference/cli/index.md +++ b/docs/reference/cli/index.md @@ -80,7 +80,7 @@ through `php Thelia`, and empties the Symfony cache only. | Command | Description | | --- | --- | -| `export` | Export data through a registered export handler. | +| `export` | Export data through a registered export handler. The sales journal and the tax summary are described in [Accounting Exports](../../features/accounting-exports.md); `thelia.fec` writes the French accounting entries file. | | `import` | Import data through a registered import handler. | | `generate:sql` | Generate the core SQL files (`insert.sql`, `update*.sql`). | | `thelia:generate-resources` | Output the admin resources (ACL resource keys). | From 3bfd5d8a19dcf5f5cdf7566835ff13b11154a441 Mon Sep 17 00:00:00 2001 From: Thomas Da Silva Date: Fri, 9 Oct 2026 22:44:53 +0200 Subject: [PATCH 2/4] docs: say how rates, untaxed shipping and older orders are booked, and how to name the FEC file --- docs/features/accounting-exports.md | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/docs/features/accounting-exports.md b/docs/features/accounting-exports.md index 4dcddb429..6ac0fe079 100644 --- a/docs/features/accounting-exports.md +++ b/docs/features/accounting-exports.md @@ -37,13 +37,18 @@ them, the orders placed before the invoice numbering was switched on among them) Each invoice is a piece, balanced to the cent: - the customer is debited of the total of the invoice; -- the products are credited excluding tax, one line per tax rate; +- the products are credited excluding tax, one line per tax rate of the chart; an amount whose + frozen tax makes a rate a little off (19.90% for 0.83 of tax on 4.17) is filed under the + closest rate of the chart within a tenth of a point, and a line taxed twice under the sum of + its rates, which the chart needs a row for; - an order discount is spread over the rates in proportion of their amount excluding tax; -- the shipping is credited excluding tax, on its own line, at the rate or rates of its tax; +- the shipping is credited excluding tax on the shipping account, at the rate or rates of its + tax; untaxed shipping needs no rate row; - the tax collected is credited by rate, the shipping's included. The amounts are those of the invoice handed to the customer, under the rounding rule the -order was priced with, older orders included: nothing is recomputed. An order in another +order was priced with, older orders included: nothing is recomputed. An order priced before +the rounding rules did not take its discount off the tax on its invoice, and is booked so. An order in another currency is booked in the shop currency at the rate of the order, with its own amount and currency beside it. An order that cannot be booked, for instance taxed at a rate the chart has no account for, is left out and named in the report. @@ -66,12 +71,14 @@ The columns of the sales journal are the 18 fields of the French accounting entr | `Montantdevise`, `Idevise` | the amount and currency of an order in another currency | Choose the **FEC** format to get the file itself: tab separated, the field names on the first -line, dates as YYYYMMDD, amounts with a decimal comma, UTF-8. Choose **CSV** to read it in a -spreadsheet. The labels follow the language chosen for the export. +line (even for a period without invoice), dates as YYYYMMDD, amounts with a decimal comma, +UTF-8. Rename it `FEC.txt` before handing it to the tax administration. Choose +**CSV** to read it in a spreadsheet. The labels follow the language chosen for the export. ## The tax summary -Per month of invoice and per tax rate: the amount taxed, the tax and the number of invoices. +Per month of invoice and per tax rate, the highest first: the amount taxed (products and +shipping), the tax and the number of invoices. It is read from the same pieces as the sales journal, so its taxes add up to the tax lines of the journal, to the cent: the figures to check the tax return against. From 4ce119ab6cb68149975ba1008c94d04f4e5621f5 Mon Sep 17 00:00:00 2001 From: Thomas Da Silva Date: Fri, 9 Oct 2026 22:52:25 +0200 Subject: [PATCH 3/4] docs: say how an amount finds its rate in the chart --- docs/features/accounting-exports.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/features/accounting-exports.md b/docs/features/accounting-exports.md index 6ac0fe079..af4347850 100644 --- a/docs/features/accounting-exports.md +++ b/docs/features/accounting-exports.md @@ -37,10 +37,10 @@ them, the orders placed before the invoice numbering was switched on among them) Each invoice is a piece, balanced to the cent: - the customer is debited of the total of the invoice; -- the products are credited excluding tax, one line per tax rate of the chart; an amount whose - frozen tax makes a rate a little off (19.90% for 0.83 of tax on 4.17) is filed under the - closest rate of the chart within a tenth of a point, and a line taxed twice under the sum of - its rates, which the chart needs a row for; +- the products are credited excluding tax, one line per tax rate of the chart; prices and taxes + being rounded to the cent, an amount is filed under the rate of the chart that gives its tax + within a cent (0.20 of tax on 0.99 makes 20.20%, filed at 20%), and a line taxed twice under + the sum of its rates, which the chart needs a row for; - an order discount is spread over the rates in proportion of their amount excluding tax; - the shipping is credited excluding tax on the shipping account, at the rate or rates of its tax; untaxed shipping needs no rate row; From e0c01562a397192246c21a21d429f6fbbe6e52e4 Mon Sep 17 00:00:00 2001 From: Thomas Da Silva Date: Sat, 10 Oct 2026 11:34:39 +0200 Subject: [PATCH 4/4] docs: quote the label of an entry so MDX does not read it as a tag --- docs/features/accounting-exports.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/features/accounting-exports.md b/docs/features/accounting-exports.md index af4347850..d322168fd 100644 --- a/docs/features/accounting-exports.md +++ b/docs/features/accounting-exports.md @@ -65,7 +65,7 @@ The columns of the sales journal are the 18 fields of the French accounting entr | `EcritureDate`, `PieceDate`, `ValidDate` | the invoice date | | `CompteNum`, `CompteLib` | the account and its label | | `CompAuxNum`, `CompAuxLib` | the customer reference and name, on the customer line only | -| `EcritureLib` | "Facture " (in the language of the export) | +| `EcritureLib` | `Facture ` (in the language of the export) | | `Debit`, `Credit` | the amount, in the shop currency | | `EcritureLet`, `DateLet` | empty | | `Montantdevise`, `Idevise` | the amount and currency of an order in another currency |