🔐

بوابة المسار

نظام إدارة متكامل

منظومة المسار - حقوق النشر © 2025
ملخص الشيكات

ملخص الشيكات

${info}
${table}
${new Date().toLocaleString('ar-EG')}
`); w.document.close(); w.print(); } function exportChecksSummary() { const table = document.getElementById('checksSummaryTable'); const blob = new Blob([table.outerHTML], { type: 'application/vnd.ms-excel' }); const link = document.createElement('a'); link.href = URL.createObjectURL(blob); link.download = `ChecksSummary_${new Date().toISOString().slice(0,10)}.xls`; link.click(); URL.revokeObjectURL(link.href); showToast("تم تصدير الملف"); } function loadChecksListReport() { const range = App.dateRange.get(); const type = document.getElementById('reportCheckType').value; const status = document.getElementById('reportCheckStatus').value; showToast("جاري تحميل القائمة..."); google.script.run.withSuccessHandler(checks => { let filtered = checks; let startDate = range.start ? new Date(range.start) : null; let endDate = range.end ? new Date(range.end) : null; if (endDate) endDate.setHours(23,59,59); filtered = filtered.filter(ch => { const createdDate = ch.createdAt ? new Date(ch.createdAt) : null; if (!createdDate) return false; if (startDate && createdDate < startDate) return false; if (endDate && createdDate > endDate) return false; return true; }); if (type) filtered = filtered.filter(c => c.type === type); if (status) filtered = filtered.filter(c => c.status === status); displayChecksListReport(filtered); document.getElementById('checksListReportResult').innerHTML = `النوع: ${type || 'الكل'} | الحالة: ${status || 'الكل'} | عدد الشيكات: ${filtered.length} | الفترة: ${range.start || 'بداية'} إلى ${range.end || 'اليوم'}`; document.getElementById('checksListReportResult').classList.remove('hidden'); }).withFailureHandler(err => showToast(err.message, true)).getChecksList(); } function displayChecksListReport(checks) { const tbody = document.getElementById('checksListBody'); tbody.innerHTML = ''; if (!checks || checks.length === 0) { tbody.innerHTML = ' لا توجد شيكات '; return; } for (const c of checks) { const row = tbody.insertRow(); row.insertCell(0).textContent = c.checkNumber; row.insertCell(1).textContent = c.type; row.insertCell(2).textContent = c.bank; row.insertCell(3).textContent = c.party; row.insertCell(4).textContent = formatNumber(c.amount); row.insertCell(5).textContent = c.dueDate ? new Date(c.dueDate).toLocaleDateString('ar-EG') : '-'; row.insertCell(6).textContent = c.status; row.insertCell(7).textContent = c.notes || '-'; } } function printChecksList() { const table = document.getElementById('checksListTable').outerHTML; const info = document.getElementById('checksListReportResult').innerHTML; const w = window.open('', '_blank'); w.document.write(` قائمة الشيكات

قائمة الشيكات

${info}
${table}
${new Date().toLocaleString('ar-EG')}
`); w.document.close(); w.print(); } function exportChecksList() { const table = document.getElementById('checksListTable'); const blob = new Blob([table.outerHTML], { type: 'application/vnd.ms-excel' }); const link = document.createElement('a'); link.href = URL.createObjectURL(blob); link.download = `ChecksList_${new Date().toISOString().slice(0,10)}.xls`; link.click(); URL.revokeObjectURL(link.href); showToast("تم تصدير الملف"); } function loadUpcomingChecks() { const days = parseInt(document.getElementById('upcomingDays').value) || 7; showToast("جاري تحميل الشيكات المستحقة..."); google.script.run.withSuccessHandler(stats => { const upcoming = stats.upcomingChecks; displayUpcomingChecks(upcoming, days); document.getElementById('upcomingChecksResult').innerHTML = `الشيكات المستحقة خلال ${days} أيام القادمة: ${upcoming.length} شيك`; document.getElementById('upcomingChecksResult').classList.remove('hidden'); }).withFailureHandler(err => showToast(err.message, true)).getChecksStats(); } function displayUpcomingChecks(upcoming, days) { const tbody = document.getElementById('upcomingChecksBody'); tbody.innerHTML = ''; if (!upcoming || upcoming.length === 0) { tbody.innerHTML = ' لا توجد شيكات مستحقة '; return; } const filtered = upcoming.filter(c => c.daysLeft <= days); for (const c of filtered) { const row = tbody.insertRow(); row.insertCell(0).textContent = c.checkNumber; row.insertCell(1).textContent = c.type; row.insertCell(2).textContent = c.bank; row.insertCell(3).textContent = c.party; row.insertCell(4).textContent = formatNumber(c.amount); row.insertCell(5).textContent = c.dueDate ? new Date(c.dueDate).toLocaleDateString('ar-EG') : '-'; row.insertCell(6).textContent = c.daysLeft; row.insertCell(7).textContent = c.status; if (c.daysLeft <= 3) row.style.backgroundColor = '#ffe6e6'; } } function printUpcomingChecks() { const table = document.getElementById('upcomingChecksTable').outerHTML; const info = document.getElementById('upcomingChecksResult').innerHTML; const w = window.open('', '_blank'); w.document.write(` الشيكات المستحقة

الشيكات المستحقة

${info}
${table}
${new Date().toLocaleString('ar-EG')}
`); w.document.close(); w.print(); } function exportUpcomingChecks() { const table = document.getElementById('upcomingChecksTable'); const blob = new Blob([table.outerHTML], { type: 'application/vnd.ms-excel' }); const link = document.createElement('a'); link.href = URL.createObjectURL(blob); link.download = `UpcomingChecks_${new Date().toISOString().slice(0,10)}.xls`; link.click(); URL.revokeObjectURL(link.href); showToast("تم تصدير الملف"); } function loadBanksToSelects() { const banks = App.banks || []; ['newCheckBank'].forEach(id => { const sel = document.getElementById(id); if (sel) { sel.innerHTML = ''; banks.forEach(b => { let opt = document.createElement('option'); opt.value = b.name; opt.textContent = `${b.name} (${b.code})`; sel.appendChild(opt); }); } }); }