Mirrored from https://github.com/davoodmehraban89/Aram.git
Synced Dec 4, 14:15 UTC
dependabot/github_actions/actions/checkout-7
add-index-html-10623938925177053894
arena/094f314c-aram
arena/2d4eda07-aram
chatgpt-phase1b2-autopilot
codex/adr-future-connectors-pi-v1
codex/aram-account-note-source-trace-20261031
codex/aram-actions-node24-maintenance-20261031
codex/aram-analyst-review-workbook-20261031
codex/aram-bs-candidate-statement-20261031
codex/aram-cash-flow-direct-candidate-20261031
codex/aram-clean-reference-year-integrity-20261030
codex/aram-cross-statement-controls-20261031
codex/aram-equity-changes-candidate-20261031
codex/aram-five-statement-cli-20261031
codex/aram-five-statement-integration-20261031
codex/aram-five-statement-orchestrator-20261031
codex/aram-gate3-coverage-target-guard-20261030
codex/aram-gate3-hidden-xlsx-guard-20261030
codex/aram-gate3-integration-validation-20261030
codex/aram-gate3-mapping-change-preview-20261030
codex/aram-gate3-stale-note-guard-20261030
codex/aram-income-statement-candidate-20261031
codex/aram-manifest-referential-integrity-20261031
codex/aram-mapping-source-parser-20261101
codex/aram-multidimensional-mapping-20261101
codex/aram-multistatement-mapping-20261031
codex/aram-pipeline-manifest-schema-20261031
codex/aram-readonly-mapping-coverage-20261031
codex/aram-reconciliation-review-gate-20261031
codex/aram-same-flush-fiscal-lock-20261030
codex/aram-synthetic-windows-demo-20261031
codex/aram-trial-balance-diagnostic-20261031
codex/aram-windows-background-detail-search-20261031
codex/aram-windows-detail-review-20261031
codex/aram-windows-five-statement-pilot-20261031
codex/aram-windows-statement-figures-20261031
codex/gate-2a-pilot-workbook
codex/gate-2a-pilot-workbook-6864754244772568979
codex/gate3-authenticated-principal-boundary-20261030
codex/gate3-authored-draft-staging-20261030
codex/gate3-carry-forward-preview-20261023
codex/gate3-draft-staging-audit-20261030
codex/gate3-mapping-batch-freshness-20261030
codex/gate3-mapping-batch-review-20261030
codex/gate3-mapping-core
codex/gate3-mapping-coverage-20261023
codex/gate3-mapping-excel-20261023
codex/gate3-note-mapping-review-20261023
codex/gate3-signed-year-scope-20261030
codex/gate3-unapproved-proposal-storage-20261030
codex/payvast-mapping-discovery-20261023
codex/phase-2a-backend-foundation
codex/phase-2b-post-merge-record
codex/phase-2b-source-registration
codex/phase-2b-source-registration-12955190277775369594
codex/post-gate2a-control-reconciliation
codex/post-pr18-acceptance-record
codex/project-control-foundation
codex/t1-repo-hygiene-20261023
codex/t2-ci-hardening-20261023
codex/t3-explicit-migrations-20261023
codex/t6a-readonly-diagnostics-20261023
codex/v1-01-safety-gate-hardening
codex/v1-year-isolation-followup-20261023
codex/windows-native-pilot-shell-20261030
dependabot/github_actions/actions/checkout-7
dependabot/github_actions/actions/setup-node-6
dependabot/github_actions/actions/setup-python-7
dependabot/github_actions/actions/upload-artifact-7
dependabot/npm_and_yarn/frontend/eslint-plugin-react-hooks-7.1.1
dependabot/npm_and_yarn/frontend/globals-17.15.0
dependabot/npm_and_yarn/frontend/vite-8.4.0
dependabot/npm_and_yarn/frontend/vitest-5.1.2
dependabot/npm_and_yarn/frontend/vitest/coverage-v8-5.1.2
dependabot/pip/backend/mypy-gte-1.13-and-lt-3
dependabot/pip/backend/pytest-cov-gte-6.0-and-lt-8
dependabot/pip/backend/setuptools-gte-75-and-lt-85
docs/aram-master-control-plan-20261111
docs/aram-roadmap-dashboard-20261030
docs/financial-statement-reconciliation-1402-1404-20261110
feat/gate3-governed-mapping-20261101
feat/gate3-package9-1-security-20261103
feat/gate3-package9-isolated-20261103
fix/password-unicode-validation-20261111
governance/aram-5-1-3-controls-20261030
governance/role-based-operating-model
jules-1168663913887856558-73b8a885
jules-gate-2b-mapping-workflow-foundation-4137724387867065330
phase-1b1-audit-report-7365389436990903239
phase-2a-backend-foundation-10237597358138521261
phase1b2-postmerge-metadata-fix
refactor/drg-parent-year-id-15088443704684163304
source-data-cleanup
| 1 | """Synthetic demo workbook for the Pilot workbench. |
| 2 | |
| 3 | Every value here is fabricated for demonstration and is clearly labelled as |
| 4 | such in the company name, the workbook itself, the API and the UI. It never |
| 5 | touches canonical data and must never be used for real financial reporting. |
| 6 | The trial balance is balanced; two suspense accounts are intentionally left |
| 7 | unmapped so the exception-queue workflow can be exercised end to end. |
| 8 | """ |
| 9 | |
| 10 | from __future__ import annotations |
| 11 | |
| 12 | from datetime import UTC, datetime |
| 13 | from io import BytesIO |
| 14 | |
| 15 | from openpyxl import Workbook |
| 16 | |
| 17 | from aram_backend.pilot_workbook import SHEET_HEADERS |
| 18 | |
| 19 | DEMO_COMPANY_CODE = "DEMO" |
| 20 | DEMO_COMPANY_NAME = "شرکت ساختگی دمو (دادهٔ کاملاً غیرواقعی)" |
| 21 | DEMO_YEAR = 1404 |
| 22 | DEMO_REVIEWER = "بازبین دمو (ساختگی)" |
| 23 | DEMO_REVIEW_DATE = "2026-12-03" |
| 24 | |
| 25 | # (full_code, name, general_code, general_name, subsidiary_code, |
| 26 | # closing, debit, credit, statement, section, note_number, approval) |
| 27 | _DEMO_ACCOUNTS = [ |
| 28 | ("1001", "نقد و بانک", "10", "داراییهای جاری", "01", 12_500_000_000, 7_500_000_000, 5_000_000_000, "BS", "Assets", "01", "Approved"), |
| 29 | ("1002", "دریافتنیهای تجاری", "10", "داراییهای جاری", "02", 8_300_000_000, 6_100_000_000, 4_300_000_000, "BS", "Assets", "02", "Approved"), |
| 30 | ("1003", "موجودی کالا", "10", "داراییهای جاری", "03", 15_200_000_000, 9_400_000_000, 7_100_000_000, "BS", "Assets", "03", "Approved"), |
| 31 | ("1004", "پیشپرداختها", "10", "داراییهای جاری", "04", 1_100_000_000, 800_000_000, 500_000_000, "BS", "Assets", "04", "Draft"), |
| 32 | ("1101", "داراییهای ثابت مشهود", "11", "داراییهای غیرجاری", "01", 22_000_000_000, 4_000_000_000, 0, "BS", "Assets", "05", "Approved"), |
| 33 | ("1102", "استهلاک انباشته", "11", "داراییهای غیرجاری", "02", -3_600_000_000, 0, 900_000_000, "BS", "Assets", "05", "Approved"), |
| 34 | ("2001", "پرداختنیهای تجاری", "20", "بدهیهای جاری", "01", -6_400_000_000, 3_200_000_000, 4_100_000_000, "BS", "Liabilities", "06", "Approved"), |
| 35 | ("2003", "ذخیره مالیات", "20", "بدهیهای جاری", "03", -1_900_000_000, 0, 1_900_000_000, "BS", "Liabilities", "08", "Approved"), |
| 36 | ("2101", "تسهیلات مالی", "21", "بدهیهای غیرجاری", "01", -14_000_000_000, 2_000_000_000, 5_000_000_000, "BS", "Liabilities", "07", "Approved"), |
| 37 | ("3001", "سرمایه", "30", "حقوق مالکانه", "01", -20_000_000_000, 0, 0, "BS", "Equity", "09", "Approved"), |
| 38 | ("3002", "سود انباشته", "30", "حقوق مالکانه", "02", -13_000_000_000, 0, 0, "BS", "Equity", "10", "Approved"), |
| 39 | ("4001", "فروش", "40", "درآمدها", "01", -18_700_000_000, 0, 18_700_000_000, "IS", "Revenue", "11", "Approved"), |
| 40 | ("4002", "سایر درآمدها", "40", "درآمدها", "02", -400_000_000, 0, 400_000_000, "IS", "Revenue", "12", "Approved"), |
| 41 | ("5001", "بهای تمامشده کالای فروشرفته", "50", "هزینهها", "01", 9_800_000_000, 9_800_000_000, 0, "IS", "Expenses", "13", "Approved"), |
| 42 | ("5002", "حقوق و دستمزد", "50", "هزینهها", "02", 3_900_000_000, 3_900_000_000, 0, "IS", "Expenses", "14", "Approved"), |
| 43 | ("5003", "اجاره و اداری", "50", "هزینهها", "03", 1_250_000_000, 1_250_000_000, 0, "IS", "Expenses", "15", "Approved"), |
| 44 | ("5004", "هزینه استهلاک", "50", "هزینهها", "04", 900_000_000, 900_000_000, 0, "IS", "Expenses", "16", "Approved"), |
| 45 | ("5005", "هزینههای مالی", "50", "هزینهها", "05", 1_150_000_000, 1_150_000_000, 0, "IS", "Expenses", "17", "Approved"), |
| 46 | ("5006", "مالیات بر درآمد", "50", "هزینهها", "06", 1_900_000_000, 1_900_000_000, 0, "IS", "Expenses", "18", "Approved"), |
| 47 | # Intentionally unmapped suspense pair: balanced, but incomplete coverage. |
| 48 | ("9001", "حساب موقت — قلم شناسایینشده بدهکار", "90", "حسابهای موقت", "01", 500_000_000, 500_000_000, 0, None, None, None, None), |
| 49 | ("9002", "حساب موقت — قلم شناسایینشده بستانکار", "90", "حسابهای موقت", "02", -500_000_000, 0, 500_000_000, None, None, None, None), |
| 50 | ] |
| 51 | |
| 52 | _DEMO_NOTES = [ |
| 53 | ("BS", "Assets", "01", "نقد و بانک"), |
| 54 | ("BS", "Assets", "02", "دریافتنیهای تجاری"), |
| 55 | ("BS", "Assets", "03", "موجودیها"), |
| 56 | ("BS", "Assets", "04", "پیشپرداختها"), |
| 57 | ("BS", "Assets", "05", "داراییهای ثابت مشهود"), |
| 58 | ("BS", "Liabilities", "06", "پرداختنیهای تجاری"), |
| 59 | ("BS", "Liabilities", "07", "تسهیلات مالی"), |
| 60 | ("BS", "Liabilities", "08", "ذخیره مالیات"), |
| 61 | ("BS", "Equity", "09", "سرمایه"), |
| 62 | ("BS", "Equity", "10", "سود انباشته"), |
| 63 | ("IS", "Revenue", "11", "درآمد عملیاتی"), |
| 64 | ("IS", "Revenue", "12", "سایر درآمدها"), |
| 65 | ("IS", "Expenses", "13", "بهای تمامشده"), |
| 66 | ("IS", "Expenses", "14", "حقوق و دستمزد"), |
| 67 | ("IS", "Expenses", "15", "هزینههای اداری و تشکیلاتی"), |
| 68 | ("IS", "Expenses", "16", "استهلاک"), |
| 69 | ("IS", "Expenses", "17", "هزینههای مالی"), |
| 70 | ("IS", "Expenses", "18", "مالیات بر درآمد"), |
| 71 | ] |
| 72 | |
| 73 | |
| 74 | def _row(sheet: str, values: dict) -> tuple: |
| 75 | return tuple(values.get(header) for header in SHEET_HEADERS[sheet]) |
| 76 | |
| 77 | |
| 78 | def build_demo_workbook() -> bytes: |
| 79 | """Build the synthetic, balanced demo workbook fully in memory.""" |
| 80 | workbook = Workbook() |
| 81 | workbook.remove(workbook.active) |
| 82 | workbook.properties.creator = "Aram Pilot Workbench (synthetic demo)" |
| 83 | workbook.properties.title = "SYNTHETIC DEMO — NOT REAL FINANCIAL DATA" |
| 84 | fixed = datetime(2026, 12, 3, tzinfo=UTC) |
| 85 | workbook.properties.created = fixed |
| 86 | workbook.properties.modified = fixed |
| 87 | for name, headers in SHEET_HEADERS.items(): |
| 88 | workbook.create_sheet(name).append(headers) |
| 89 | |
| 90 | company = { |
| 91 | "company_code": DEMO_COMPANY_CODE, |
| 92 | "company_name": DEMO_COMPANY_NAME, |
| 93 | "fiscal_year": DEMO_YEAR, |
| 94 | "currency": "IRR", |
| 95 | "unit": "ریال (ساختگی)", |
| 96 | "prepared_by": "Aram Demo", |
| 97 | "status": "Draft", |
| 98 | } |
| 99 | workbook["Company"].append(_row("Company", company)) |
| 100 | |
| 101 | mapping_index = 0 |
| 102 | for (code, name, general, general_name, subsidiary, closing, debit, credit, |
| 103 | statement, section, note_number, approval) in _DEMO_ACCOUNTS: |
| 104 | opening = closing - debit + credit |
| 105 | source_row = 100 + int(code) |
| 106 | workbook["Accounts"].append(_row("Accounts", { |
| 107 | "company_code": DEMO_COMPANY_CODE, |
| 108 | "fiscal_year": DEMO_YEAR, |
| 109 | "general_code": general, |
| 110 | "general_name": general_name, |
| 111 | "subsidiary_code": subsidiary, |
| 112 | "subsidiary_name": name, |
| 113 | "account_full_code": code, |
| 114 | "account_name": name, |
| 115 | "opening": opening, |
| 116 | "debit": debit, |
| 117 | "credit": credit, |
| 118 | "closing": closing, |
| 119 | "source_row": source_row, |
| 120 | "row_status": "Reviewed", |
| 121 | "closing_delta": 0, |
| 122 | })) |
| 123 | if statement is None: |
| 124 | continue |
| 125 | mapping_index += 1 |
| 126 | reviewed = approval in {"Reviewed", "Approved"} |
| 127 | workbook["Mapping"].append(_row("Mapping", { |
| 128 | "mapping_id": f"DM{mapping_index:03d}", |
| 129 | "company_code": DEMO_COMPANY_CODE, |
| 130 | "fiscal_year": DEMO_YEAR, |
| 131 | "account_full_code": code, |
| 132 | "account_level": "Subsidiary", |
| 133 | "general_code": general, |
| 134 | "subsidiary_code": subsidiary, |
| 135 | "target_statement": statement, |
| 136 | "statement_section": section, |
| 137 | "note_number": note_number, |
| 138 | "mapping_version": 1, |
| 139 | "approval_status": approval, |
| 140 | "reviewer": DEMO_REVIEWER if reviewed else None, |
| 141 | "review_date": DEMO_REVIEW_DATE if reviewed else None, |
| 142 | "source": "synthetic-demo", |
| 143 | "validation_status": "Valid" if approval == "Approved" else "Pending", |
| 144 | })) |
| 145 | |
| 146 | for statement, section, note_number, title in _DEMO_NOTES: |
| 147 | workbook["Notes"].append(_row("Notes", { |
| 148 | "company_code": DEMO_COMPANY_CODE, |
| 149 | "fiscal_year": DEMO_YEAR, |
| 150 | "statement": statement, |
| 151 | "statement_section": section, |
| 152 | "note_number": note_number, |
| 153 | "note_title": title, |
| 154 | })) |
| 155 | |
| 156 | workbook["Guide_FA"].append(("هشدار", "همهٔ ارقام این فایل ساختگی و غیرواقعی هستند.")) |
| 157 | workbook["Lists"].append(("demo", "SYNTHETIC")) |
| 158 | |
| 159 | stream = BytesIO() |
| 160 | workbook.save(stream) |
| 161 | return stream.getvalue() |