Skip to content

Accounting Reports

The Accounting Reports page displays and exports Moroccan regulatory financial statements: Balance Sheet (Bilan), Income Statement (CPC), Management Balances (ESG), and Cash Flow Statement (Tableau de Financement). It uses the selected report template and the current fiscal year data.

Watch the step-by-step tutorial

The page has two tabs:

  • Report view — displays the generated report (table by sections and lines) with Excel and PDF export
  • Configuration — shows the model structure (sections, lines, zones, calculation sources)

The report is generated automatically when a fiscal year is selected.

The active model (e.g. BILAN_MA, CPC_MA, ESG_MA, TF_MA) is loaded via the URL slug parameter (/accounting/reports/<code>). Each model defines:

  • Sections (report blocks: Assets, Liabilities, Revenue, Expenses, etc.)
  • Numbered lines within each section
  • Zones (columns: N, N-1, Gross, Amortization, Net, etc.)
  • Calculation sources (balance, balance_debit, balance_credit, debit_moves, credit_moves, formula)

The Report view tab ($t('accounting.report_view')) shows:

  • A structured table by sections and lines
  • Calculated cells for each zone (numeric values)
  • Excel export and PDF export buttons at the top

Click a line to open the side panel with:

  • Line cell details (label, value, sources, formula)
  • Option to expand the account (handleExpandAccount) to see associated general ledger entries
  • Glossary button (GlossaryDialog)

The Configuration tab ($t('accounting.report_config')) shows the model tree:

  • Sections with their lines and zones
  • For each zone: code, label, official code, column, sources
  • Sources define the calculation method and account pattern or formula

The Export Excel ($t('accounting.export_excel')) and Export PDF ($t('accounting.export_pdf')) buttons trigger exportReport() with the model, selected fiscal year, and format. Loading indicators (exportingXlsx, exportingPdf) show when an export is in progress.

Clicking a table line opens a right-side panel (Dialog) showing:

  • The line label
  • Cells with their calculated values
  • The fiscal year label (selectedFY?.label)
  • Account expansion state (expandedAccno) and general ledger entries (ledgerEntries)
  • The Glossary button (GlossaryDialog) explaining methods, patterns, and formulas
  1. Open /accounting/reports/<CODE> (e.g. BILAN_MA, CPC_MA)
  2. Make sure the Report view tab is active
  3. Browse the table by sections and lines
  4. Click a line to see details and sources
  1. In the Report view tab, click Export Excel or Export PDF
  2. Wait for the download (the button shows a loading indicator)
  3. The file downloads with the generated name (filename) or by default report.xlsx / report.pdf
  1. Click a report line to open the detail panel
  2. In the panel, click the account expand button (onExpandAccount)
  3. General ledger entries (ledgerEntries) appear, sorted by accno, entry_date, entry_number
  4. Click again to collapse
  1. Switch to the Configuration tab
  2. Browse sections and lines
  3. Check zones and their sources (method, pattern, formula)
  • The page redirects from /accounting/reports/ to /accounting/reports/bilan_ma via +layout.svelte and +page.svelte
  • The fiscal year (selectedFY) and period (period.fiscalYearId) are loaded from the parent (await parent())
  • If no period is configured (period.fiscalYearId is empty), generateReport() returns null and the report stays empty
  • The side panel keeps selectedLine, expandedAccno, and ledgerEntries in local state ($state)
  • No report displayed: check that a fiscal year is selected (selectedFiscalYearId) and the model (template) exists. If the slug does not match any model, a 404 error is returned (if (!template) error(404, 'Report not found')).
  • Export failed: an error message (addLocalError) appears and loading indicators are reset (finally)
  • Panel empty after clicking a line: reportSections is derived from data.lines. If no lines are defined in the model, the table stays empty
  • Empty general ledger entries: the accounting_ledger query filters by company_id, accno (with like), fiscal_year_id, and sorts by date and entry number

Related pages: Report Builder, Fiscal Years, Chart of Accounts