فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
test/a08-native-webview2-heap-metrics
a02/strict-export-preflight-20261018
audit/a01-readonly-invoice-metadata-20261101
ci/a06-require-trusted-issuer-for-release
ci/main-postmerge-phase-a-validation-20261020
ci/phase-a-controlled-public-release
design/issue-5-commercial-corrections-adr
docs/a01-a02-a05-oct23-verified-evidence
docs/a01-cheque-endorsement-evidence-20261022
docs/a01-cheque-event-date-evidence-20261021
docs/a01-explicit-refund-reason-evidence-20261021
docs/a01-refund-auth-status-20261020
docs/a01-refund-trace-evidence-20261020
docs/a02-102-evidence-20261018
docs/a02-pr104-evidence-20261018
docs/a02-pr106-evidence-20261019
docs/a02-pr108-ten-tests-20261019
docs/a02-private-sql-backup-evidence-20261111
docs/a03-merge-status-sync-20261020
docs/a04-software-gate-acceptance-20261020
docs/feature-matrix-20261014
docs/finora-master-execution-playbook
docs/four-phase-execution-20261014
docs/four-phase-roadmap-20261014
docs/holoo-lab-stabilization-phase1-20261111
docs/holoo-runtime-schema-audit-20261111
docs/ops-142-governance-5-1-3-20261030
docs/phase-a-a01-a02-a06-a08-verified-evidence-20261023
docs/phase-a-a01-a05-a06-evidence-20261023
docs/phase-a-independent-acceptance-evidence
docs/phase-a-pr110-evidence-20261019
docs/project-status-phase-a-20261014
feat/a01-referenced-return-corrections
feat/a01-referenced-returns-on-main
feat/a02-atomic-opening-ledger-preflight
feat/a02-holoo-compatibility-preflight
feat/a02-holoo-declared-control-totals
feat/a02-holoo-explicit-csv-gate
feat/a02-holoo-safe-zip-intake-offline-webview2-20261030
feat/a02-offline-sql-server-provisioning-20261030
feat/a02-opening-balance-dry-run
feat/a02-opening-ledger-admin-ui
feat/a02-opt-in-isolated-sql-restore-executor-20261030
feat/a02-private-holoo-zip-staging-20261030
feat/a02-safe-isolated-restore-plan-20261030
feat/a02-sql-backup-header-verifyonly-20261030
feat/a03-audit-schema-atomic-events
feat/a03-complete-manual-journal-audit
feat/a05-cheque-treasury-reconciliation
feat/a06-signed-offline-license-activation
feat/a08-synthetic-performance-baseline
feat/phase-a-accounting-benchmark-return-preview
feat/phase-a-ledger-settlement-diagnostics
feature/v2-reconciliation-20261013
fix/a01-atomic-confirm-ui-one-shot-20261031
fix/a01-cheque-clearance-explicit-account-20261023
fix/a01-cheque-contractual-due-date-validity-20261023
fix/a01-cheque-endorsement-counterparty-20261022
fix/a01-cheque-event-date-open-period-20261021
fix/a01-cumulative-return-amount-cap
fix/a01-explicit-refund-reason-approval-20261021
fix/a01-manager-authorized-customer-refunds-20261020
fix/a01-no-implicit-refund
fix/a01-one-shot-confirm-on-atomic-import-20261031
fix/a01-refund-and-overcollection-net-cash
fix/a01-refund-correction-trace-20261020
fix/a02-atomic-excel-master-merge-20261031
fix/a02-canonical-mapping-contract-20261018
fix/a02-disable-destructive-excel-replace-20261031
fix/a02-holoo-invoice-line-coverage-20261023
fix/a02-holoo-preflight-required-invoice-lines-20261023
fix/a02-mapping-contract-20261018
fix/a02-opening-preflight-unbalanced-report
fix/a02-orphan-mapping-20261018
fix/a02-private-excel-import-session-20261031
fix/a02-strict-export-input-20261019
fix/a03-append-only-full-backup-import
fix/a03-append-only-write-guard
fix/a03-block-transaction-clear-append-only-20261016
fix/a03-chain-validation-20261020
fix/a03-company-scoped-audit-data-access
fix/a03-deny-direct-audit-write-20261019
fix/a03-escaped-expense-list-20261031
fix/a03-escaped-financial-record-ids-20261031
fix/a03-financial-ledger-actions-and-print-20261031
fix/a04-backup-checksum-preflight
fix/a04-company-audit-replay-stable-compare
fix/a04-company-backup-source-isolation-20261020
fix/a04-full-restore-posted-financial-integrity
fix/a04-reject-mixed-company-backup-20261019
fix/a04-replace-immutable-posted-ledger
fix/a04-restore-financial-journal-references
fix/a04-service-source-company-boundary-20261020
fix/a05-block-inactive-treasury-settlements
fix/a05-cheque-cash-evidence-reconciliation-20261023
fix/a05-cheque-ledger-and-bank-reconciliation-20261023
fix/a05-fiscal-close-invariant-gates
fix/a06-backup-restore-user-privileges
fix/a06-license-user-company-quota-20261023
fix/a06-malformed-trial-state-fail-closed
fix/a06-offline-clock-fail-closed-20261019
fix/a07-indexeddb-blocked-startup
fix/a07-offline-bundled-assets
fix/a07-version-and-startup-banner
fix/issue-7-company-backup-isolation
fix/p0-deterministic-fractional-invoice-money-20261031
fix/p0-fractional-quantity-input-20261031
fix/p0-fractional-quantity-integrated-20261031
fix/p0-invoice-posting-invariants-20261031
fix/p0-legacy-stock-and-product-inputs-20261031
fix/p0-reports-immutable-cogs-20261101
fix/p0-verified-financial-percent-20261031
fix/p0-zero-discount-report-revenue-20261101
fix/phase-a-backup-app-version
fix/phase-a-backup-integrity-checksum
fix/phase-a-backup-record-id-validation-20261014
fix/phase-a-backup-version-validation-20261014
fix/phase-a-closure-pack3-20261101
fix/phase-a-entitlement-payload-validation
fix/phase-a-gate-exact-evidence-20261019
fix/phase-a-pack4-stock-scope-20261101
fix/phase-a-pack5-integrated-evidence-20261101
fix/phase-a-pack6-atomic-legacy-20261101
fix/phase-a-restore-envelope-and-rollback
fix/phase-a-settings-admin-gate
fix/print-browser-header-footer-20261014
fix/q01-expense-security-probe-exact-option-20261031
fix/q01-financial-grid-labels-20261031
fix/q01-form-label-association-20261031
fix/q01-native-evidence-integrity-20261030
fix/q01-number-input-persian-decimal-20261031
fix/q01-responsive-dashboard-and-cheque-table-20261031
fix/q01-safe-ui-action-audit-coverage-20261031
fix/q01-visible-desktop-sidebar-and-safe-confirm-20261030
fix/roadmap-metadata-sync-20261014
gate/a03-audit-metadata-validation-20261019
integration/a02-windows-holoo-setup-candidate-20261030
license-server
main
perf/a07-lazy-load-excel
perf/a08-cheque-reconciliation-account-index-20261023
perf/a08-paginated-reports-20261101
phase1-restore-hardening
planning/holoo-execution-20261013
planning/roadmap-project-management-20261014
qa/native-click-coverage-audit-20261030
release/v2.0.0
test/a01-native-endorsement-mandatory-20261023
test/a01-native-purchase-return-guardrails
test/a01-native-sale-return-financial-guardrails
test/a01-safe-integer-boundary-20261019
test/a02-native-opening-dry-run-rejections
test/a02-native-positive-opening-ledger
test/a04-native-corrupt-fbackup-20261016
test/a04-native-encrypted-company-backup
test/a04-native-encrypted-company-backup-main
test/a04-native-late-transaction-rollback
test/a04-native-windows-backup-recovery
test/a04-real-edge-v6-v7-migration
test/a04-real-native-interrupted-restore
test/a05-native-draft-ledger-and-repeat-close-20261016
test/a05-native-fiscal-close-guardrails
test/a07-native-multipage-print-engine
test/a07-native-origin-provenance
test/a07-native-webview2-offline-routes
test/a07-windows-offline-startup-smoke
test/a08-installed-webview2-60k-baseline
test/a08-native-webview2-heap-metrics
test/a08-windows-synthetic-performance-baseline
test/github-write-access-20261009
test/native-win-ui-routes-after-finance-backup
test/phase-a-combined-a01-a05-a08-final-evidence
test/phase-a-combined-native-acceptance-matrix
test/phase-a-ledger-invariants-20261014
test/phase-a-native-all-routes-on-merged-lab
test/phase-a-native-encrypted-backup
test/phase-a-native-finance-backup-matrix
test/phase-a-native-ui-and-backup-smoke
test/phase-a-windows-native-installer-lab
work/a08-dispatch-activation-20261123
work/a08-memory-stability-20261123
work/finance-curated-20261123
| 1 | // ============================================================ |
| 2 | // ReportsView — گزارش سود و زیان، تحلیل فروش و سودآوری |
| 3 | // ============================================================ |
| 4 | |
| 5 | import { ReportController } from '../controllers/ReportController.js'; |
| 6 | import { Formatters } from '../utils/Formatters.js'; |
| 7 | import { Jalali } from '../utils/Jalali.js'; |
| 8 | import { Toast } from '../core/Toast.js'; |
| 9 | import { Chart } from '../utils/Chart.js'; |
| 10 | |
| 11 | let currentTab = 'pl'; // pl | sales | products | customers |
| 12 | let currentFilter = { |
| 13 | preset: '30days', |
| 14 | from: '', |
| 15 | to: '' |
| 16 | }; |
| 17 | |
| 18 | let cache = { |
| 19 | pl: null, |
| 20 | sales: null, |
| 21 | products: [], |
| 22 | customers: [] |
| 23 | }; |
| 24 | |
| 25 | class ReportsViewImpl { |
| 26 | async render() { |
| 27 | await this.reload(); |
| 28 | return ` |
| 29 | <div class="page-title" style="display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:10px"> |
| 30 | <div> |
| 31 | <h2>گزارشهای مالی</h2> |
| 32 | <p>تحلیل سود و زیان، فروش و سودآوری کسبوکار</p> |
| 33 | </div> |
| 34 | <button class="btn btn-secondary btn-inline" onclick="window.ReportsView._printReport()">🖨️ چاپ گزارش</button> |
| 35 | </div> |
| 36 | |
| 37 | ${this._renderFilterBar()} |
| 38 | |
| 39 | <div class="tabs" style="margin-top:16px"> |
| 40 | <button class="tab-btn ${currentTab === 'pl' ? 'active' : ''}" onclick="window.ReportsView._switchTab('pl', event)"> |
| 41 | 💹 سود و زیان |
| 42 | </button> |
| 43 | <button class="tab-btn ${currentTab === 'sales' ? 'active' : ''}" onclick="window.ReportsView._switchTab('sales', event)"> |
| 44 | 📈 تحلیل فروش |
| 45 | </button> |
| 46 | <button class="tab-btn ${currentTab === 'products' ? 'active' : ''}" onclick="window.ReportsView._switchTab('products', event)"> |
| 47 | 📦 سودآوری کالاها |
| 48 | </button> |
| 49 | <button class="tab-btn ${currentTab === 'customers' ? 'active' : ''}" onclick="window.ReportsView._switchTab('customers', event)"> |
| 50 | 👥 گزارش مشتریان |
| 51 | </button> |
| 52 | </div> |
| 53 | |
| 54 | <div id="reports-content">${this.renderTabContent()}</div> |
| 55 | `; |
| 56 | } |
| 57 | |
| 58 | onMount() { |
| 59 | window.ReportsView = this; |
| 60 | } |
| 61 | |
| 62 | async reload() { |
| 63 | cache.pl = await ReportController.getProfitLoss(currentFilter); |
| 64 | cache.sales = await ReportController.getSalesAnalysis(currentFilter); |
| 65 | cache.products = await ReportController.getProductProfitability(currentFilter); |
| 66 | cache.customers = await ReportController.getCustomerReport(currentFilter); |
| 67 | } |
| 68 | |
| 69 | renderTabContent() { |
| 70 | if (currentTab === 'pl') return this.renderPLTab(); |
| 71 | if (currentTab === 'sales') return this.renderSalesTab(); |
| 72 | if (currentTab === 'products') return this.renderProductsTab(); |
| 73 | if (currentTab === 'customers') return this.renderCustomersTab(); |
| 74 | return ''; |
| 75 | } |
| 76 | |
| 77 | _switchTab(tab, event) { |
| 78 | currentTab = tab; |
| 79 | document.querySelectorAll('.tabs .tab-btn').forEach(btn => btn.classList.remove('active')); |
| 80 | if (event && event.target) { |
| 81 | const target = event.target.closest('.tab-btn'); |
| 82 | if (target) target.classList.add('active'); |
| 83 | } |
| 84 | document.getElementById('reports-content').innerHTML = this.renderTabContent(); |
| 85 | } |
| 86 | |
| 87 | // ============================================================ |
| 88 | // فیلتر بازه |
| 89 | // ============================================================ |
| 90 | _renderFilterBar() { |
| 91 | const presets = [ |
| 92 | { key: 'today', label: 'امروز' }, |
| 93 | { key: '7days', label: '۷ روز' }, |
| 94 | { key: '30days', label: '۳۰ روز' }, |
| 95 | { key: '3months', label: '۳ ماه' }, |
| 96 | { key: 'thisYear', label: 'سال جاری' }, |
| 97 | { key: 'lastYear', label: 'سال قبل' }, |
| 98 | { key: 'custom', label: 'دلخواه' } |
| 99 | ]; |
| 100 | |
| 101 | const buttons = presets.map(p => |
| 102 | `<button class="chart-tab ${currentFilter.preset === p.key ? 'active' : ''}" onclick="window.ReportsView._setPreset('${p.key}')">${p.label}</button>` |
| 103 | ).join(''); |
| 104 | |
| 105 | const customInputs = currentFilter.preset === 'custom' ? ` |
| 106 | <div style="display:flex;gap:8px;align-items:center;margin-top:10px;flex-wrap:wrap"> |
| 107 | <span style="font-size:12.5px;color:var(--text-muted)">از تاریخ:</span> |
| 108 | <input type="text" class="form-control" style="width:130px" placeholder="1405/01/01" value="${this._esc(currentFilter.from)}" onchange="window.ReportsView._setCustomDate('from', this.value)" /> |
| 109 | <span style="font-size:12.5px;color:var(--text-muted)">تا تاریخ:</span> |
| 110 | <input type="text" class="form-control" style="width:130px" placeholder="1405/06/27" value="${this._esc(currentFilter.to)}" onchange="window.ReportsView._setCustomDate('to', this.value)" /> |
| 111 | <button class="btn btn-secondary btn-inline" style="font-size:12px;min-height:34px" onclick="window.ReportsView._applyCustom()">اعمال</button> |
| 112 | </div> |
| 113 | ` : ''; |
| 114 | |
| 115 | const rangeText = this._formatRange(cache.pl?.periodFrom, cache.pl?.periodTo); |
| 116 | |
| 117 | return ` |
| 118 | <div class="card" style="padding:14px 16px;margin-bottom:0"> |
| 119 | <div style="display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:10px"> |
| 120 | <div> |
| 121 | <span style="font-size:13px;font-weight:700">دورهی گزارش:</span> |
| 122 | <span style="font-size:12.5px;color:var(--primary);margin-right:6px">${rangeText}</span> |
| 123 | </div> |
| 124 | <div class="chart-tabs" style="flex-wrap:wrap">${buttons}</div> |
| 125 | </div> |
| 126 | ${customInputs} |
| 127 | </div> |
| 128 | `; |
| 129 | } |
| 130 | |
| 131 | _formatRange(from, to) { |
| 132 | if (!from && !to) return 'همهی زمانها'; |
| 133 | const f = from ? Jalali.format(from) : '—'; |
| 134 | const t = to ? Jalali.format(to) : '—'; |
| 135 | return `${Formatters.toPersianDigits(f)} تا ${Formatters.toPersianDigits(t)}`; |
| 136 | } |
| 137 | |
| 138 | _setPreset(preset) { |
| 139 | currentFilter.preset = preset; |
| 140 | if (preset !== 'custom') { |
| 141 | currentFilter.from = ''; |
| 142 | currentFilter.to = ''; |
| 143 | } |
| 144 | this._refresh(); |
| 145 | } |
| 146 | |
| 147 | _setCustomDate(key, value) { |
| 148 | currentFilter[key] = value; |
| 149 | } |
| 150 | |
| 151 | _applyCustom() { |
| 152 | if (!currentFilter.from || !currentFilter.to) { |
| 153 | Toast.warning('تاریخ شروع و پایان رو کامل وارد کنید'); |
| 154 | return; |
| 155 | } |
| 156 | this._refresh(); |
| 157 | } |
| 158 | |
| 159 | async _refresh() { |
| 160 | await this.reload(); |
| 161 | // رندر کامل مجدد تا فیلتر و همهچیز آپدیت بشه |
| 162 | const html = await this.render(); |
| 163 | document.getElementById('pageContent').innerHTML = html; |
| 164 | } |
| 165 | |
| 166 | // ============================================================ |
| 167 | // تب ۱: سود و زیان |
| 168 | // ============================================================ |
| 169 | renderPLTab() { |
| 170 | const pl = cache.pl || {}; |
| 171 | |
| 172 | const rows = [ |
| 173 | { label: 'فروش ناخالص', value: pl.grossSales, color: 'var(--text)', bold: false, sign: '+' }, |
| 174 | { label: 'تخفیف فروش', value: -pl.salesDiscounts, color: 'var(--danger)', bold: false, sign: '-' }, |
| 175 | { label: 'برگشت از فروش', value: -pl.returnsAmount, color: 'var(--danger)', bold: false, sign: '-' }, |
| 176 | { label: 'فروش خالص', value: pl.netSales, color: 'var(--primary)', bold: true, sign: '=' }, |
| 177 | { label: 'بهای تمامشده کالای فروشرفته (COGS)', value: -pl.cogs, color: 'var(--warning)', bold: false, sign: '-' }, |
| 178 | { label: 'سود ناخالص', value: pl.grossProfit, color: 'var(--success)', bold: true, sign: '=' }, |
| 179 | { label: 'هزینههای عملیاتی', value: -pl.operatingExpenses, color: 'var(--danger)', bold: false, sign: '-' }, |
| 180 | { label: 'سایر درآمدها', value: pl.otherIncome, color: 'var(--success)', bold: false, sign: '+' }, |
| 181 | { label: 'سود (زیان) خالص', value: pl.netProfit, color: pl.netProfit >= 0 ? 'var(--success)' : 'var(--danger)', bold: true, sign: '=' } |
| 182 | ]; |
| 183 | |
| 184 | const rowsHtml = rows.map(r => { |
| 185 | const isBold = r.bold; |
| 186 | const val = Math.abs(Number(r.value) || 0); |
| 187 | const sign = Number(r.value) < 0 ? '-' : (r.sign === '+' ? '+' : ''); |
| 188 | const display = (r.value === 0) ? Formatters.money(0) : `${sign} ${Formatters.money(val)}`; |
| 189 | return ` |
| 190 | <tr style="${isBold ? 'background:var(--bg);font-weight:700' : ''}"> |
| 191 | <td style="padding:12px 16px;font-size:${isBold ? '14px' : '13px'}">${r.label}</td> |
| 192 | <td style="padding:12px 16px;text-align:left;font-size:${isBold ? '14px' : '13px'};color:${r.color};font-weight:${isBold ? '800' : '600'}"> |
| 193 | ${display} |
| 194 | </td> |
| 195 | </tr> |
| 196 | `; |
| 197 | }).join(''); |
| 198 | |
| 199 | const marginLabel = pl.netProfit >= 0 ? 'حاشیه سود خالص' : 'حاشیه زیان خالص'; |
| 200 | |
| 201 | return ` |
| 202 | <div class="grid-kpi"> |
| 203 | <div class="card kpi-card" style="margin:0;border-top:3px solid var(--primary)"> |
| 204 | <div class="kpi-card-icon" style="background:#eff6ff;color:var(--primary)">📊</div> |
| 205 | <div style="flex:1"> |
| 206 | <div style="font-size:11px;color:var(--text-muted);margin-bottom:4px">فروش خالص</div> |
| 207 | <div style="font-size:16px;font-weight:800;color:var(--primary)">${Formatters.money(pl.netSales)}</div> |
| 208 | <div style="font-size:10.5px;color:var(--text-muted);margin-top:2px">${Formatters.number(pl.invoiceCount)} فاکتور</div> |
| 209 | </div> |
| 210 | </div> |
| 211 | <div class="card kpi-card" style="margin:0;border-top:3px solid var(--success)"> |
| 212 | <div class="kpi-card-icon" style="background:#ecfdf5;color:var(--success)">💵</div> |
| 213 | <div style="flex:1"> |
| 214 | <div style="font-size:11px;color:var(--text-muted);margin-bottom:4px">سود ناخالص</div> |
| 215 | <div style="font-size:16px;font-weight:800;color:var(--success)">${Formatters.money(pl.grossProfit)}</div> |
| 216 | <div style="font-size:10.5px;color:var(--text-muted);margin-top:2px">${Formatters.percent(pl.grossMargin || 0)}</div> |
| 217 | </div> |
| 218 | </div> |
| 219 | <div class="card kpi-card" style="margin:0;border-top:3px solid ${pl.netProfit >= 0 ? 'var(--success)' : 'var(--danger)'}"> |
| 220 | <div class="kpi-card-icon" style="background:${pl.netProfit >= 0 ? '#ecfdf5' : '#fef2f2'};color:${pl.netProfit >= 0 ? 'var(--success)' : 'var(--danger)'}">${pl.netProfit >= 0 ? '📈' : '📉'}</div> |
| 221 | <div style="flex:1"> |
| 222 | <div style="font-size:11px;color:var(--text-muted);margin-bottom:4px">سود (زیان) خالص</div> |
| 223 | <div style="font-size:16px;font-weight:800;color:${pl.netProfit >= 0 ? 'var(--success)' : 'var(--danger)'}">${Formatters.money(pl.netProfit)}</div> |
| 224 | <div style="font-size:10.5px;color:var(--text-muted);margin-top:2px">${Formatters.percent(pl.netMargin || 0)}</div> |
| 225 | </div> |
| 226 | </div> |
| 227 | <div class="card kpi-card" style="margin:0;border-top:3px solid var(--danger)"> |
| 228 | <div class="kpi-card-icon" style="background:#fef2f2;color:var(--danger)">💸</div> |
| 229 | <div style="flex:1"> |
| 230 | <div style="font-size:11px;color:var(--text-muted);margin-bottom:4px">بهای تمامشده</div> |
| 231 | <div style="font-size:16px;font-weight:800;color:var(--danger)">${Formatters.money(pl.cogs)}</div> |
| 232 | <div style="font-size:10.5px;color:var(--text-muted);margin-top:2px">COGS</div> |
| 233 | </div> |
| 234 | </div> |
| 235 | </div> |
| 236 | |
| 237 | <div class="card"> |
| 238 | <h3 style="font-size:15px;font-weight:700;margin-bottom:14px">💹 صورت سود و زیان</h3> |
| 239 | <div class="table-wrap"> |
| 240 | <table> |
| 241 | <thead> |
| 242 | <tr> |
| 243 | <th style="width:60%">شرح</th> |
| 244 | <th style="text-align:left">مبلغ</th> |
| 245 | </tr> |
| 246 | </thead> |
| 247 | <tbody>${rowsHtml}</tbody> |
| 248 | <tfoot> |
| 249 | <tr style="background:${pl.netProfit >= 0 ? 'linear-gradient(135deg,#ecfdf5,#f0fdf4)' : 'linear-gradient(135deg,#fef2f2,#fff1f2)'}"> |
| 250 | <td style="padding:16px;font-weight:800;font-size:15px">${marginLabel}</td> |
| 251 | <td style="padding:16px;text-align:left;font-weight:800;font-size:15px;color:${pl.netProfit >= 0 ? 'var(--success)' : 'var(--danger)'}"> |
| 252 | ${Formatters.percent(pl.netMargin || 0)} |
| 253 | </td> |
| 254 | </tr> |
| 255 | </tfoot> |
| 256 | </table> |
| 257 | </div> |
| 258 | </div> |
| 259 | |
| 260 | ${pl.netSales === 0 ? ` |
| 261 | <div class="card" style="text-align:center;padding:30px"> |
| 262 | <div style="font-size:40px;margin-bottom:10px;opacity:.4">📊</div> |
| 263 | <p style="font-size:13px;color:var(--text-muted)">در این بازهی زمانی فروشی ثبت نشده است</p> |
| 264 | </div> |
| 265 | ` : ''} |
| 266 | `; |
| 267 | } |
| 268 | |
| 269 | // ============================================================ |
| 270 | // تب ۲: تحلیل فروش |
| 271 | // ============================================================ |
| 272 | renderSalesTab() { |
| 273 | const s = cache.sales || {}; |
| 274 | const topBySales = s.topProductsBySales || []; |
| 275 | const topByQty = s.topProductsByQty || []; |
| 276 | const topCustomers = s.topCustomers || []; |
| 277 | |
| 278 | const productsChartData = topBySales.slice(0, 8).map(p => ({ |
| 279 | label: this._truncate(p.productName, 12), |
| 280 | value: p.totalSales |
| 281 | })); |
| 282 | |
| 283 | return ` |
| 284 | <div class="card"> |
| 285 | <h3 style="font-size:15px;font-weight:700;margin-bottom:14px">📊 پرفروشترین کالاها (به ترتیب مبلغ)</h3> |
| 286 | ${Chart.bars(topBySales.slice(0, 8).map(p => ({ |
| 287 | label: this._truncate(p.productName, 10), |
| 288 | income: p.totalSales, |
| 289 | expense: p.cogs |
| 290 | })), { incomeColor: '#0d9488', expenseColor: '#d97706' })} |
| 291 | </div> |
| 292 | |
| 293 | <div style="display:grid;grid-template-columns:1fr 1fr;gap:16px" class="dash-grid-main"> |
| 294 | <div class="card" style="margin:0"> |
| 295 | <h3 style="font-size:15px;font-weight:700;margin-bottom:14px">🏆 ۱۰ کالای پرفروش (مبلغ)</h3> |
| 296 | <div class="table-wrap"> |
| 297 | <table> |
| 298 | <thead> |
| 299 | <tr> |
| 300 | <th style="width:30px">#</th> |
| 301 | <th>نام کالا</th> |
| 302 | <th style="width:70px">تعداد</th> |
| 303 | <th style="width:130px">مبلغ فروش</th> |
| 304 | </tr> |
| 305 | </thead> |
| 306 | <tbody> |
| 307 | ${topBySales.length === 0 ? '<tr><td colspan="4" style="text-align:center;padding:20px;color:var(--text-muted)">دادهای نیست</td></tr>' : topBySales.map((p, i) => ` |
| 308 | <tr> |
| 309 | <td><strong>${Formatters.toPersianDigits(i + 1)}</strong></td> |
| 310 | <td>${this._esc(p.productName)}</td> |
| 311 | <td>${Formatters.number(p.qty)}</td> |
| 312 | <td style="font-weight:600">${Formatters.money(p.totalSales)}</td> |
| 313 | </tr> |
| 314 | `).join('')} |
| 315 | </tbody> |
| 316 | </table> |
| 317 | </div> |
| 318 | </div> |
| 319 | |
| 320 | <div class="card" style="margin:0"> |
| 321 | <h3 style="font-size:15px;font-weight:700;margin-bottom:14px">🏆 ۱۰ کالای پرفروش (تعداد)</h3> |
| 322 | <div class="table-wrap"> |
| 323 | <table> |
| 324 | <thead> |
| 325 | <tr> |
| 326 | <th style="width:30px">#</th> |
| 327 | <th>نام کالا</th> |
| 328 | <th style="width:70px">تعداد</th> |
| 329 | <th style="width:130px">مبلغ فروش</th> |
| 330 | </tr> |
| 331 | </thead> |
| 332 | <tbody> |
| 333 | ${topByQty.length === 0 ? '<tr><td colspan="4" style="text-align:center;padding:20px;color:var(--text-muted)">دادهای نیست</td></tr>' : topByQty.map((p, i) => ` |
| 334 | <tr> |
| 335 | <td><strong>${Formatters.toPersianDigits(i + 1)}</strong></td> |
| 336 | <td>${this._esc(p.productName)}</td> |
| 337 | <td style="font-weight:700;color:var(--primary)">${Formatters.number(p.qty)}</td> |
| 338 | <td>${Formatters.money(p.totalSales)}</td> |
| 339 | </tr> |
| 340 | `).join('')} |
| 341 | </tbody> |
| 342 | </table> |
| 343 | </div> |
| 344 | </div> |
| 345 | </div> |
| 346 | |
| 347 | <div class="card"> |
| 348 | <h3 style="font-size:15px;font-weight:700;margin-bottom:14px">👥 ۱۰ مشتری برتر (به ترتیب مبلغ خرید)</h3> |
| 349 | <div class="table-wrap"> |
| 350 | <table> |
| 351 | <thead> |
| 352 | <tr> |
| 353 | <th style="width:30px">#</th> |
| 354 | <th>مشتری</th> |
| 355 | <th style="width:100px">تعداد فاکتور</th> |
| 356 | <th style="width:150px">مجموع خرید</th> |
| 357 | <th style="width:150px">مجموع پرداخت</th> |
| 358 | <th style="width:150px">مانده</th> |
| 359 | </tr> |
| 360 | </thead> |
| 361 | <tbody> |
| 362 | ${topCustomers.length === 0 ? '<tr><td colspan="6" style="text-align:center;padding:20px;color:var(--text-muted)">دادهای نیست</td></tr>' : topCustomers.map((c, i) => ` |
| 363 | <tr> |
| 364 | <td><strong>${Formatters.toPersianDigits(i + 1)}</strong></td> |
| 365 | <td>${this._esc(c.contactName)}</td> |
| 366 | <td>${Formatters.number(c.invoiceCount)}</td> |
| 367 | <td style="font-weight:600;color:var(--primary)">${Formatters.money(c.totalSales)}</td> |
| 368 | <td style="color:var(--success)">${Formatters.money(c.totalPaid)}</td> |
| 369 | <td style="font-weight:600;color:${c.totalRemaining > 0 ? 'var(--danger)' : 'var(--success)'}">${Formatters.money(c.totalRemaining)}</td> |
| 370 | </tr> |
| 371 | `).join('')} |
| 372 | </tbody> |
| 373 | </table> |
| 374 | </div> |
| 375 | </div> |
| 376 | `; |
| 377 | } |
| 378 | |
| 379 | // ============================================================ |
| 380 | // تب ۳: سودآوری کالاها |
| 381 | // ============================================================ |
| 382 | renderProductsTab() { |
| 383 | const list = cache.products || []; |
| 384 | const totalSales = list.reduce((s, p) => s + p.totalSales, 0); |
| 385 | const totalProfit = list.reduce((s, p) => s + p.profit, 0); |
| 386 | |
| 387 | return ` |
| 388 | <div class="grid-kpi"> |
| 389 | <div class="card kpi-card" style="margin:0"> |
| 390 | <div class="kpi-card-icon" style="background:#eff6ff;color:var(--primary)">📦</div> |
| 391 | <div style="flex:1"> |
| 392 | <div style="font-size:11px;color:var(--text-muted);margin-bottom:4px">تعداد کالاهای فروشرفته</div> |
| 393 | <div style="font-size:16px;font-weight:800;color:var(--primary)">${Formatters.number(list.length)}</div> |
| 394 | </div> |
| 395 | </div> |
| 396 | <div class="card kpi-card" style="margin:0"> |
| 397 | <div class="kpi-card-icon" style="background:#ecfdf5;color:var(--success)">💰</div> |
| 398 | <div style="flex:1"> |
| 399 | <div style="font-size:11px;color:var(--text-muted);margin-bottom:4px">مجموع فروش</div> |
| 400 | <div style="font-size:16px;font-weight:800;color:var(--success)">${Formatters.money(totalSales)}</div> |
| 401 | </div> |
| 402 | </div> |
| 403 | <div class="card kpi-card" style="margin:0"> |
| 404 | <div class="kpi-card-icon" style="background:#fef2f2;color:var(--danger)">📈</div> |
| 405 | <div style="flex:1"> |
| 406 | <div style="font-size:11px;color:var(--text-muted);margin-bottom:4px">مجموع سود</div> |
| 407 | <div style="font-size:16px;font-weight:800;color:var(--danger)">${Formatters.money(totalProfit)}</div> |
| 408 | </div> |
| 409 | </div> |
| 410 | <div class="card kpi-card" style="margin:0"> |
| 411 | <div class="kpi-card-icon" style="background:#fef3c7;color:var(--warning)">%</div> |
| 412 | <div style="flex:1"> |
| 413 | <div style="font-size:11px;color:var(--text-muted);margin-bottom:4px">میانگین حاشیه سود</div> |
| 414 | <div style="font-size:16px;font-weight:800;color:var(--warning)">${Formatters.percent(totalSales > 0 ? (totalProfit / totalSales) * 100 : 0)}</div> |
| 415 | </div> |
| 416 | </div> |
| 417 | </div> |
| 418 | |
| 419 | <div class="card"> |
| 420 | <h3 style="font-size:15px;font-weight:700;margin-bottom:14px">📦 جدول سودآوری کالاها</h3> |
| 421 | <div class="table-wrap"> |
| 422 | <table> |
| 423 | <thead> |
| 424 | <tr> |
| 425 | <th style="width:30px">#</th> |
| 426 | <th>نام کالا</th> |
| 427 | <th style="width:80px">واحد</th> |
| 428 | <th style="width:80px">تعداد فروش</th> |
| 429 | <th style="width:140px">فروش کل</th> |
| 430 | <th style="width:140px">بهای تمامشده</th> |
| 431 | <th style="width:140px">سود خالص</th> |
| 432 | <th style="width:100px">حاشیه سود</th> |
| 433 | </tr> |
| 434 | </thead> |
| 435 | <tbody> |
| 436 | ${list.length === 0 ? '<tr><td colspan="8" style="text-align:center;padding:30px;color:var(--text-muted)">هیچ کالایی در این بازه فروش نرفته</td></tr>' : list.map((p, i) => ` |
| 437 | <tr> |
| 438 | <td><strong>${Formatters.toPersianDigits(i + 1)}</strong></td> |
| 439 | <td>${this._esc(p.productName)}</td> |
| 440 | <td>${this._esc(p.unit)}</td> |
| 441 | <td style="font-weight:700">${Formatters.number(p.qty)}</td> |
| 442 | <td>${Formatters.money(p.totalSales)}</td> |
| 443 | <td style="color:var(--warning)">${Formatters.money(p.cogs)}</td> |
| 444 | <td style="font-weight:700;color:${p.profit >= 0 ? 'var(--success)' : 'var(--danger)'}">${Formatters.money(p.profit)}</td> |
| 445 | <td> |
| 446 | <span class="badge ${p.margin >= 30 ? 'badge-success' : p.margin >= 10 ? 'badge-warning' : 'badge-danger'}"> |
| 447 | ${Formatters.percent(p.margin)} |
| 448 | </span> |
| 449 | </td> |
| 450 | </tr> |
| 451 | `).join('')} |
| 452 | </tbody> |
| 453 | </table> |
| 454 | </div> |
| 455 | </div> |
| 456 | `; |
| 457 | } |
| 458 | |
| 459 | // ============================================================ |
| 460 | // تب ۴: گزارش مشتریان |
| 461 | // ============================================================ |
| 462 | renderCustomersTab() { |
| 463 | const list = cache.customers || []; |
| 464 | const totalSales = list.reduce((s, c) => s + c.totalSales, 0); |
| 465 | const totalRemaining = list.reduce((s, c) => s + c.totalRemaining, 0); |
| 466 | |
| 467 | return ` |
| 468 | <div class="grid-kpi"> |
| 469 | <div class="card kpi-card" style="margin:0"> |
| 470 | <div class="kpi-card-icon" style="background:#eff6ff;color:var(--primary)">👥</div> |
| 471 | <div style="flex:1"> |
| 472 | <div style="font-size:11px;color:var(--text-muted);margin-bottom:4px">تعداد مشتریان فعال</div> |
| 473 | <div style="font-size:16px;font-weight:800;color:var(--primary)">${Formatters.number(list.length)}</div> |
| 474 | </div> |
| 475 | </div> |
| 476 | <div class="card kpi-card" style="margin:0"> |
| 477 | <div class="kpi-card-icon" style="background:#ecfdf5;color:var(--success)">💰</div> |
| 478 | <div style="flex:1"> |
| 479 | <div style="font-size:11px;color:var(--text-muted);margin-bottom:4px">مجموع فروش</div> |
| 480 | <div style="font-size:16px;font-weight:800;color:var(--success)">${Formatters.money(totalSales)}</div> |
| 481 | </div> |
| 482 | </div> |
| 483 | <div class="card kpi-card" style="margin:0"> |
| 484 | <div class="kpi-card-icon" style="background:#fef2f2;color:var(--danger)">⏳</div> |
| 485 | <div style="flex:1"> |
| 486 | <div style="font-size:11px;color:var(--text-muted);margin-bottom:4px">مجموع مطالبات</div> |
| 487 | <div style="font-size:16px;font-weight:800;color:var(--danger)">${Formatters.money(totalRemaining)}</div> |
| 488 | </div> |
| 489 | </div> |
| 490 | </div> |
| 491 | |
| 492 | <div class="card"> |
| 493 | <h3 style="font-size:15px;font-weight:700;margin-bottom:14px">👥 گزارش تفصیلی مشتریان</h3> |
| 494 | <div class="table-wrap"> |
| 495 | <table> |
| 496 | <thead> |
| 497 | <tr> |
| 498 | <th style="width:30px">#</th> |
| 499 | <th>نام مشتری</th> |
| 500 | <th style="width:100px">نوع</th> |
| 501 | <th style="width:110px">تعداد فاکتور</th> |
| 502 | <th style="width:140px">مجموع خرید</th> |
| 503 | <th style="width:140px">پرداختشده</th> |
| 504 | <th style="width:140px">مانده</th> |
| 505 | <th style="width:120px">آخرین فاکتور</th> |
| 506 | </tr> |
| 507 | </thead> |
| 508 | <tbody> |
| 509 | ${list.length === 0 ? '<tr><td colspan="8" style="text-align:center;padding:30px;color:var(--text-muted)">دادهای نیست</td></tr>' : list.map((c, i) => ` |
| 510 | <tr> |
| 511 | <td><strong>${Formatters.toPersianDigits(i + 1)}</strong></td> |
| 512 | <td>${this._esc(c.contactName)}</td> |
| 513 | <td><span class="badge ${c.entityType === 'legal' ? 'badge-warning' : 'badge-success'}">${c.entityType === 'legal' ? 'حقوقی' : 'حقیقی'}</span></td> |
| 514 | <td>${Formatters.number(c.totalInvoices)}</td> |
| 515 | <td style="font-weight:600;color:var(--primary)">${Formatters.money(c.totalSales)}</td> |
| 516 | <td style="color:var(--success)">${Formatters.money(c.totalPaid)}</td> |
| 517 | <td style="font-weight:700;color:${c.totalRemaining > 0 ? 'var(--danger)' : 'var(--success)'}">${Formatters.money(c.totalRemaining)}</td> |
| 518 | <td>${c.lastInvoiceDate ? Formatters.toPersianDigits(c.lastInvoiceDate) : '—'}</td> |
| 519 | </tr> |
| 520 | `).join('')} |
| 521 | </tbody> |
| 522 | </table> |
| 523 | </div> |
| 524 | </div> |
| 525 | `; |
| 526 | } |
| 527 | |
| 528 | // ============================================================ |
| 529 | // چاپ گزارش |
| 530 | // ============================================================ |
| 531 | _printReport() { |
| 532 | const pl = cache.pl || {}; |
| 533 | const tabNames = { pl: 'سود و زیان', sales: 'تحلیل فروش', products: 'سودآوری کالاها', customers: 'گزارش مشتریان' }; |
| 534 | const rangeText = this._formatRange(pl.periodFrom, pl.periodTo); |
| 535 | |
| 536 | const printWin = window.open('', '_blank', 'width=900,height=700'); |
| 537 | if (!printWin) { Toast.error('پاپآپ را فعال کنید'); return; } |
| 538 | |
| 539 | const content = this._buildPrintContent(); |
| 540 | |
| 541 | printWin.document.write(` |
| 542 | <!DOCTYPE html> |
| 543 | <html lang="fa" dir="rtl"> |
| 544 | <head> |
| 545 | <meta charset="UTF-8" /> |
| 546 | <title>گزارش ${tabNames[currentTab]}</title> |
| 547 | <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/misc/Farsi-Digits/Vazirmatn-FD-font-face.css" /> |
| 548 | <style> |
| 549 | @page { size: A4 portrait; margin: 10mm; } |
| 550 | * { box-sizing: border-box; margin: 0; padding: 0; } |
| 551 | html, body { direction: rtl; text-align: right; font-family: 'Vazirmatn FD', Tahoma, sans-serif; background: #fff; color: #000; } |
| 552 | body { padding: 10px; } |
| 553 | table { width: 100%; border-collapse: collapse; direction: rtl; } |
| 554 | th, td { padding: 8px 10px; border: 1px solid #cbd5e1; text-align: right; font-size: 11.5px; } |
| 555 | th { background: #f1f5f9; font-weight: 700; } |
| 556 | h1 { font-size: 18px; margin-bottom: 6px; color: #0d9488; text-align: center; } |
| 557 | h2 { font-size: 14px; margin: 16px 0 10px; color: #0d9488; border-bottom: 2px solid #0d9488; padding-bottom: 4px; } |
| 558 | .header-info { text-align: center; font-size: 12px; color: #64748b; margin-bottom: 20px; } |
| 559 | .footer { margin-top: 30px; text-align: center; font-size: 10px; color: #94a3b8; padding-top: 10px; border-top: 1px dashed #cbd5e1; } |
| 560 | @media print { |
| 561 | * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; } |
| 562 | } |
| 563 | </style> |
| 564 | </head> |
| 565 | <body> |
| 566 | <h1>گزارش ${tabNames[currentTab]}</h1> |
| 567 | <div class="header-info">بازه: ${rangeText} | تاریخ چاپ: ${Jalali.today()}</div> |
| 568 | ${content} |
| 569 | <div class="footer">Factor-easyPro - سامانه مدیریت کسبوکار</div> |
| 570 | </body> |
| 571 | </html> |
| 572 | `); |
| 573 | printWin.document.close(); |
| 574 | setTimeout(() => { printWin.focus(); printWin.print(); }, 500); |
| 575 | } |
| 576 | |
| 577 | _buildPrintContent() { |
| 578 | const pl = cache.pl || {}; |
| 579 | if (currentTab === 'pl') { |
| 580 | return ` |
| 581 | <h2>صورت سود و زیان</h2> |
| 582 | <table> |
| 583 | <tr><td style="width:60%">فروش ناخالص</td><td>${Formatters.money(pl.grossSales)}</td></tr> |
| 584 | <tr><td>تخفیف فروش</td><td style="color:#dc2626">- ${Formatters.money(pl.salesDiscounts)}</td></tr> |
| 585 | <tr><td>برگشت از فروش</td><td style="color:#dc2626">- ${Formatters.money(pl.returnsAmount)}</td></tr> |
| 586 | <tr style="background:#f1f5f9;font-weight:700"><td>فروش خالص</td><td>${Formatters.money(pl.netSales)}</td></tr> |
| 587 | <tr><td>بهای تمامشده کالای فروشرفته</td><td style="color:#d97706">- ${Formatters.money(pl.cogs)}</td></tr> |
| 588 | <tr style="background:#f1f5f9;font-weight:700"><td>سود ناخالص</td><td style="color:#059669">${Formatters.money(pl.grossProfit)}</td></tr> |
| 589 | <tr><td>هزینههای عملیاتی</td><td style="color:#dc2626">- ${Formatters.money(pl.operatingExpenses)}</td></tr> |
| 590 | <tr><td>سایر درآمدها</td><td style="color:#059669">+ ${Formatters.money(pl.otherIncome)}</td></tr> |
| 591 | <tr style="background:#ecfdf5;font-weight:800;font-size:13px"><td>سود (زیان) خالص</td><td style="color:${pl.netProfit >= 0 ? '#059669' : '#dc2626'}">${Formatters.money(pl.netProfit)}</td></tr> |
| 592 | </table> |
| 593 | <h2>شاخصها</h2> |
| 594 | <table> |
| 595 | <tr><td>حاشیه سود ناخالص</td><td>${Formatters.percent(pl.grossMargin)}</td></tr> |
| 596 | <tr><td>حاشیه سود خالص</td><td>${Formatters.percent(pl.netMargin)}</td></tr> |
| 597 | <tr><td>تعداد فاکتور فروش</td><td>${Formatters.number(pl.invoiceCount)}</td></tr> |
| 598 | </table> |
| 599 | `; |
| 600 | } |
| 601 | |
| 602 | if (currentTab === 'products') { |
| 603 | const list = cache.products || []; |
| 604 | return ` |
| 605 | <h2>سودآوری کالاها (${Formatters.number(list.length)} کالا)</h2> |
| 606 | <table> |
| 607 | <thead><tr><th>#</th><th>نام کالا</th><th>تعداد</th><th>فروش کل</th><th>بهای تمامشده</th><th>سود خالص</th><th>حاشیه سود</th></tr></thead> |
| 608 | <tbody> |
| 609 | ${list.map((p, i) => ` |
| 610 | <tr> |
| 611 | <td>${Formatters.toPersianDigits(i + 1)}</td> |
| 612 | <td>${this._esc(p.productName)}</td> |
| 613 | <td>${Formatters.number(p.qty)}</td> |
| 614 | <td>${Formatters.money(p.totalSales)}</td> |
| 615 | <td>${Formatters.money(p.cogs)}</td> |
| 616 | <td>${Formatters.money(p.profit)}</td> |
| 617 | <td>${Formatters.percent(p.margin)}</td> |
| 618 | </tr> |
| 619 | `).join('')} |
| 620 | </tbody> |
| 621 | </table> |
| 622 | `; |
| 623 | } |
| 624 | |
| 625 | if (currentTab === 'customers') { |
| 626 | const list = cache.customers || []; |
| 627 | return ` |
| 628 | <h2>گزارش مشتریان (${Formatters.number(list.length)} مشتری)</h2> |
| 629 | <table> |
| 630 | <thead><tr><th>#</th><th>نام مشتری</th><th>تعداد فاکتور</th><th>مجموع خرید</th><th>پرداختشده</th><th>مانده</th></tr></thead> |
| 631 | <tbody> |
| 632 | ${list.map((c, i) => ` |
| 633 | <tr> |
| 634 | <td>${Formatters.toPersianDigits(i + 1)}</td> |
| 635 | <td>${this._esc(c.contactName)}</td> |
| 636 | <td>${Formatters.number(c.totalInvoices)}</td> |
| 637 | <td>${Formatters.money(c.totalSales)}</td> |
| 638 | <td>${Formatters.money(c.totalPaid)}</td> |
| 639 | <td>${Formatters.money(c.totalRemaining)}</td> |
| 640 | </tr> |
| 641 | `).join('')} |
| 642 | </tbody> |
| 643 | </table> |
| 644 | `; |
| 645 | } |
| 646 | |
| 647 | if (currentTab === 'sales') { |
| 648 | const topP = cache.sales?.topProductsBySales || []; |
| 649 | const topC = cache.sales?.topCustomers || []; |
| 650 | return ` |
| 651 | <h2>۱۰ کالای پرفروش</h2> |
| 652 | <table> |
| 653 | <thead><tr><th>#</th><th>نام کالا</th><th>تعداد</th><th>مبلغ فروش</th></tr></thead> |
| 654 | <tbody> |
| 655 | ${topP.map((p, i) => ` |
| 656 | <tr><td>${Formatters.toPersianDigits(i + 1)}</td><td>${this._esc(p.productName)}</td><td>${Formatters.number(p.qty)}</td><td>${Formatters.money(p.totalSales)}</td></tr> |
| 657 | `).join('')} |
| 658 | </tbody> |
| 659 | </table> |
| 660 | <h2>۱۰ مشتری برتر</h2> |
| 661 | <table> |
| 662 | <thead><tr><th>#</th><th>نام مشتری</th><th>تعداد فاکتور</th><th>مجموع خرید</th></tr></thead> |
| 663 | <tbody> |
| 664 | ${topC.map((c, i) => ` |
| 665 | <tr><td>${Formatters.toPersianDigits(i + 1)}</td><td>${this._esc(c.contactName)}</td><td>${Formatters.number(c.invoiceCount)}</td><td>${Formatters.money(c.totalSales)}</td></tr> |
| 666 | `).join('')} |
| 667 | </tbody> |
| 668 | </table> |
| 669 | `; |
| 670 | } |
| 671 | |
| 672 | return ''; |
| 673 | } |
| 674 | |
| 675 | _truncate(str, len) { |
| 676 | if (!str) return ''; |
| 677 | return str.length > len ? str.slice(0, len) + '…' : str; |
| 678 | } |
| 679 | |
| 680 | _esc(s) { |
| 681 | if (!s) return ''; |
| 682 | return String(s).replace(/[&<>"']/g, c => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c])); |
| 683 | } |
| 684 | } |
| 685 | |
| 686 | export const ReportsView = new ReportsViewImpl(); |
| 687 | window.ReportsView = ReportsView; |