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.
Overview
Section titled “Overview”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.
Key Features
Section titled “Key Features”Report Template Selection
Section titled “Report Template Selection”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)
Report View
Section titled “Report View”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)
Configuration
Section titled “Configuration”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
Export
Section titled “Export”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.
Line Detail Panel
Section titled “Line Detail Panel”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
Step-by-Step Tasks
Section titled “Step-by-Step Tasks”View a Report
Section titled “View a Report”- Open
/accounting/reports/<CODE>(e.g.BILAN_MA,CPC_MA) - Make sure the Report view tab is active
- Browse the table by sections and lines
- Click a line to see details and sources
Export a Report
Section titled “Export a Report”- In the Report view tab, click Export Excel or Export PDF
- Wait for the download (the button shows a loading indicator)
- The file downloads with the generated name (
filename) or by defaultreport.xlsx/report.pdf
View Ledger Entries for an Account
Section titled “View Ledger Entries for an Account”- Click a report line to open the detail panel
- In the panel, click the account expand button (
onExpandAccount) - General ledger entries (
ledgerEntries) appear, sorted byaccno,entry_date,entry_number - Click again to collapse
View the Model Configuration
Section titled “View the Model Configuration”- Switch to the Configuration tab
- Browse sections and lines
- Check zones and their sources (method, pattern, formula)
- The page redirects from
/accounting/reports/to/accounting/reports/bilan_mavia+layout.svelteand+page.svelte - The fiscal year (
selectedFY) and period (period.fiscalYearId) are loaded from the parent (await parent()) - If no period is configured (
period.fiscalYearIdis empty),generateReport()returnsnulland the report stays empty - The side panel keeps
selectedLine,expandedAccno, andledgerEntriesin local state ($state)
Troubleshooting
Section titled “Troubleshooting”- No report displayed: check that a fiscal year is selected (
selectedFiscalYearId) and the model (template) exists. If theslugdoes 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:
reportSectionsis derived fromdata.lines. If no lines are defined in the model, the table stays empty - Empty general ledger entries: the
accounting_ledgerquery filters bycompany_id,accno(withlike),fiscal_year_id, and sorts by date and entry number
Related pages: Report Builder, Fiscal Years, Chart of Accounts