@davoodmehraban89 / Factor-easy / commits / 23205cc
Fork 0

سامانه صدور فاکتور و حسابداری

Update version references from 4.4 to 4.5

davoodmehraban89 committed Sep 16, 2026 at 16:47 UTC 23205ccf5f2ad794a0ca2b6558921e8addbb3224
1 file changed +30 -22
index.html
+30 -22
@@ -152,7 +152,7 @@
152 <div class="brand-icon">ایزی</div>
153 <div>
154 <h2 style="font-size: 15px; font-weight: bold;">ایزی فاکتور</h2>
155 - <small style="color: var(--text-muted); font-size: 11px;">نگارش ۴.۴ (پایدار موبایل)</small>
155 + <small style="color: var(--text-muted); font-size: 11px;">نگارش ۴.۵ (پایدار کامل)</small>
156 </div>
157 </div>
158 <ul class="sidebar-menu">
@@ -551,7 +551,7 @@
551 </div>
552 </section>
553
554 - <!-- ۷. تنظیمات و شرکت‌ها -->
554 + <!-- ۷. تنظیمات و شرکت‌ها (با IDs صحیح و منطبق بر فرم) -->
555 <section id="view-settings" class="view-pane">
556
557 <div class="accordion-item open">
@@ -641,7 +641,7 @@
641 <div class="accordion-body">
642 <h3 style="font-size:16px; font-weight:bold;">ایزی فاکتور - EasyFactor</h3>
643 <p style="color:var(--text-muted); font-size:13px; margin:6px 0 12px 0;">سیستم هوشمند صدور فاکتور رسمی و غیررسمی (ریال)</p>
644 - <p style="font-size:13px; margin-bottom:14px;">نگارش فعال: <strong>نسخه ۴.۴ (پایدار موبایل)</strong></p>
644 + <p style="font-size:13px; margin-bottom:14px;">نگارش فعال: <strong>نسخه ۴.۵ (اصلاح فرم شرکت)</strong></p>
645 <div style="display:flex; gap:10px;">
646 <button class="btn btn-primary" onclick="alert('آخرین نگارش نصب است.')">بررسی آپدیت</button>
647 <button class="btn btn-secondary" onclick="alert('پشتیبانی فعال است.')">گزارش باگ</button>
@@ -755,8 +755,8 @@
755 </nav>
756
757 <script>
758 - const STORAGE_KEY = 'easy_factor_commercial_v4_4';
759 - const AUTH_KEY = 'easy_factor_auth_users_v4_4';
758 + const STORAGE_KEY = 'easy_factor_commercial_v4_5';
759 + const AUTH_KEY = 'easy_factor_auth_users_v4_5';
760
761 let currentUser = null;
762 let usersDb = [
@@ -811,7 +811,7 @@
811 localStorage.setItem(AUTH_KEY, JSON.stringify(usersDb));
812 }
813
814 - const activeSession = sessionStorage.getItem('easy_factor_session_v4_4');
814 + const activeSession = sessionStorage.getItem('easy_factor_session_v4_5');
815 if (activeSession) {
816 const u = usersDb.find(x => x.username === activeSession);
817 if (u) {
@@ -832,7 +832,7 @@
832 return;
833 }
834
835 - sessionStorage.setItem('easy_factor_session_v4_4', found.username);
835 + sessionStorage.setItem('easy_factor_session_v4_5', found.username);
836 loginSuccess(found);
837 }
838
@@ -864,7 +864,7 @@
864
865 usersDb.push(newUser);
866 localStorage.setItem(AUTH_KEY, JSON.stringify(usersDb));
867 - sessionStorage.setItem('easy_factor_session_v4_4', newUser.username);
867 + sessionStorage.setItem('easy_factor_session_v4_5', newUser.username);
868 alert('ثبت‌نام با موفقیت انجام شد. حساب شما به مدت ۱۵ روز آزمایشی فعال شد.');
869 loginSuccess(newUser);
870 }
@@ -905,7 +905,7 @@
905 }
906
907 function handleLogout() {
908 - sessionStorage.removeItem('easy_factor_session_v4_4');
908 + sessionStorage.removeItem('easy_factor_session_v4_5');
909 window.location.reload();
910 }
911
@@ -1777,26 +1777,35 @@
1777 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('');
1778 }
1779
1780 - // ۷. شرکت‌ها
1780 + // ۷. شرکت‌ها (اصلاح کامل ثبت شرکت)
1781 function commitSaveCompany() {
1782 const entity_type = document.getElementById('company-entity-type').value;
1783 const raw_name = document.getElementById('company-name-input').value;
1784 if (!raw_name) { alert('نام شرکت الزامی است.'); return; }
1785
1786 - datastore.companies.push({
1787 - id: 'COMP_' + Date.now(), entity_type,
1786 + const newComp = {
1787 + id: 'COMP_' + Date.now(),
1788 + entity_type,
1789 name: formatEntityName(raw_name, entity_type),
1789 - phone: document.getElementById('company-phone-input').value,
1790 - national_id: document.getElementById('company-national-input').value,
1791 - economic_code: document.getElementById('company-economic-input').value,
1792 - reg_number: document.getElementById('company-reg-input').value,
1793 - postal_code: document.getElementById('company-postal-input').value,
1794 - address: document.getElementById('company-address-input').value,
1795 - footer: document.getElementById('company-footer-input').value
1796 - });
1790 + phone: document.getElementById('company-phone-input').value || '',
1791 + national_id: document.getElementById('company-national-input').value || '',
1792 + economic_code: document.getElementById('company-economic-input').value || '',
1793 + reg_number: document.getElementById('company-reg-input').value || '',
1794 + postal_code: document.getElementById('company-postal-input').value || '',
1795 + address: document.getElementById('company-address-input').value || '',
1796 + footer: document.getElementById('company-footer-input')?.value || 'از خرید شما سپاسگزاریم.'
1797 + };
1798 +
1799 + datastore.companies.push(newComp);
1800 persistDatastore();
1798 - alert('شرکت ثبت شد.');
1801 + alert('شرکت با موفقیت ثبت و ذخیره شد.');
1802 document.getElementById('company-name-input').value = '';
1803 + document.getElementById('company-phone-input').value = '';
1804 + document.getElementById('company-national-input').value = '';
1805 + document.getElementById('company-economic-input').value = '';
1806 + document.getElementById('company-reg-input').value = '';
1807 + document.getElementById('company-postal-input').value = '';
1808 + document.getElementById('company-address-input').value = '';
1809 refreshAllSurfaces();
1810 }
1811
@@ -1809,7 +1818,6 @@
1818 tbody.innerHTML = datastore.companies.map(c => `
1819 <tr>
1820 <td><strong>${c.name}</strong></td>
1812 - <td><span class="badge ${c.entity_type === 'legal' ? 'badge-warning' : 'badge-success'}">${c.entity_type === 'legal' ? 'حقوقی' : 'حقیقی'}</span></td>
1821 <td>${c.national_id || '—'}</td>
1822 <td>${c.economic_code || '—'}</td>
1823 <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>