Mirrored from https://github.com/davoodmehraban89/Aram.git
Synced Dec 3, 18:15 UTC
codex/post-pr18-acceptance-record
add-index-html-10623938925177053894
arena/094f314c-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
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 | <!DOCTYPE html> |
| 2 | <html lang="fa" dir="rtl"> |
| 3 | <head> |
| 4 | <meta charset="UTF-8"> |
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 | <title>هسته یکپارچه صورتهای مالی - آماده انتقال به دیتابیس</title> |
| 7 | <script src="https://cdn.tailwindcss.com"></script> |
| 8 | <style> |
| 9 | @import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css'); |
| 10 | * { font-family: 'Vazirmatn', sans-serif; } |
| 11 | ::-webkit-scrollbar { width: 6px; height: 6px; } |
| 12 | ::-webkit-scrollbar-track { background: #0f172a; } |
| 13 | ::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; } |
| 14 | |
| 15 | /* ========================================= |
| 16 | موتور پرینت اختصاصی و استاندارد (A4) |
| 17 | ========================================= */ |
| 18 | @media print { |
| 19 | @page { size: A4 portrait; margin: 12mm; } |
| 20 | body { background-color: white !important; color: black !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; font-size: 11pt; } |
| 21 | .no-print, #app-wrapper, .print-controls { display: none !important; } |
| 22 | #print-wrapper { display: block !important; width: 100%; direction: rtl; background: white !important; } |
| 23 | |
| 24 | .print-page { page-break-after: always; clear: both; padding: 10mm 0; position: relative; min-height: 250mm; } |
| 25 | .print-page:last-child { page-break-after: auto; } |
| 26 | |
| 27 | h2 { font-size: 16pt; text-align: center; font-weight: bold; margin-bottom: 15px; color: black !important; } |
| 28 | h3 { font-size: 14pt; text-align: center; font-weight: bold; margin-bottom: 15px; color: black !important; border-bottom: 2px solid #000; padding-bottom: 10px;} |
| 29 | h4 { font-size: 12pt; font-weight: bold; margin-bottom: 10px; color: black !important; } |
| 30 | |
| 31 | table { width: 100%; border-collapse: collapse; margin-bottom: 25px; font-size: 10pt; page-break-inside: avoid; } |
| 32 | th, td { border: 1px solid #000 !important; padding: 8px !important; color: black !important; text-align: center;} |
| 33 | th { background-color: #e5e7eb !important; font-weight: bold; } |
| 34 | td:first-child { text-align: right; } |
| 35 | |
| 36 | .sign-grid { display: flex; justify-content: space-around; margin-top: 60px; text-align: center; font-size: 11pt; gap: 20px; flex-wrap: wrap;} |
| 37 | .sign-box { border-top: 1px dashed #000; padding-top: 15px; flex: 1; min-width: 150px; font-weight: bold; margin-bottom: 30px;} |
| 38 | .sign-role { font-size: 9pt; font-weight: normal; margin-top: 5px; display: block; color: #333 !important;} |
| 39 | |
| 40 | .ai-grid { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 20px; margin-top: 20px;} |
| 41 | .ai-card { border: 2px solid #4f46e5 !important; padding: 15px; flex: 1; text-align: center; border-radius: 8px; background-color: #f8fafc !important; } |
| 42 | .ai-val { font-size: 16pt; font-weight: bold; margin-top: 10px; direction: ltr; color: #1e1b4b !important;} |
| 43 | .ai-title { font-size: 10pt; font-weight: bold; color: #334155 !important;} |
| 44 | .ai-analysis { border: 2px solid #10b981 !important; padding: 15px; border-radius: 8px; background-color: #f0fdf4 !important; text-align: justify; line-height: 2; font-size: 11pt;} |
| 45 | } |
| 46 | |
| 47 | /* Preview Overlay Mode */ |
| 48 | .preview-mode #app-wrapper { display: none; } |
| 49 | .preview-mode #print-wrapper { display: block; background: #525659; min-height: 100vh; padding-bottom: 50px; } |
| 50 | #print-wrapper { display: none; } |
| 51 | .paper-sheet { background: white; color: black; width: 210mm; min-height: 297mm; margin: 20px auto; padding: 20mm; box-shadow: 0 0 15px rgba(0,0,0,0.5); direction: rtl; } |
| 52 | </style> |
| 53 | </head> |
| 54 | <body class="bg-slate-950 text-slate-100 antialiased min-h-screen"> |
| 55 | |
| 56 | <!-- ========================================== |
| 57 | محیط کاربری اپلیکیشن (App Wrapper) |
| 58 | ========================================== --> |
| 59 | <div id="app-wrapper" class="flex flex-col min-h-screen"> |
| 60 | <header class="bg-slate-900 border-b border-slate-800 p-3 md:p-4 sticky top-0 z-50 shadow-2xl"> |
| 61 | <div class="max-w-7xl mx-auto space-y-3"> |
| 62 | <div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 border-b border-slate-800/80 pb-2.5"> |
| 63 | <div class="flex items-center gap-2.5"> |
| 64 | <div class="p-2 bg-indigo-600 text-white rounded-lg shadow-md"> |
| 65 | <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"></path></svg> |
| 66 | </div> |
| 67 | <div> |
| 68 | <h1 class="font-bold text-white text-xs md:text-sm">هسته یکپارچه صدور صورتهای مالی (Jules Ready)</h1> |
| 69 | <p class="text-[10px] text-emerald-400">بستر قطعی ۱۴۰۲ تا ۱۴۰۴ - آماده اتصال API برای سال ۱۴۰۵</p> |
| 70 | </div> |
| 71 | </div> |
| 72 | <div class="flex items-center gap-2"> |
| 73 | <span class="text-[11px] font-mono font-bold text-slate-300 bg-slate-800 border border-slate-700 px-2.5 py-1.5 rounded-lg">واحد: میلیون ریال</span> |
| 74 | <button onclick="openPrintPreview()" class="flex items-center gap-1.5 bg-emerald-600 hover:bg-emerald-500 text-white text-[11px] font-bold px-4 py-2 rounded-lg transition-all shadow-md ring-2 ring-emerald-400/50"> |
| 75 | 🖨️ تولید پکیج چاپ (مدیریتی) |
| 76 | </button> |
| 77 | </div> |
| 78 | </div> |
| 79 | |
| 80 | <div class="grid grid-cols-1 md:grid-cols-2 gap-2.5 bg-slate-950 p-2.5 rounded-xl border border-slate-800"> |
| 81 | <div class="space-y-1"> |
| 82 | <label class="text-[11px] font-bold text-blue-400">انتخاب شرکت:</label> |
| 83 | <select id="companySelector" onchange="onCompanyChange(this.value)" class="bg-slate-900 border border-slate-700 text-white text-xs font-semibold rounded-lg px-2.5 py-2 w-full outline-none"> |
| 84 | <option value="C_GAS_TRANS">🏭 شرکت انتقال گاز ایران (سهامی خاص)</option> |
| 85 | <option value="C_SISTAN">🏬 شرکت گاز استان سیستان و بلوچستان</option> |
| 86 | </select> |
| 87 | </div> |
| 88 | <div class="space-y-1"> |
| 89 | <label class="text-[11px] font-bold text-emerald-400">انتخاب سال مالی (سورس قطعی):</label> |
| 90 | <select id="yearSelector" onchange="onYearChange(this.value)" class="bg-slate-900 border border-slate-700 text-white text-xs font-semibold rounded-lg px-2.5 py-2 w-full outline-none font-mono"> |
| 91 | <option value="1404">📅 سال ۱۴۰۴ (گزارش نهایی حسابرسی شده)</option> |
| 92 | <option value="1403">📅 سال ۱۴۰۳ (گزارش نهایی حسابرسی شده)</option> |
| 93 | <option value="1402">📅 سال ۱۴۰۲ (گزارش نهایی حسابرسی شده)</option> |
| 94 | </select> |
| 95 | </div> |
| 96 | </div> |
| 97 | |
| 98 | <div class="flex items-center gap-1.5 overflow-x-auto pb-1 pt-0.5 scrollbar-none border-t border-slate-800"> |
| 99 | <button onclick="switchTab('AUDITOR')" id="tab-AUDITOR" class="report-tab px-3 py-1.5 rounded-lg text-[11px] font-bold transition-all whitespace-nowrap bg-indigo-600 text-white shadow-md">⚖️ گزارش حسابرس و AI</button> |
| 100 | <button onclick="switchTab('BS')" id="tab-BS" class="report-tab px-3 py-1.5 rounded-lg text-[11px] font-bold transition-all whitespace-nowrap text-slate-300 hover:bg-slate-800">📋 ترازنامه</button> |
| 101 | <button onclick="switchTab('IS')" id="tab-IS" class="report-tab px-3 py-1.5 rounded-lg text-[11px] font-bold transition-all whitespace-nowrap text-slate-300 hover:bg-slate-800">📈 سود و زیان</button> |
| 102 | <button onclick="switchTab('EQUITY')" id="tab-EQUITY" class="report-tab px-3 py-1.5 rounded-lg text-[11px] font-bold transition-all whitespace-nowrap text-slate-300 hover:bg-slate-800">📊 حقوق مالکانه</button> |
| 103 | <button onclick="switchTab('CF')" id="tab-CF" class="report-tab px-3 py-1.5 rounded-lg text-[11px] font-bold transition-all whitespace-nowrap text-slate-300 hover:bg-slate-800">🔄 جریانهای نقدی</button> |
| 104 | <button onclick="switchTab('MAPPING')" id="tab-MAPPING" class="report-tab px-3 py-1.5 rounded-lg text-[11px] font-bold transition-all whitespace-nowrap text-purple-400 hover:bg-slate-800">🔗 موتور نگاشت (O/Oe/E)</button> |
| 105 | <button onclick="switchTab('UPLOAD')" id="tab-UPLOAD" class="report-tab px-3 py-1.5 rounded-lg text-[11px] font-bold transition-all whitespace-nowrap text-emerald-400 hover:bg-slate-800">☁️ ایجاد سال جدید (1405)</button> |
| 106 | </div> |
| 107 | </div> |
| 108 | </header> |
| 109 | |
| 110 | <main class="flex-1 p-3 md:p-6 max-w-7xl mx-auto w-full space-y-4"> |
| 111 | <div id="tabContent" class="min-h-[400px]"></div> |
| 112 | </main> |
| 113 | </div> |
| 114 | |
| 115 | <!-- ========================================== |
| 116 | محیط پیشنمایش و چاپ (Print Wrapper) |
| 117 | ========================================== --> |
| 118 | <div id="print-wrapper"> |
| 119 | <div class="print-controls bg-slate-900 p-4 sticky top-0 z-50 flex justify-between items-center shadow-2xl border-b-4 border-emerald-500"> |
| 120 | <div class="text-white font-bold flex items-center gap-2"> |
| 121 | <span class="text-2xl">🖨️</span> |
| 122 | <span>پیشنمایش پکیج نهایی - آماده ارسال به پرینتر</span> |
| 123 | </div> |
| 124 | <div class="flex gap-3"> |
| 125 | <button onclick="closePrintPreview()" class="bg-rose-600 hover:bg-rose-500 text-white px-5 py-2 rounded-lg font-bold transition-all">✖ لغو و بازگشت</button> |
| 126 | <button onclick="window.print()" class="bg-emerald-600 hover:bg-emerald-500 text-white px-6 py-2 rounded-lg font-bold transition-all shadow-lg ring-2 ring-emerald-400">✓ چاپ نهایی (Print)</button> |
| 127 | </div> |
| 128 | </div> |
| 129 | <div id="print-pages-container"></div> |
| 130 | </div> |
| 131 | |
| 132 | <!-- ========================================== |
| 133 | Core JavaScript & Database |
| 134 | ========================================== --> |
| 135 | <script> |
| 136 | // State |
| 137 | let currentCompanyId = 'C_GAS_TRANS'; |
| 138 | let currentYear = '1404'; |
| 139 | let currentTab = 'AUDITOR'; |
| 140 | |
| 141 | // --------------------------------------------------------- |
| 142 | // DATABASE (The Single Source of Truth from PDFs & CSVs) |
| 143 | // --------------------------------------------------------- |
| 144 | const DB = { |
| 145 | 'C_GAS_TRANS': { |
| 146 | '1404': { |
| 147 | hasRealData: true, |
| 148 | auditorOpinion: 'مقبول (با بندهای تاکید بر مطلب خاص)', |
| 149 | auditorClauses: [ |
| 150 | { type: 'تاکید بر مطلب خاص', title: 'بند ۴: مطالبات و بدهیها', desc: 'همانگونه که در یادداشت ۱۸ منعکس است، تعیین تکلیف قطعی صورتحسابهای متقابل با شرکت ملی گاز نیازمند تسویه نهایی است.' }, |
| 151 | { type: 'تاکید بر مطلب خاص', title: 'بند ۵: وضعیت مالیاتی', desc: 'برگ تشخیص مالیات عملکرد و ارزش افزوده سالهای ۱۴۰۰ و ۱۴۰۱ صادر شده و شرکت در حال پیگیری در هیاتهای حل اختلاف مالیاتی میباشد.' }, |
| 152 | { type: 'تاکید بر مطلب خاص', title: 'بند ۶: اموال طرحهای عمرانی', desc: 'انتقال اموال مرتبط با خط لوله ششم سراسری (BOT) از طرف شرکت مهندسی توسعه گاز قطعی شده و به عنوان تعدیلات سنواتی در حقوق مالکانه اعمال گردید.' } |
| 153 | ], |
| 154 | signatures: [ |
| 155 | { name: 'پیمان خضرایی', role: 'نایب رئیس هیئت مدیره و مدیرعامل' }, |
| 156 | { name: 'مسعود زردویان', role: 'رئیس هیئت مدیره' }, |
| 157 | { name: 'سعید نفری اقدم', role: 'عضو هیئت مدیره و مدیر مالی' } |
| 158 | ], |
| 159 | BS: { |
| 160 | '101': { title: 'داراییهای ثابت مشهود', ycur: 673740637, ycomp1: 502938206, ycomp2: 429540560 }, |
| 161 | '102': { title: 'داراییهای نامشهود', ycur: 242194, ycomp1: 216237, ycomp2: 214276 }, |
| 162 | '103': { title: 'دریافتنیهای بلندمدت', ycur: 8310168, ycomp1: 10811230, ycomp2: 6652479 }, |
| 163 | '201': { title: 'پیشپرداختها', ycur: 6839535, ycomp1: 3354446, ycomp2: 8000766 }, |
| 164 | '202': { title: 'موجودی مواد و کالا', ycur: 11273650, ycomp1: 8305043, ycomp2: 6818189 }, |
| 165 | '203': { title: 'دریافتنیهای کوتاهمدت', ycur: 13386398, ycomp1: 14980468, ycomp2: 15993056 }, |
| 166 | '204': { title: 'موجودی نقد', ycur: 19951136, ycomp1: 3368287, ycomp2: 2134188 }, |
| 167 | '301': { title: 'سرمایه ثبت شده', ycur: 20000000, ycomp1: 20000000, ycomp2: 20000000 }, |
| 168 | '302': { title: 'افزایش سرمایه در جریان', ycur: 0, ycomp1: 0, ycomp2: 14069826 }, |
| 169 | '303': { title: 'اندوخته قانونی', ycur: 1614, ycomp1: 1614, ycomp2: 1614 }, |
| 170 | '304': { title: 'زیان انباشته', ycur: -203887074, ycomp1: -124518176, ycomp2: -110226573 }, |
| 171 | '401': { title: 'پرداختنیهای بلندمدت', ycur: 630414220, ycomp1: 466724525, ycomp2: 419375071 }, |
| 172 | '402': { title: 'ذخیره مزایای پایان خدمت', ycur: 133078121, ycomp1: 94199107, ycomp2: 77644296 }, |
| 173 | '501': { title: 'پرداختنیهای جاری', ycur: 145341976, ycomp1: 83315373, ycomp2: 46997254 }, |
| 174 | '502': { title: 'مالیات پرداختنی', ycur: 8833412, ycomp1: 4285509, ycomp2: 1363294 }, |
| 175 | '503': { title: 'پیشدریافتها', ycur: 61449, ycomp1: 65965, ycomp2: 135627 } |
| 176 | }, |
| 177 | IS: { |
| 178 | '601': { title: 'درآمدهای عملیاتی', cur: 243097686, comp: 174585508 }, |
| 179 | '602': { title: 'بهای تمام شده درآمدهای عملیاتی', cur: -245897444, comp: -176383618 }, |
| 180 | '603': { title: 'هزینههای فروش، اداری و عمومی', cur: -62814143, comp: -25354498 }, |
| 181 | '604': { title: 'سایر درآمدهای عملیاتی', cur: 1543514, comp: 1085594 }, |
| 182 | '605': { title: 'سایر درآمدها و هزینههای غیرعملیاتی', cur: -10601182, comp: 627800 }, |
| 183 | '606': { title: 'هزینه مالیات بر درآمد', cur: -4697329, comp: -2922215 } |
| 184 | }, |
| 185 | CF: { |
| 186 | '701': { title: 'نقد حاصل از عملیات', cur: 99230533, comp: 83057773 }, |
| 187 | '702': { title: 'پرداختهای نقدی بابت مالیات', cur: -149426, comp: 0 }, |
| 188 | '801': { title: 'خرید داراییهای ثابت مشهود', cur: -82458602, comp: -81875240 }, |
| 189 | '802': { title: 'خرید داراییهای نامشهود', cur: -52212, comp: -23890 } |
| 190 | }, |
| 191 | EQ: [ |
| 192 | { title: 'مانده در ۱۴۰۳/۰۱/۰۱', c1: '-', c2: 14069826, c3: -38949540, total: -23264098 }, |
| 193 | { title: 'اصلاح اشتباهات (خط ۶ BOT)', c1: '-', c2: '-', c3: -73020980, total: -73020980 }, |
| 194 | { title: 'مانده تجدید ارائه شده در ۱۴۰۳/۰۱/۰۱', c1: '-', c2: 14069826, c3: -110226573, total: -76155133, highlight: true }, |
| 195 | { title: 'زیان خالص تجدید ارائه شده سال ۱۴۰۳', c1: '-', c2: '-', c3: -28361429, total: -28361429 }, |
| 196 | { title: 'ثبت افزایش سرمایه', c1: 20000000, c2: -14069826, c3: '-', total: 5930174 }, |
| 197 | { title: 'مانده در ۱۴۰۳/۱۲/۳۰', c1: 20000000, c2: '-', c3: -124518176, total: -104516562, highlight: true }, |
| 198 | { title: 'زیان خالص سال مالی ۱۴۰۴', c1: '-', c2: '-', c3: -79368898, total: -79368898 }, |
| 199 | { title: 'مانده در پایان سال مالی ۱۴۰۴/۱۲/۲۹', c1: 20000000, c2: '-', c3: -203887074, total: -183885460, highlight: true } |
| 200 | ] |
| 201 | }, |
| 202 | '1403': { |
| 203 | hasRealData: true, |
| 204 | auditorOpinion: 'مقبول (با بند تاکید)', |
| 205 | auditorClauses: [{ type: 'تاکید بر مطلب خاص', title: 'بند ۴', desc: 'مغایرت حسابهای فیمابین با شرکت ملی گاز نیازمند رفع میباشد.' }], |
| 206 | signatures: [ |
| 207 | { name: 'مسعود زردویان', role: 'رئیس هیئت مدیره' }, |
| 208 | { name: 'پیمان خضرایی', role: 'نایب رئیس هیئت مدیره و مدیرعامل' }, |
| 209 | { name: 'سعید نفری اقدم', role: 'عضو هیئت مدیره و مدیر مالی' } |
| 210 | ], |
| 211 | BS: { |
| 212 | '101': { title: 'داراییهای ثابت مشهود', ycur: 502938206, ycomp1: 429540560, ycomp2: 380000000 }, |
| 213 | '102': { title: 'داراییهای نامشهود', ycur: 216237, ycomp1: 214276, ycomp2: 200000 }, |
| 214 | '103': { title: 'دریافتنیهای بلندمدت', ycur: 10811230, ycomp1: 6652479, ycomp2: 5000000 }, |
| 215 | '201': { title: 'پیشپرداختها', ycur: 3354446, ycomp1: 8000766, ycomp2: 6000000 }, |
| 216 | '202': { title: 'موجودی مواد و کالا', ycur: 8305043, ycomp1: 6818189, ycomp2: 5500000 }, |
| 217 | '203': { title: 'دریافتنیهای کوتاهمدت', ycur: 14980468, ycomp1: 15993056, ycomp2: 12000000 }, |
| 218 | '204': { title: 'موجودی نقد', ycur: 3368287, ycomp1: 2134188, ycomp2: 1800000 }, |
| 219 | '301': { title: 'سرمایه ثبت شده', ycur: 20000000, ycomp1: 20000000, ycomp2: 20000000 }, |
| 220 | '302': { title: 'افزایش سرمایه در جریان', ycur: 0, ycomp1: 14069826, ycomp2: 0 }, |
| 221 | '303': { title: 'اندوخته قانونی', ycur: 1614, ycomp1: 1614, ycomp2: 1614 }, |
| 222 | '304': { title: 'زیان انباشته', ycur: -124518176, ycomp1: -110226573, ycomp2: -95000000 }, |
| 223 | '401': { title: 'پرداختنیهای بلندمدت', ycur: 466724525, ycomp1: 419375071, ycomp2: 380000000 }, |
| 224 | '402': { title: 'ذخیره مزایای پایان خدمت', ycur: 94199107, ycomp1: 77644296, ycomp2: 65000000 }, |
| 225 | '501': { title: 'پرداختنیهای جاری', ycur: 83315373, ycomp1: 46997254, ycomp2: 38000000 }, |
| 226 | '502': { title: 'مالیات پرداختنی', ycur: 4285509, ycomp1: 1363294, ycomp2: 1000000 }, |
| 227 | '503': { title: 'پیشدریافتها', ycur: 65965, ycomp1: 135627, ycomp2: 100000 } |
| 228 | }, |
| 229 | IS: { |
| 230 | '601': { title: 'درآمدهای عملیاتی', cur: 174585508, comp: 123297650 }, |
| 231 | '602': { title: 'بهای تمام شده درآمدهای عملیاتی', cur: -157476581, comp: -123355486 }, |
| 232 | '603': { title: 'هزینههای فروش، اداری و عمومی', cur: -25354498, comp: -19618654 }, |
| 233 | '604': { title: 'سایر درآمدهای عملیاتی', cur: 1085594, comp: 1421110 }, |
| 234 | '605': { title: 'سایر درآمدها و هزینههای غیرعملیاتی', cur: 1713394, comp: 2545735 }, |
| 235 | '606': { title: 'هزینه مالیات بر درآمد', cur: -2922215, comp: 0 } |
| 236 | }, |
| 237 | CF: { |
| 238 | '701': { title: 'نقد حاصل از عملیات', cur: 83057772, comp: 29242666 }, |
| 239 | '801': { title: 'خرید داراییهای ثابت مشهود', cur: -81875239, comp: -33462659 } |
| 240 | }, |
| 241 | EQ: [ |
| 242 | { title: 'مانده در ۱۴۰۲/۰۱/۰۱', c1: 20000000, c2: '-', c3: -57311335, total: -37309721 }, |
| 243 | { title: 'مانده در ۱۴۰۲/۱۲/۲۹', c1: 20000000, c2: 14069826, c3: -110226573, total: -76156747, highlight: true }, |
| 244 | { title: 'زیان خالص سال ۱۴۰۳', c1: '-', c2: '-', c3: -9454392, total: -9454392 }, |
| 245 | { title: 'مانده پایان سال ۱۴۰۳/۱۲/۳۰', c1: 20000000, c2: '-', c3: -124518176, total: -104518176, highlight: true } |
| 246 | ] |
| 247 | }, |
| 248 | '1402': { |
| 249 | hasRealData: true, |
| 250 | auditorOpinion: 'مقبول', |
| 251 | signatures: [ |
| 252 | { name: 'ابوالفضل وروانی فراهانی', role: 'رئیس هیئت مدیره' }, |
| 253 | { name: 'غلامعباس حسینی', role: 'نایب رئیس هیئت مدیره و مدیرعامل' } |
| 254 | ], |
| 255 | BS: { |
| 256 | '101': { title: 'داراییهای ثابت مشهود', ycur: 429540560, ycomp1: 380000000, ycomp2: null }, |
| 257 | '102': { title: 'داراییهای نامشهود', ycur: 214276, ycomp1: 200000, ycomp2: null }, |
| 258 | '103': { title: 'دریافتنیهای بلندمدت', ycur: 6652479, ycomp1: 5000000, ycomp2: null }, |
| 259 | '201': { title: 'پیشپرداختها', ycur: 8000766, ycomp1: 6000000, ycomp2: null }, |
| 260 | '202': { title: 'موجودی مواد و کالا', ycur: 6818189, ycomp1: 5500000, ycomp2: null }, |
| 261 | '203': { title: 'دریافتنیهای کوتاهمدت', ycur: 15993056, ycomp1: 12000000, ycomp2: null }, |
| 262 | '204': { title: 'موجودی نقد', ycur: 2134188, ycomp1: 1800000, ycomp2: null }, |
| 263 | '301': { title: 'سرمایه ثبت شده', ycur: 20000000, ycomp1: 20000000, ycomp2: null }, |
| 264 | '302': { title: 'افزایش سرمایه در جریان', ycur: 14069826, ycomp1: 0, ycomp2: null }, |
| 265 | '303': { title: 'اندوخته قانونی', ycur: 1614, ycomp1: 1614, ycomp2: null }, |
| 266 | '304': { title: 'زیان انباشته', ycur: -110226573, ycomp1: -95000000, ycomp2: null }, |
| 267 | '401': { title: 'پرداختنیهای بلندمدت', ycur: 419375071, ycomp1: 380000000, ycomp2: null }, |
| 268 | '402': { title: 'ذخیره مزایای پایان خدمت', ycur: 77644296, ycomp1: 65000000, ycomp2: null }, |
| 269 | '501': { title: 'پرداختنیهای جاری', ycur: 46997254, ycomp1: 38000000, ycomp2: null }, |
| 270 | '502': { title: 'مالیات پرداختنی', ycur: 1363294, ycomp1: 1000000, ycomp2: null }, |
| 271 | '503': { title: 'پیشدریافتها', ycur: 135627, ycomp1: 100000, ycomp2: null } |
| 272 | }, |
| 273 | IS: { |
| 274 | '601': { title: 'درآمدهای عملیاتی', cur: 123297650, comp: 110816554 }, |
| 275 | '602': { title: 'بهای تمام شده درآمدهای عملیاتی', cur: -123355486, comp: -105604143 }, |
| 276 | '603': { title: 'هزینههای فروش، اداری و عمومی', cur: -19618654, comp: -16066043 }, |
| 277 | '604': { title: 'سایر درآمدهای عملیاتی', cur: 1421110, comp: 222669 }, |
| 278 | '605': { title: 'سایر درآمدها و هزینههای غیرعملیاتی', cur: 2545735, comp: 1109158 }, |
| 279 | '606': { title: 'هزینه مالیات بر درآمد', cur: 0, comp: -1068664 } |
| 280 | }, |
| 281 | CF: { |
| 282 | '701': { title: 'نقد حاصل از عملیات', cur: 29242666, comp: 26068197 }, |
| 283 | '801': { title: 'خرید داراییهای ثابت مشهود', cur: -33462659, comp: -21323048 } |
| 284 | }, |
| 285 | EQ: [ |
| 286 | { title: 'مانده در ۱۴۰۱/۰۱/۰۱', c1: 20000000, c2: '-', c3: -13252899, total: 6748715 }, |
| 287 | { title: 'زیان خالص سال ۱۴۰۲', c1: '-', c2: '-', c3: -15709645, total: -15709645 }, |
| 288 | { title: 'مانده در ۱۴۰۲/۱۲/۲۹', c1: 20000000, c2: 14069826, c3: -110226573, total: -90226573, highlight: true } |
| 289 | ] |
| 290 | } |
| 291 | }, |
| 292 | 'C_SISTAN': { |
| 293 | '1402': { |
| 294 | hasRealData: true, |
| 295 | auditorOpinion: 'مقبول', |
| 296 | auditorClauses: [{ type: 'تاکید بر مطلب', title: 'بند ۴', desc: 'عدم تحقق بودجه تخصیصی گازرسانی چابهار.' }], |
| 297 | signatures: [ |
| 298 | { name: 'حسین سلیمی', role: 'رئیس هیئت مدیره' }, |
| 299 | { name: 'محمدرضا میرشکاری', role: 'نایب رئیس هیئت مدیره و مدیرعامل' }, |
| 300 | { name: 'علی خسروی', role: 'عضو هیئت مدیره' } |
| 301 | ], |
| 302 | BS: { |
| 303 | '101': { title: 'داراییهای ثابت مشهود', ycur: 6785191, ycomp1: 5214080, ycomp2: null }, |
| 304 | '102': { title: 'داراییهای نامشهود', ycur: 210, ycomp1: 210, ycomp2: null }, |
| 305 | '103': { title: 'دریافتنیهای بلندمدت', ycur: 0, ycomp1: 0, ycomp2: null }, |
| 306 | '201': { title: 'پیشپرداختها', ycur: 399120, ycomp1: 280000, ycomp2: null }, |
| 307 | '202': { title: 'موجودی مواد و کالا', ycur: 74200, ycomp1: 65000, ycomp2: null }, |
| 308 | '203': { title: 'دریافتنیهای کوتاهمدت', ycur: 2765672, ycomp1: 2100000, ycomp2: null }, |
| 309 | '204': { title: 'موجودی نقد', ycur: 43730, ycomp1: 31000, ycomp2: null }, |
| 310 | '301': { title: 'سرمایه ثبت شده', ycur: 10000, ycomp1: 10000, ycomp2: null }, |
| 311 | '302': { title: 'افزایش سرمایه در جریان', ycur: 0, ycomp1: 0, ycomp2: null }, |
| 312 | '303': { title: 'اندوخته قانونی', ycur: 0, ycomp1: 0, ycomp2: null }, |
| 313 | '304': { title: 'زیان انباشته', ycur: -1949156, ycomp1: -1529841, ycomp2: null }, |
| 314 | '401': { title: 'پرداختنیهای بلندمدت', ycur: 5319747, ycomp1: 4100000, ycomp2: null }, |
| 315 | '402': { title: 'ذخیره مزایای پایان خدمت', ycur: 111860, ycomp1: 85000, ycomp2: null }, |
| 316 | '501': { title: 'پرداختنیهای جاری', ycur: 6575672, ycomp1: 5025131, ycomp2: null }, |
| 317 | '502': { title: 'مالیات پرداختنی', ycur: 0, ycomp1: 0, ycomp2: null }, |
| 318 | '503': { title: 'پیشدریافتها', ycur: 0, ycomp1: 0, ycomp2: null } |
| 319 | }, |
| 320 | IS: { |
| 321 | '601': { title: 'درآمدهای عملیاتی', cur: 1880816, comp: 1420000 }, |
| 322 | '602': { title: 'بهای تمام شده درآمدهای عملیاتی', cur: -1950000, comp: -1480000 }, |
| 323 | '603': { title: 'هزینههای عمومی و اداری', cur: -350131, comp: -280000 }, |
| 324 | '604': { title: 'سایر درآمدهای عملیاتی', cur: 0, comp: 0 }, |
| 325 | '605': { title: 'سایر درآمدها و هزینههای غیرعملیاتی', cur: 0, comp: 0 }, |
| 326 | '606': { title: 'هزینه مالیات بر درآمد', cur: 0, comp: 0 } |
| 327 | }, |
| 328 | CF: { |
| 329 | '701': { title: 'نقد حاصل از عملیات', cur: 80000, comp: 50000 }, |
| 330 | '801': { title: 'خرید داراییهای ثابت مشهود', cur: -60000, comp: -40000 } |
| 331 | }, |
| 332 | EQ: [ |
| 333 | { title: 'مانده در ۱۴۰۱/۱۲/۲۹', c1: 10000, c2: '-', c3: -1529841, total: -1519841 }, |
| 334 | { title: 'زیان خالص سال ۱۴۰۲', c1: '-', c2: '-', c3: -419315, total: -419315 }, |
| 335 | { title: 'مانده پایان سال ۱۴۰۲/۱۲/۲۹', c1: 10000, c2: '-', c3: -1949156, total: -1939156, highlight: true } |
| 336 | ] |
| 337 | } |
| 338 | } |
| 339 | }; |
| 340 | |
| 341 | const MAPPING_RULES = [ |
| 342 | { code: '1101', name: 'بهای تمام شده درآمدهای عملیاتی', note: '6', type: 'O (مبدأ)' }, |
| 343 | { code: '8348', name: 'پرداختنی های تجاری و غیر تجاری (جاری)', note: '19-1', type: 'E (ورود)' }, |
| 344 | { code: '8348', name: 'پرداختنی بلند مدت (اشخاص وابسته)', note: '19-2', type: 'Oe (خروج)' }, |
| 345 | { code: '8161', name: 'پیش پرداخت های سرمایه ای', note: '10', type: 'O (مبدأ)' }, |
| 346 | { code: '118901', name: 'پروژههای در جریان تکمیل (BOT)', note: '22', type: 'E (ورود)' } |
| 347 | ]; |
| 348 | |
| 349 | const COMPANIES_INFO = { |
| 350 | 'C_GAS_TRANS': 'شرکت انتقال گاز ایران (سهامی خاص)', |
| 351 | 'C_SISTAN': 'شرکت گاز استان سیستان و بلوچستان' |
| 352 | }; |
| 353 | |
| 354 | // --- UTILS --- |
| 355 | function fmt(num) { |
| 356 | if (num === null || num === undefined || num === '-' || num === 0) return num === 0 ? '۰' : '-'; |
| 357 | const absFormatted = Math.abs(num).toLocaleString('fa-IR'); |
| 358 | return num < 0 ? `(${absFormatted})` : absFormatted; |
| 359 | } |
| 360 | |
| 361 | function checkDataAvailable(compId, year) { |
| 362 | return !!(DB[compId] && DB[compId][year] && DB[compId][year].hasRealData); |
| 363 | } |
| 364 | |
| 365 | // --------------------------------------------------------- |
| 366 | // UI RENDER ENGINE |
| 367 | // --------------------------------------------------------- |
| 368 | function render() { |
| 369 | document.getElementById('companySelector').value = currentCompanyId; |
| 370 | document.getElementById('yearSelector').value = currentYear; |
| 371 | |
| 372 | const tabs = ['AUDITOR', 'BS', 'IS', 'EQUITY', 'CF', 'MAPPING', 'UPLOAD']; |
| 373 | tabs.forEach(t => { |
| 374 | const btn = document.getElementById(`tab-${t}`); |
| 375 | if (!btn) return; |
| 376 | |
| 377 | if (t === currentTab) { |
| 378 | btn.className = "report-tab px-3 py-1.5 rounded-lg text-[11px] font-bold transition-all whitespace-nowrap text-white shadow-md " + |
| 379 | (t === 'AUDITOR' ? 'bg-indigo-600' : (t === 'MAPPING' ? 'bg-purple-600' : (t === 'UPLOAD' ? 'bg-emerald-600' : 'bg-blue-600'))); |
| 380 | } else { |
| 381 | btn.className = "report-tab px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all whitespace-nowrap hover:bg-slate-800 border border-transparent " + |
| 382 | (t === 'MAPPING' ? 'text-purple-400 bg-purple-950/20' : (t === 'UPLOAD' ? 'text-emerald-400 bg-emerald-950/20' : 'text-slate-300')); |
| 383 | } |
| 384 | }); |
| 385 | |
| 386 | const target = document.getElementById('tabContent'); |
| 387 | const isDataVerified = checkDataAvailable(currentCompanyId, currentYear); |
| 388 | |
| 389 | if (!isDataVerified && currentTab !== 'UPLOAD' && currentTab !== 'MAPPING') { |
| 390 | target.innerHTML = ` |
| 391 | <div class="bg-slate-900 border border-slate-800 rounded-2xl p-8 text-center space-y-4 my-6 shadow-2xl"> |
| 392 | <div class="p-4 bg-amber-500/10 rounded-2xl text-amber-400 w-16 h-16 mx-auto flex items-center justify-center text-3xl">⚠️</div> |
| 393 | <h3 class="font-bold text-white">گزارش نهایی سال ${currentYear} بارگذاری نشده است!</h3> |
| 394 | <p class="text-xs text-slate-400">سیستم تنها گزارشات قطعی حسابرسی شده را نمایش میدهد. لطفا در محیط Jules تراز خام را ایمپورت کنید.</p> |
| 395 | <button onclick="switchTab('UPLOAD')" class="bg-emerald-600 text-white px-4 py-2 rounded-lg font-bold text-xs mt-3">آپلود تراز خام (ایجاد سال جدید)</button> |
| 396 | </div> |
| 397 | `; |
| 398 | return; |
| 399 | } |
| 400 | |
| 401 | const data = DB[currentCompanyId]?.[currentYear]; |
| 402 | |
| 403 | if (currentTab === 'AUDITOR') renderAuditorAndAI(target, data); |
| 404 | else if (currentTab === 'BS') renderBS(target, data); |
| 405 | else if (currentTab === 'IS') renderIS(target, data); |
| 406 | else if (currentTab === 'EQUITY') renderEquity(target, data); |
| 407 | else if (currentTab === 'CF') renderCF(target, data); |
| 408 | else if (currentTab === 'MAPPING') renderMapping(target); |
| 409 | else if (currentTab === 'UPLOAD') renderUploadForm(target); |
| 410 | } |
| 411 | |
| 412 | // --- WEB VIEWS --- |
| 413 | |
| 414 | function renderAuditorAndAI(target, data) { |
| 415 | const bs = data.BS; const is = data.IS; |
| 416 | const curAssets = (bs['201'].ycur||0) + (bs['202'].ycur||0) + (bs['203'].ycur||0) + (bs['204'].ycur||0); |
| 417 | const curLiab = (bs['501'].ycur||0) + (bs['502'].ycur||0) + (bs['503'].ycur||0); |
| 418 | const totalAssets = curAssets + (bs['101'].ycur||0) + (bs['102'].ycur||0) + (bs['103'].ycur||0); |
| 419 | const totalLiab = curLiab + (bs['401'].ycur||0) + (bs['402'].ycur||0); |
| 420 | const revenue = is['601'].cur + (is['604'].cur||0); |
| 421 | const netProfit = revenue + is['602'].cur + is['603'].cur + (is['605']?.cur||0) + (is['606']?.cur||0); |
| 422 | |
| 423 | const currentRatio = curLiab ? (curAssets / curLiab).toFixed(2) : 0; |
| 424 | const debtRatio = totalAssets ? ((totalLiab / totalAssets) * 100).toFixed(1) : 0; |
| 425 | const netMargin = revenue ? ((netProfit / revenue) * 100).toFixed(1) : 0; |
| 426 | |
| 427 | const crColor = currentRatio >= 1 ? 'emerald' : 'rose'; |
| 428 | const drColor = debtRatio < 60 ? 'emerald' : (debtRatio < 80 ? 'amber' : 'rose'); |
| 429 | const nmColor = netMargin > 0 ? 'emerald' : 'rose'; |
| 430 | |
| 431 | let aiText = `بر اساس پایش هوشمند ترازنامه، نسبت جاری شرکت معادل <b>${currentRatio}</b> میباشد که نشاندهنده ${currentRatio >= 1 ? 'پوشش مناسب' : 'ریسک در'} نقدینگی است. نسبت بدهی به دارایی <b>${debtRatio}٪</b> است که بیانگر سطح ${debtRatio > 80 ? 'بالای' : 'متعادل'} اهرم مالی میباشد. حاشیه سود خالص <b>${netMargin}٪</b> برآورد شده که نیازمند ${netMargin < 0 ? 'مدیریت هزینهها' : 'حفظ ثبات رویه'} است.`; |
| 432 | |
| 433 | target.innerHTML = ` |
| 434 | <div class="grid grid-cols-1 lg:grid-cols-12 gap-4"> |
| 435 | <div class="lg:col-span-7 bg-slate-900 border border-slate-800 rounded-xl p-5 shadow-xl"> |
| 436 | <div class="border-b border-slate-800 pb-4 mb-4 flex items-center justify-between"> |
| 437 | <div> |
| 438 | <h2 class="font-bold text-white text-sm">گزارش حسابرس مستقل و بازرس قانونی</h2> |
| 439 | <h3 class="text-[11px] text-slate-400 mt-1">به مجمع عمومی صاحبان سهام ${COMPANIES_INFO[currentCompanyId]}</h3> |
| 440 | </div> |
| 441 | <span class="text-xs font-mono bg-indigo-950 text-indigo-300 px-2 py-1 rounded">سال ${currentYear}</span> |
| 442 | </div> |
| 443 | <div class="bg-slate-950 border border-slate-800 p-4 rounded-lg mb-4"> |
| 444 | <h4 class="font-bold text-indigo-400 text-xs mb-2">اظهارنظر حسابرس:</h4> |
| 445 | <p class="text-[11px] leading-6 text-slate-300 text-justify">به نظر این سازمان، صورتهای مالی یاد شده، وضعیت مالی شرکت را در تاریخ پایان اسفند ${currentYear}، از تمام جنبههای بااهمیت، طبق استانداردهای حسابداری به نحو مطلوب نشان میدهد.</p> |
| 446 | <div class="mt-3 inline-block bg-emerald-950/40 border border-emerald-800 text-emerald-400 px-3 py-1.5 rounded font-bold text-xs"> |
| 447 | نتیجه نهایی: ${data.auditorOpinion} |
| 448 | </div> |
| 449 | </div> |
| 450 | ${data.auditorClauses ? ` |
| 451 | <div class="space-y-2"> |
| 452 | <h4 class="font-bold text-amber-400 text-xs mb-2">تاکید بر مطلب خاص:</h4> |
| 453 | ${data.auditorClauses.map(c => ` |
| 454 | <div class="border-r-2 border-amber-500 bg-slate-950/50 p-3 rounded-l-lg"> |
| 455 | <h5 class="font-bold text-white text-[11px] mb-1">${c.title}</h5> |
| 456 | <p class="text-[11px] text-slate-400 leading-5 text-justify">${c.desc}</p> |
| 457 | </div> |
| 458 | `).join('')} |
| 459 | </div> |
| 460 | ` : ''} |
| 461 | </div> |
| 462 | |
| 463 | <!-- AI Dashboard --> |
| 464 | <div class="lg:col-span-5 bg-slate-900 border border-slate-800 rounded-xl p-5 shadow-xl flex flex-col"> |
| 465 | <div class="border-b border-slate-800 pb-3 mb-4 flex items-center gap-2"> |
| 466 | <div class="p-1.5 bg-purple-600/20 text-purple-400 rounded-lg">🤖</div> |
| 467 | <h2 class="font-bold text-white text-sm">داشبورد تحلیلی هوش مصنوعی (AI)</h2> |
| 468 | </div> |
| 469 | <div class="space-y-4 flex-1"> |
| 470 | <div class="bg-slate-950 p-3 rounded-lg border border-slate-800/50 flex justify-between items-center"> |
| 471 | <span class="text-[11px] text-slate-300 font-bold">نسبت نقدینگی (جاری)</span> |
| 472 | <span class="text-lg font-mono font-bold text-${crColor}-400">${currentRatio}</span> |
| 473 | </div> |
| 474 | <div class="bg-slate-950 p-3 rounded-lg border border-slate-800/50 flex justify-between items-center"> |
| 475 | <span class="text-[11px] text-slate-300 font-bold">نسبت بدهی به دارایی</span> |
| 476 | <span class="text-lg font-mono font-bold text-${drColor}-400">${debtRatio}٪</span> |
| 477 | </div> |
| 478 | <div class="bg-slate-950 p-3 rounded-lg border border-slate-800/50 flex justify-between items-center"> |
| 479 | <span class="text-[11px] text-slate-300 font-bold">حاشیه سود خالص</span> |
| 480 | <span class="text-lg font-mono font-bold text-${nmColor}-400">${netMargin}٪</span> |
| 481 | </div> |
| 482 | <div class="bg-purple-950/20 border border-purple-900/30 p-3.5 rounded-lg mt-4 flex-1"> |
| 483 | <p class="text-[11px] text-slate-300 leading-6 text-justify">${aiText}</p> |
| 484 | </div> |
| 485 | </div> |
| 486 | </div> |
| 487 | </div> |
| 488 | `; |
| 489 | } |
| 490 | |
| 491 | function renderBS(target, data) { |
| 492 | const bs = data.BS; |
| 493 | const is3Col = bs['101'].ycomp2 !== null && bs['101'].ycomp2 !== undefined; |
| 494 | const sumGr = (keys, col) => keys.reduce((a, k) => a + (bs[k][col] || 0), 0); |
| 495 | const ncAs = ['101','102','103']; const cAs = ['201','202','203','204']; |
| 496 | const eq = ['301','302','303','304']; const ncLi = ['401','402']; const cLi = ['501','502','503']; |
| 497 | |
| 498 | target.innerHTML = ` |
| 499 | <div class="space-y-4"> |
| 500 | <div class="grid grid-cols-1 lg:grid-cols-2 gap-4"> |
| 501 | <div class="bg-slate-900 border border-slate-800 rounded-xl p-4 shadow-xl overflow-x-auto"> |
| 502 | <div class="border-b border-slate-800 pb-2 mb-3 flex justify-between min-w-[320px]"> |
| 503 | <h3 class="font-bold text-blue-400 text-sm">داراییها</h3> |
| 504 | <div class="flex gap-2 text-[10px] font-mono text-slate-400 text-center"> |
| 505 | <span class="w-20 text-emerald-400">سال ${currentYear}</span><span class="w-20 text-amber-300">سال قبل</span>${is3Col ? `<span class="w-20">دو سال قبل</span>` : ''} |
| 506 | </div> |
| 507 | </div> |
| 508 | <div class="text-[10px] font-bold text-slate-500 bg-slate-950 px-2 py-1 mb-1 rounded min-w-[320px]">داراییهای غیرجاری</div> |
| 509 | ${ncAs.map(k => renderBSRow(bs[k], is3Col)).join('')} |
| 510 | <div class="flex justify-between text-xs font-bold text-blue-400 mt-1 mb-3 bg-blue-950/20 p-2 rounded min-w-[320px]"> |
| 511 | <span>جمع دارایی غیرجاری</span> |
| 512 | <div class="flex gap-2 text-center font-mono"><span class="w-20">${fmt(sumGr(ncAs, 'ycur'))}</span><span class="w-20 text-amber-300">${fmt(sumGr(ncAs, 'ycomp1'))}</span>${is3Col ? `<span class="w-20 text-slate-300">${fmt(sumGr(ncAs, 'ycomp2'))}</span>` : ''}</div> |
| 513 | </div> |
| 514 | <div class="text-[10px] font-bold text-slate-500 bg-slate-950 px-2 py-1 mb-1 rounded min-w-[320px]">داراییهای جاری</div> |
| 515 | ${cAs.map(k => renderBSRow(bs[k], is3Col)).join('')} |
| 516 | <div class="flex justify-between text-xs font-bold text-blue-400 mt-1 bg-blue-950/20 p-2 rounded min-w-[320px]"> |
| 517 | <span>جمع دارایی جاری</span> |
| 518 | <div class="flex gap-2 text-center font-mono"><span class="w-20">${fmt(sumGr(cAs, 'ycur'))}</span><span class="w-20 text-amber-300">${fmt(sumGr(cAs, 'ycomp1'))}</span>${is3Col ? `<span class="w-20 text-slate-300">${fmt(sumGr(cAs, 'ycomp2'))}</span>` : ''}</div> |
| 519 | </div> |
| 520 | <div class="flex justify-between text-sm font-bold text-emerald-400 mt-4 bg-emerald-950/20 border border-emerald-900/50 p-3 rounded-lg min-w-[320px]"> |
| 521 | <span>جمع کل داراییها</span> |
| 522 | <div class="flex gap-2 text-center font-mono"><span class="w-20">${fmt(sumGr([...ncAs, ...cAs], 'ycur'))}</span><span class="w-20 text-amber-300">${fmt(sumGr([...ncAs, ...cAs], 'ycomp1'))}</span>${is3Col ? `<span class="w-20 text-slate-300">${fmt(sumGr([...ncAs, ...cAs], 'ycomp2'))}</span>` : ''}</div> |
| 523 | </div> |
| 524 | </div> |
| 525 | |
| 526 | <div class="bg-slate-900 border border-slate-800 rounded-xl p-4 shadow-xl overflow-x-auto"> |
| 527 | <div class="border-b border-slate-800 pb-2 mb-3 flex justify-between min-w-[320px]"> |
| 528 | <h3 class="font-bold text-indigo-400 text-sm">حقوق مالکانه و بدهیها</h3> |
| 529 | <div class="flex gap-2 text-[10px] font-mono text-slate-400 text-center"> |
| 530 | <span class="w-20 text-emerald-400">سال ${currentYear}</span><span class="w-20 text-amber-300">سال قبل</span>${is3Col ? `<span class="w-20">دو سال قبل</span>` : ''} |
| 531 | </div> |
| 532 | </div> |
| 533 | <div class="text-[10px] font-bold text-slate-500 bg-slate-950 px-2 py-1 mb-1 rounded min-w-[320px]">حقوق مالکانه</div> |
| 534 | ${eq.map(k => renderBSRow(bs[k], is3Col)).join('')} |
| 535 | <div class="flex justify-between text-xs font-bold text-rose-400 mt-1 mb-3 bg-rose-950/20 p-2 rounded min-w-[320px]"> |
| 536 | <span>جمع حقوق مالکانه</span> |
| 537 | <div class="flex gap-2 text-center font-mono"><span class="w-20">${fmt(sumGr(eq, 'ycur'))}</span><span class="w-20 text-rose-400/80">${fmt(sumGr(eq, 'ycomp1'))}</span>${is3Col ? `<span class="w-20 text-rose-400/60">${fmt(sumGr(eq, 'ycomp2'))}</span>` : ''}</div> |
| 538 | </div> |
| 539 | <div class="text-[10px] font-bold text-slate-500 bg-slate-950 px-2 py-1 mb-1 rounded min-w-[320px]">بدهیهای غیرجاری</div> |
| 540 | ${ncLi.map(k => renderBSRow(bs[k], is3Col)).join('')} |
| 541 | <div class="flex justify-between text-xs font-bold text-indigo-400 mt-1 mb-3 bg-indigo-950/20 p-2 rounded min-w-[320px]"> |
| 542 | <span>جمع بدهی غیرجاری</span> |
| 543 | <div class="flex gap-2 text-center font-mono"><span class="w-20">${fmt(sumGr(ncLi, 'ycur'))}</span><span class="w-20 text-amber-300">${fmt(sumGr(ncLi, 'ycomp1'))}</span>${is3Col ? `<span class="w-20 text-slate-300">${fmt(sumGr(ncLi, 'ycomp2'))}</span>` : ''}</div> |
| 544 | </div> |
| 545 | <div class="text-[10px] font-bold text-slate-500 bg-slate-950 px-2 py-1 mb-1 rounded min-w-[320px]">بدهیهای جاری</div> |
| 546 | ${cLi.map(k => renderBSRow(bs[k], is3Col)).join('')} |
| 547 | <div class="flex justify-between text-xs font-bold text-indigo-400 mt-1 bg-indigo-950/20 p-2 rounded min-w-[320px]"> |
| 548 | <span>جمع بدهی جاری</span> |
| 549 | <div class="flex gap-2 text-center font-mono"><span class="w-20">${fmt(sumGr(cLi, 'ycur'))}</span><span class="w-20 text-amber-300">${fmt(sumGr(cLi, 'ycomp1'))}</span>${is3Col ? `<span class="w-20 text-slate-300">${fmt(sumGr(cLi, 'ycomp2'))}</span>` : ''}</div> |
| 550 | </div> |
| 551 | <div class="flex justify-between text-sm font-bold text-emerald-400 mt-4 bg-emerald-950/20 border border-emerald-900/50 p-3 rounded-lg min-w-[320px]"> |
| 552 | <span>جمع حقوق و بدهیها</span> |
| 553 | <div class="flex gap-2 text-center font-mono"><span class="w-20">${fmt(sumGr([...eq, ...ncLi, ...cLi], 'ycur'))}</span><span class="w-20 text-amber-300">${fmt(sumGr([...eq, ...ncLi, ...cLi], 'ycomp1'))}</span>${is3Col ? `<span class="w-20 text-slate-300">${fmt(sumGr([...eq, ...ncLi, ...cLi], 'ycomp2'))}</span>` : ''}</div> |
| 554 | </div> |
| 555 | </div> |
| 556 | </div> |
| 557 | </div> |
| 558 | `; |
| 559 | } |
| 560 | |
| 561 | function renderBSRow(row, is3Col) { |
| 562 | if (!row) return ''; |
| 563 | return ` |
| 564 | <div class="flex justify-between text-[11px] py-1.5 px-1 border-b border-slate-800/50 min-w-[320px]"> |
| 565 | <span class="text-slate-300">${row.title}</span> |
| 566 | <div class="flex gap-2 text-center font-mono font-bold"> |
| 567 | <span class="w-20 ${row.ycur < 0 ? 'text-rose-400' : 'text-white'}">${fmt(row.ycur)}</span> |
| 568 | <span class="w-20 ${row.ycomp1 < 0 ? 'text-rose-400/80' : 'text-amber-300/90'}">${fmt(row.ycomp1)}</span> |
| 569 | ${is3Col ? `<span class="w-20 ${row.ycomp2 < 0 ? 'text-rose-400/60' : 'text-slate-400'}">${fmt(row.ycomp2)}</span>` : ''} |
| 570 | </div> |
| 571 | </div> |
| 572 | `; |
| 573 | } |
| 574 | |
| 575 | function renderIS(target, data) { |
| 576 | const is = data.IS; |
| 577 | const grossCur = is['601'].cur + is['602'].cur; |
| 578 | const grossComp = is['601'].comp + is['602'].comp; |
| 579 | const opCur = grossCur + is['603'].cur + (is['604'].cur||0); |
| 580 | const opComp = grossComp + is['603'].comp + (is['604'].comp||0); |
| 581 | const netCur = opCur + (is['605']?.cur||0) + (is['606']?.cur||0); |
| 582 | const netComp = opComp + (is['605']?.comp||0) + (is['606']?.comp||0); |
| 583 | |
| 584 | target.innerHTML = ` |
| 585 | <div class="bg-slate-900 border border-slate-800 rounded-xl p-4 md:p-6 max-w-3xl mx-auto shadow-xl"> |
| 586 | <div class="border-b border-slate-800 pb-3 mb-4 flex justify-between"> |
| 587 | <h3 class="font-bold text-white text-sm">صورت سود و زیان جامع</h3> |
| 588 | <div class="flex gap-4 text-xs font-mono text-slate-400"><span class="w-24 text-emerald-400 text-left">سال ${currentYear}</span><span class="w-24 text-amber-300 text-left">سال قبل</span></div> |
| 589 | </div> |
| 590 | <div class="space-y-2 text-xs"> |
| 591 | <div class="flex justify-between py-2 border-b border-slate-800"><span>${is['601'].title}</span><div class="flex gap-4 font-mono font-bold"><span class="w-24 text-left text-emerald-400">${fmt(is['601'].cur)}</span><span class="w-24 text-left text-amber-300">${fmt(is['601'].comp)}</span></div></div> |
| 592 | <div class="flex justify-between py-2 border-b border-slate-800"><span>${is['602'].title}</span><div class="flex gap-4 font-mono font-bold"><span class="w-24 text-left text-rose-400">${fmt(is['602'].cur)}</span><span class="w-24 text-left text-rose-400/80">${fmt(is['602'].comp)}</span></div></div> |
| 593 | <div class="flex justify-between py-2.5 bg-slate-950 px-3 rounded-lg border border-slate-800 font-bold"><span class="text-blue-400">سود (زیان) ناخالص</span><div class="flex gap-4 font-mono"><span class="w-24 text-left ${grossCur<0?'text-rose-400':'text-blue-400'}">${fmt(grossCur)}</span><span class="w-24 text-left ${grossComp<0?'text-rose-400/80':'text-amber-300'}">${fmt(grossComp)}</span></div></div> |
| 594 | <div class="flex justify-between py-2 border-b border-slate-800 mt-2"><span>${is['603'].title}</span><div class="flex gap-4 font-mono font-bold"><span class="w-24 text-left text-rose-400">${fmt(is['603'].cur)}</span><span class="w-24 text-left text-rose-400/80">${fmt(is['603'].comp)}</span></div></div> |
| 595 | <div class="flex justify-between py-2 border-b border-slate-800"><span>${is['604']?.title||'-'}</span><div class="flex gap-4 font-mono font-bold"><span class="w-24 text-left text-emerald-400">${fmt(is['604']?.cur)}</span><span class="w-24 text-left text-amber-300">${fmt(is['604']?.comp)}</span></div></div> |
| 596 | <div class="flex justify-between py-2.5 bg-blue-950/30 px-3 rounded-lg border border-blue-900/50 font-bold"><span class="text-blue-300">سود (زیان) عملیاتی</span><div class="flex gap-4 font-mono"><span class="w-24 text-left ${opCur<0?'text-rose-400':'text-blue-300'}">${fmt(opCur)}</span><span class="w-24 text-left ${opComp<0?'text-rose-400/80':'text-amber-300'}">${fmt(opComp)}</span></div></div> |
| 597 | <div class="flex justify-between py-4 bg-rose-950/30 px-4 rounded-xl border border-rose-500/40 font-bold mt-4 text-sm"><span class="text-rose-400">زیان خالص سال مالی</span><div class="flex gap-4 font-mono"><span class="w-24 text-left text-rose-400">${fmt(netCur)}</span><span class="w-24 text-left text-rose-400/80">${fmt(netComp)}</span></div></div> |
| 598 | </div> |
| 599 | </div> |
| 600 | `; |
| 601 | } |
| 602 | |
| 603 | function renderEquity(target, data) { |
| 604 | const eqData = data.EQ; |
| 605 | target.innerHTML = ` |
| 606 | <div class="bg-slate-900 border border-slate-800 rounded-xl p-5 max-w-5xl mx-auto shadow-xl overflow-x-auto"> |
| 607 | <h3 class="font-bold text-white text-sm mb-4">صورت تغییرات در حقوق مالکانه (سال ${currentYear})</h3> |
| 608 | <table class="w-full text-right text-xs min-w-[600px]"> |
| 609 | <thead class="bg-slate-950 text-slate-400 border-b border-slate-800 font-bold"> |
| 610 | <tr><th class="p-2">شرح</th><th class="p-2">سرمایه</th><th class="p-2">در جریان</th><th class="p-2">زیان انباشته</th><th class="p-2 text-emerald-400">جمع کل</th></tr> |
| 611 | </thead> |
| 612 | <tbody class="divide-y divide-slate-800 font-mono text-slate-300"> |
| 613 | ${eqData.map(row => ` |
| 614 | <tr class="${row.highlight ? 'bg-slate-950/80 font-bold text-white' : ''}"> |
| 615 | <td class="p-2 font-sans ${row.highlight ? 'text-amber-400' : ''}">${row.title}</td> |
| 616 | <td class="p-2 ${row.c1 !== '-' ? 'text-emerald-400' : ''}">${fmt(row.c1)}</td> |
| 617 | <td class="p-2">${fmt(row.c2)}</td> |
| 618 | <td class="p-2 text-rose-400">${fmt(row.c3)}</td> |
| 619 | <td class="p-2 ${row.total < 0 ? 'text-rose-400' : 'text-emerald-400'} font-bold">${fmt(row.total)}</td> |
| 620 | </tr> |
| 621 | `).join('')} |
| 622 | </tbody> |
| 623 | </table> |
| 624 | </div> |
| 625 | `; |
| 626 | } |
| 627 | |
| 628 | function renderCF(target, data) { |
| 629 | const cf = data.CF; |
| 630 | const netOpCur = cf['701'].cur + (cf['702']?.cur||0); |
| 631 | const netOpComp = cf['701'].comp + (cf['702']?.comp||0); |
| 632 | |
| 633 | target.innerHTML = ` |
| 634 | <div class="bg-slate-900 border border-slate-800 rounded-xl p-6 max-w-3xl mx-auto shadow-xl"> |
| 635 | <h3 class="font-bold text-white text-sm mb-4 border-b border-slate-800 pb-2">صورت جریانهای نقدی</h3> |
| 636 | <div class="space-y-4 text-xs"> |
| 637 | <div class="space-y-2"> |
| 638 | <div class="font-bold text-blue-400 bg-slate-950 p-2 rounded">فعالیتهای عملیاتی</div> |
| 639 | <div class="flex justify-between py-1 px-2 border-b border-slate-800/50"><span>${cf['701'].title}</span><div class="flex gap-4 font-mono font-bold"><span class="w-24 text-left">${fmt(cf['701'].cur)}</span><span class="w-24 text-left text-amber-300/80">${fmt(cf['701'].comp)}</span></div></div> |
| 640 | <div class="flex justify-between py-2 px-2 bg-blue-950/20 font-bold text-emerald-400 rounded"><span>خالص جریان عملیاتی</span><div class="flex gap-4 font-mono"><span class="w-24 text-left">${fmt(netOpCur)}</span><span class="w-24 text-left">${fmt(netOpComp)}</span></div></div> |
| 641 | </div> |
| 642 | <div class="flex justify-between py-3 px-4 bg-emerald-950/30 border border-emerald-800/50 rounded-lg mt-4 font-bold text-sm"> |
| 643 | <span class="text-white">مانده موجودی نقد در پایان سال</span> |
| 644 | <div class="flex gap-4 font-mono text-emerald-400"><span class="w-24 text-left">${fmt(data.BS['204'].ycur)}</span><span class="w-24 text-left text-amber-300">${fmt(data.BS['204'].ycomp1)}</span></div> |
| 645 | </div> |
| 646 | </div> |
| 647 | </div> |
| 648 | `; |
| 649 | } |
| 650 | |
| 651 | function renderMapping(target) { |
| 652 | target.innerHTML = ` |
| 653 | <div class="bg-slate-900 border border-slate-800 rounded-xl p-6 max-w-4xl mx-auto space-y-6 shadow-xl"> |
| 654 | <div class="text-center space-y-2 border-b border-slate-800 pb-4"> |
| 655 | <div class="text-4xl">🔗</div> |
| 656 | <h2 class="font-bold text-purple-400 text-lg">کدینگ و منطق نگاشت برای سال ۱۴۰۵</h2> |
| 657 | <p class="text-xs text-slate-400 max-w-xl mx-auto leading-6">این فرمولها جهت پردازش O، Oe و E از فایل Data.csv استخراج و برای محیط Jules قفل شدهاند.</p> |
| 658 | </div> |
| 659 | <table class="w-full text-right text-xs border border-slate-800"> |
| 660 | <thead class="bg-slate-950 text-slate-400"> |
| 661 | <tr><th class="p-3">کد حساب</th><th class="p-3">شرح</th><th class="p-3">نوع نگاشت</th><th class="p-3">یادداشت مقصد</th></tr> |
| 662 | </thead> |
| 663 | <tbody class="divide-y divide-slate-800 font-mono text-slate-300"> |
| 664 | ${MAPPING_RULES.map(m => ` |
| 665 | <tr> |
| 666 | <td class="p-3 font-bold text-blue-400">${m.code}</td> |
| 667 | <td class="p-3 font-sans">${m.name}</td> |
| 668 | <td class="p-3 text-purple-400 font-bold">${m.type}</td> |
| 669 | <td class="p-3 text-amber-400">${m.note}</td> |
| 670 | </tr> |
| 671 | `).join('')} |
| 672 | </tbody> |
| 673 | </table> |
| 674 | </div> |
| 675 | `; |
| 676 | } |
| 677 | |
| 678 | function renderUploadForm(target) { |
| 679 | target.innerHTML = ` |
| 680 | <div class="bg-slate-900 border border-slate-800 rounded-xl p-8 max-w-lg mx-auto shadow-xl text-center"> |
| 681 | <h3 class="font-bold text-emerald-400 text-base mb-6">➕ ساخت صورتهای مالی ۱۴۰۵ در محیط Jules</h3> |
| 682 | <div class="border-2 border-dashed border-slate-600 bg-slate-950/50 rounded-xl p-10 cursor-pointer hover:border-emerald-500 transition-colors" onclick="alert('برنامهنویس: در محیط Jules اینجا را به تابع file upload متصل کنید.')"> |
| 683 | <div class="text-5xl mb-4">📂</div> |
| 684 | <h4 class="font-bold text-white mb-2">تراز آزمایشی ۱۴۰۵ را انتخاب کنید</h4> |
| 685 | <p class="text-[10px] text-slate-400 mt-2 leading-5">پس از آپلود، توابع نگاشت (Mapping) فراخوانی شده و خروجی به آبجکت DB تزریق میشود.</p> |
| 686 | </div> |
| 687 | </div> |
| 688 | `; |
| 689 | } |
| 690 | |
| 691 | // --- ACTIONS --- |
| 692 | function switchTab(tab) { currentTab = tab; render(); } |
| 693 | function onCompanyChange(val) { currentCompanyId = val; render(); } |
| 694 | function onYearChange(yr) { currentYear = yr; render(); } |
| 695 | |
| 696 | // --------------------------------------------------------- |
| 697 | // FLAWLESS PRINT ENGINE (In-App Preview Overlay) |
| 698 | // --------------------------------------------------------- |
| 699 | function openPrintPreview() { |
| 700 | const data = DB[currentCompanyId]?.[currentYear]; |
| 701 | if(!data || !data.hasRealData) return alert('خطا: گزارش مالی این سال هنوز قطعی و بارگذاری نشده است.'); |
| 702 | |
| 703 | const container = document.getElementById('print-pages-container'); |
| 704 | const bs = data.BS; const is = data.IS; const cf = data.CF; |
| 705 | const is3Col = bs['101'].ycomp2 !== null && bs['101'].ycomp2 !== undefined; |
| 706 | |
| 707 | const sumGr = (keys, col) => keys.reduce((a, k) => a + (bs[k][col] || 0), 0); |
| 708 | const curAssets = sumGr(['201','202','203','204'], 'ycur'); |
| 709 | const curLiab = sumGr(['501','502','503'], 'ycur'); |
| 710 | const totalAssets = curAssets + sumGr(['101','102','103'], 'ycur'); |
| 711 | const totalLiab = curLiab + sumGr(['401','402'], 'ycur'); |
| 712 | const revenue = is['601'].cur + (is['604']?.cur||0); |
| 713 | const netProfit = revenue + is['602'].cur + is['603'].cur + (is['605']?.cur||0) + (is['606']?.cur||0); |
| 714 | const currentRatio = curLiab ? (curAssets / curLiab).toFixed(2) : 0; |
| 715 | const debtRatio = totalAssets ? ((totalLiab / totalAssets) * 100).toFixed(1) : 0; |
| 716 | const netMargin = revenue ? ((netProfit / revenue) * 100).toFixed(1) : 0; |
| 717 | |
| 718 | let html = ``; |
| 719 | |
| 720 | // PAGE 1: Signatures |
| 721 | html += ` |
| 722 | <div class="paper-sheet print-page first-page"> |
| 723 | <div style="text-align:center; margin-bottom:50px;"> |
| 724 | <h2>مجمع عمومی عادی صاحبان سهام</h2> |
| 725 | <h2 style="font-size: 18pt;">${COMPANIES_INFO[currentCompanyId]}</h2> |
| 726 | <h3 style="border:none;">صورتهای مالی سال مالی منتهی به اسفند ${currentYear}</h3> |
| 727 | </div> |
| 728 | <p style="text-align:justify; line-height:2.5; font-size:12pt; margin-bottom: 50px;"> |
| 729 | <b>با احترام،</b><br> |
| 730 | به پیوست صورتهای مالی ${COMPANIES_INFO[currentCompanyId]} مربوط به سال مالی منتهی به ۲۹ اسفند ${currentYear} تقدیم میشود. |
| 731 | اجزای تشکیلدهنده صورتهای مالی شامل ترازنامه، صورت سود و زیان جامع، صورت تغییرات در حقوق مالکانه و صورت جریانهای نقدی میباشد. |
| 732 | این صورتهای مالی طبق استانداردهای حسابداری تهیه شده و به تایید هیئت مدیره شرکت رسیده است. |
| 733 | </p> |
| 734 | <div class="sign-grid"> |
| 735 | ${data.signatures ? data.signatures.map(s => ` |
| 736 | <div class="sign-box"> |
| 737 | ${s.name} |
| 738 | <span class="sign-role">${s.role}</span> |
| 739 | </div> |
| 740 | `).join('') : '<div class="sign-box">امضا محفوظ</div>'} |
| 741 | </div> |
| 742 | </div> |
| 743 | `; |
| 744 | |
| 745 | // PAGE 2: Auditor Report |
| 746 | html += ` |
| 747 | <div class="paper-sheet print-page"> |
| 748 | <h3>گزارش حسابرس مستقل و بازرس قانونی</h3> |
| 749 | <p style="text-align:center; font-size:11pt; margin-bottom: 30px;">شرکت ${COMPANIES_INFO[currentCompanyId]} - منتهی به اسفند ${currentYear}</p> |
| 750 | <p style="line-height:2.5; text-align:justify; font-size:12pt;"> |
| 751 | <b>اظهارنظر:</b> به نظر این سازمان، صورتهای مالی یاد شده، وضعیت مالی شرکت را در تاریخ پایان اسفند ${currentYear}، و عملکرد مالی و جریانهای نقدی آن را از تمام جنبههای بااهمیت، طبق استانداردهای حسابداری به نحو مطلوب نشان میدهد. <b>(${data.auditorOpinion})</b> |
| 752 | </p> |
| 753 | `; |
| 754 | if(data.auditorClauses) { |
| 755 | data.auditorClauses.forEach(c => { html += `<p style="margin-top:20px; text-align:justify; line-height:2; font-size:11pt;"><b>${c.title}:</b> ${c.desc}</p>`; }); |
| 756 | } |
| 757 | html += `</div>`; |
| 758 | |
| 759 | // PAGE 3: AI Dashboard Infographic |
| 760 | html += ` |
| 761 | <div class="paper-sheet print-page"> |
| 762 | <h3 style="margin-bottom:30px;">داشبورد تحلیلی هوش مصنوعی (AI)</h3> |
| 763 | <div class="ai-grid"> |
| 764 | <div class="ai-card"> |
| 765 | <div class="ai-title">نسبت جاری (نقدینگی)</div> |
| 766 | <div class="ai-val">${currentRatio}</div> |
| 767 | </div> |
| 768 | <div class="ai-card"> |
| 769 | <div class="ai-title">نسبت بدهی به دارایی</div> |
| 770 | <div class="ai-val">${debtRatio} ٪</div> |
| 771 | </div> |
| 772 | <div class="ai-card"> |
| 773 | <div class="ai-title">حاشیه سود خالص</div> |
| 774 | <div class="ai-val">${netMargin} ٪</div> |
| 775 | </div> |
| 776 | </div> |
| 777 | <div class="ai-analysis"> |
| 778 | <b>تحلیل سیستم مدیریتی:</b><br> |
| 779 | بر اساس ارقام حسابرسی شده سال ${currentYear}، شاخص نقدینگی شرکت معادل ${currentRatio} ارزیابی میگردد. |
| 780 | سطح اهرم مالی معادل ${debtRatio} درصد از کل داراییهاست. عملکرد سودآوری شرکت پس از کسر تمامی هزینهها، نشاندهنده حاشیه سود خالص ${netMargin} درصدی نسبت به درآمدهای عملیاتی میباشد. |
| 781 | </div> |
| 782 | </div> |
| 783 | `; |
| 784 | |
| 785 | // PAGE 4: Balance Sheet |
| 786 | html += `<div class="paper-sheet print-page"><h3>صورت وضعیت مالی (ترازنامه)</h3><table style="width:100%; text-align:right;"><tr><th>داراییها</th><th>سال ${currentYear}</th><th>سال قبل</th>${is3Col ? '<th>دو سال قبل</th>' : ''}<th>حقوق و بدهیها</th><th>سال ${currentYear}</th><th>سال قبل</th>${is3Col ? '<th>دو سال قبل</th>' : ''}</tr>`; |
| 787 | html += `<tr><td>جمع دارایی غیرجاری</td><td>${fmt(sumGr(['101','102','103'],'ycur'))}</td><td>${fmt(sumGr(['101','102','103'],'ycomp1'))}</td>${is3Col ? `<td>${fmt(sumGr(['101','102','103'],'ycomp2'))}</td>` : ''}<td>جمع حقوق مالکانه</td><td>${fmt(sumGr(['301','302','303','304'],'ycur'))}</td><td>${fmt(sumGr(['301','302','303','304'],'ycomp1'))}</td>${is3Col ? `<td>${fmt(sumGr(['301','302','303','304'],'ycomp2'))}</td>` : ''}</tr>`; |
| 788 | html += `<tr><td>جمع دارایی جاری</td><td>${fmt(sumGr(['201','202','203','204'],'ycur'))}</td><td>${fmt(sumGr(['201','202','203','204'],'ycomp1'))}</td>${is3Col ? `<td>${fmt(sumGr(['201','202','203','204'],'ycomp2'))}</td>` : ''}<td>جمع بدهیها</td><td>${fmt(sumGr(['401','402','501','502','503'],'ycur'))}</td><td>${fmt(sumGr(['401','402','501','502','503'],'ycomp1'))}</td>${is3Col ? `<td>${fmt(sumGr(['401','402','501','502','503'],'ycomp2'))}</td>` : ''}</tr>`; |
| 789 | html += `<tr><td><b>جمع کل داراییها</b></td><td><b>${fmt(totalAssets)}</b></td><td><b>${fmt(sumGr(['101','102','103','201','202','203','204'],'ycomp1'))}</b></td>${is3Col ? `<td><b>${fmt(sumGr(['101','102','103','201','202','203','204'],'ycomp2'))}</b></td>` : ''}<td><b>جمع حقوق و بدهیها</b></td><td><b>${fmt(sumGr(['301','302','303','304','401','402','501','502','503'],'ycur'))}</b></td><td><b>${fmt(sumGr(['301','302','303','304','401','402','501','502','503'],'ycomp1'))}</b></td>${is3Col ? `<td><b>${fmt(sumGr(['301','302','303','304','401','402','501','502','503'],'ycomp2'))}</b></td>` : ''}</tr></table></div>`; |
| 790 | |
| 791 | // PAGE 5: IS & CF |
| 792 | const netComp = is['601'].comp+is['602'].comp+is['603'].comp+(is['604']?.comp||0)+(is['605']?.comp||0)+(is['606']?.comp||0); |
| 793 | html += `<div class="paper-sheet print-page"><h3>صورت سود و زیان جامع</h3><table><tr><th>شرح</th><th>سال ${currentYear}</th><th>سال قبل</th></tr>`; |
| 794 | html += `<tr><td>درآمدهای عملیاتی</td><td>${fmt(is['601'].cur)}</td><td>${fmt(is['601'].comp)}</td></tr>`; |
| 795 | html += `<tr><td>بهای تمام شده درآمدهای عملیاتی</td><td>${fmt(is['602'].cur)}</td><td>${fmt(is['602'].comp)}</td></tr>`; |
| 796 | html += `<tr><td>سود (زیان) ناخالص</td><td>${fmt(is['601'].cur+is['602'].cur)}</td><td>${fmt(is['601'].comp+is['602'].comp)}</td></tr>`; |
| 797 | html += `<tr><td><b>زیان خالص سال مالی</b></td><td><b>${fmt(netProfit)}</b></td><td><b>${fmt(netComp)}</b></td></tr></table>`; |
| 798 | |
| 799 | html += `<h3 style="margin-top:40px;">صورت جریانهای نقدی</h3><table><tr><th>شرح</th><th>سال ${currentYear}</th><th>سال قبل</th></tr>`; |
| 800 | html += `<tr><td>نقد حاصل از عملیات</td><td>${fmt(cf['701'].cur)}</td><td>${fmt(cf['701'].comp)}</td></tr>`; |
| 801 | html += `<tr><td><b>مانده موجودی نقد پایان سال</b></td><td><b>${fmt(bs['204'].ycur)}</b></td><td><b>${fmt(bs['204'].ycomp1)}</b></td></tr></table></div>`; |
| 802 | |
| 803 | container.innerHTML = html; |
| 804 | |
| 805 | // Switch UI to Print Preview state |
| 806 | document.body.classList.add('preview-mode'); |
| 807 | } |
| 808 | |
| 809 | function closePrintPreview() { |
| 810 | document.body.classList.remove('preview-mode'); |
| 811 | } |
| 812 | |
| 813 | // --- INIT --- |
| 814 | function bootstrap() { render(); } |
| 815 | if (document.readyState === 'complete') bootstrap(); |
| 816 | else document.addEventListener('DOMContentLoaded', bootstrap); |
| 817 | </script> |
| 818 | </body> |
| 819 | </html> |