سامانه صدور فاکتور و حسابداری
Update fmt.Println message from 'Hello' to 'Goodbye'
davoodmehraban89 committed
Sep 16, 2026 at 14:21 UTC
e76f27218c29c10e7d36ff78d15da4ba1fe2c175
1 file changed
+610
-1216
index.html
+610
-1216
@@ -3,23 +3,23 @@
3
<head>
4
<meta charset="UTF-8" />
5
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
6
- <title>ایزی فاکتور | سامانه صدور فاکتور و مدیریت مالی</title>
6
+ <title>ایزی فاکتور | سامانه جامع صدور فاکتور و مدیریت مالی</title>
7
8
<link rel="manifest" href="manifest.json" />
9
<meta name="apple-mobile-web-app-capable" content="yes" />
10
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
11
<meta name="apple-mobile-web-app-title" content="ایزی فاکتور" />
12
- <meta name="theme-color" content="#1e3a8a" />
12
+ <meta name="theme-color" content="#2563eb" />
13
14
- <!-- کتابخانه خواندن و پردازش فایل اکسل -->
14
+ <!-- کتابخانه پردازش فایل اکسل -->
15
<script src="https://cdn.jsdelivr.net/npm/xlsx@0.18.5/dist/xlsx.full.min.js"></script>
16
- <!-- فونت وزیرمتن فارسی -->
16
+ <!-- فونت وزیرمتن فارسی با اعداد ریال -->
17
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/misc/Farsi-Digits/Vazirmatn-FD-font-face.css" />
18
19
<style>
20
:root {
21
- --primary: #1e3a8a;
22
- --primary-hover: #172554;
21
+ --primary: #2563eb;
22
+ --primary-hover: #1d4ed8;
23
--accent: #2563eb;
24
--bg: #f8fafc;
25
--card-bg: #ffffff;
@@ -51,294 +51,53 @@
51
body {
52
background-color: var(--bg);
53
color: var(--text);
54
- font-size: 15px;
55
- }
56
-
57
- .app-root {
58
- display: flex;
59
- min-height: 100vh;
60
- width: 100%;
61
- max-width: 100%;
62
- overflow-x: hidden;
63
- }
64
-
65
- .sidebar {
66
- width: var(--sidebar-w);
67
- background: var(--card-bg);
68
- border-left: 1px solid var(--border);
69
- display: flex;
70
- flex-direction: column;
71
- position: fixed;
72
- top: 0;
73
- bottom: 0;
74
- right: 0;
75
- z-index: 100;
76
- }
77
-
78
- .brand-box {
79
- padding: 20px;
80
- display: flex;
81
- align-items: center;
82
- gap: 12px;
83
- border-bottom: 1px solid var(--border);
84
- }
85
-
86
- .brand-icon {
87
- width: 44px;
88
- height: 44px;
89
- background: linear-gradient(135deg, var(--primary), var(--accent));
90
- border-radius: 12px;
91
- display: flex;
92
- align-items: center;
93
- justify-content: center;
94
- color: #fff;
95
- font-weight: bold;
96
- font-size: 20px;
97
- }
98
-
99
- .sidebar-menu {
100
- list-style: none;
101
- padding: 16px 8px;
102
- flex: 1;
103
- overflow-y: auto;
104
- }
105
-
106
- .sidebar-menu li a {
107
- display: flex;
108
- align-items: center;
109
- gap: 12px;
110
- padding: 14px 16px;
111
- color: var(--text);
112
- text-decoration: none;
113
- border-radius: 10px;
114
- margin-bottom: 6px;
115
- font-size: 15px;
116
- font-weight: 500;
117
- transition: all 0.2s;
118
- }
119
-
120
- .sidebar-menu li a:hover, .sidebar-menu li a.active {
121
- background: #eff6ff;
122
- color: var(--accent);
123
- font-weight: bold;
124
- }
125
-
126
- .sidebar-footer {
127
- padding: 14px;
128
- border-top: 1px solid var(--border);
129
- font-size: 11px;
130
- color: var(--text-muted);
131
- text-align: center;
132
- }
133
-
134
- .main-surface {
135
- flex: 1;
136
- margin-right: var(--sidebar-w);
137
- padding: 20px;
138
- padding-bottom: 100px;
139
- max-width: calc(100% - var(--sidebar-w));
140
- overflow-x: hidden;
141
- }
142
-
143
- .mobile-dock {
144
- display: none;
145
- position: fixed;
146
- bottom: 0;
147
- left: 0;
148
- right: 0;
149
- height: var(--nav-h);
150
- background: rgba(255,255,255,0.98);
151
- backdrop-filter: blur(14px);
152
- -webkit-backdrop-filter: blur(14px);
153
- border-top: 1px solid #cbd5e1;
154
- z-index: 200;
155
- justify-content: space-around;
156
- align-items: center;
157
- padding-bottom: env(safe-area-inset-bottom);
158
- box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
159
- }
160
-
161
- .dock-tab {
162
- display: flex;
163
- flex-direction: column;
164
- align-items: center;
165
- justify-content: center;
166
- gap: 4px;
167
- color: #475569;
168
- text-decoration: none;
169
- font-size: 13px;
170
- font-weight: 600;
171
- flex: 1;
172
- height: 100%;
173
- cursor: pointer;
174
- }
175
-
176
- .dock-tab.active {
177
- color: var(--accent);
178
- font-weight: 800;
179
- }
180
-
181
- .dock-tab svg {
182
- width: 26px;
183
- height: 26px;
184
- stroke-width: 2.2;
185
- }
186
-
187
- .card {
188
- background: var(--card-bg);
189
- border: 1px solid var(--border);
190
- border-radius: 14px;
191
- padding: 18px;
192
- margin-bottom: 18px;
193
- box-shadow: 0 2px 4px rgba(0,0,0,0.02);
194
- width: 100%;
195
- max-width: 100%;
196
- overflow: hidden;
197
- }
198
-
199
- .grid-kpi {
200
- display: grid;
201
- grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
202
- gap: 14px;
203
- margin-bottom: 18px;
54
+ font-size: 14px;
55
}
56
206
- .kpi-unit {
207
- background: var(--card-bg);
208
- border: 1px solid var(--border);
209
- border-radius: 12px;
210
- padding: 16px;
211
- display: flex;
212
- align-items: center;
213
- gap: 14px;
214
- }
57
+ .app-root { display: flex; min-height: 100vh; width: 100%; max-width: 100%; overflow-x: hidden; }
58
+ .sidebar { width: var(--sidebar-w); background: var(--card-bg); border-left: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; right: 0; z-index: 100; }
59
+ .brand-box { padding: 20px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); }
60
+ .brand-icon { width: 40px; height: 40px; background: var(--primary); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: bold; font-size: 18px; }
61
+
62
+ .sidebar-menu { list-style: none; padding: 16px 8px; flex: 1; overflow-y: auto; }
63
+ .sidebar-menu li a { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--text); text-decoration: none; border-radius: 8px; margin-bottom: 4px; font-size: 14px; font-weight: 500; transition: all 0.2s; }
64
+ .sidebar-menu li a:hover, .sidebar-menu li a.active { background: #eff6ff; color: var(--primary); font-weight: bold; }
65
216
- .kpi-icon {
217
- width: 50px;
218
- height: 50px;
219
- border-radius: 12px;
220
- display: flex;
221
- align-items: center;
222
- justify-content: center;
223
- font-size: 24px;
224
- }
66
+ .sidebar-footer { padding: 12px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-muted); text-align: center; }
67
+ .main-surface { flex: 1; margin-right: var(--sidebar-w); padding: 20px; padding-bottom: 100px; max-width: calc(100% - var(--sidebar-w)); overflow-x: hidden; }
68
226
- .kpi-val {
227
- font-size: 18px;
228
- font-weight: bold;
229
- margin-top: 4px;
230
- }
69
+ .mobile-dock { display: none; position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav-h); background: rgba(255,255,255,0.98); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid #cbd5e1; z-index: 200; justify-content: space-around; align-items: center; padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 12px rgba(0,0,0,0.06); }
70
+ .dock-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #475569; text-decoration: none; font-size: 12px; font-weight: 600; flex: 1; height: 100%; cursor: pointer; }
71
+ .dock-tab.active { color: var(--primary); font-weight: 800; }
72
+ .dock-tab svg { width: 24px; height: 24px; stroke-width: 2; }
73
232
- .kpi-lbl {
233
- color: var(--text-muted);
234
- font-size: 13px;
235
- font-weight: 500;
236
- }
237
-
238
- .btn {
239
- display: inline-flex;
240
- align-items: center;
241
- justify-content: center;
242
- gap: 8px;
243
- min-height: 46px;
244
- padding: 10px 18px;
245
- background: var(--primary);
246
- color: #fff;
247
- border: none;
248
- border-radius: 10px;
249
- cursor: pointer;
250
- font-size: 15px;
251
- font-weight: 600;
252
- transition: background 0.2s;
253
- }
74
+ .card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 18px; box-shadow: 0 1px 3px rgba(0,0,0,0.03); width: 100%; max-width: 100%; overflow: hidden; }
75
+ .grid-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
76
+ .kpi-unit { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 16px; display: flex; align-items: center; gap: 14px; }
77
+ .kpi-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
78
+ .kpi-val { font-size: 17px; font-weight: bold; margin-top: 4px; }
79
+ .kpi-lbl { color: var(--text-muted); font-size: 12px; font-weight: 500; }
80
81
+ .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 16px; background: var(--primary); color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600; transition: background 0.2s; }
82
.btn:hover { background: var(--primary-hover); }
83
.btn-secondary { background: #e2e8f0; color: var(--text); }
84
.btn-secondary:hover { background: #cbd5e1; }
85
.btn-success { background: var(--success); }
86
.btn-danger { background: var(--danger); }
87
261
- .form-group {
262
- margin-bottom: 15px;
263
- width: 100%;
264
- }
88
+ .form-group { margin-bottom: 14px; width: 100%; }
89
+ .form-group label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: #334155; }
90
+ .form-control { width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; background: #fff; transition: border-color 0.2s; }
91
+ .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
92
+ .form-control:disabled { background-color: #f1f5f9; color: #94a3b8; cursor: not-allowed; }
93
+ .form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; width: 100%; }
94
266
- .form-group label {
267
- display: block;
268
- margin-bottom: 8px;
269
- font-size: 14px;
270
- font-weight: 600;
271
- color: #334155;
272
- }
273
-
274
- .form-control {
275
- width: 100%;
276
- min-height: 46px;
277
- padding: 10px 14px;
278
- border: 1.5px solid var(--border);
279
- border-radius: 10px;
280
- font-size: 15px;
281
- outline: none;
282
- background: #fff;
283
- transition: border-color 0.2s;
284
- }
285
-
286
- .form-control:focus {
287
- border-color: var(--accent);
288
- box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
289
- }
290
-
291
- .form-control:disabled {
292
- background-color: #f1f5f9;
293
- color: #94a3b8;
294
- cursor: not-allowed;
295
- border-color: #e2e8f0;
296
- }
297
-
298
- .form-row {
299
- display: grid;
300
- grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
301
- gap: 14px;
302
- width: 100%;
303
- }
304
-
305
- .table-responsive {
306
- width: 100%;
307
- max-width: 100%;
308
- overflow-x: auto;
309
- -webkit-overflow-scrolling: touch;
310
- border: 1px solid var(--border);
311
- border-radius: 10px;
312
- }
313
-
314
- table {
315
- width: 100%;
316
- border-collapse: collapse;
317
- text-align: right;
318
- font-size: 14px;
319
- min-width: 600px;
320
- }
321
-
322
- th, td {
323
- padding: 12px 10px;
324
- border-bottom: 1px solid var(--border);
325
- white-space: nowrap;
326
- }
327
-
328
- th {
329
- background: #f1f5f9;
330
- color: #334155;
331
- font-weight: 700;
332
- }
333
-
334
- .badge {
335
- display: inline-block;
336
- padding: 4px 10px;
337
- border-radius: 6px;
338
- font-size: 12px;
339
- font-weight: 600;
340
- }
95
+ .table-responsive { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: 8px; }
96
+ table { width: 100%; border-collapse: collapse; text-align: right; font-size: 13px; min-width: 600px; }
97
+ th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
98
+ th { background: #f1f5f9; color: #334155; font-weight: 700; }
99
100
+ .badge { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
101
.badge-success { background: #d1fae5; color: #065f46; }
102
.badge-warning { background: #fef3c7; color: #92400e; }
103
.badge-danger { background: #fee2e2; color: #991b1b; }
@@ -346,46 +105,28 @@
105
.view-pane { display: none; }
106
.view-pane.active { display: block; }
107
349
- /* پنجره مودال پاپآپ سریع */
350
- .modal-backdrop {
351
- display: none;
352
- position: fixed;
353
- top: 0; left: 0; right: 0; bottom: 0;
354
- background: rgba(15,23,42,0.6);
355
- backdrop-filter: blur(4px);
356
- z-index: 999;
357
- align-items: center;
358
- justify-content: center;
359
- padding: 16px;
360
- }
108
+ .modal-backdrop { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15,23,42,0.6); backdrop-filter: blur(4px); z-index: 999; align-items: center; justify-content: center; padding: 16px; }
109
.modal-backdrop.active { display: flex; }
362
- .modal-card {
363
- background: #fff;
364
- border-radius: 16px;
365
- max-width: 650px;
366
- width: 100%;
367
- max-height: 90vh;
368
- overflow-y: auto;
369
- padding: 24px;
370
- box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
371
- }
110
+ .modal-card { background: #fff; border-radius: 14px; max-width: 600px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 20px; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); }
111
+
112
+ /* آکاردیون تنظیمات مشابه تصویر ۱۶ و ۲۴ */
113
+ .accordion-item { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; overflow: hidden; background: #fff; }
114
+ .accordion-header { padding: 14px 18px; background: #f8fafc; font-weight: bold; display: flex; justify-content: space-between; align-items: center; cursor: pointer; user-select: none; }
115
+ .accordion-body { padding: 16px; border-top: 1px solid var(--border); display: none; background: #fff; }
116
+ .accordion-item.open .accordion-body { display: block; }
117
118
@media print {
119
body { background: #fff; }
120
.sidebar, .mobile-dock, .no-print { display: none !important; }
121
.main-surface { margin: 0; padding: 0; max-width: 100%; }
122
.card { border: none; box-shadow: none; padding: 0; }
378
- #printable-invoice { display: block !important; }
123
+ .invoice-page-break { page-break-after: always; break-after: page; display: block !important; margin-bottom: 30px; }
124
+ .invoice-page-break:last-child { page-break-after: avoid; break-after: avoid; margin-bottom: 0; }
125
}
126
127
@media (max-width: 768px) {
128
.sidebar { display: none; }
383
- .main-surface {
384
- margin-right: 0;
385
- padding: 14px;
386
- padding-bottom: calc(var(--nav-h) + 26px);
387
- max-width: 100%;
388
- }
129
+ .main-surface { margin-right: 0; padding: 12px; padding-bottom: calc(var(--nav-h) + 20px); max-width: 100%; }
130
.mobile-dock { display: flex; }
131
.btn { width: 100%; }
132
.btn-inline { width: auto; }
@@ -401,8 +142,8 @@
142
<div class="brand-box">
143
<div class="brand-icon">ایزی</div>
144
<div>
404
- <h2 style="font-size: 16px; font-weight: bold;">ایزی فاکتور</h2>
405
- <small style="color: var(--text-muted); font-size: 12px;">صدور هوشمند انواع فاکتور</small>
145
+ <h2 style="font-size: 15px; font-weight: bold;">ایزی فاکتور</h2>
146
+ <small style="color: var(--text-muted); font-size: 11px;">نگارش ۴.۰ (کامل)</small>
147
</div>
148
</div>
149
<ul class="sidebar-menu">
@@ -415,7 +156,7 @@
156
<li><a href="#" class="nav-link" data-view="view-settings">⚙️ تنظیمات و شرکتها</a></li>
157
</ul>
158
<div class="sidebar-footer">
418
- نگارش ۳.۰ | <span id="lbl-build-date">۱۴۰۵/۰۶/۲۶</span>
159
+ نگارش ۴.۰ | <span id="lbl-build-date">۱۴۰۵/۰۶/۲۶</span>
160
</div>
161
</aside>
162
@@ -424,34 +165,34 @@
165
166
<!-- ۱. داشبورد -->
167
<section id="view-dashboard" class="view-pane active">
427
- <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px;">
168
+ <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 10px;">
169
<div>
429
- <h1 style="font-size: 22px; font-weight: bold;">سامانه ایزی فاکتور</h1>
430
- <p style="color: var(--text-muted); font-size: 14px;" id="dashboard-date-display"></p>
170
+ <h1 style="font-size: 20px; font-weight: bold;">سامانه ایزی فاکتور</h1>
171
+ <p style="color: var(--text-muted); font-size: 13px;" id="dashboard-date-display"></p>
172
</div>
173
<button class="btn btn-inline no-print" onclick="startNewInvoice()">➕ صدور فاکتور جدید</button>
174
</div>
175
176
<div class="grid-kpi">
177
<div class="kpi-unit">
437
- <div class="kpi-icon" style="background:#eff6ff; color:var(--accent);">💰</div>
178
+ <div class="kpi-icon" style="background:#eff6ff; color:var(--primary);">💰</div>
179
<div>
439
- <div class="kpi-lbl">مجموع فروش ثبتشده</div>
440
- <div class="kpi-val" id="kpi-sales-sum">۰ تومان</div>
180
+ <div class="kpi-lbl">مجموع فروش ثبتشده (ریال)</div>
181
+ <div class="kpi-val" id="kpi-sales-sum">۰ ریال</div>
182
</div>
183
</div>
184
<div class="kpi-unit">
185
<div class="kpi-icon" style="background:#ecfdf5; color:var(--success);">📥</div>
186
<div>
187
<div class="kpi-lbl">دریافت وصول شده</div>
447
- <div class="kpi-val" id="kpi-settled-sum">۰ تومان</div>
188
+ <div class="kpi-val" id="kpi-settled-sum">۰ ریال</div>
189
</div>
190
</div>
191
<div class="kpi-unit">
192
<div class="kpi-icon" style="background:#fffbeb; color:var(--warning);">⏳</div>
193
<div>
194
<div class="kpi-lbl">مانده مطالبات نسیه</div>
454
- <div class="kpi-val" id="kpi-debtors-sum">۰ تومان</div>
195
+ <div class="kpi-val" id="kpi-debtors-sum">۰ ریال</div>
196
</div>
197
</div>
198
<div class="kpi-unit">
@@ -464,7 +205,7 @@
205
</div>
206
207
<div class="card">
467
- <h3 style="font-size: 16px; margin-bottom: 14px;">آخرین فاکتورهای صادر شده شرکت فعال</h3>
208
+ <h3 style="font-size: 15px; margin-bottom: 12px;">آخرین فاکتورهای صادر شده</h3>
209
<div class="table-responsive">
210
<table>
211
<thead>
@@ -474,7 +215,7 @@
215
<th>خریدار</th>
216
<th>نوع فاکتور</th>
217
<th>ارزش افزوده</th>
477
- <th>مبلغ کل (تومان)</th>
218
+ <th>مبلغ کل (ریال)</th>
219
<th>عملیات</th>
220
</tr>
221
</thead>
@@ -486,118 +227,133 @@
227
</div>
228
</section>
229
489
- <!-- ۲. صدور و ویرایش فاکتور -->
230
+ <!-- ۲. صدور فاکتور -->
231
<section id="view-invoices" class="view-pane">
232
<div class="card no-print">
492
- <div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:16px;">
493
- <h2 style="font-size: 18px;" id="invoice-form-title">صدور فاکتور فروش</h2>
494
- <button class="btn btn-secondary btn-inline" style="display:none;" id="btn-cancel-edit" onclick="cancelInvoiceEdit()">انصراف از ویرایش</button>
233
+ <div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:14px;">
234
+ <h2 style="font-size: 17px;" id="invoice-form-title">صدور فاکتور جدید</h2>
235
+ <button class="btn btn-secondary btn-inline" style="display:none; padding:4px 10px; font-size:12px;" id="btn-cancel-edit" onclick="cancelInvoiceEdit()">انصراف از ویرایش</button>
236
</div>
237
238
<input type="hidden" id="edit-invoice-id" value="" />
239
499
- <div class="form-row">
500
- <div class="form-group">
501
- <label>فروشنده (سربرگ شرکت)</label>
502
- <select id="invoice-company-id" class="form-control" onchange="onActiveCompanyFilterChange()"></select>
240
+ <!-- نوار بالای فرم طبق عکس ۷ -->
241
+ <div class="form-row" style="background:#f1f5f9; padding:12px; border-radius:10px; margin-bottom:14px;">
242
+ <div class="form-group" style="margin-bottom:0;">
243
+ <label>تاریخ فاکتور</label>
244
+ <input type="text" id="invoice-date-input" class="form-control" />
245
</div>
504
- <div class="form-group">
246
+ <div class="form-group" style="margin-bottom:0;">
247
+ <label>شماره فاکتور</label>
248
+ <input type="text" id="invoice-number" class="form-control" placeholder="PINV-31" />
249
+ </div>
250
+ <div class="form-group" style="margin-bottom:0;">
251
<label>قالب و نوع سند</label>
252
<select id="invoice-kind" class="form-control" onchange="handleInvoiceKindChange()">
507
- <option value="non_formal">فاکتور غیررسمی (آزاد)</option>
253
+ <option value="non_formal">فاکتور غیررسمی</option>
254
<option value="formal">فاکتور رسمی</option>
509
- <option value="pre_invoice">پیشفاکتور رسمی</option>
255
+ <option value="pre_invoice">پیشفاکتور فروش</option>
256
</select>
257
</div>
512
- <div class="form-group" id="box-invoice-vat-mode">
513
- <label>وضعیت ارزش افزوده</label>
514
- <select id="invoice-vat-mode" class="form-control" onchange="handleVatModeChange()">
515
- <option value="none">بدون ارزش افزوده</option>
516
- <option value="with_vat">با ارزش افزوده</option>
517
- </select>
518
- </div>
519
- <div class="form-group" id="box-invoice-vat-rate" style="display:none;">
520
- <label>درصد مالیات ارزش افزوده</label>
521
- <input type="number" id="invoice-vat-rate-input" class="form-control" value="10" oninput="recomputeTotals()" />
522
- </div>
258
+ </div>
259
+
260
+ <div class="form-row">
261
<div class="form-group">
524
- <label>شماره فاکتور</label>
525
- <input type="text" id="invoice-number" class="form-control" placeholder="1085" />
262
+ <label>فروشنده (سربرگ شرکت)</label>
263
+ <select id="invoice-company-id" class="form-control" onchange="onActiveCompanyFilterChange()"></select>
264
</div>
265
<div class="form-group">
266
<label style="display:flex; justify-content:space-between;">
529
- <span>خریدار / طرف حساب</span>
530
- <a href="#" style="color:var(--accent); text-decoration:none;" onclick="openQuickContactModal()">➕ شخص جدید</a>
267
+ <span>نام خریدار را وارد یا انتخاب کنید</span>
268
+ <a href="#" style="color:var(--primary); text-decoration:none;" onclick="openQuickContactModal()">➕ شخص جدید</a>
269
</label>
270
<div style="display:flex; gap:8px;">
271
<select id="invoice-contact-id" class="form-control" style="flex:1;"></select>
534
- <button class="btn btn-secondary btn-inline" type="button" onclick="openQuickContactModal()" style="padding:0 12px; min-height:46px;">➕</button>
272
+ <button class="btn btn-secondary btn-inline" type="button" onclick="openQuickContactModal()" style="padding:0 12px; min-height:42px;">➕</button>
273
</div>
274
</div>
537
- <div class="form-group">
538
- <label>تاریخ فاکتور (شمسی)</label>
539
- <input type="text" id="invoice-date-input" class="form-control" />
540
- </div>
275
</div>
276
543
- <div style="margin: 20px 0;">
544
- <div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:10px;">
545
- <h4 style="font-size: 15px;">اقلام فاکتور</h4>
546
- <button class="btn btn-secondary btn-inline" style="font-size:13px; min-height:36px; padding:4px 12px;" onclick="openQuickProductModal()">➕ کالای جدید</button>
277
+ <!-- جدول اقلام فاکتور -->
278
+ <div style="margin: 16px 0;">
279
+ <div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;">
280
+ <h4 style="font-size: 14px;">اقلام کالا یا خدمات</h4>
281
+ <button class="btn btn-secondary btn-inline" style="font-size:12px; min-height:34px; padding:4px 10px;" onclick="openQuickProductModal()">➕ کالای جدید</button>
282
</div>
283
<div class="table-responsive">
284
<table>
285
<thead>
551
- <tr>
552
- <th>انتخاب کالا / خدمت</th>
553
- <th style="width:110px;">تعداد</th>
554
- <th style="width:170px;">قیمت واحد (تومان)</th>
555
- <th style="width:170px;">جمع سطر</th>
286
+ <tr style="background:#e2e8f0;">
287
+ <th style="width:40px; text-align:center;">#</th>
288
+ <th>شرح کالا | خدمات</th>
289
+ <th style="width:90px;">واحد</th>
290
+ <th style="width:100px;">مقدار</th>
291
+ <th style="width:160px;">قیمت واحد (ریال)</th>
292
+ <th style="width:170px;">قیمت کل (ریال)</th>
293
<th style="width:50px;">حذف</th>
294
</tr>
295
</thead>
296
<tbody id="invoice-items-table-body"></tbody>
297
</table>
298
</div>
562
- <div style="display:flex; gap:10px; margin-top:12px; flex-wrap:wrap;">
563
- <button class="btn btn-secondary btn-inline" onclick="addInvoiceItemRow()">➕ افزودن ردیف کالا</button>
564
- </div>
299
+ <button class="btn btn-secondary btn-inline" style="margin-top: 10px; width:100%; border: 1.5px dashed var(--primary); color:var(--primary); background:#eff6ff;" onclick="addInvoiceItemRow()">+ افزودن ردیف</button>
300
</div>
301
567
- <div class="form-row" style="background:#f1f5f9; padding:16px; border-radius:12px; margin-top:14px;">
568
- <div class="form-group">
569
- <label>شرایط تسویه</label>
570
- <select id="invoice-payment-method" class="form-control">
571
- <option value="cash">نقدی / کارتخوان (تسویه کامل)</option>
572
- <option value="credit">نسیه (بدهکار در معین خریدار)</option>
573
- <option value="cheque">چک صیادی</option>
574
- <option value="installment">فروش اقساطی</option>
575
- </select>
302
+ <!-- کادرهای پایانی (جمعبندی، مالیات و تخفیف) -->
303
+ <div class="form-row" style="background:#f1f5f9; padding:14px; border-radius:10px; margin-top:12px;">
304
+ <div class="form-group" style="background:#fff; padding:12px; border-radius:8px; border:1px solid var(--border); margin-bottom:0;">
305
+ <label style="font-weight:bold; border-bottom:1px solid #eee; padding-bottom:6px; margin-bottom:8px;">مالیات و تخفیف</label>
306
+ <div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;">
307
+ <span>مالیات ارزش افزوده</span>
308
+ <select id="invoice-vat-mode" class="form-control" style="width:140px; min-height:36px;" onchange="handleVatModeChange()">
309
+ <option value="none">غیرفعال</option>
310
+ <option value="with_vat">فعال (درصدی)</option>
311
+ </select>
312
+ </div>
313
+ <div id="box-invoice-vat-rate" style="display:none; display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;">
314
+ <span>درصد مالیات</span>
315
+ <input type="number" id="invoice-vat-rate-input" class="form-control" style="width:100px; min-height:36px;" value="10" oninput="recomputeTotals()" />
316
+ </div>
317
+ <div style="display:flex; justify-content:space-between; align-items:center;">
318
+ <span>تخفیف کلی فاکتور</span>
319
+ <input type="number" id="invoice-discount-fixed" class="form-control" style="width:140px; min-height:36px;" value="0" oninput="recomputeTotals()" />
320
+ </div>
321
</div>
577
- <div class="form-group">
578
- <label>تخفیف کلی فاکتور (تومان)</label>
579
- <input type="number" id="invoice-discount-fixed" class="form-control" value="0" oninput="recomputeTotals()" />
322
+
323
+ <div class="form-group" style="background:#fff; padding:12px; border-radius:8px; border:1px solid var(--border); margin-bottom:0;">
324
+ <label style="font-weight:bold; border-bottom:1px solid #eee; padding-bottom:6px; margin-bottom:8px;">جمعبندی نهایی</label>
325
+ <div style="display:flex; justify-content:space-between; margin-bottom:6px; font-size:13px;">
326
+ <span>جمع کل:</span>
327
+ <span id="summary-subtotal" style="font-weight:bold;">۰ ریال</span>
328
+ </div>
329
+ <div style="display:flex; justify-content:space-between; margin-bottom:6px; font-size:13px;">
330
+ <span>مالیات:</span>
331
+ <span id="summary-vat" style="font-weight:bold;">۰ ریال</span>
332
+ </div>
333
+ <div style="display:flex; justify-content:space-between; margin-bottom:6px; font-size:14px; border-top:1px solid #eee; padding-top:6px;">
334
+ <span style="font-weight:bold; color:var(--primary);">قابل پرداخت:</span>
335
+ <span id="summary-grandtotal" style="font-weight:bold; color:var(--primary);">۰ ریال</span>
336
+ </div>
337
+ <div style="font-size:11px; color:var(--text-muted); margin-top:4px;" id="summary-words">به حروف: صفر ریال</div>
338
</div>
581
- <div class="form-group">
582
- <label>مبلغ نهایی قابل پرداخت</label>
583
- <input type="text" id="invoice-grand-total-display" class="form-control" readonly style="font-weight:bold; font-size:16px; background:#e2e8f0;" />
339
+ </div>
340
+
341
+ <div class="form-row" style="margin-top:14px;">
342
+ <div class="form-group" style="margin-bottom:0;">
343
+ <label>توضیحات فاکتور</label>
344
+ <textarea id="invoice-desc-input" class="form-control" rows="2" placeholder="توضیحات تکمیلی..."></textarea>
345
</div>
346
</div>
347
587
- <div style="display:flex; gap:12px; margin-top: 20px; flex-wrap:wrap;">
588
- <button class="btn btn-success" id="btn-save-invoice" onclick="commitSaveInvoice()">💾 ثبت و صدور فاکتور</button>
348
+ <div style="display:flex; gap:10px; margin-top: 16px; flex-wrap:wrap;">
349
+ <button class="btn btn-success" id="btn-save-invoice" onclick="commitSaveInvoice()">💾 ثبت فاکتور</button>
350
</div>
351
</div>
352
353
<div class="card no-print">
593
- <div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:14px; flex-wrap:wrap; gap:10px;">
594
- <h3 style="font-size: 16px;">دفتر بایگانی فاکتورها</h3>
595
- <div style="display:flex; align-items:center; gap:8px;">
596
- <label style="font-size:13px; font-weight:600;">فیلتر شرکت:</label>
597
- <select id="filter-invoice-company" class="form-control" style="width:200px; min-height:38px;" onchange="renderInvoices()">
598
- <!-- گزینهها داینامیک پر میشوند -->
599
- </select>
600
- </div>
354
+ <div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; flex-wrap:wrap; gap:10px;">
355
+ <h3 style="font-size: 15px;">دفتر بایگانی فاکتورها</h3>
356
+ <select id="filter-invoice-company" class="form-control" style="width:200px; min-height:36px;" onchange="renderInvoices()"></select>
357
</div>
358
<div class="table-responsive">
359
<table>
@@ -607,9 +363,8 @@
363
<th>فروشنده</th>
364
<th>خریدار</th>
365
<th>نوع</th>
610
- <th>ارزش افزوده</th>
366
<th>تاریخ</th>
612
- <th>مبلغ نهایی (تومان)</th>
367
+ <th>قابل پرداخت (ریال)</th>
368
<th>عملیات</th>
369
</tr>
370
</thead>
@@ -619,72 +374,43 @@
374
</div>
375
</section>
376
622
- <!-- ۳. کالاها و خدمات + ایمپورت اکسل -->
377
+ <!-- ۳. کالاها و خدمات -->
378
<section id="view-products" class="view-pane">
379
<div class="card no-print">
625
- <div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; flex-wrap:wrap; gap:10px;">
626
- <h2 style="font-size: 18px;">تعریف کالا / خدمت جدید</h2>
380
+ <div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:14px; flex-wrap:wrap; gap:10px;">
381
+ <h2 style="font-size: 17px;">تعریف کالا / خدمت جدید</h2>
382
<div style="display:flex; gap:8px;">
628
- <label class="btn btn-secondary btn-inline" style="min-height:40px; padding:6px 14px;">
629
- 📥 ورود کالاها از اکسل
383
+ <label class="btn btn-secondary btn-inline" style="min-height:36px; padding:4px 12px; font-size:13px;">
384
+ 📥 ورود از اکسل
385
<input type="file" id="excel-import-products" style="display:none;" onchange="importProductsFromExcel(event)" accept=".xlsx, .xls" />
386
</label>
632
- <button class="btn btn-secondary btn-inline" style="min-height:40px; padding:6px 14px;" onclick="downloadProductsExcelTemplate()">📄 دانلود نمونه اکسل</button>
387
+ <button class="btn btn-secondary btn-inline" style="min-height:36px; padding:4px 12px; font-size:13px;" onclick="downloadProductsExcelTemplate()">📄 نمونه اکسل</button>
388
</div>
389
</div>
390
<div class="form-row">
636
- <div class="form-group">
637
- <label>کد کالا</label>
638
- <input type="text" id="prod-code-input" class="form-control" placeholder="101" />
639
- </div>
640
- <div class="form-group">
641
- <label>عنوان کالا یا خدمت</label>
642
- <input type="text" id="prod-name-input" class="form-control" placeholder="مثلاً: بلوک سیمانی ۱۰" />
643
- </div>
644
- <div class="form-group">
645
- <label>مشخصه / مدل / نوع</label>
646
- <input type="text" id="prod-spec-input" class="form-control" placeholder="مثلاً: سبک لیکا / سنگین ماسهای" />
647
- </div>
648
- <div class="form-group">
649
- <label>نوع ردیف</label>
650
- <select id="prod-type-input" class="form-control">
651
- <option value="good">کالای فیزیکی</option>
652
- <option value="service">خدمات و اجرا</option>
653
- </select>
654
- </div>
391
+ <div class="form-group"><label>کد کالا</label><input type="text" id="prod-code-input" class="form-control" placeholder="101" /></div>
392
+ <div class="form-group"><label>عنوان کالا</label><input type="text" id="prod-name-input" class="form-control" placeholder="هارد سرور..." /></div>
393
+ <div class="form-group"><label>مشخصه / مدل</label><input type="text" id="prod-spec-input" class="form-control" placeholder="2.5 اینچ SAS" /></div>
394
+ <div class="form-group"><label>واحد</label><input type="text" id="prod-unit-input" class="form-control" value="عدد" /></div>
395
</div>
396
<div class="form-row">
657
- <div class="form-group">
658
- <label>واحد اندازهگیری</label>
659
- <input type="text" id="prod-unit-input" class="form-control" value="قالب" placeholder="قالب، عدد، متر..." />
660
- </div>
661
- <div class="form-group">
662
- <label>قیمت خرید (تومان)</label>
663
- <input type="number" id="prod-buy-input" class="form-control" value="0" />
664
- </div>
665
- <div class="form-group">
666
- <label>قیمت فروش (تومان)</label>
667
- <input type="number" id="prod-sale-input" class="form-control" value="0" />
668
- </div>
669
- <div class="form-group">
670
- <label>موجودی فیزیکی اولیه (اختیاری)</label>
671
- <input type="number" id="prod-stock-input" class="form-control" value="0" />
672
- </div>
397
+ <div class="form-group"><label>قیمت خرید (ریال)</label><input type="number" id="prod-buy-input" class="form-control" value="0" /></div>
398
+ <div class="form-group"><label>قیمت فروش (ریال)</label><input type="number" id="prod-sale-input" class="form-control" value="0" /></div>
399
</div>
674
- <button class="btn btn-success" onclick="commitSaveProduct()">➕ افزودن به لیست کالاها</button>
400
+ <button class="btn btn-success" onclick="commitSaveProduct()">➕ ثبت کالا</button>
401
</div>
402
403
<div class="card">
678
- <h3 style="font-size: 16px; margin-bottom: 14px;">لیست کالاها و خدمات ثبتشده</h3>
404
+ <h3 style="font-size: 15px; margin-bottom: 12px;">کالاهای ثبتشده</h3>
405
<div class="table-responsive">
406
<table>
407
<thead>
408
<tr>
409
<th>کد</th>
684
- <th>عنوان کالا</th>
685
- <th>مشخصه / نوع</th>
410
+ <th>نام کالا</th>
411
+ <th>مشخصه</th>
412
<th>واحد</th>
687
- <th>قیمت فروش (تومان)</th>
413
+ <th>قیمت فروش (ریال)</th>
414
<th>عملیات</th>
415
</tr>
416
</thead>
@@ -694,20 +420,19 @@
420
</div>
421
</section>
422
697
- <!-- ۴. اشخاص و طرفحسابها + ایمپورت اکسل -->
423
+ <!-- ۴. اشخاص -->
424
<section id="view-contacts" class="view-pane">
425
<div class="card no-print">
700
- <div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; flex-wrap:wrap; gap:10px;">
701
- <h2 style="font-size: 18px;">ثبت طرف حساب جدید</h2>
426
+ <div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:14px; flex-wrap:wrap; gap:10px;">
427
+ <h2 style="font-size: 17px;">ثبت طرف حساب جدید</h2>
428
<div style="display:flex; gap:8px;">
703
- <label class="btn btn-secondary btn-inline" style="min-height:40px; padding:6px 14px;">
704
- 📥 ورود اشخاص از اکسل
429
+ <label class="btn btn-secondary btn-inline" style="min-height:36px; padding:4px 12px; font-size:13px;">
430
+ 📥 ورود از اکسل
431
<input type="file" id="excel-import-contacts" style="display:none;" onchange="importContactsFromExcel(event)" accept=".xlsx, .xls" />
432
</label>
707
- <button class="btn btn-secondary btn-inline" style="min-height:40px; padding:6px 14px;" onclick="downloadContactsExcelTemplate()">📄 دانلود نمونه اکسل</button>
433
+ <button class="btn btn-secondary btn-inline" style="min-height:36px; padding:4px 12px; font-size:13px;" onclick="downloadContactsExcelTemplate()">📄 نمونه اکسل</button>
434
</div>
435
</div>
710
-
436
<div class="form-row">
437
<div class="form-group">
438
<label>نوع شخص</label>
@@ -717,72 +442,44 @@
442
</select>
443
</div>
444
<div class="form-group" id="box-contact-prefix">
720
- <label>پیشوند انتخابی</label>
445
+ <label>پیشوند</label>
446
<select id="contact-prefix-select" class="form-control">
447
<option value="آقا/خانم">آقا / خانم</option>
448
<option value="فروشگاه">فروشگاه</option>
449
</select>
450
</div>
451
<div class="form-group" style="grid-column: span 2;">
727
- <label>نام طرف حساب (شخص یا نام فروشگاه/شرکت)</label>
728
- <input type="text" id="contact-name-input" class="form-control" placeholder="مثلاً: احمدی یا عمران نوین" />
452
+ <label>نام طرف حساب</label>
453
+ <input type="text" id="contact-name-input" class="form-control" placeholder="دانشگاه صنعتی شریف..." />
454
</div>
455
</div>
731
-
456
<div class="form-row">
733
- <div class="form-group">
734
- <label>نقش تجاری</label>
735
- <select id="contact-role-input" class="form-control">
736
- <option value="customer">مشتری (خریدار)</option>
737
- <option value="supplier">تامینکننده (فروشنده)</option>
738
- <option value="both">دوگانه</option>
739
- </select>
740
- </div>
741
- <div class="form-group">
742
- <label>شماره تماس همراه</label>
743
- <input type="text" id="contact-mobile-input" class="form-control" placeholder="0912..." />
744
- </div>
745
- <div class="form-group">
746
- <label>کد ملی / شناسه ملی</label>
747
- <input type="text" id="contact-national-input" class="form-control" placeholder="۱۰ یا ۱۱ رقم" />
748
- </div>
749
- <div class="form-group">
750
- <label>کد اقتصادی</label>
751
- <input type="text" id="contact-economic-input" class="form-control" placeholder="کد اقتصادی ۱۲ رقمی" />
752
- </div>
457
+ <div class="form-group"><label>نقش</label><select id="contact-role-input" class="form-control"><option value="customer">مشتری</option><option value="supplier">تامینکننده</option></select></div>
458
+ <div class="form-group"><label>همراه</label><input type="text" id="contact-mobile-input" class="form-control" /></div>
459
+ <div class="form-group"><label>شناسه / کد ملی</label><input type="text" id="contact-national-input" class="form-control" /></div>
460
+ <div class="form-group"><label>کد اقتصادی</label><input type="text" id="contact-economic-input" class="form-control" /></div>
461
</div>
754
-
462
<div class="form-row">
756
- <div class="form-group">
757
- <label>شماره ثبت (ویژه اشخاص حقوقی)</label>
758
- <input type="text" id="contact-reg-input" class="form-control" placeholder="شماره ثبت شرکت" />
759
- </div>
760
- <div class="form-group">
761
- <label>کد پستی (۱۰ رقم مجزا)</label>
762
- <input type="text" id="contact-postal-input" class="form-control" placeholder="کد پستی ۱۰ رقمی" />
763
- </div>
764
- <div class="form-group" style="grid-column: span 2;">
765
- <label>نشانی کامل</label>
766
- <input type="text" id="contact-address-input" class="form-control" placeholder="استان، شهر، خیابان..." />
767
- </div>
463
+ <div class="form-group"><label>شماره ثبت</label><input type="text" id="contact-reg-input" class="form-control" /></div>
464
+ <div class="form-group"><label>کد پستی</label><input type="text" id="contact-postal-input" class="form-control" /></div>
465
+ <div class="form-group" style="grid-column: span 2;"><label>نشانی</label><input type="text" id="contact-address-input" class="form-control" /></div>
466
</div>
467
<button class="btn btn-success" onclick="commitSaveContact()">➕ ثبت طرف حساب</button>
468
</div>
469
470
<div class="card">
773
- <h3 style="font-size: 16px; margin-bottom: 14px;">دفتر طرفحسابها و معین مانده حساب</h3>
471
+ <h3 style="font-size: 15px; margin-bottom: 12px;">دفتر اشخاص</h3>
472
<div class="table-responsive">
473
<table>
474
<thead>
475
<tr>
778
- <th>نام طرف حساب</th>
476
+ <th>نام</th>
477
<th>نوع</th>
478
<th>شناسه ملی</th>
479
<th>کد اقتصادی</th>
782
- <th>شماره ثبت</th>
480
<th>کد پستی</th>
481
<th>همراه</th>
785
- <th>مانده (تومان)</th>
482
+ <th>مانده (ریال)</th>
483
<th>عملیات</th>
484
</tr>
485
</thead>
@@ -792,448 +489,215 @@
489
</div>
490
</section>
491
795
- <!-- ۵. چکهای صیاد -->
492
+ <!-- ۵. چکها -->
493
<section id="view-cheques" class="view-pane">
797
- <div class="card no-print">
798
- <h2 style="font-size: 18px; margin-bottom: 16px;">ثبت چک صیادی</h2>
494
+ <div class="card">
495
+ <h2 style="font-size: 17px; margin-bottom: 14px;">ثبت چک صیادی</h2>
496
<div class="form-row">
800
- <div class="form-group">
801
- <label>نوع چک</label>
802
- <select id="chq-direction-input" class="form-control">
803
- <option value="inbound">چک دریافتی از مشتری</option>
804
- <option value="outbound">چک صادره پرداختی</option>
805
- </select>
806
- </div>
807
- <div class="form-group">
808
- <label>طرف حساب</label>
809
- <select id="chq-contact-select" class="form-control"></select>
810
- </div>
811
- <div class="form-group">
812
- <label>شناسه ۱۶ رقمی صیاد</label>
813
- <input type="text" id="chq-sayad-input" class="form-control" placeholder="شماره صیاد" />
814
- </div>
815
- <div class="form-group">
816
- <label>نام بانک و شعبه</label>
817
- <input type="text" id="chq-bank-input" class="form-control" placeholder="ملت، ملی، سپه..." />
818
- </div>
497
+ <div class="form-group"><label>نوع</label><select id="chq-direction-input" class="form-control"><option value="inbound">دریافتی</option><option value="outbound">پرداختی</option></select></div>
498
+ <div class="form-group"><label>طرف حساب</label><select id="chq-contact-select" class="form-control"></select></div>
499
+ <div class="form-group"><label>شناسه صیادی</label><input type="text" id="chq-sayad-input" class="form-control" /></div>
500
+ <div class="form-group"><label>بانک</label><input type="text" id="chq-bank-input" class="form-control" /></div>
501
</div>
502
<div class="form-row">
821
- <div class="form-group">
822
- <label>مبلغ چک (تومان)</label>
823
- <input type="number" id="chq-amount-input" class="form-control" />
824
- </div>
825
- <div class="form-group">
826
- <label>تاریخ سررسید (شمسی)</label>
827
- <input type="text" id="chq-due-input" class="form-control" placeholder="1405/04/15" />
828
- </div>
829
- <div class="form-group">
830
- <label>وضعیت وصول</label>
831
- <select id="chq-status-input" class="form-control">
832
- <option value="registered">در جریان وصول</option>
833
- <option value="cleared">وصول شده</option>
834
- <option value="returned">برگشت خورده</option>
835
- </select>
836
- </div>
503
+ <div class="form-group"><label>مبلغ (ریال)</label><input type="number" id="chq-amount-input" class="form-control" /></div>
504
+ <div class="form-group"><label>سررسید</label><input type="text" id="chq-due-input" class="form-control" placeholder="1405/06/30" /></div>
505
+ <div class="form-group"><label>وضعیت</label><select id="chq-status-input" class="form-control"><option value="registered">در جریان</option><option value="cleared">وصول شده</option></select></div>
506
</div>
838
- <button class="btn btn-success" onclick="commitSaveCheque()">➕ ثبت سند چک</button>
507
+ <button class="btn btn-success" onclick="commitSaveCheque()">➕ ثبت چک</button>
508
</div>
840
-
509
<div class="card">
842
- <h3 style="font-size: 16px; margin-bottom: 14px;">دفتر چکهای ثبتشده</h3>
510
+ <h3 style="font-size: 15px; margin-bottom: 12px;">لیست چکها</h3>
511
<div class="table-responsive">
512
<table>
845
- <thead>
846
- <tr>
847
- <th>نوع</th>
848
- <th>طرف حساب</th>
849
- <th>بانک / صیاد</th>
850
- <th>مبلغ (تومان)</th>
851
- <th>سررسید</th>
852
- <th>وضعیت</th>
853
- </tr>
854
- </thead>
513
+ <thead><tr><th>نوع</th><th>طرف حساب</th><th>بانک / صیاد</th><th>مبلغ (ریال)</th><th>سررسید</th><th>وضعیت</th></tr></thead>
514
<tbody id="cheques-ledger-table-body"></tbody>
515
</table>
516
</div>
517
</div>
518
</section>
519
861
- <!-- ۶. هزینهها و درآمدها -->
520
+ <!-- ۶. هزینهها -->
521
<section id="view-expenses" class="view-pane">
863
- <div class="card no-print">
864
- <h2 style="font-size: 18px; margin-bottom: 16px;">ثبت هزینه / درآمد متفرقه</h2>
522
+ <div class="card">
523
+ <h2 style="font-size: 17px; margin-bottom: 14px;">ثبت هزینه / درآمد</h2>
524
<div class="form-row">
866
- <div class="form-group">
867
- <label>نوع تراکنش</label>
868
- <select id="trx-kind-input" class="form-control">
869
- <option value="expense">هزینه (پرداخت)</option>
870
- <option value="income">درآمد متفرقه (دریافت)</option>
871
- </select>
872
- </div>
873
- <div class="form-group">
874
- <label>سرفصل</label>
875
- <select id="trx-category-input" class="form-control">
876
- <option value="کرایه و حمل">کرایه، باربری و تخلیه</option>
877
- <option value="حقوق">حقوق و دستمزد</option>
878
- <option value="قبوض">قبوض آب، برق، گاز و ارتباطات</option>
879
- <option value="تعمیرات">تعمیرات و استهلاک</option>
880
- <option value="سایر">سایر موارد</option>
881
- </select>
882
- </div>
883
- <div class="form-group">
884
- <label>مبلغ (تومان)</label>
885
- <input type="number" id="trx-amount-input" class="form-control" />
886
- </div>
887
- <div class="form-group">
888
- <label>شرح سند</label>
889
- <input type="text" id="trx-desc-input" class="form-control" placeholder="توضیح کوتاه..." />
890
- </div>
525
+ <div class="form-group"><label>نوع</label><select id="trx-kind-input" class="form-control"><option value="expense">هزینه</option><option value="income">درآمد</option></select></div>
526
+ <div class="form-group"><label>سرفصل</label><select id="trx-category-input" class="form-control"><option value="قبوض">قبوض</option><option value="حقوق">حقوق</option><option value="سایر">سایر</option></select></div>
527
+ <div class="form-group"><label>مبلغ (ریال)</label><input type="number" id="trx-amount-input" class="form-control" /></div>
528
+ <div class="form-group"><label>شرح</label><input type="text" id="trx-desc-input" class="form-control" /></div>
529
</div>
892
- <button class="btn btn-success" onclick="commitSaveExpense()">➕ ثبت در دفاتر</button>
530
+ <button class="btn btn-success" onclick="commitSaveExpense()">➕ ثبت سند</button>
531
</div>
894
-
532
<div class="card">
896
- <h3 style="font-size: 16px; margin-bottom: 14px;">گردش هزینهها و درآمدها</h3>
533
+ <h3 style="font-size: 15px; margin-bottom: 12px;">گردش هزینه و درآمد</h3>
534
<div class="table-responsive">
535
<table>
899
- <thead>
900
- <tr>
901
- <th>نوع</th>
902
- <th>سرفصل</th>
903
- <th>شرح بابت</th>
904
- <th>مبلغ (تومان)</th>
905
- </tr>
906
- </thead>
536
+ <thead><tr><th>نوع</th><th>سرفصل</th><th>شرح</th><th>مبلغ (ریال)</th></tr></thead>
537
<tbody id="expenses-ledger-table-body"></tbody>
538
</table>
539
</div>
540
</div>
541
</section>
542
913
- <!-- ۷. تنظیمات و چندشرکتی -->
543
+ <!-- ۷. تنظیمات و شرکتها (با ساختار آکاردیونی شبیه تصویر ۱۶ و ۲۴) -->
544
<section id="view-settings" class="view-pane">
915
- <div class="card">
916
- <h2 style="font-size: 18px; margin-bottom: 16px;">🏢 مدیریت شرکتها و فروشندگان (چند شرکتی نامحدود)</h2>
917
- <p style="color:var(--text-muted); font-size:13px; margin-bottom:14px;">شرکتهای مختلف (مثلاً باناپ، آوانتک و...) را با اطلاعات حقوقی جداگانه تعریف کنید.</p>
918
-
919
- <div class="form-row">
920
- <div class="form-group">
921
- <label>نوع شخص / فروشنده</label>
922
- <select id="company-entity-type" class="form-control">
923
- <option value="legal">شخص حقوقی (شرکت)</option>
924
- <option value="natural">شخص حقیقی (فروشگاه)</option>
925
- </select>
926
- </div>
927
- <div class="form-group">
928
- <label>نام فروشگاه یا شرکت (بدون نیاز به نوشتن کلمه شرکت/فروشگاه)</label>
929
- <input type="text" id="company-name-input" class="form-control" placeholder="مثلاً: باناپ یا آوانتک" />
930
- </div>
931
- <div class="form-group">
932
- <label>شماره تماس مستقیم</label>
933
- <input type="text" id="company-phone-input" class="form-control" placeholder="021... / 0912..." />
934
- </div>
545
+
546
+ <!-- آکاردیون ۱: اطلاعات فروشگاه و چاپ (مشابه تصویر ۱۶) -->
547
+ <div class="accordion-item open">
548
+ <div class="accordion-header" onclick="toggleAccordion(this)">
549
+ <span>🏢 اطلاعات فروشگاه و چاپ (مدیریت شرکتها)</span>
550
+ <span>▼</span>
551
</div>
936
-
937
- <div class="form-row">
938
- <div class="form-group">
939
- <label>شناسه ملی / کد ملی</label>
940
- <input type="text" id="company-national-input" class="form-control" placeholder="۱۰ یا ۱۱ رقم" />
941
- </div>
942
- <div class="form-group">
943
- <label>کد اقتصادی (۱۲ رقم)</label>
944
- <input type="text" id="company-economic-input" class="form-control" placeholder="کد اقتصادی" />
552
+ <div class="accordion-body">
553
+ <div class="form-row">
554
+ <div class="form-group"><label>نوع شخص</label><select id="company-entity-type" class="form-control"><option value="legal">حقوقی</option><option value="natural">حقیقی</option></select></div>
555
+ <div class="form-group"><label>نام شرکت / فروشگاه</label><input type="text" id="company-name-input" class="form-control" placeholder="آرا سپهر راستین" /></div>
556
+ <div class="form-group"><label>تلفن</label><input type="text" id="company-phone-input" class="form-control" /></div>
557
</div>
946
- <div class="form-group">
947
- <label>شماره ثبت (برای شرکتها)</label>
948
- <input type="text" id="company-reg-input" class="form-control" placeholder="شماره ثبت" />
558
+ <div class="form-row">
559
+ <div class="form-group"><label>شناسه ملی</label><input type="text" id="company-national-input" class="form-control" /></div>
560
+ <div class="form-group"><label>کد اقتصادی</label><input type="text" id="company-economic-input" class="form-control" /></div>
561
+ <div class="form-group"><label>شماره ثبت</label><input type="text" id="company-reg-input" class="form-control" /></div>
562
+ <div class="form-group"><label>کد پستی</label><input type="text" id="company-postal-input" class="form-control" /></div>
563
</div>
950
- <div class="form-group">
951
- <label>کد پستی (۱۰ رقم مجزا)</label>
952
- <input type="text" id="company-postal-input" class="form-control" placeholder="کد پستی" />
564
+ <div class="form-group"><label>نشانی کامل</label><input type="text" id="company-address-input" class="form-control" /></div>
565
+ <div class="form-group"><label>پاورقی فاکتور</label><textarea id="company-footer-input" class="form-control" rows="2"></textarea></div>
566
+ <button class="btn btn-success" onclick="commitSaveCompany()">➕ ثبت شرکت جدید</button>
567
+
568
+ <div style="margin-top:16px;">
569
+ <h4 style="font-size:14px; margin-bottom:8px;">لیست شرکتهای ثبتشده</h4>
570
+ <div class="table-responsive">
571
+ <table>
572
+ <thead><tr><th>نام</th><th>شناسه ملی</th><th>کد اقتصادی</th><th>پیشفرض</th><th>عملیات</th></tr></thead>
573
+ <tbody id="companies-table-body"></tbody>
574
+ </table>
575
+ </div>
576
</div>
577
</div>
578
+ </div>
579
956
- <div class="form-group">
957
- <label>نشانی کامل فروشگاه / کارخانه</label>
958
- <input type="text" id="company-address-input" class="form-control" placeholder="استان، شهر، آدرس دقیق..." />
959
- </div>
960
- <div class="form-group">
961
- <label>متن پاورقی فاکتور این شرکت</label>
962
- <textarea id="company-footer-input" class="form-control" rows="2" placeholder="شرایط فروش، پیام تشکر یا اطلاعات حساب"></textarea>
580
+ <!-- آکاردیون ۲: مالیات، تخفیف و واحد پول -->
581
+ <div class="accordion-item">
582
+ <div class="accordion-header" onclick="toggleAccordion(this)">
583
+ <span>⚙️ مالیات، تخفیف و واحد پول (پیشفرض فاکتور جدید)</span>
584
+ <span>▼</span>
585
</div>
964
- <button class="btn btn-success" onclick="commitSaveCompany()">➕ ثبت فروشنده جدید</button>
965
-
966
- <div style="margin-top:24px;">
967
- <h4 style="font-size:15px; margin-bottom:10px;">لیست فروشندگان و سربرگهای فعال</h4>
968
- <div class="table-responsive">
969
- <table>
970
- <thead>
971
- <tr>
972
- <th>عنوان رسمی</th>
973
- <th>نوع</th>
974
- <th>شناسه ملی</th>
975
- <th>کد اقتصادی</th>
976
- <th>شماره ثبت</th>
977
- <th>کد پستی</th>
978
- <th>پیشفرض</th>
979
- <th>عملیات</th>
980
- </tr>
981
- </thead>
982
- <tbody id="companies-table-body"></tbody>
983
- </table>
586
+ <div class="accordion-body">
587
+ <div class="form-row">
588
+ <div class="form-group">
589
+ <label>قالب پیشفرض فاکتور</label>
590
+ <select id="def-invoice-kind" class="form-control" onchange="handleDefaultKindChange()">
591
+ <option value="non_formal">فاکتور غیررسمی</option>
592
+ <option value="formal">فاکتور رسمی</option>
593
+ </select>
594
+ </div>
595
+ <div class="form-group" id="def-vat-mode-box">
596
+ <label>وضعیت پیشفرض ارزش افزوده</label>
597
+ <select id="def-vat-mode" class="form-control" onchange="handleDefaultVatModeChange()">
598
+ <option value="none">بدون ارزش افزوده</option>
599
+ <option value="with_vat">با ارزش افزوده</option>
600
+ </select>
601
+ </div>
602
+ <div class="form-group" id="def-vat-rate-box">
603
+ <label>نرخ ارزش افزوده (درصد)</label>
604
+ <input type="number" id="def-vat-rate" class="form-control" value="10" />
605
+ </div>
606
</div>
607
+ <button class="btn btn-primary" onclick="commitSaveDefaultSettings()">ذخیره پیشفرضها</button>
608
</div>
609
</div>
610
988
- <div class="card">
989
- <h2 style="font-size: 18px; margin-bottom: 16px;">⚙️ تنظیمات پیشفرض صدور فاکتور</h2>
990
- <div class="form-row">
991
- <div class="form-group">
992
- <label>قالب پیشفرض فاکتور</label>
993
- <select id="def-invoice-kind" class="form-control" onchange="handleDefaultKindChange()">
994
- <option value="non_formal">فاکتور غیررسمی (آزاد)</option>
995
- <option value="formal">فاکتور رسمی</option>
996
- </select>
997
- </div>
998
- <div class="form-group" id="def-vat-mode-box">
999
- <label>وضعیت پیشفرض ارزش افزوده</label>
1000
- <select id="def-vat-mode" class="form-control" onchange="handleDefaultVatModeChange()">
1001
- <option value="none">بدون ارزش افزوده</option>
1002
- <option value="with_vat">با ارزش افزوده</option>
1003
- </select>
1004
- </div>
1005
- <div class="form-group" id="def-vat-rate-box">
1006
- <label>نرخ پیشفرض ارزش افزوده (درصد)</label>
1007
- <input type="number" id="def-vat-rate" class="form-control" value="10" />
611
+ <!-- آکاردیون ۳: دیتابیس و پشتیبانگیری (مشابه تصویر ۲۴) -->
612
+ <div class="accordion-item">
613
+ <div class="accordion-header" onclick="toggleAccordion(this)">
614
+ <span>💾 دیتابیس و پشتیبانگیری (اطلاعات ذخیرهسازی)</span>
615
+ <span>▼</span>
616
+ </div>
617
+ <div class="accordion-body">
618
+ <p style="font-size:13px; color:var(--text-muted); margin-bottom:12px;">
619
+ مسیر دیتابیس محلی: <code style="background:#f1f5f9; padding:2px 6px; border-radius:4px;">localStorage://easy_factor_datastore_v4</code><br />
620
+ وضعیت: <span class="badge badge-success">موجود و فعال</span> | یکپارچگی: <span class="badge badge-success">سالم</span>
621
+ </p>
622
+ <div style="display:flex; gap:10px; flex-wrap:wrap;">
623
+ <button class="btn btn-secondary" onclick="exportDataBlob()">📥 دانلود فایل پشتیبان (JSON)</button>
624
+ <label class="btn btn-secondary" style="margin-bottom:0;">📤 بازگردانی فایل<input type="file" id="import-json-file" style="display:none;" onchange="importDataBlob(event)" accept=".json" /></label>
625
</div>
626
</div>
1010
- <button class="btn btn-primary" onclick="commitSaveDefaultSettings()">ذخیره پیشفرضها</button>
1011
- </div>
1012
-
1013
- <div class="card" style="background:#f8fafc;">
1014
- <h3 style="font-size: 16px; margin-bottom: 10px;">📌 وضعیت نگارش برنامه</h3>
1015
- <p style="font-size:14px; color:#334155; line-height:1.8;">
1016
- نگارش فعال: <strong>ایزی فاکتور - نسخه ۳.۰ (پایدار رسمی)</strong><br />
1017
- تاریخ انتشار و اعمال تغییرات: <strong id="lbl-last-update-full">۱۴۰۵/۰۶/۲۶ - ۱۳:۳۸</strong>
1018
- </p>
627
</div>
628
1021
- <div class="card">
1022
- <h3 style="font-size: 16px; margin-bottom: 14px;">💾 پشتیبانگیری و انتقال اطلاعات</h3>
1023
- <div style="display:flex; gap:12px; flex-wrap:wrap;">
1024
- <button class="btn btn-secondary btn-inline" onclick="exportDataBlob()">📥 دانلود پشتیبان (JSON)</button>
1025
- <label class="btn btn-secondary btn-inline" style="margin-bottom:0;">
1026
- 📤 بازگردانی پشتیبان
1027
- <input type="file" id="import-json-file" style="display:none;" onchange="importDataBlob(event)" accept=".json" />
1028
- </label>
629
+ <!-- آکاردیون ۴: درباره (مشابه تصویر ۳۶) -->
630
+ <div class="accordion-item">
631
+ <div class="accordion-header" onclick="toggleAccordion(this)">
632
+ <span>ℹ️ درباره نرمافزار</span>
633
+ <span>▼</span>
634
+ </div>
635
+ <div class="accordion-body">
636
+ <h3 style="font-size:16px; font-weight:bold;">ایزی فاکتور - EasyFactor</h3>
637
+ <p style="color:var(--text-muted); font-size:13px; margin:6px 0 12px 0;">سیستم هوشمند صدور فاکتور رسمی و غیررسمی (ریال)</p>
638
+ <p style="font-size:13px; margin-bottom:14px;">نگارش فعال: <strong>نسخه ۴.۰ (پایدار کامل)</strong></p>
639
+ <div style="display:flex; gap:10px;">
640
+ <button class="btn btn-primary" onclick="alert('شما از آخرین نگارش پایدار سیستم استفاده میکنید.')">بررسی آپدیت</button>
641
+ <button class="btn btn-secondary" onclick="alert('جهت ارسال گزارش و پیشنهاد با پشتیبانی تماس بگیرید.')">گزارش باگ / پیشنهاد</button>
642
+ </div>
643
</div>
644
</div>
645
+
646
</section>
647
1033
- <!-- قالب پرینت A4 منطبق بر صورتحساب استاندارد دارایی و رسمی -->
1034
- <div id="printable-invoice" style="display:none; background:#fff; padding:20px; border:2px solid #000; margin-top:20px; border-radius:0px;">
1035
- <!-- سربرگ رسمی با ۳ کادر بالا -->
1036
- <table style="width:100%; border-collapse:collapse; border:1.5px solid #000; margin-bottom:6px;">
1037
- <tr>
1038
- <td style="width:25%; border:1px solid #000; padding:6px; font-size:11px; vertical-align:top;">
1039
- <div>شماره سریال: <strong id="p-doc-number"></strong></div>
1040
- <div style="margin-top:4px;">تاریخ: <span id="p-doc-date"></span></div>
1041
- <div style="margin-top:4px;">پیوست: ندارد</div>
1042
- </td>
1043
- <td style="width:50%; border:1px solid #000; padding:8px; text-align:center; vertical-align:middle;">
1044
- <h2 id="p-doc-kind-title" style="font-size:16px; margin:0; font-weight:bold;">صورتحساب فروش کالا و خدمات</h2>
1045
- <div style="font-size:12px; margin-top:4px; font-weight:600;" id="p-org-name"></div>
1046
- </td>
1047
- <td style="width:25%; border:1px solid #000; padding:6px; font-size:11px; text-align:left; vertical-align:top;">
1048
- <div>تلفن: <span id="p-org-phone"></span></div>
1049
- </td>
1050
- </tr>
1051
- </table>
1052
-
1053
- <!-- کادر مشخصات فروشنده -->
1054
- <table style="width:100%; border-collapse:collapse; border:1.5px solid #000; font-size:11px; margin-bottom:6px;">
1055
- <tr style="background:#e2e8f0; font-weight:bold;"><td colspan="4" style="border:1px solid #000; padding:5px; text-align:right;">مشخصات فروشنده</td></tr>
1056
- <tr>
1057
- <td style="border:1px solid #000; padding:5px; width:15%;">نام شخص حقیقی/حقوقی:</td>
1058
- <td style="border:1px solid #000; padding:5px; width:35%;"><strong id="p-seller-name"></strong></td>
1059
- <td style="border:1px solid #000; padding:5px; width:15%;">شماره اقتصادی:</td>
1060
- <td style="border:1px solid #000; padding:5px; width:35%;"><span id="p-seller-economic"></span></td>
1061
- </tr>
1062
- <tr>
1063
- <td style="border:1px solid #000; padding:5px;">شماره ثبت / شناسه ملی:</td>
1064
- <td style="border:1px solid #000; padding:5px;"><span id="p-seller-national"></span> / ثبت: <span id="p-seller-reg"></span></td>
1065
- <td style="border:1px solid #000; padding:5px;">کد پستی ۱۰ رقمی:</td>
1066
- <td style="border:1px solid #000; padding:5px;"><span id="p-seller-postal"></span></td>
1067
- </tr>
1068
- <tr>
1069
- <td style="border:1px solid #000; padding:5px;">نشانی کامل:</td>
1070
- <td colspan="3" style="border:1px solid #000; padding:5px;"><span id="p-seller-address"></span></td>
1071
- </tr>
1072
- </table>
1073
-
1074
- <!-- کادر مشخصات خریدار -->
1075
- <table style="width:100%; border-collapse:collapse; border:1.5px solid #000; font-size:11px; margin-bottom:6px;">
1076
- <tr style="background:#e2e8f0; font-weight:bold;"><td colspan="4" style="border:1px solid #000; padding:5px; text-align:right;">مشخصات خریدار</td></tr>
1077
- <tr>
1078
- <td style="border:1px solid #000; padding:5px; width:15%;">نام شخص حقیقی/حقوقی:</td>
1079
- <td style="border:1px solid #000; padding:5px; width:35%;"><strong id="p-target-name"></strong></td>
1080
- <td style="border:1px solid #000; padding:5px; width:15%;">شماره اقتصادی:</td>
1081
- <td style="border:1px solid #000; padding:5px; width:35%;"><span id="p-target-economic"></span></td>
1082
- </tr>
1083
- <tr>
1084
- <td style="border:1px solid #000; padding:5px;">شماره ثبت / شناسه ملی:</td>
1085
- <td style="border:1px solid #000; padding:5px;"><span id="p-target-national"></span> / ثبت: <span id="p-target-reg"></span></td>
1086
- <td style="border:1px solid #000; padding:5px;">کد پستی ۱۰ رقمی:</td>
1087
- <td style="border:1px solid #000; padding:5px;"><span id="p-target-postal"></span></td>
1088
- </tr>
1089
- <tr>
1090
- <td style="border:1px solid #000; padding:5px;">نشانی و تلفن:</td>
1091
- <td colspan="3" style="border:1px solid #000; padding:5px;"><span id="p-target-address"></span> | تلفن: <span id="p-target-phone"></span></td>
1092
- </tr>
1093
- </table>
1094
-
1095
- <!-- جدول مشخصات کالا و خدمات -->
1096
- <table style="width:100%; border-collapse:collapse; border:1.5px solid #000; font-size:11px;">
1097
- <thead>
1098
- <tr style="background:#e2e8f0; font-weight:bold; text-align:center;">
1099
- <th style="border:1px solid #000; padding:6px; width:35px;">ردیف</th>
1100
- <th style="border:1px solid #000; padding:6px; text-align:right;">شرح کالا یا خدمت</th>
1101
- <th style="border:1px solid #000; padding:6px; width:60px;">تعداد/مقدار</th>
1102
- <th style="border:1px solid #000; padding:6px; width:110px; text-align:left;">مبلغ واحد (تومان)</th>
1103
- <th style="border:1px solid #000; padding:6px; width:130px; text-align:left;">مبلغ کل (تومان)</th>
1104
- </tr>
1105
- </thead>
1106
- <tbody id="p-target-items-table"></tbody>
1107
- </table>
1108
-
1109
- <!-- محاسبات پایانی و امضاها -->
1110
- <table style="width:100%; border-collapse:collapse; border:1.5px solid #000; font-size:11px; margin-top:6px;">
1111
- <tr>
1112
- <td style="width:55%; border:1px solid #000; padding:8px; vertical-align:top;">
1113
- <div><strong>شرایط و توضیحات فاکتور:</strong></div>
1114
- <div id="p-doc-footer-note" style="margin-top:4px; font-size:11px;"></div>
1115
- </td>
1116
- <td style="width:45%; border:1px solid #000; padding:0;">
1117
- <table style="width:100%; border-collapse:collapse; font-size:11px;">
1118
- <tr><td style="border-bottom:1px solid #000; padding:5px;">جمع کل اقلام:</td><td style="border-bottom:1px solid #000; padding:5px; text-align:left;"><span id="p-calc-subtotal"></span> تومان</td></tr>
1119
- <tr><td style="border-bottom:1px solid #000; padding:5px;">مبلغ تخفیف:</td><td style="border-bottom:1px solid #000; padding:5px; text-align:left;"><span id="p-calc-discount"></span> تومان</td></tr>
1120
- <tr id="p-tax-row"><td style="border-bottom:1px solid #000; padding:5px;">مالیات و عوارض ارزش افزوده:</td><td style="border-bottom:1px solid #000; padding:5px; text-align:left;"><span id="p-calc-tax"></span> تومان</td></tr>
1121
- <tr style="background:#f1f5f9; font-weight:bold; font-size:12px;">
1122
- <td style="padding:6px;">مبلغ قابل پرداخت:</td>
1123
- <td style="padding:6px; text-align:left;"><span id="p-calc-grandtotal"></span> تومان</td>
1124
- </tr>
1125
- </table>
1126
- </td>
1127
- </tr>
1128
- </table>
1129
-
1130
- <!-- بخش مهرهای رسمی طرفین -->
1131
- <table style="width:100%; margin-top:15px; text-align:center; font-size:12px;">
1132
- <tr>
1133
- <td style="width:50%; height:75px; vertical-align:top; border:1px dashed #666; padding:8px;">مهر و امضای فروشنده</td>
1134
- <td style="width:50%; height:75px; vertical-align:top; border:1px dashed #666; padding:8px;">مهر و امضای خریدار</td>
1135
- </tr>
1136
- </table>
1137
- </div>
648
+ <!-- قالب پرینت چندصفحهای استاندارد (حداکثر ۱۰ ردیف در هر صفحه) -->
649
+ <div id="printable-invoice" style="display:none;"></div>
650
651
</main>
652
</div>
653
1142
- <!-- مودال پاپآپ سریع تعریف طرفحساب داخل فاکتور -->
654
+ <!-- مودال شخص جدید -->
655
<div class="modal-backdrop" id="modal-quick-contact">
656
<div class="modal-card">
1145
- <h3 style="font-size:17px; margin-bottom:14px;">➕ تعریف سریع طرف حساب</h3>
657
+ <h3 style="font-size:16px; margin-bottom:12px;">➕ تعریف سریع خریدار</h3>
658
<div class="form-row">
1147
- <div class="form-group">
1148
- <label>نوع شخص</label>
1149
- <select id="quick-c-entity" class="form-control" onchange="handleQuickCEntityChange()">
1150
- <option value="natural">شخص حقیقی</option>
1151
- <option value="legal">شخص حقوقی</option>
1152
- </select>
1153
- </div>
1154
- <div class="form-group" id="box-quick-c-prefix">
1155
- <label>پیشوند</label>
1156
- <select id="quick-c-prefix" class="form-control">
1157
- <option value="آقا/خانم">آقا / خانم</option>
1158
- <option value="فروشگاه">فروشگاه</option>
1159
- </select>
1160
- </div>
1161
- <div class="form-group">
1162
- <label>نام شخص یا شرکت</label>
1163
- <input type="text" id="quick-c-name" class="form-control" placeholder="نام خریدار" />
1164
- </div>
659
+ <div class="form-group"><label>نوع شخص</label><select id="quick-c-entity" class="form-control" onchange="handleQuickCEntityChange()"><option value="natural">شخص حقیقی</option><option value="legal">شخص حقوقی</option></select></div>
660
+ <div class="form-group" id="box-quick-c-prefix"><label>پیشوند</label><select id="quick-c-prefix" class="form-control"><option value="آقا/خانم">آقا / خانم</option><option value="فروشگاه">فروشگاه</option></select></div>
661
+ <div class="form-group"><label>نام طرف حساب</label><input type="text" id="quick-c-name" class="form-control" placeholder="دانشگاه صنعتی شریف..." /></div>
662
</div>
663
<div class="form-row">
1167
- <div class="form-group">
1168
- <label>شماره تماس همراه</label>
1169
- <input type="text" id="quick-c-mobile" class="form-control" placeholder="0912..." />
1170
- </div>
1171
- <div class="form-group">
1172
- <label>شناسه/کد ملی</label>
1173
- <input type="text" id="quick-c-national" class="form-control" />
1174
- </div>
1175
- <div class="form-group">
1176
- <label>کد اقتصادی</label>
1177
- <input type="text" id="quick-c-economic" class="form-control" />
1178
- </div>
664
+ <div class="form-group"><label>شناسه ملی</label><input type="text" id="quick-c-national" class="form-control" /></div>
665
+ <div class="form-group"><label>کد اقتصادی</label><input type="text" id="quick-c-economic" class="form-control" /></div>
666
+ <div class="form-group"><label>شماره ثبت</label><input type="text" id="quick-c-reg" class="form-control" /></div>
667
</div>
668
<div class="form-row">
1181
- <div class="form-group">
1182
- <label>شماره ثبت</label>
1183
- <input type="text" id="quick-c-reg" class="form-control" />
1184
- </div>
1185
- <div class="form-group">
1186
- <label>کد پستی (۱۰ رقم)</label>
1187
- <input type="text" id="quick-c-postal" class="form-control" />
1188
- </div>
1189
- </div>
1190
- <div class="form-group">
1191
- <label>نشانی کامل</label>
1192
- <input type="text" id="quick-c-address" class="form-control" />
669
+ <div class="form-group"><label>کد پستی</label><input type="text" id="quick-c-postal" class="form-control" /></div>
670
+ <div class="form-group"><label>تلفن</label><input type="text" id="quick-c-mobile" class="form-control" /></div>
671
</div>
1194
- <div style="display:flex; gap:10px; margin-top:14px;">
672
+ <div class="form-group"><label>نشانی</label><input type="text" id="quick-c-address" class="form-control" /></div>
673
+ <div style="display:flex; gap:10px; margin-top:12px;">
674
<button class="btn btn-success" onclick="saveQuickContact()">ذخیره و انتخاب در فاکتور</button>
675
<button class="btn btn-secondary" onclick="closeQuickContactModal()">انصراف</button>
676
</div>
677
</div>
678
</div>
679
1201
- <!-- مودال پاپآپ سریع تعریف کالا داخل فاکتور -->
680
+ <!-- مودال کالای جدید -->
681
<div class="modal-backdrop" id="modal-quick-product">
682
<div class="modal-card">
1204
- <h3 style="font-size:17px; margin-bottom:14px;">➕ تعریف سریع کالا / خدمات</h3>
683
+ <h3 style="font-size:16px; margin-bottom:12px;">➕ تعریف سریع کالا / خدمات</h3>
684
<div class="form-row">
1206
- <div class="form-group">
1207
- <label>کد کالا</label>
1208
- <input type="text" id="quick-p-code" class="form-control" placeholder="101" />
1209
- </div>
1210
- <div class="form-group">
1211
- <label>عنوان کالا</label>
1212
- <input type="text" id="quick-p-name" class="form-control" placeholder="مثلاً: بلوک سیمانی" />
1213
- </div>
1214
- <div class="form-group">
1215
- <label>مشخصه / مدل</label>
1216
- <input type="text" id="quick-p-spec" class="form-control" placeholder="مثلاً: سبک ۱۰" />
1217
- </div>
685
+ <div class="form-group"><label>کد کالا</label><input type="text" id="quick-p-code" class="form-control" /></div>
686
+ <div class="form-group"><label>عنوان کالا</label><input type="text" id="quick-p-name" class="form-control" /></div>
687
+ <div class="form-group"><label>مشخصه / مدل</label><input type="text" id="quick-p-spec" class="form-control" /></div>
688
</div>
689
<div class="form-row">
1220
- <div class="form-group">
1221
- <label>واحد</label>
1222
- <input type="text" id="quick-p-unit" class="form-control" value="عدد" />
1223
- </div>
1224
- <div class="form-group">
1225
- <label>قیمت فروش (تومان)</label>
1226
- <input type="number" id="quick-p-price" class="form-control" value="0" />
1227
- </div>
690
+ <div class="form-group"><label>واحد</label><input type="text" id="quick-p-unit" class="form-control" value="عدد" /></div>
691
+ <div class="form-group"><label>قیمت فروش (ریال)</label><input type="number" id="quick-p-price" class="form-control" value="0" /></div>
692
</div>
1229
- <div style="display:flex; gap:10px; margin-top:14px;">
1230
- <button class="btn btn-success" onclick="saveQuickProduct()">ذخیره و افزودن به سطر</button>
693
+ <div style="display:flex; gap:10px; margin-top:12px;">
694
+ <button class="btn btn-success" onclick="saveQuickProduct()">ذخیره و افزودن</button>
695
<button class="btn btn-secondary" onclick="closeQuickProductModal()">انصراف</button>
696
</div>
697
</div>
698
</div>
699
1236
- <!-- منوی لمسی پایین در آیفون -->
700
+ <!-- ناو بار موبایل -->
701
<nav class="mobile-dock">
702
<div class="dock-tab active" onclick="switchView('view-dashboard')">
703
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path></svg>
@@ -1258,60 +722,43 @@
722
</nav>
723
724
<script>
1261
- const STORAGE_KEY = 'easy_factor_datastore_v3_0';
1262
- const APP_BUILD_TIMESTAMP = '۱۴۰۵/۰۶/۲۶ - ۱۳:۳۸';
725
+ const STORAGE_KEY = 'easy_factor_datastore_v4_0';
726
+ const APP_BUILD_TIMESTAMP = '۱۴۰۵/۰۶/۲۶ - ۱۴:۴۵';
727
728
let datastore = {
1265
- default_settings: {
1266
- invoice_kind: 'non_formal',
1267
- vat_mode: 'none',
1268
- vat_rate: 10,
1269
- default_company_id: 'COMP-1'
1270
- },
729
+ default_settings: { invoice_kind: 'non_formal', vat_mode: 'none', vat_rate: 10, default_company_id: 'COMP-1' },
730
companies: [
731
{
732
id: 'COMP-1',
733
entity_type: 'legal',
1275
- name: 'شرکت باناپ',
1276
- phone: '02188888888',
1277
- national_id: '10103040506',
1278
- economic_code: '411122233344',
1279
- reg_number: '54321',
1280
- postal_code: '1987654321',
1281
- address: 'تهران، خیابان سهروردی شمالی',
1282
- footer: 'از حسن انتخاب و اعتماد شما سپاسگزاریم.'
1283
- },
1284
- {
1285
- id: 'COMP-2',
1286
- entity_type: 'natural',
1287
- name: 'فروشگاه آوانتک',
1288
- phone: '09121111111',
1289
- national_id: '0012345678',
1290
- economic_code: '',
1291
- reg_number: '',
1292
- postal_code: '1455667788',
1293
- address: 'تهران، بازار موبایل',
1294
- footer: 'کالای فروخته شده دارای ۲۴ ساعت ضمانت تست میباشد.'
734
+ name: 'آرا سپهر راستین',
735
+ phone: '09124376991',
736
+ national_id: '14008507476',
737
+ economic_code: '14008507476',
738
+ reg_number: '544926',
739
+ postal_code: '1445956311',
740
+ address: 'استان تهران - شهرستان تهران - شهر آرا کوچه مجاهد پلاک 61',
741
+ footer: 'از خرید شما سپاسگزاریم.'
742
}
743
],
744
contacts: [
745
{
746
id: 'C-1',
747
entity_type: 'legal',
1301
- name: 'شرکت عمران نوین',
1302
- mobile: '09121111111',
1303
- national_id: '10109876543',
1304
- economic_code: '411188899900',
1305
- reg_number: '12345',
1306
- postal_code: '1455667788',
1307
- address: 'تهران - بازار آهن شادآباد',
1308
- balance: 2950000,
748
+ name: 'دانشگاه صنعتی شریف',
749
+ mobile: '02166165000',
750
+ national_id: '14002830256',
751
+ economic_code: '14002830256',
752
+ reg_number: '',
753
+ postal_code: '1458889694',
754
+ address: 'طرشت محله تیموری پلاک 435',
755
+ balance: 7978300000,
756
role: 'customer'
757
}
758
],
759
products: [
1313
- { id: 'P-1', code: '101', name: 'بلوک سیمانی ۱۰', spec: 'سبک لیکا', unit: 'قالب', buy_price: 18000, sale_price: 26000, stock: 0, type: 'good' },
1314
- { id: 'P-2', code: '102', name: 'بلوک سیمانی ۱۵', spec: 'سنگین ته پر', unit: 'قالب', buy_price: 22000, sale_price: 32000, stock: 0, type: 'good' }
760
+ { id: 'P-1', code: '1', name: 'سوئیچ شبکه 24 پورت فیبر نوری', spec: 'با 2 پاور 350', unit: 'عدد', buy_price: 1800000000, sale_price: 2180000000, stock: 10, type: 'good' },
761
+ { id: 'P-2', code: '2', name: 'هارد 2.5 اینچ سرور', spec: '', unit: 'عدد', buy_price: 30000000, sale_price: 37000000, stock: 10, type: 'good' }
762
],
763
invoices: [],
764
cheques: [],
@@ -1319,14 +766,9 @@
766
};
767
768
function initDatastore() {
1322
- const persisted = localStorage.getItem(STORAGE_KEY) || localStorage.getItem('easy_factor_datastore_v2_4') || localStorage.getItem('easy_factor_datastore_v2');
769
+ const persisted = localStorage.getItem(STORAGE_KEY) || localStorage.getItem('easy_factor_datastore_v3_2');
770
if (persisted) {
1324
- try {
1325
- const parsed = JSON.parse(persisted);
1326
- if (parsed.companies && parsed.companies.length > 0) {
1327
- datastore = parsed;
1328
- }
1329
- } catch(e) { console.error('Data init error', e); }
771
+ try { datastore = JSON.parse(persisted); } catch(e) {}
772
}
773
persistDatastore();
774
refreshAllSurfaces();
@@ -1341,8 +783,7 @@
783
}
784
785
function getJalaliNumeric() {
1344
- const now = new Date();
1345
- return new Intl.DateTimeFormat('fa-IR-u-ca-persian', { year: 'numeric', month: '2-digit', day: '2-digit' }).format(now);
786
+ return new Intl.DateTimeFormat('fa-IR-u-ca-persian', { year: 'numeric', month: '2-digit', day: '2-digit' }).format(new Date());
787
}
788
789
function switchView(viewId) {
@@ -1369,11 +810,15 @@
810
});
811
});
812
813
+ function toggleAccordion(headerEl) {
814
+ const item = headerEl.parentElement;
815
+ item.classList.toggle('open');
816
+ }
817
+
818
function refreshAllSurfaces() {
819
document.getElementById('dashboard-date-display').innerText = getJalaliDate();
820
document.getElementById('invoice-date-input').value = getJalaliNumeric();
821
document.getElementById('lbl-build-date').innerText = APP_BUILD_TIMESTAMP;
1376
- document.getElementById('lbl-last-update-full').innerText = APP_BUILD_TIMESTAMP;
822
823
renderCompanies();
824
renderContacts();
@@ -1388,19 +833,9 @@
833
function formatEntityName(rawName, entityType, customPrefix = '') {
834
let trimmed = (rawName || '').trim();
835
if (entityType === 'legal') {
1391
- if (!trimmed.startsWith('شرکت')) {
1392
- trimmed = 'شرکت ' + trimmed;
1393
- }
1394
- } else if (entityType === 'natural') {
1395
- if (customPrefix === 'فروشگاه') {
1396
- if (!trimmed.startsWith('فروشگاه')) {
1397
- trimmed = 'فروشگاه ' + trimmed;
1398
- }
1399
- } else if (customPrefix === 'آقا/خانم') {
1400
- if (!trimmed.startsWith('آقا/خانم') && !trimmed.startsWith('آقای') && !trimmed.startsWith('خانم')) {
1401
- trimmed = 'آقا/خانم ' + trimmed;
1402
- }
1403
- }
836
+ if (!trimmed.startsWith('شرکت')) trimmed = 'شرکت ' + trimmed;
837
+ } else if (entityType === 'natural' && customPrefix) {
838
+ if (!trimmed.startsWith(customPrefix)) trimmed = customPrefix + ' ' + trimmed;
839
}
840
return trimmed;
841
}
@@ -1434,52 +869,12 @@
869
recomputeTotals();
870
}
871
1437
- function handleContactEntityChange() {
1438
- const type = document.getElementById('contact-entity-type').value;
1439
- const prefixBox = document.getElementById('box-contact-prefix');
1440
- prefixBox.style.display = type === 'natural' ? 'block' : 'none';
1441
- }
1442
-
1443
- function handleDefaultKindChange() {
1444
- const kind = document.getElementById('def-invoice-kind').value;
1445
- const vatModeSelect = document.getElementById('def-vat-mode');
1446
- const vatRateBox = document.getElementById('def-vat-rate-box');
1447
-
1448
- if (kind === 'formal') {
1449
- vatModeSelect.disabled = false;
1450
- handleDefaultVatModeChange();
1451
- } else {
1452
- vatModeSelect.value = 'none';
1453
- vatModeSelect.disabled = true;
1454
- vatRateBox.style.display = 'none';
1455
- }
1456
- }
1457
-
1458
- function handleDefaultVatModeChange() {
1459
- const kind = document.getElementById('def-invoice-kind').value;
1460
- const mode = document.getElementById('def-vat-mode').value;
1461
- const vatRateBox = document.getElementById('def-vat-rate-box');
1462
-
1463
- if (kind === 'formal' && mode === 'with_vat') {
1464
- vatRateBox.style.display = 'block';
1465
- } else {
1466
- vatRateBox.style.display = 'none';
1467
- }
1468
- }
1469
-
872
function applyDefaultSettingsToForm() {
873
const def = datastore.default_settings || { invoice_kind: 'non_formal', vat_mode: 'none', vat_rate: 10 };
874
document.getElementById('def-invoice-kind').value = def.invoice_kind;
875
document.getElementById('def-vat-mode').value = def.vat_mode;
876
document.getElementById('def-vat-rate').value = def.vat_rate;
1475
-
1476
- document.getElementById('invoice-kind').value = def.invoice_kind;
1477
- document.getElementById('invoice-vat-mode').value = def.vat_mode;
1478
- document.getElementById('invoice-vat-rate-input').value = def.vat_rate;
1479
-
1480
- handleDefaultKindChange();
877
handleInvoiceKindChange();
1482
- handleContactEntityChange();
878
}
879
880
function commitSaveDefaultSettings() {
@@ -1490,15 +885,13 @@
885
default_company_id: datastore.default_settings?.default_company_id || (datastore.companies[0]?.id)
886
};
887
persistDatastore();
1493
- alert('تنظیمات پیشفرض با موفقیت ذخیره شد.');
888
+ alert('پیشفرضها ذخیره شد.');
889
}
890
1496
- // ۱. داشبورد (با فیلتر تفکیکی شرکت فعال)
891
function renderDashboard() {
892
let salesSum = 0;
893
let debtorsSum = 0;
894
const activeCompId = document.getElementById('invoice-company-id')?.value || datastore.companies[0]?.id;
1501
-
895
const filteredInvoices = datastore.invoices.filter(inv => inv.companyId === activeCompId);
896
897
filteredInvoices.forEach(inv => {
@@ -1506,14 +899,14 @@
899
if (inv.paymentMethod === 'credit') debtorsSum += inv.grandTotal;
900
});
901
1509
- document.getElementById('kpi-sales-sum').innerText = salesSum.toLocaleString('fa-IR') + ' تومان';
1510
- document.getElementById('kpi-settled-sum').innerText = (salesSum - debtorsSum).toLocaleString('fa-IR') + ' تومان';
1511
- document.getElementById('kpi-debtors-sum').innerText = debtorsSum.toLocaleString('fa-IR') + ' تومان';
902
+ document.getElementById('kpi-sales-sum').innerText = salesSum.toLocaleString('fa-IR') + ' ریال';
903
+ document.getElementById('kpi-settled-sum').innerText = (salesSum - debtorsSum).toLocaleString('fa-IR') + ' ریال';
904
+ document.getElementById('kpi-debtors-sum').innerText = debtorsSum.toLocaleString('fa-IR') + ' ریال';
905
document.getElementById('kpi-cheques-count').innerText = datastore.cheques.filter(c => c.status === 'registered').length.toLocaleString('fa-IR') + ' فقره';
906
907
const recentTbody = document.getElementById('dashboard-recent-table');
908
if (filteredInvoices.length === 0) {
1516
- recentTbody.innerHTML = '<tr><td colspan="7" style="text-align:center; color:var(--text-muted); padding:20px;">هیچ فاکتوری برای این شرکت صادر نشده است.</td></tr>';
909
+ recentTbody.innerHTML = '<tr><td colspan="7" style="text-align:center; color:var(--text-muted); padding:20px;">هیچ فاکتوری صادر نشده است.</td></tr>';
910
return;
911
}
912
@@ -1530,13 +923,10 @@
923
`).join('');
924
}
925
1533
- // ۲. فاکتورها (صدور، اقلام و ویرایش)
926
function onActiveCompanyFilterChange() {
927
const activeCompId = document.getElementById('invoice-company-id').value;
928
const filterSelect = document.getElementById('filter-invoice-company');
1537
- if (filterSelect) {
1538
- filterSelect.value = activeCompId;
1539
- }
929
+ if (filterSelect) filterSelect.value = activeCompId;
930
renderInvoices();
931
renderDashboard();
932
}
@@ -1553,20 +943,21 @@
943
tr.id = rowKey;
944
945
const productOptions = datastore.products.map(p =>
1556
- `<option value="${p.id}" data-price="${p.sale_price}" ${p.id === selectedProdId ? 'selected' : ''}>${p.name} ${p.spec ? '(' + p.spec + ')' : ''} [${p.unit}]</option>`
946
+ `<option value="${p.id}" data-price="${p.sale_price}" ${p.id === selectedProdId ? 'selected' : ''}>${p.name} ${p.spec ? '(' + p.spec + ')' : ''}</option>`
947
).join('');
948
949
tr.innerHTML = `
950
<td>
951
<select class="form-control row-product-select" onchange="onRowProductChange('${rowKey}')">
1562
- <option value="">-- انتخاب کالا / خدمت --</option>
952
+ <option value="">-- انتخاب کالا / خدمات --</option>
953
${productOptions}
954
</select>
955
</td>
956
+ <td><input type="text" class="form-control row-unit-input" value="عدد" /></td>
957
<td><input type="number" class="form-control row-quantity" value="${initialQty}" min="1" oninput="recomputeTotals()" /></td>
958
<td><input type="number" class="form-control row-price" value="${initialPrice !== null ? initialPrice : 0}" oninput="recomputeTotals()" /></td>
959
<td class="row-linetotal" style="font-weight:bold; padding-top:16px;">۰</td>
1569
- <td><button class="btn btn-danger" style="min-height:40px; padding:4px 10px;" onclick="document.getElementById('${rowKey}').remove(); recomputeTotals();">✕</button></td>
960
+ <td><button class="btn btn-danger" style="min-height:38px; padding:4px 8px;" onclick="document.getElementById('${rowKey}').remove(); recomputeTotals();">✕</button></td>
961
`;
962
tbody.appendChild(tr);
963
@@ -1608,7 +999,12 @@
999
}
1000
const grandTotal = afterDiscount + vatAmount;
1001
1611
- document.getElementById('invoice-grand-total-display').value = grandTotal.toLocaleString('fa-IR') + ' تومان';
1002
+ document.getElementById('summary-subtotal').innerText = subtotal.toLocaleString('fa-IR') + ' ریال';
1003
+ document.getElementById('summary-vat').innerText = vatAmount.toLocaleString('fa-IR') + ' ریال';
1004
+ document.getElementById('summary-grandtotal').innerText = grandTotal.toLocaleString('fa-IR') + ' ریال';
1005
+ document.getElementById('summary-words').innerText = 'به حروف: ' + grandTotal.toLocaleString('fa-IR') + ' ریال';
1006
+ document.getElementById('invoice-grand-total-display').value = grandTotal.toLocaleString('fa-IR') + ' ریال';
1007
+
1008
return { subtotal, fixedDiscount, vatAmount, grandTotal, vatRate };
1009
}
1010
@@ -1619,11 +1015,12 @@
1015
1016
const contactSelect = document.getElementById('invoice-contact-id');
1017
const contactId = contactSelect.value;
1622
- const contactName = contactSelect.options[contactSelect.selectedIndex]?.text || 'مشتری آزاد';
1623
- const number = document.getElementById('invoice-number').value || ('INV-' + (datastore.invoices.length + 1085));
1018
+ const contactName = contactSelect.options[contactSelect.selectedIndex]?.text || 'مشتری';
1019
+ const number = document.getElementById('invoice-number').value || ('PINV-' + (datastore.invoices.length + 31));
1020
const date = document.getElementById('invoice-date-input').value;
1021
const kind = document.getElementById('invoice-kind').value;
1022
const paymentMethod = document.getElementById('invoice-payment-method').value;
1023
+ const description = document.getElementById('invoice-desc-input').value;
1024
const editId = document.getElementById('edit-invoice-id').value;
1025
1026
const items = [];
@@ -1631,16 +1028,17 @@
1028
const sel = tr.querySelector('.row-product-select');
1029
const prodId = sel.value;
1030
const prodName = sel.options[sel.selectedIndex]?.text || '';
1031
+ const unit = tr.querySelector('.row-unit-input').value || 'عدد';
1032
const qty = parseFloat(tr.querySelector('.row-quantity').value) || 0;
1033
const price = parseFloat(tr.querySelector('.row-price').value) || 0;
1034
1035
if (prodId && qty > 0) {
1638
- items.push({ prodId, prodName, qty, price, lineTotal: qty * price });
1036
+ items.push({ prodId, prodName, unit, qty, price, lineTotal: qty * price });
1037
}
1038
});
1039
1040
if (items.length === 0) {
1643
- alert('لطفاً حداقل یک قلم کالا یا خدمات به فاکتور اضافه کنید.');
1041
+ alert('لطفاً حداقل یک ردیف کالا به فاکتور اضافه کنید.');
1042
return;
1043
}
1044
@@ -1649,7 +1047,6 @@
1047
const kindLabels = { formal: 'رسمی', non_formal: 'غیررسمی', pre_invoice: 'پیشفاکتور' };
1048
1049
if (editId) {
1652
- // ویرایش فاکتور موجود
1050
const existingIndex = datastore.invoices.findIndex(i => i.id === editId);
1051
if (existingIndex !== -1) {
1052
datastore.invoices[existingIndex] = {
@@ -1663,13 +1060,13 @@
1060
vat: totals.vatAmount,
1061
vatRate: totals.vatRate,
1062
grandTotal: totals.grandTotal,
1063
+ description,
1064
items
1065
};
1066
alert('فاکتور با موفقیت ویرایش شد.');
1067
}
1068
cancelInvoiceEdit();
1069
} else {
1672
- // ثبت فاکتور جدید
1070
const record = {
1071
id: 'INV_' + Date.now(),
1072
number, date, companyId, companyName, kind,
@@ -1681,10 +1078,11 @@
1078
vat: totals.vatAmount,
1079
vatRate: totals.vatRate,
1080
grandTotal: totals.grandTotal,
1081
+ description,
1082
items
1083
};
1084
datastore.invoices.push(record);
1687
- alert('فاکتور با موفقیت صادر و ثبت گردید.');
1085
+ alert('فاکتور با موفقیت ثبت شد.');
1086
cancelInvoiceEdit();
1087
renderAndPrintDirect(record.id);
1088
}
@@ -1701,7 +1099,7 @@
1099
document.getElementById('edit-invoice-id').value = inv.id;
1100
document.getElementById('invoice-form-title').innerText = `✏️ ویرایش فاکتور #${inv.number}`;
1101
document.getElementById('btn-cancel-edit').style.display = 'inline-flex';
1704
- document.getElementById('btn-save-invoice').innerText = '💾 ذخیره تغییرات فاکتور';
1102
+ document.getElementById('btn-save-invoice').innerText = '💾 ذخیره تغییرات';
1103
1104
document.getElementById('invoice-company-id').value = inv.companyId;
1105
document.getElementById('invoice-kind').value = inv.kind;
@@ -1712,31 +1110,33 @@
1110
document.getElementById('invoice-date-input').value = inv.date;
1111
document.getElementById('invoice-payment-method').value = inv.paymentMethod;
1112
document.getElementById('invoice-discount-fixed').value = inv.discount || 0;
1113
+ document.getElementById('invoice-desc-input').value = inv.description || '';
1114
1115
handleInvoiceKindChange();
1116
1718
- // بارگذاری اقلام
1117
const tbody = document.getElementById('invoice-items-table-body');
1118
tbody.innerHTML = '';
1119
inv.items.forEach(it => {
1120
addInvoiceItemRow(it.prodId, it.qty, it.price);
1121
+ const lastRow = tbody.lastElementChild;
1122
+ if (lastRow) lastRow.querySelector('.row-unit-input').value = it.unit || 'عدد';
1123
});
1124
recomputeTotals();
1125
}
1126
1127
function cancelInvoiceEdit() {
1128
document.getElementById('edit-invoice-id').value = '';
1729
- document.getElementById('invoice-form-title').innerText = 'صدور فاکتور فروش';
1129
+ document.getElementById('invoice-form-title').innerText = 'صدور فاکتور جدید';
1130
document.getElementById('btn-cancel-edit').style.display = 'none';
1731
- document.getElementById('btn-save-invoice').innerText = '💾 ثبت و صدور فاکتور';
1131
+ document.getElementById('btn-save-invoice').innerText = '💾 ثبت فاکتور';
1132
document.getElementById('invoice-items-table-body').innerHTML = '';
1133
document.getElementById('invoice-number').value = '';
1134
document.getElementById('invoice-discount-fixed').value = 0;
1135
+ document.getElementById('invoice-desc-input').value = '';
1136
addInvoiceItemRow();
1137
applyDefaultSettingsToForm();
1138
}
1139
1739
- // رندر فاکتورها بر اساس فیلتر شرکت انتخابی یا تمام شرکتها
1140
function renderInvoices() {
1141
const tbody = document.getElementById('invoice-archive-table-body');
1142
const filterSelect = document.getElementById('filter-invoice-company');
@@ -1748,7 +1148,7 @@
1148
}
1149
1150
if (list.length === 0) {
1751
- tbody.innerHTML = '<tr><td colspan="8" style="text-align:center; color:var(--text-muted); padding:20px;">هیچ فاکتوری برای این فیلتر ثبت نشده است.</td></tr>';
1151
+ tbody.innerHTML = '<tr><td colspan="7" style="text-align:center; color:var(--text-muted); padding:20px;">هیچ فاکتوری ثبت نشده است.</td></tr>';
1152
return;
1153
}
1154
@@ -1758,7 +1158,6 @@
1158
<td>${inv.companyName || '—'}</td>
1159
<td>${inv.contactName}</td>
1160
<td><span class="badge ${inv.kind === 'formal' ? 'badge-danger' : 'badge-success'}">${inv.kindLabel}</span></td>
1761
- <td>${inv.vat > 0 ? (inv.vatRate + '٪') : '—'}</td>
1161
<td>${inv.date}</td>
1162
<td>${inv.grandTotal.toLocaleString('fa-IR')}</td>
1163
<td>
@@ -1769,6 +1168,7 @@
1168
`).join('');
1169
}
1170
1171
+ // موتور صفحهبندی هوشمند دقیقاً ۱۰ ردیف در هر صفحه (مشابه تصویر ۱۳ و PDFهای ارسالی)
1172
function renderAndPrintDirect(invId) {
1173
const inv = datastore.invoices.find(i => i.id === invId);
1174
if (!inv) return;
@@ -1776,75 +1176,175 @@
1176
const seller = datastore.companies.find(c => c.id === inv.companyId) || datastore.companies[0] || {};
1177
const contact = datastore.contacts.find(c => c.id === inv.contactId) || {};
1178
1779
- document.getElementById('p-org-name').innerText = seller.name || 'ایزی فاکتور';
1780
- document.getElementById('p-org-phone').innerText = seller.phone || '—';
1781
-
1782
- document.getElementById('p-doc-kind-title').innerText = inv.kind === 'formal' ? 'صورتحساب رسمی فروش کالا و خدمات' : (inv.kind === 'pre_invoice' ? 'پیشفاکتور رسمی' : 'صورتحساب فروش کالا و خدمات (آزاد)');
1783
- document.getElementById('p-doc-number').innerText = inv.number;
1784
- document.getElementById('p-doc-date').innerText = inv.date;
1785
-
1786
- document.getElementById('p-seller-name').innerText = seller.name || '—';
1787
- document.getElementById('p-seller-national').innerText = seller.national_id || '—';
1788
- document.getElementById('p-seller-economic').innerText = seller.economic_code || '—';
1789
- document.getElementById('p-seller-reg').innerText = seller.reg_number || '—';
1790
- document.getElementById('p-seller-postal').innerText = seller.postal_code || '—';
1791
- document.getElementById('p-seller-address').innerText = seller.address || '—';
1179
+ const itemsPerPage = 10;
1180
+ const totalPages = Math.ceil(inv.items.length / itemsPerPage) || 1;
1181
+ let containerHtml = '';
1182
+
1183
+ let runningSubtotal = 0;
1184
+
1185
+ for (let p = 0; p < totalPages; p++) {
1186
+ const pageItems = inv.items.slice(p * itemsPerPage, (p + 1) * itemsPerPage);
1187
+ let pageSubtotal = 0;
1188
+
1189
+ const rowsHtml = pageItems.map((it, idx) => {
1190
+ const absoluteIndex = (p * itemsPerPage) + idx + 1;
1191
+ pageSubtotal += it.lineTotal;
1192
+ return `
1193
+ <tr>
1194
+ <td style="border:1px solid #000; padding:6px; text-align:center; font-size:11px;">${absoluteIndex}</td>
1195
+ <td style="border:1px solid #000; padding:6px; text-align:right; font-size:11px;">${it.prodName}</td>
1196
+ <td style="border:1px solid #000; padding:6px; text-align:center; font-size:11px;">${it.unit || 'عدد'}</td>
1197
+ <td style="border:1px solid #000; padding:6px; text-align:center; font-size:11px;">${it.qty}</td>
1198
+ <td style="border:1px solid #000; padding:6px; text-align:left; font-size:11px;">${it.price.toLocaleString('fa-IR')}</td>
1199
+ <td style="border:1px solid #000; padding:6px; text-align:left; font-size:11px;">${it.lineTotal.toLocaleString('fa-IR')}</td>
1200
+ </tr>
1201
+ `;
1202
+ }).join('');
1203
+
1204
+ let cumulativeBefore = runningSubtotal;
1205
+ runningSubtotal += pageSubtotal;
1206
+ let cumulativeTotal = runningSubtotal;
1207
+
1208
+ const isLastPage = (p === totalPages - 1);
1209
+
1210
+ containerHtml += `
1211
+ <div class="invoice-page-break" style="background:#fff; padding:18px; border:2px solid #000; margin-bottom:20px;">
1212
+ <!-- سربرگ رسمی با ۳ کادر بالا مطابق فایل PDF ارسالی -->
1213
+ <table style="width:100%; border-collapse:collapse; border:1.5px solid #000; margin-bottom:6px;">
1214
+ <tr>
1215
+ <td style="width:25%; border:1px solid #000; padding:6px; font-size:11px; vertical-align:top;">
1216
+ <div>شماره: <strong>${inv.number}</strong></div>
1217
+ <div style="margin-top:4px;">تاریخ: ${inv.date}</div>
1218
+ <div style="margin-top:4px;">صفحه: ${p + 1} از ${totalPages}</div>
1219
+ </td>
1220
+ <td style="width:50%; border:1px solid #000; padding:8px; text-align:center; vertical-align:middle;">
1221
+ <h2 style="font-size:16px; margin:0; font-weight:bold;">${inv.kind === 'formal' ? 'صورتحساب رسمی فروش کالا و خدمات' : 'پیش فاکتور فروش کالا و خدمات'}</h2>
1222
+ <div style="font-size:11px; margin-top:4px; font-weight:600;">${seller.name || ''}</div>
1223
+ </td>
1224
+ <td style="width:25%; border:1px solid #000; padding:6px; font-size:11px; text-align:left; vertical-align:top;">
1225
+ <div>تلفن: ${seller.phone || '—'}</div>
1226
+ </td>
1227
+ </tr>
1228
+ </table>
1229
1793
- document.getElementById('p-target-name').innerText = contact.name || inv.contactName;
1794
- document.getElementById('p-target-national').innerText = contact.national_id || '—';
1795
- document.getElementById('p-target-economic').innerText = contact.economic_code || '—';
1796
- document.getElementById('p-target-reg').innerText = contact.reg_number || '—';
1797
- document.getElementById('p-target-postal').innerText = contact.postal_code || '—';
1798
- document.getElementById('p-target-address').innerText = contact.address || '—';
1799
- document.getElementById('p-target-phone').innerText = contact.mobile || '—';
1230
+ <!-- کادر مشخصات فروشنده -->
1231
+ <table style="width:100%; border-collapse:collapse; border:1.5px solid #000; font-size:11px; margin-bottom:6px;">
1232
+ <tr>
1233
+ <td style="border:1px solid #000; padding:5px; width:15%; background:#f1f5f9;">فروشنده:</td>
1234
+ <td style="border:1px solid #000; padding:5px; width:35%;"><strong>${seller.name || '—'}</strong></td>
1235
+ <td style="border:1px solid #000; padding:5px; width:15%; background:#f1f5f9;">شناسه ملی:</td>
1236
+ <td style="border:1px solid #000; padding:5px; width:35%;"><span>${seller.national_id || '—'}</span></td>
1237
+ </tr>
1238
+ <tr>
1239
+ <td style="border:1px solid #000; padding:5px; background:#f1f5f9;">کد اقتصادی:</td>
1240
+ <td style="border:1px solid #000; padding:5px;"><span>${seller.economic_code || '—'}</span></td>
1241
+ <td style="border:1px solid #000; padding:5px; background:#f1f5f9;">شماره ثبت:</td>
1242
+ <td style="border:1px solid #000; padding:5px;"><span>${seller.reg_number || '—'}</span></td>
1243
+ </tr>
1244
+ <tr>
1245
+ <td style="border:1px solid #000; padding:5px; background:#f1f5f9;">کد پستی و نشانی:</td>
1246
+ <td colspan="3" style="border:1px solid #000; padding:5px;">کد پستی: ${seller.postal_code || '—'} | آدرس: ${seller.address || '—'}</td>
1247
+ </tr>
1248
+ </table>
1249
1801
- document.getElementById('p-doc-footer-note').innerText = seller.footer || 'از خرید شما سپاسگزاریم.';
1250
+ <!-- کادر مشخصات خریدار -->
1251
+ <table style="width:100%; border-collapse:collapse; border:1.5px solid #000; font-size:11px; margin-bottom:6px;">
1252
+ <tr>
1253
+ <td style="border:1px solid #000; padding:5px; width:15%; background:#f1f5f9;">خریدار:</td>
1254
+ <td style="border:1px solid #000; padding:5px; width:35%;"><strong>${contact.name || inv.contactName}</strong></td>
1255
+ <td style="border:1px solid #000; padding:5px; width:15%; background:#f1f5f9;">شناسه ملی:</td>
1256
+ <td style="border:1px solid #000; padding:5px; width:35%;"><span>${contact.national_id || '—'}</span></td>
1257
+ </tr>
1258
+ <tr>
1259
+ <td style="border:1px solid #000; padding:5px; background:#f1f5f9;">کد اقتصادی:</td>
1260
+ <td style="border:1px solid #000; padding:5px;"><span>${contact.economic_code || '—'}</span></td>
1261
+ <td style="border:1px solid #000; padding:5px; background:#f1f5f9;">تلفن / ثبت:</td>
1262
+ <td style="border:1px solid #000; padding:5px;"><span>${contact.mobile || '—'}</span> / ثبت: ${contact.reg_number || '—'}</td>
1263
+ </tr>
1264
+ <tr>
1265
+ <td style="border:1px solid #000; padding:5px; background:#f1f5f9;">کد پستی و نشانی:</td>
1266
+ <td colspan="3" style="border:1px solid #000; padding:5px;">کد پستی: ${contact.postal_code || '—'} | آدرس: ${contact.address || '—'}</td>
1267
+ </tr>
1268
+ </table>
1269
1803
- document.getElementById('p-target-items-table').innerHTML = inv.items.map((it, idx) => `
1804
- <tr>
1805
- <td style="border:1px solid #000; padding:6px; text-align:center;">${idx + 1}</td>
1806
- <td style="border:1px solid #000; padding:6px; text-align:right;">${it.prodName}</td>
1807
- <td style="border:1px solid #000; padding:6px; text-align:center;">${it.qty}</td>
1808
- <td style="border:1px solid #000; padding:6px; text-align:left;">${it.price.toLocaleString('fa-IR')}</td>
1809
- <td style="border:1px solid #000; padding:6px; text-align:left;">${it.lineTotal.toLocaleString('fa-IR')}</td>
1810
- </tr>
1811
- `).join('');
1270
+ <!-- جدول اقلام این صفحه با ستونهای دقیق PDF -->
1271
+ <table style="width:100%; border-collapse:collapse; border:1.5px solid #000; font-size:11px;">
1272
+ <thead>
1273
+ <tr style="background:#e2e8f0; font-weight:bold; text-align:center;">
1274
+ <th style="border:1px solid #000; padding:6px; width:35px;">ردیف</th>
1275
+ <th style="border:1px solid #000; padding:6px; text-align:right;">شرح کالا | خدمات</th>
1276
+ <th style="border:1px solid #000; padding:6px; width:55px;">واحد</th>
1277
+ <th style="border:1px solid #000; padding:6px; width:55px;">مقدار</th>
1278
+ <th style="border:1px solid #000; padding:6px; width:130px; text-align:left;">قیمت واحد (ریال)</th>
1279
+ <th style="border:1px solid #000; padding:6px; width:140px; text-align:left;">قیمت کل (ریال)</th>
1280
+ </tr>
1281
+ </thead>
1282
+ <tbody>
1283
+ ${p > 0 ? `<tr><td colspan="5" style="border:1px solid #000; padding:6px; text-align:left; font-weight:bold; background:#f8fafc;">نقل از صفحه قبل:</td><td style="border:1px solid #000; padding:6px; text-align:left; font-weight:bold; background:#f8fafc;">${cumulativeBefore.toLocaleString('fa-IR')} ریال</td></tr>` : ''}
1284
+ ${rowsHtml}
1285
+ <tr>
1286
+ <td colspan="5" style="border:1px solid #000; padding:6px; text-align:left; font-weight:bold; background:#f1f5f9;">جمع کل این صفحه:</td>
1287
+ <td style="border:1px solid #000; padding:6px; text-align:left; font-weight:bold; background:#f1f5f9;">${cumulativeTotal.toLocaleString('fa-IR')} ریال</td>
1288
+ </tr>
1289
+ </tbody>
1290
+ </table>
1291
1813
- document.getElementById('p-calc-subtotal').innerText = inv.subtotal.toLocaleString('fa-IR');
1814
- document.getElementById('p-calc-discount').innerText = inv.discount.toLocaleString('fa-IR');
1815
-
1816
- const taxRow = document.getElementById('p-tax-row');
1817
- if (inv.vat > 0) {
1818
- taxRow.style.display = 'table-row';
1819
- taxRow.querySelector('td').innerText = `مالیات ارزش افزوده (${inv.vatRate}٪):`;
1820
- document.getElementById('p-calc-tax').innerText = inv.vat.toLocaleString('fa-IR');
1821
- } else {
1822
- taxRow.style.display = 'none';
1292
+ <!-- جمعبندی نهایی در صفحه آخر -->
1293
+ ${isLastPage ? `
1294
+ <table style="width:100%; border-collapse:collapse; border:1.5px solid #000; font-size:11px; margin-top:6px;">
1295
+ <tr>
1296
+ <td style="width:60%; border:1px solid #000; padding:8px; vertical-align:top;">
1297
+ <div><strong>مبلغ به حروف:</strong> ${inv.grandTotal.toLocaleString('fa-IR')} ریال</div>
1298
+ <div style="margin-top:6px; font-size:11px; color:#333;">${inv.description || seller.footer || ''}</div>
1299
+ </td>
1300
+ <td style="width:40%; border:1px solid #000; padding:0;">
1301
+ <table style="width:100%; border-collapse:collapse; font-size:11px;">
1302
+ <tr><td style="border-bottom:1px solid #000; padding:4px;">قیمت کل:</td><td style="border-bottom:1px solid #000; padding:4px; text-align:left;">${inv.subtotal.toLocaleString('fa-IR')} ریال</td></tr>
1303
+ <tr><td style="border-bottom:1px solid #000; padding:4px;">تخفیف:</td><td style="border-bottom:1px solid #000; padding:4px; text-align:left;">${inv.discount.toLocaleString('fa-IR')} ریال</td></tr>
1304
+ ${inv.vat > 0 ? `<tr><td style="border-bottom:1px solid #000; padding:4px;">مالیات (${inv.vatRate}٪):</td><td style="border-bottom:1px solid #000; padding:4px; text-align:left;">${inv.vat.toLocaleString('fa-IR')} ریال</td></tr>` : ''}
1305
+ <tr style="background:#f1f5f9; font-weight:bold; font-size:12px;">
1306
+ <td style="padding:6px;">مبلغ کل (ریال):</td>
1307
+ <td style="padding:6px; text-align:left;">${inv.grandTotal.toLocaleString('fa-IR')} ریال</td>
1308
+ </tr>
1309
+ </table>
1310
+ </td>
1311
+ </tr>
1312
+ </table>
1313
+ <table style="width:100%; margin-top:12px; text-align:center; font-size:12px;">
1314
+ <tr>
1315
+ <td style="width:50%; height:65px; vertical-align:top; border:1px solid #000; padding:6px;">مهر و امضای فروشنده</td>
1316
+ <td style="width:50%; height:65px; vertical-align:top; border:1px solid #000; padding:6px;">مهر و امضای خریدار</td>
1317
+ </tr>
1318
+ </table>
1319
+ ` : `
1320
+ <div style="margin-top:15px; text-align:center; font-size:11px; color:#555;">(ادامه در صفحه بعد...)</div>
1321
+ `}
1322
+ </div>
1323
+ `;
1324
}
1325
1825
- document.getElementById('p-calc-grandtotal').innerText = inv.grandTotal.toLocaleString('fa-IR');
1826
-
1827
- document.getElementById('printable-invoice').style.display = 'block';
1326
+ const printContainer = document.getElementById('printable-invoice');
1327
+ printContainer.innerHTML = containerHtml;
1328
+ printContainer.style.display = 'block';
1329
window.print();
1829
- document.getElementById('printable-invoice').style.display = 'none';
1330
+ printContainer.style.display = 'none';
1331
}
1332
1832
- // ۳. کالاها و ورود از اکسل
1333
+ // ۳. کالاها
1334
function commitSaveProduct() {
1834
- const code = document.getElementById('prod-code-input').value || (datastore.products.length + 101).toString();
1335
+ const code = document.getElementById('prod-code-input').value || (datastore.products.length + 1).toString();
1336
const name = document.getElementById('prod-name-input').value;
1337
const spec = document.getElementById('prod-spec-input').value || '';
1338
const type = document.getElementById('prod-type-input').value;
1339
const unit = document.getElementById('prod-unit-input').value || 'عدد';
1340
const buy_price = parseFloat(document.getElementById('prod-buy-input').value) || 0;
1341
const sale_price = parseFloat(document.getElementById('prod-sale-input').value) || 0;
1841
- const stock = parseFloat(document.getElementById('prod-stock-input').value) || 0;
1342
1843
- if (!name) { alert('عنوان کالا یا خدمت الزامی است.'); return; }
1343
+ if (!name) { alert('عنوان کالا الزامی است.'); return; }
1344
1845
- datastore.products.push({ id: 'P_' + Date.now(), code, name, spec, type, unit, buy_price, sale_price, stock });
1345
+ datastore.products.push({ id: 'P_' + Date.now(), code, name, spec, type, unit, buy_price, sale_price, stock: 0 });
1346
persistDatastore();
1847
- alert('کالا با موفقیت ذخیره شد.');
1347
+ alert('کالا ثبت شد.');
1348
document.getElementById('prod-name-input').value = '';
1349
document.getElementById('prod-spec-input').value = '';
1350
refreshAllSurfaces();
@@ -1859,27 +1359,23 @@
1359
<td>${p.spec || '—'}</td>
1360
<td>${p.unit}</td>
1361
<td>${p.sale_price.toLocaleString('fa-IR')}</td>
1862
- <td><button class="btn btn-danger btn-inline" style="padding:4px 10px; font-size:12px; min-height:34px;" onclick="deleteProduct('${p.id}')">حذف</button></td>
1362
+ <td><button class="btn btn-danger btn-inline" style="padding:4px 8px; font-size:12px; min-height:30px;" onclick="deleteProduct('${p.id}')">حذف</button></td>
1363
</tr>
1364
`).join('');
1365
}
1366
1367
function deleteProduct(id) {
1868
- if (confirm('آیا از حذف این ردیف مطمئن هستید؟')) {
1368
+ if (confirm('حذف شود؟')) {
1369
datastore.products = datastore.products.filter(p => p.id !== id);
1370
persistDatastore();
1371
refreshAllSurfaces();
1372
}
1373
}
1374
1875
- function openQuickProductModal() {
1876
- document.getElementById('modal-quick-product').classList.add('active');
1877
- }
1878
- function closeQuickProductModal() {
1879
- document.getElementById('modal-quick-product').classList.remove('active');
1880
- }
1375
+ function openQuickProductModal() { document.getElementById('modal-quick-product').classList.add('active'); }
1376
+ function closeQuickProductModal() { document.getElementById('modal-quick-product').classList.remove('active'); }
1377
function saveQuickProduct() {
1882
- const code = document.getElementById('quick-p-code').value || (datastore.products.length + 101).toString();
1378
+ const code = document.getElementById('quick-p-code').value || (datastore.products.length + 1).toString();
1379
const name = document.getElementById('quick-p-name').value;
1380
const spec = document.getElementById('quick-p-spec').value || '';
1381
const unit = document.getElementById('quick-p-unit').value || 'عدد';
@@ -1895,12 +1391,11 @@
1391
addInvoiceItemRow(newId, 1, price);
1392
}
1393
1898
- // ایمپورت اکسل کالاها
1394
function downloadProductsExcelTemplate() {
1395
const ws_data = [
1901
- ["کد کالا", "نام کالا", "مشخصه و نوع", "واحد", "قیمت فروش (تومان)"],
1902
- ["101", "بلوک سیمانی ۱۰", "سبک لیکا", "قالب", 26000],
1903
- ["102", "بلوک سیمانی ۱۵", "سنگین ماسهای", "قالب", 32000]
1396
+ ["کد کالا", "نام کالا", "مشخصه و نوع", "واحد", "قیمت فروش (ریال)"],
1397
+ ["1", "سوئیچ شبکه 24 پورت", "با 2 پاور", "عدد", 2180000000],
1398
+ ["2", "هارد 2.5 اینچ سرور", "", "عدد", 37000000]
1399
];
1400
const ws = XLSX.utils.aoa_to_sheet(ws_data);
1401
const wb = XLSX.utils.book_new();
@@ -1911,44 +1406,36 @@
1406
function importProductsFromExcel(event) {
1407
const file = event.target.files[0];
1408
if (!file) return;
1914
-
1409
const reader = new FileReader();
1410
reader.onload = function(e) {
1411
try {
1412
const data = new Uint8Array(e.target.result);
1413
const workbook = XLSX.read(data, { type: 'array' });
1920
- const firstSheetName = workbook.SheetNames[0];
1921
- const rows = XLSX.utils.sheet_to_json(workbook.Sheets[firstSheetName]);
1922
-
1923
- let added = 0;
1414
+ const rows = XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]]);
1415
rows.forEach((r, idx) => {
1925
- const name = r["نام کالا"] || r["عنوان"] || r["name"];
1416
+ const name = r["نام کالا"] || r["عنوان"];
1417
if (name) {
1418
datastore.products.push({
1419
id: 'P_' + Date.now() + '_' + idx,
1929
- code: (r["کد کالا"] || r["code"] || (datastore.products.length + 101)).toString(),
1420
+ code: (r["کد کالا"] || (datastore.products.length + 1)).toString(),
1421
name: name.toString(),
1931
- spec: (r["مشخصه و نوع"] || r["مشخصه"] || r["spec"] || '').toString(),
1932
- unit: (r["واحد"] || r["unit"] || 'عدد').toString(),
1933
- buy_price: parseFloat(r["قیمت خرید"] || 0) || 0,
1934
- sale_price: parseFloat(r["قیمت فروش (تومان)"] || r["قیمت فروش"] || r["price"] || 0) || 0,
1935
- stock: 0,
1936
- type: 'good'
1422
+ spec: (r["مشخصه و نوع"] || '').toString(),
1423
+ unit: (r["واحد"] || 'عدد').toString(),
1424
+ buy_price: 0,
1425
+ sale_price: parseFloat(r["قیمت فروش (ریال)"] || r["قیمت فروش"] || 0) || 0,
1426
+ stock: 0, type: 'good'
1427
});
1938
- added++;
1428
}
1429
});
1430
persistDatastore();
1431
refreshAllSurfaces();
1943
- alert(`${added} کالا با موفقیت از اکسل اضافه شد.`);
1944
- } catch(err) {
1945
- alert('خطا در خواندن فایل اکسل! لطفاً از فرمت نمونه استفاده فرمایید.');
1946
- }
1432
+ alert('کالاها ایمپورت شدند.');
1433
+ } catch(err) { alert('خطا در فایل اکسل!'); }
1434
};
1435
reader.readAsArrayBuffer(file);
1436
}
1437
1951
- // ۴. اشخاص و ورود از اکسل
1438
+ // ۴. اشخاص
1439
function commitSaveContact() {
1440
const entity_type = document.getElementById('contact-entity-type').value;
1441
const custom_prefix = entity_type === 'natural' ? document.getElementById('contact-prefix-select').value : '';
@@ -1964,21 +1451,10 @@
1451
if (!raw_name) { alert('نام طرف حساب الزامی است.'); return; }
1452
1453
const formatted_name = formatEntityName(raw_name, entity_type, custom_prefix);
1967
-
1968
- datastore.contacts.push({
1969
- id: 'C_' + Date.now(),
1970
- entity_type,
1971
- name: formatted_name,
1972
- role, mobile, national_id, economic_code, reg_number, postal_code, address, balance: 0
1973
- });
1454
+ datastore.contacts.push({ id: 'C_' + Date.now(), entity_type, name: formatted_name, role, mobile, national_id, economic_code, reg_number, postal_code, address, balance: 0 });
1455
persistDatastore();
1975
- alert('طرف حساب با موفقیت ثبت شد.');
1456
+ alert('طرف حساب ثبت شد.');
1457
document.getElementById('contact-name-input').value = '';
1977
- document.getElementById('contact-national-input').value = '';
1978
- document.getElementById('contact-economic-input').value = '';
1979
- document.getElementById('contact-reg-input').value = '';
1980
- document.getElementById('contact-postal-input').value = '';
1981
- document.getElementById('contact-address-input').value = '';
1458
refreshAllSurfaces();
1459
}
1460
@@ -1989,15 +1465,14 @@
1465
1466
tbody.innerHTML = datastore.contacts.map(c => `
1467
<tr>
1992
- <td><strong>${c.name}</strong> (${c.role === 'customer' ? 'مشتری' : 'تامینکننده'})</td>
1468
+ <td><strong>${c.name}</strong></td>
1469
<td><span class="badge ${c.entity_type === 'legal' ? 'badge-warning' : 'badge-success'}">${c.entity_type === 'legal' ? 'حقوقی' : 'حقیقی'}</span></td>
1470
<td>${c.national_id || '—'}</td>
1471
<td>${c.economic_code || '—'}</td>
1996
- <td>${c.reg_number || '—'}</td>
1472
<td>${c.postal_code || '—'}</td>
1473
<td>${c.mobile || '—'}</td>
1474
<td>${Math.abs(c.balance || 0).toLocaleString('fa-IR')}</td>
2000
- <td><button class="btn btn-danger btn-inline" style="padding:4px 8px; font-size:12px; min-height:32px;" onclick="deleteContact('${c.id}')">حذف</button></td>
1475
+ <td><button class="btn btn-danger btn-inline" style="padding:4px 8px; font-size:12px; min-height:30px;" onclick="deleteContact('${c.id}')">حذف</button></td>
1476
</tr>
1477
`).join('');
1478
@@ -2007,45 +1482,36 @@
1482
}
1483
1484
function deleteContact(id) {
2010
- if (confirm('آیا مایل به حذف این طرف حساب هستید؟')) {
1485
+ if (confirm('حذف شود؟')) {
1486
datastore.contacts = datastore.contacts.filter(c => c.id !== id);
1487
persistDatastore();
1488
refreshAllSurfaces();
1489
}
1490
}
1491
2017
- function openQuickContactModal() {
2018
- document.getElementById('modal-quick-contact').classList.add('active');
2019
- }
2020
- function closeQuickContactModal() {
2021
- document.getElementById('modal-quick-contact').classList.remove('active');
2022
- }
1492
+ function openQuickContactModal() { document.getElementById('modal-quick-contact').classList.add('active'); }
1493
+ function closeQuickContactModal() { document.getElementById('modal-quick-contact').classList.remove('active'); }
1494
function handleQuickCEntityChange() {
2024
- const type = document.getElementById('quick-c-entity').value;
2025
- document.getElementById('box-quick-c-prefix').style.display = type === 'natural' ? 'block' : 'none';
1495
+ document.getElementById('box-quick-c-prefix').style.display = document.getElementById('quick-c-entity').value === 'natural' ? 'block' : 'none';
1496
}
1497
function saveQuickContact() {
1498
const entity_type = document.getElementById('quick-c-entity').value;
1499
const prefix = entity_type === 'natural' ? document.getElementById('quick-c-prefix').value : '';
1500
const raw_name = document.getElementById('quick-c-name').value;
2031
- const mobile = document.getElementById('quick-c-mobile').value;
2032
- const national_id = document.getElementById('quick-c-national').value;
2033
- const economic_code = document.getElementById('quick-c-economic').value;
2034
- const reg_number = document.getElementById('quick-c-reg').value;
2035
- const postal_code = document.getElementById('quick-c-postal').value;
2036
- const address = document.getElementById('quick-c-address').value;
2037
-
2038
- if (!raw_name) { alert('نام طرف حساب الزامی است.'); return; }
1501
+ if (!raw_name) { alert('نام الزامی است.'); return; }
1502
1503
const newId = 'C_' + Date.now();
2041
- const formatted_name = formatEntityName(raw_name, entity_type, prefix);
2042
-
1504
datastore.contacts.push({
2044
- id: newId,
2045
- entity_type,
2046
- name: formatted_name,
1505
+ id: newId, entity_type,
1506
+ name: formatEntityName(raw_name, entity_type, prefix),
1507
role: 'customer',
2048
- mobile, national_id, economic_code, reg_number, postal_code, address, balance: 0
1508
+ mobile: document.getElementById('quick-c-mobile').value,
1509
+ national_id: document.getElementById('quick-c-national').value,
1510
+ economic_code: document.getElementById('quick-c-economic').value,
1511
+ reg_number: document.getElementById('quick-c-reg').value,
1512
+ postal_code: document.getElementById('quick-c-postal').value,
1513
+ address: document.getElementById('quick-c-address').value,
1514
+ balance: 0
1515
});
1516
persistDatastore();
1517
closeQuickContactModal();
@@ -2053,12 +1519,10 @@
1519
document.getElementById('invoice-contact-id').value = newId;
1520
}
1521
2056
- // ایمپورت اکسل اشخاص
1522
function downloadContactsExcelTemplate() {
1523
const ws_data = [
1524
["نام شخص یا شرکت", "نوع (حقیقی/حقوقی)", "شماره همراه", "شناسه یا کد ملی", "کد اقتصادی", "شماره ثبت", "کد پستی", "نشانی"],
2060
- ["عمران سازه پردیس", "حقوقی", "09121234567", "10103456789", "411122233344", "12345", "1455667788", "تهران - خیابان سهروردی"],
2061
- ["احمدی", "حقیقی", "09129876543", "0012345678", "", "", "1987654321", "تهران - بازار"]
1525
+ ["دانشگاه صنعتی شریف", "حقوقی", "02166165000", "14002830256", "14002830256", "", "1458889694", "طرشت محله تیموری پلاک 435"]
1526
];
1527
const ws = XLSX.utils.aoa_to_sheet(ws_data);
1528
const wb = XLSX.utils.book_new();
@@ -2069,50 +1533,40 @@
1533
function importContactsFromExcel(event) {
1534
const file = event.target.files[0];
1535
if (!file) return;
2072
-
1536
const reader = new FileReader();
1537
reader.onload = function(e) {
1538
try {
1539
const data = new Uint8Array(e.target.result);
1540
const workbook = XLSX.read(data, { type: 'array' });
2078
- const firstSheetName = workbook.SheetNames[0];
2079
- const rows = XLSX.utils.sheet_to_json(workbook.Sheets[firstSheetName]);
2080
-
2081
- let added = 0;
1541
+ const rows = XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]]);
1542
rows.forEach((r, idx) => {
2083
- const raw_name = r["نام شخص یا شرکت"] || r["نام"] || r["name"];
1543
+ const raw_name = r["نام شخص یا شرکت"] || r["نام"];
1544
if (raw_name) {
2085
- const typeStr = (r["نوع (حقیقی/حقوقی)"] || r["نوع"] || '').toString();
2086
- const entity_type = typeStr.includes('حقوقی') ? 'legal' : 'natural';
2087
- const formatted_name = formatEntityName(raw_name.toString(), entity_type, entity_type === 'natural' ? 'آقا/خانم' : '');
2088
-
1545
+ const entity_type = (r["نوع (حقیقی/حقوقی)"] || '').includes('حقوقی') ? 'legal' : 'natural';
1546
datastore.contacts.push({
1547
id: 'C_' + Date.now() + '_' + idx,
1548
entity_type,
2092
- name: formatted_name,
1549
+ name: formatEntityName(raw_name.toString(), entity_type, 'آقا/خانم'),
1550
role: 'customer',
2094
- mobile: (r["شماره همراه"] || r["همراه"] || r["تلفن"] || '').toString(),
2095
- national_id: (r["شناسه یا کد ملی"] || r["کد ملی"] || '').toString(),
1551
+ mobile: (r["شماره همراه"] || '').toString(),
1552
+ national_id: (r["شناسه یا کد ملی"] || '').toString(),
1553
economic_code: (r["کد اقتصادی"] || '').toString(),
1554
reg_number: (r["شماره ثبت"] || '').toString(),
1555
postal_code: (r["کد پستی"] || '').toString(),
2099
- address: (r["نشانی"] || r["آدرس"] || '').toString(),
1556
+ address: (r["نشانی"] || '').toString(),
1557
balance: 0
1558
});
2102
- added++;
1559
}
1560
});
1561
persistDatastore();
1562
refreshAllSurfaces();
2107
- alert(`${added} طرف حساب با موفقیت از اکسل وارد شد.`);
2108
- } catch(err) {
2109
- alert('خطا در خواندن فایل اکسل اشخاص! لطفاً ساختار فایل نمونه را رعایت فرمایید.');
2110
- }
1563
+ alert('اشخاص ایمپورت شدند.');
1564
+ } catch(err) { alert('خطا در فایل اکسل!'); }
1565
};
1566
reader.readAsArrayBuffer(file);
1567
}
1568
2115
- // ۵. چکهای صیاد
1569
+ // ۵. چک و ۶. هزینه
1570
function commitSaveCheque() {
1571
const direction = document.getElementById('chq-direction-input').value;
1572
const contactSelect = document.getElementById('chq-contact-select');
@@ -2120,103 +1574,51 @@
1574
const sayad_id = document.getElementById('chq-sayad-input').value;
1575
const bank = document.getElementById('chq-bank-input').value;
1576
const amount = parseFloat(document.getElementById('chq-amount-input').value) || 0;
2123
- const due_date = document.getElementById('chq-due-input').value;
2124
- const status = document.getElementById('chq-status-input').value;
2125
-
2126
- if (!sayad_id || amount <= 0) {
2127
- alert('ورود شناسه صیاد و مبلغ معتبر الزامی است.');
2128
- return;
2129
- }
2130
-
2131
- datastore.cheques.push({ id: 'CHQ_' + Date.now(), direction, contactName, sayad_id, bank, amount, due_date, status });
1577
+ if (!sayad_id || amount <= 0) { alert('اطلاعات چک نامعتبر است.'); return; }
1578
+ datastore.cheques.push({ id: 'CHQ_' + Date.now(), direction, contactName, sayad_id, bank, amount, due_date: document.getElementById('chq-due-input').value, status: document.getElementById('chq-status-input').value });
1579
persistDatastore();
2133
- alert('چک با موفقیت ذخیره شد.');
1580
+ alert('چک ثبت شد.');
1581
refreshAllSurfaces();
1582
}
2136
-
1583
function renderCheques() {
1584
const tbody = document.getElementById('cheques-ledger-table-body');
2139
- if (datastore.cheques.length === 0) {
2140
- tbody.innerHTML = '<tr><td colspan="6" style="text-align:center; color:var(--text-muted); padding:20px;">چکی ثبت نشده است.</td></tr>';
2141
- return;
2142
- }
2143
-
2144
- tbody.innerHTML = datastore.cheques.map(c => `
2145
- <tr>
2146
- <td>${c.direction === 'inbound' ? '📥 دریافتی' : '📤 پرداختی'}</td>
2147
- <td>${c.contactName}</td>
2148
- <td>${c.bank} - صیاد: ${c.sayad_id}</td>
2149
- <td>${c.amount.toLocaleString('fa-IR')}</td>
2150
- <td>${c.due_date}</td>
2151
- <td><span class="badge ${c.status === 'cleared' ? 'badge-success' : (c.status === 'returned' ? 'badge-danger' : 'badge-warning')}">${c.status === 'cleared' ? 'وصول شد' : (c.status === 'returned' ? 'برگشتی' : 'در جریان')}</span></td>
2152
- </tr>
2153
- `).join('');
1585
+ tbody.innerHTML = datastore.cheques.length === 0 ? '<tr><td colspan="6" style="text-align:center;">چکی ثبت نشده است.</td></tr>' :
1586
+ datastore.cheques.map(c => `<tr><td>${c.direction === 'inbound' ? 'دریافتی' : 'پرداختی'}</td><td>${c.contactName}</td><td>${c.bank} - ${c.sayad_id}</td><td>${c.amount.toLocaleString('fa-IR')}</td><td>${c.due_date}</td><td>${c.status}</td></tr>`).join('');
1587
}
2155
-
2156
- // ۶. هزینهها
1588
function commitSaveExpense() {
2158
- const kind = document.getElementById('trx-kind-input').value;
2159
- const category = document.getElementById('trx-category-input').value;
1589
const amount = parseFloat(document.getElementById('trx-amount-input').value) || 0;
2161
- const desc = document.getElementById('trx-desc-input').value;
2162
-
2163
- if (amount <= 0) { alert('ورود مبلغ معتبر الزامی است.'); return; }
2164
-
2165
- datastore.expenses.push({ id: 'TRX_' + Date.now(), kind, category, amount, desc });
1590
+ if (amount <= 0) { alert('مبلغ معتبر نیست.'); return; }
1591
+ datastore.expenses.push({ id: 'TRX_' + Date.now(), kind: document.getElementById('trx-kind-input').value, category: document.getElementById('trx-category-input').value, amount, desc: document.getElementById('trx-desc-input').value });
1592
persistDatastore();
2167
- alert('سند با موفقیت ذخیره شد.');
1593
+ alert('سند ثبت شد.');
1594
refreshAllSurfaces();
1595
}
2170
-
1596
function renderExpenses() {
1597
const tbody = document.getElementById('expenses-ledger-table-body');
2173
- if (datastore.expenses.length === 0) {
2174
- tbody.innerHTML = '<tr><td colspan="4" style="text-align:center; color:var(--text-muted); padding:20px;">موردی ثبت نشده است.</td></tr>';
2175
- return;
2176
- }
2177
-
2178
- tbody.innerHTML = datastore.expenses.map(e => `
2179
- <tr>
2180
- <td>${e.kind === 'expense' ? '🔴 هزینه' : '🟢 درآمد'}</td>
2181
- <td>${e.category}</td>
2182
- <td>${e.desc || '—'}</td>
2183
- <td>${e.amount.toLocaleString('fa-IR')}</td>
2184
- </tr>
2185
- `).join('');
1598
+ tbody.innerHTML = datastore.expenses.length === 0 ? '<tr><td colspan="4" style="text-align:center;">موردی ثبت نشده است.</td></tr>' :
1599
+ datastore.expenses.map(e => `<tr><td>${e.kind}</td><td>${e.category}</td><td>${e.desc}</td><td>${e.amount.toLocaleString('fa-IR')}</td></tr>`).join('');
1600
}
1601
2188
- // ۷. چندشرکتی
1602
+ // ۷. شرکتها
1603
function commitSaveCompany() {
1604
const entity_type = document.getElementById('company-entity-type').value;
1605
const raw_name = document.getElementById('company-name-input').value;
2192
- const phone = document.getElementById('company-phone-input').value;
2193
- const national_id = document.getElementById('company-national-input').value;
2194
- const economic_code = document.getElementById('company-economic-input').value;
2195
- const reg_number = document.getElementById('company-reg-input').value;
2196
- const postal_code = document.getElementById('company-postal-input').value;
2197
- const address = document.getElementById('company-address-input').value;
2198
- const footer = document.getElementById('company-footer-input').value;
2199
-
2200
- if (!raw_name) { alert('نام شرکت یا فروشگاه الزامی است.'); return; }
2201
-
2202
- const formatted_name = formatEntityName(raw_name, entity_type, entity_type === 'natural' ? 'فروشگاه' : '');
1606
+ if (!raw_name) { alert('نام شرکت الزامی است.'); return; }
1607
1608
datastore.companies.push({
2205
- id: 'COMP_' + Date.now(),
2206
- entity_type,
2207
- name: formatted_name,
2208
- phone, national_id, economic_code, reg_number, postal_code, address, footer
1609
+ id: 'COMP_' + Date.now(), entity_type,
1610
+ name: formatEntityName(raw_name, entity_type),
1611
+ phone: document.getElementById('company-phone-input').value,
1612
+ national_id: document.getElementById('company-national-input').value,
1613
+ economic_code: document.getElementById('company-economic-input').value,
1614
+ reg_number: document.getElementById('company-reg-input').value,
1615
+ postal_code: document.getElementById('company-postal-input').value,
1616
+ address: document.getElementById('company-address-input').value,
1617
+ footer: document.getElementById('company-footer-input').value
1618
});
1619
persistDatastore();
2211
- alert('فروشنده جدید با موفقیت ثبت شد.');
1620
+ alert('شرکت ثبت شد.');
1621
document.getElementById('company-name-input').value = '';
2213
- document.getElementById('company-phone-input').value = '';
2214
- document.getElementById('company-national-input').value = '';
2215
- document.getElementById('company-economic-input').value = '';
2216
- document.getElementById('company-reg-input').value = '';
2217
- document.getElementById('company-postal-input').value = '';
2218
- document.getElementById('company-address-input').value = '';
2219
- document.getElementById('company-footer-input').value = '';
1622
refreshAllSurfaces();
1623
}
1624
@@ -2232,22 +1634,16 @@
1634
<td><span class="badge ${c.entity_type === 'legal' ? 'badge-warning' : 'badge-success'}">${c.entity_type === 'legal' ? 'حقوقی' : 'حقیقی'}</span></td>
1635
<td>${c.national_id || '—'}</td>
1636
<td>${c.economic_code || '—'}</td>
2235
- <td>${c.reg_number || '—'}</td>
2236
- <td>${c.postal_code || '—'}</td>
2237
- <td>${c.id === defCompId ? '<span class="badge badge-success">پیشفرض</span>' : `<button class="btn btn-secondary btn-inline" style="padding:2px 8px; font-size:11px; min-height:28px;" onclick="setDefaultCompany('${c.id}')">انتخاب</button>`}</td>
2238
- <td>${datastore.companies.length > 1 ? `<button class="btn btn-danger btn-inline" style="padding:2px 8px; font-size:11px; min-height:28px;" onclick="deleteCompany('${c.id}')">حذف</button>` : '—'}</td>
1637
+ <td>${c.id === defCompId ? '<span class="badge badge-success">پیشفرض</span>' : `<button class="btn btn-secondary btn-inline" style="padding:2px 8px; font-size:11px;" onclick="setDefaultCompany('${c.id}')">انتخاب</button>`}</td>
1638
+ <td>${datastore.companies.length > 1 ? `<button class="btn btn-danger btn-inline" style="padding:2px 8px; font-size:11px;" onclick="deleteCompany('${c.id}')">حذف</button>` : '—'}</td>
1639
</tr>
1640
`).join('');
1641
2242
- invoiceCompSelect.innerHTML = datastore.companies.map(c =>
2243
- `<option value="${c.id}" ${c.id === defCompId ? 'selected' : ''}>${c.name}</option>`
2244
- ).join('');
2245
-
1642
+ invoiceCompSelect.innerHTML = datastore.companies.map(c => `<option value="${c.id}" ${c.id === defCompId ? 'selected' : ''}>${c.name}</option>`).join('');
1643
if (filterCompSelect) {
2247
- filterCompSelect.innerHTML = `
2248
- <option value="ALL">نمایش همه شرکتها</option>
2249
- ${datastore.companies.map(c => `<option value="${c.id}" ${c.id === defCompId ? 'selected' : ''}>فقط ${c.name}</option>`).join('')}
2250
- `;
1644
+ const currentVal = filterCompSelect.value || 'ALL';
1645
+ filterCompSelect.innerHTML = `<option value="ALL">نمایش همه شرکتها</option>` + datastore.companies.map(c => `<option value="${c.id}">فقط ${c.name}</option>`).join('');
1646
+ filterCompSelect.value = currentVal;
1647
}
1648
}
1649
@@ -2259,7 +1655,7 @@
1655
}
1656
1657
function deleteCompany(id) {
2262
- if (confirm('آیا از حذف این شرکت مطمئن هستید؟')) {
1658
+ if (confirm('حذف شود؟')) {
1659
datastore.companies = datastore.companies.filter(c => c.id !== id);
1660
persistDatastore();
1661
refreshAllSurfaces();
@@ -2285,10 +1681,8 @@
1681
datastore = JSON.parse(e.target.result);
1682
persistDatastore();
1683
refreshAllSurfaces();
2288
- alert('اطلاعات با موفقیت بازگردانی شد.');
2289
- } catch(err) {
2290
- alert('فایل پشتیبان نامعتبر است.');
2291
- }
1684
+ alert('اطلاعات بازگردانی شد.');
1685
+ } catch(err) { alert('فایل نامعتبر است.'); }
1686
};
1687
reader.readAsText(file);
1688
}