Back to blocks

نظام محاسبي للذهب

4.0
arبرامج محاسبيةنظام محاسبيذهب ومجوهراتإدارة مبيعات

Prompt

ابني لي نظام محاسبي للذهب والمجوهرات
الواجهة عربي كامل
فاتورة مبيعت مرتجع مبيعات
فاتورة مشتريات مردود مشتريات
صندوق المشغول
سندصرف وقبض
صندوق الكسروالريال
اشعارتحويل
تسكيرلعميل وتسكيرعندرئيسي
صندوق تسكير
اصناف
العملاء
الموردين
شجرةمحاسبية
استاذعام واستاذمساعد
كشف حساب وكشف يومية وكشف ديون
اعدادت تغيرالوان واعدادات
طباعة تعديل حذف الغا
نظام محاسبي للذهب والمجوهرات
فعلي وفعلة
اكمل
فعل النظام

Generated Result

Loading editor...

More Recommendations

View All

نظام محاسبة محلات الذهب

برامج محاسبيةar
4.0

📌 واجهة عربية بالكامل 📌 شغال Offline بدون إنترنت 📌 سهل التعديل حسب احتياجك سندقبض وصرف وخانة جرام اشاعارتحويل دائن ومدين اشعارتسكيرلعميل واشعارتسكيرعندرئيسي كل النظام اجل/نقدا فاتورة مبيعات مرتجع مبيعات فاتورة مشتريات مردودمشتريات كشف حساب كشف يومية ديون عملاء موردين شجرةالحسابات قائمةالذخل الخسائروالارباح استاذعام استاذمساعد مخزن صندوق كسروريال مخزن صندوق المشغول مخزن صندوق التسكير صندوق فرق العيار وعيارات24,22,21,18 نسخ احتياطي نسخ جوجل درايف اعدادات وتغيرالالون قائمة الديون لنظام كامل اضافة اصناف ⏱ بنرنامج محاسبة محلات الذهب جملة وقطاعي...) 📤 تقدر تحفظ البيانات وتصدرها بسهولة 🔒 وأمان كامل بكلمة سر للإدارة نظام متكامل وجذاب وسلس عالي المواصفات (رابط ويب) نشاء نظام محاسبة محلات الذهب مبيعات مرتجع مبيعات مشتريات مردود مشتريات عملاء موردين سندصرف وقبض تحويل تسكيرلعميل تسكير عندرئيسي صندوق كسروريال مخزن مشغول شجرة الحسابات اجل/ نقدا فتح حساب طباعة تعديل حذف العا اعدادت تغيرالوان تسجيل دخول كشف حساب كشف يومة كشف ديون قائمة الذخل الارباح والخسائر استاذعام استاذمساعد نسخ احتياطي نسخة جوجل درايف حفظ يشتغل بنت وبدون نت كمبيوتر اوفيس وتاب اولاين//اضافة خانة وزن ذهب عيارات 24و22و21و18 اصناف ومخازن وديونرابط ويب نظام محاسبة كامل وجذاب ضرب السعراوالاجرة في الكمية اوالوزن يساوري الاجمالي معادة اعمل افضل نظام متكامل وسلس يدوي اضافة قاعدة بيانات اضافة شجرة الحسابات قائم الذخل الخسائر والارباح كشف حساب كشف يومية كشف ديون مساعد عام اسثاذمساعد عملاءموردين مبيعات مرتجع مبيعات مشتروات مردود مشتروات سندقبض سندصرفمخزن صندوق مخزن مشغول اشعارتحويل اشعارتسكيرلعميلالذهب للزبون الريال للمحل تسكيرعندرئيسي الذهب للمحل الريال لزبون نسخ احطياطي نسخ جوجل درايف خانة وزن ذهب سعراجرةالسعرضرب الكمية يساوي الاجمالي اجمالي نظام متكامل وجذاب طباعة تعديل حذف الغاء اكمل النواقص للبرنامج اعم برنامج محاسبي للذهب والمجورات متابعت المصروفات والايرادات والرصيد سحابي رابط ويب

محاسبة الذهبنظام متكاملإدارة المخازن6/18/2025

نظام محاسبي للذهب والمجوهرات

برامج محاسبيةar
4.0

ابني لي نظام محاسبي للذهب والمجوهرات الواجهة عربي كامل فاتورة مبيعت مرتجع مبيعات فاتورة مشتريات مردود مشتريات صندوق المشغول سندصرف وقبض صندوق الكسروالريال اشعارتحويل تسكيرلعميل وتسكيرعندرئيسي صندوق تسكير اصناف العملاء الموردين شجرةمحاسبية استاذعام واستاذمساعد كشف حساب وكشف يومية وكشف ديون اعدادت تغيرالوان واعدادات طباعة تعديل حذف الغا نظام محاسبي للذهب والمجوهرات فعلي وفعلة اكمل

نظام محاسبيالذهبالمجوهرات6/16/2025

نظام محاسبي للذهب

برامج محاسبيةar
4.0

<!DOCTYPE html> <html lang="ar" dir="rtl"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>نظام محاسبي للذهب والمجوهرات</title> <!-- Tailwind CSS CDN for styling --> <script src="https://cdn.tailwindcss.com"></script> <script type="module"> // Firebase CDN imports (Ensure these are correct and up-to-date) import { initializeApp } from "https://www.gstatic.com/firebasejs/11.6.1/firebase-app.js"; import { getAuth, signInAnonymously, signInWithCustomToken, onAuthStateChanged } from "https://www.gstatic.com/firebasejs/11.6.1/firebase-auth.js"; import { getFirestore, doc, getDoc, addDoc, setDoc, updateDoc, deleteDoc, onSnapshot, collection, query, where, getDocs } from "https://www.gstatic.com/firebasejs/11.6.1/firebase-firestore.js"; // Tailwind CSS Configuration tailwind.config = { theme: { extend: { fontFamily: { sans: ['Inter', 'sans-serif'], }, colors: { // Default emerald palette emerald: { 50: 'var(--color-primary-50)', 100: 'var(--color-primary-100)', 200: 'var(--color-primary-200)', 300: 'var(--color-primary-300)', 400: 'var(--color-primary-400)', 500: 'var(--color-primary-500)', 600: 'var(--color-primary-600)', 700: 'var(--color-primary-700)', 800: 'var(--color-primary-800)', 900: 'var(--color-primary-900)', 950: 'var(--color-primary-950)', }, }, } } } // Global variables provided by the Canvas environment const appId = typeof __app_id !== 'undefined' ? __app_id : 'default-app-id'; const firebaseConfig = JSON.parse(typeof __firebase_config !== 'undefined' ? __firebase_config : '{}'); let app; let db; let auth; let userId = null; // Will store the authenticated user ID let isAuthReady = false; // Flag to ensure Firestore operations wait for auth // Global data stores (will be populated from Firestore) let itemsData = []; let customersData = []; let suppliersData = []; // Function to initialize Firebase and authenticate async function initializeFirebase() { try { // Initialize Firebase app app = initializeApp(firebaseConfig); db = getFirestore(app); auth = getAuth(app); // Listen for authentication state changes onAuthStateChanged(auth, async (user) => { if (user) { userId = user.uid; console.log("Firebase Authenticated:", userId); } else { // Sign in anonymously if no custom token is provided (e.g., local development) try { await signInAnonymously(auth); userId = auth.currentUser?.uid; console.log("Firebase Signed in anonymously:", userId); } catch (error) { console.error("Error signing in anonymously:", error); window.showMessage("خطأ في تسجيل الدخول كمستخدم مجهول.", 'error'); } } isAuthReady = true; // Auth is ready, now can interact with Firestore document.getElementById('current-user-id').textContent = ID: ${userId}; // Display user ID if (userId) { loadInitialData(); // Load items, customers, suppliers after auth is ready } }); // Use custom token if provided (for Canvas environment) if (typeof __initial_auth_token !== 'undefined' && __initial_auth_token) { await signInWithCustomToken(auth, __initial_auth_token); } else { // Fallback to anonymous sign-in if no custom token provided initially await signInAnonymously(auth); } } catch (error) { console.error("Firebase initialization error:", error); window.showMessage("خطأ في تهيئة النظام. الرجاء المحاولة لاحقاً.", 'error'); } } // --- Firestore Data Operations --- // Load initial data (items, customers, suppliers) from Firestore function loadInitialData() { if (!isAuthReady || !db) { console.warn("Firestore not ready. Cannot load initial data."); return; } // Items Listener onSnapshot(collection(db, artifacts/${appId}/public/data/items), (snapshot) => { itemsData = []; snapshot.forEach((doc) => { const item = doc.data(); item.docId = doc.id; // Store Firestore document ID itemsData.push(item); }); window.renderItemsTable(); // Update items table in UI window.updateSalesInvoiceItemOptions(); // Update item dropdowns in sales form console.log("Items loaded from Firestore:", itemsData); }, (error) => { console.error("Error fetching items:", error); window.showMessage("خطأ في تحميل الأصناف.", 'error'); }); // Customers Listener onSnapshot(collection(db, artifacts/${appId}/public/data/customers), (snapshot) => { customersData = []; snapshot.forEach((doc) => { const customer = doc.data(); customer.docId = doc.id; customersData.push(customer); }); window.renderCustomersTable(); // Update customers table in UI console.log("Customers loaded from Firestore:", customersData); }, (error) => { console.error("Error fetching customers:", error); window.showMessage("خطأ في تحميل العملاء.", 'error'); }); // Suppliers Listener onSnapshot(collection(db, artifacts/${appId}/public/data/suppliers), (snapshot) => { suppliersData = []; snapshot.forEach((doc) => { const supplier = doc.data(); supplier.docId = doc.id; suppliersData.push(supplier); }); window.renderSuppliersTable(); // Update suppliers table in UI console.log("Suppliers loaded from Firestore:", suppliersData); }, (error) => { console.error("Error fetching suppliers:", error); window.showMessage("خطأ في تحميل الموردين.", 'error'); }); } // --- Utility Functions for Firestore Operations --- // Generic function to save data to a Firestore collection async function saveDataToFirestore(collectionPath, data, docId = null) { if (!isAuthReady || !db || !userId) { window.showMessage("النظام غير جاهز أو غير مصادق عليه. الرجاء المحاولة لاحقاً.", 'error'); return null; } try { if (docId) { // Update existing document await updateDoc(doc(db, collectionPath, docId), data); return docId; } else { // Add new document const docRef = await addDoc(collection(db, collectionPath), data); return docRef.id; } } catch (e) { console.error(`Error saving to ${collectionPath}: `, e); window.showMessage(فشل حفظ البيانات: ${e.message}, 'error'); return null; } } // Generic function to delete data from a Firestore collection async function deleteDataFromFirestore(collectionPath, docId) { if (!isAuthReady || !db || !userId) { window.showMessage("النظام غير جاهز أو غير مصادق عليه. الرجاء المحاولة لاحقاً.", 'error'); return false; } try { await deleteDoc(doc(db, collectionPath, docId)); return true; } catch (e) { console.error(`Error deleting from ${collectionPath}: `, e); window.showMessage(فشل حذف البيانات: ${e.message}, 'error'); return false; } } // --- UI Section Management --- // Function to show a specific section and hide others window.showSection = function(sectionId) { const sections = document.querySelectorAll('section'); sections.forEach(section => { section.classList.add('hidden'); }); document.getElementById(sectionId).classList.remove('hidden'); // Specific logic for sections that need initial rendering or resets if (sectionId === 'items') { window.renderItemsTable(); document.getElementById('itemForm').reset(); // Clear item form when navigating to it } else if (sectionId === 'sales-invoice') { window.resetSalesInvoiceForm(); // Reset and add initial row } else if (sectionId === 'customers') { document.getElementById('customerForm').reset(); // Clear customer form } else if (sectionId === 'suppliers') { document.getElementById('supplierForm').reset(); // Clear supplier form } else if (sectionId === 'settings') { window.applyThemeFromSettings(); // Apply theme when settings are viewed } } // --- Sales Invoice Section Logic --- window.addInvoiceItemRow = function(item = null) { const tableBody = document.getElementById('invoice-items-body'); const newRow = tableBody.insertRow(); newRow.className = 'border-b border-gray-200'; newRow.innerHTML = ` <td class="py-2 px-4"> <select class="item-select shadow border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" onchange="populateItemDetails(this)"> <option value="">اختر صنفاً</option> ${itemsData.map(i => <option value="${i.docId}" ${item && item.itemId === i.docId ? 'selected' : ''}>${i.name} (${i.carat} قيراط)</option>).join('')} </select> </td> <td class="py-2 px-4"><input type="number" step="0.01" class="item-weight shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" oninput="calculateItemTotal(this.parentNode.parentNode)" value="${item ? item.weight : '0.00'}"></td> <td class="py-2 px-4"> <select class="item-carat shadow border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" onchange="calculateItemTotal(this.parentNode.parentNode)"> <option value="24" ${item && item.carat === '24' ? 'selected' : ''}>24 قيراط</option> <option value="22" ${item && item.carat === '22' ? 'selected' : ''}>22 قيراط</option> <option value="21" ${item && item.carat === '21' ? 'selected' : ''}>21 قيراط</option> <option value="18" ${item && item.carat === '18' ? 'selected' : ''}>18 قيراط</option> <option value="14" ${item && item.carat === '14' ? 'selected' : ''}>14 قيراط</option> </select> </td> <td class="py-2 px-4"><input type="number" step="0.01" class="gold-price shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" oninput="calculateItemTotal(this.parentNode.parentNode)" value="${item ? item.goldPrice : '0.00'}"></td> <td class="py-2 px-4"><input type="number" step="0.01" class="craftsmanship-cost shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" oninput="calculateItemTotal(this.parentNode.parentNode)" value="${item ? item.craftsmanship : '0.00'}"></td> <td class="py-2 px-4"><input type="number" step="0.01" class="total-item-amount shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 bg-gray-100 leading-tight focus:outline-none focus:shadow-outline" readonly value="${item ? item.totalItem : '0.00'}"></td> <td class="py-2 px-4 text-center no-print"> <button type="button" class="bg-red-500 text-white px-3 py-1 rounded-md hover:bg-red-600 transition-colors text-sm" onclick="removeInvoiceItemRow(this)">حذف</button> </td> `; window.calculateInvoiceTotals(); // Recalculate totals after adding a row } window.removeInvoiceItemRow = function(button) { const row = button.parentNode.parentNode; row.parentNode.removeChild(row); window.calculateInvoiceTotals(); // Recalculate totals after removing a row if (document.getElementById('invoice-items-body').rows.length === 0) { window.addInvoiceItemRow(); // Always keep at least one row } } window.populateItemDetails = function(selectElement) { const selectedItemDocId = selectElement.value; const selectedItem = itemsData.find(item => item.docId === selectedItemDocId); const row = selectElement.parentNode.parentNode; if (selectedItem) { row.querySelector('.item-weight').value = selectedItem.weight; row.querySelector('.item-carat').value = selectedItem.carat; // You might also pre-fill a default gold price from settings here if available } else { row.querySelector('.item-weight').value = '0.00'; row.querySelector('.item-carat').value = ''; // Reset carat if no item selected row.querySelector('.gold-price').value = '0.00'; } window.calculateItemTotal(row); } window.calculateItemTotal = function(row) { const weight = parseFloat(row.querySelector('.item-weight').value) || 0; const goldPrice = parseFloat(row.querySelector('.gold-price').value) || 0; const craftsmanship = parseFloat(row.querySelector('.craftsmanship-cost').value) || 0; const carat = row.querySelector('.item-carat').value; // Simple example: gold price scaled by carat (approximation). // In a real system, you'd have daily prices per carat or a more precise calculation. let effectiveGoldPrice = goldPrice; if (carat === '22') effectiveGoldPrice = goldPrice * (22 / 24); else if (carat === '21') effectiveGoldPrice = goldPrice * (21 / 24); else if (carat === '18') effectiveGoldPrice = goldPrice * (18 / 24); else if (carat === '14') effectiveGoldPrice = goldPrice * (14 / 24); const total = (weight * effectiveGoldPrice) + craftsmanship; row.querySelector('.total-item-amount').value = total.toFixed(2); window.calculateInvoiceTotals(); } window.calculateInvoiceTotals = function() { let subtotal = 0; document.querySelectorAll('#invoice-items-body .total-item-amount').forEach(input => { subtotal += parseFloat(input.value) || 0; }); const discount = parseFloat(document.getElementById('discount_amount').value) || 0; const totalAmount = subtotal - discount; document.getElementById('subtotal_amount').value = subtotal.toFixed(2); document.getElementById('total_amount').value = totalAmount.toFixed(2); } // Handle Sales Invoice Form Submission document.getElementById('salesInvoiceForm').addEventListener('submit', async function(event) { event.preventDefault(); // Prevent default form submission const invoiceDate = document.getElementById('invoice_date').value; const customerName = document.getElementById('customer_name').value; const customerId = document.getElementById('customer_id').value; const invoiceNumber = document.getElementById('invoice_number').value; const paymentMethod = document.getElementById('payment_method').value; // Cash or Credit const subtotal = parseFloat(document.getElementById('subtotal_amount').value); const discount = parseFloat(document.getElementById('discount_amount').value); const totalAmount = parseFloat(document.getElementById('total_amount').value); const notes = document.getElementById('notes').value; const items = []; document.querySelectorAll('#invoice-items-body tr').forEach(row => { const itemSelect = row.querySelector('.item-select'); const itemDocId = itemSelect.value; const selectedItem = itemsData.find(item => item.docId === itemDocId); if (selectedItem) { items.push({ itemId: selectedItem.docId, itemName: selectedItem.name, weight: parseFloat(row.querySelector('.item-weight').value) || 0, carat: row.querySelector('.item-carat').value, goldPrice: parseFloat(row.querySelector('.gold-price').value) || 0, craftsmanship: parseFloat(row.querySelector('.craftsmanship-cost').value) || 0, totalItem: parseFloat(row.querySelector('.total-item-amount').value) || 0 }); } }); if (!customerName || items.length === 0 || !items[0].itemName) { window.showMessage('الرجاء تعبئة اسم العميل وإضافة صنف واحد على الأقل.', 'error'); return; } const salesData = { type: 'sales_invoice', invoiceDate, customerName, customerId, invoiceNumber, paymentMethod, subtotal, discount, totalAmount, notes, items, timestamp: firebase.firestore.Timestamp.now() }; const docId = await saveDataToFirestore(artifacts/${appId}/users/${userId}/transactions, salesData); if (docId) { window.showMessage(تم حفظ فاتورة مبيعات للعميل "${customerName}" بنجاح! رقم الفاتورة: ${docId}, 'success'); // Logic to update customer balance for 'Agel' payment can go here if (paymentMethod === 'credit') { // Find customer and update their balance in customersData and Firestore const customer = customersData.find(cust => cust.name === customerName); if (customer) { const newBalance = (parseFloat(customer.balance) || 0) + totalAmount; await saveDataToFirestore(artifacts/${appId}/public/data/customers, { balance: newBalance }, customer.docId); } else { console.warn("Customer not found for balance update."); } } window.resetSalesInvoiceForm(); } }); window.resetSalesInvoiceForm = function() { document.getElementById('salesInvoiceForm').reset(); document.getElementById('invoice-items-body').innerHTML = ''; // Clear items window.addInvoiceItemRow(); // Add a fresh row window.calculateInvoiceTotals(); // Recalculate document.getElementById('invoice_date').valueAsDate = new Date(); // Set current date document.getElementById('invoice_number').value = INV-${Date.now().toString().slice(-6)}; // Simple unique ID } window.printInvoice = function() { window.print(); } // --- Items Management Section Logic --- let editingItemId = null; // Store docId of item being edited document.getElementById('itemForm').addEventListener('submit', async function(event) { event.preventDefault(); const name = document.getElementById('item_name').value; const carat = document.getElementById('item_carat').value; const weight = parseFloat(document.getElementById('item_weight').value); const barcode = document.getElementById('item_barcode').value; if (!name || !carat || isNaN(weight)) { window.showMessage('الرجاء تعبئة اسم الصنف، العيار، والوزن بشكل صحيح.', 'error'); return; } const itemData = { name, carat, weight, barcode: barcode || 'N/A' }; let success = false; if (editingItemId) { // Update existing item success = await saveDataToFirestore(artifacts/${appId}/public/data/items, itemData, editingItemId); if (success) { window.showMessage(تم تحديث الصنف "${name}" بنجاح., 'success'); } editingItemId = null; // Reset editing state document.getElementById('itemFormSubmitBtn').textContent = 'إضافة صنف'; } else { // Add new item success = await saveDataToFirestore(artifacts/${appId}/public/data/items, itemData); if (success) { window.showMessage(تم إضافة الصنف "${name}" بنجاح., 'success'); } } if (success) { document.getElementById('itemForm').reset(); } }); window.renderItemsTable = function() { const tableBody = document.getElementById('items-table-body'); tableBody.innerHTML = ''; // Clear existing rows itemsData.forEach(item => { const row = tableBody.insertRow(); row.className = 'border-b border-gray-200'; row.innerHTML = ` <td class="py-2 px-4">${item.name}</td> <td class="py-2 px-4">${item.carat} قيراط</td> <td class="py-2 px-4">${item.weight.toFixed(2)}</td> <td class="py-2 px-4">${item.barcode}</td> <td class="py-2 px-4 text-center"> <button class="bg-blue-500 text-white px-3 py-1 rounded-md text-sm hover:bg-blue-600 transition-colors ml-2" onclick="editItem('${item.docId}')">تعديل</button> <button class="bg-red-500 text-white px-3 py-1 rounded-md text-sm hover:bg-red-600 transition-colors" onclick="confirmDeleteItem('${item.docId}', 'item')">حذف</button> </td> `; }); window.updateSalesInvoiceItemOptions(); // Ensure sales invoice dropdowns are fresh } window.editItem = function(docId) { const item = itemsData.find(i => i.docId === docId); if (item) { document.getElementById('item_name').value = item.name; document.getElementById('item_carat').value = item.carat; document.getElementById('item_weight').value = item.weight; document.getElementById('item_barcode').value = item.barcode === 'N/A' ? '' : item.barcode; editingItemId = docId; // Set ID of item being edited document.getElementById('itemFormSubmitBtn').textContent = 'تحديث الصنف'; window.showMessage(تقوم الآن بتعديل الصنف "${item.name}"., 'info'); } } // --- Customers Management Section Logic --- let editingCustomerId = null; document.getElementById('customerForm').addEventListener('submit', async function(event) { event.preventDefault(); const name = document.getElementById('customer_add_name').value; const phone = document.getElementById('customer_add_phone').value; const address = document.getElementById('customer_add_address').value; const idNumber = document.getElementById('customer_add_id_number').value; if (!name) { window.showMessage('الرجاء تعبئة اسم العميل.', 'error'); return; } const customerData = { name, phone: phone || 'N/A', address: address || 'N/A', idNumber: idNumber || 'N/A', balance: 0 // Initialize balance }; let success = false; if (editingCustomerId) { // Preserve existing balance if updating const existingCustomer = customersData.find(c => c.docId === editingCustomerId); if (existingCustomer) { customerData.balance = existingCustomer.balance; } success = await saveDataToFirestore(artifacts/${appId}/public/data/customers, customerData, editingCustomerId); if (success) window.showMessage(تم تحديث العميل "${name}" بنجاح., 'success'); editingCustomerId = null; document.getElementById('customerFormSubmitBtn').textContent = 'إضافة عميل'; } else { success = await saveDataToFirestore(artifacts/${appId}/public/data/customers, customerData); if (success) window.showMessage(تم إضافة العميل "${name}" بنجاح., 'success'); } if (success) { document.getElementById('customerForm').reset(); } }); window.renderCustomersTable = function() { const tableBody = document.getElementById('customers-table-body'); tableBody.innerHTML = ''; customersData.forEach(customer => { const balanceClass = customer.balance < 0 ? 'text-red-600' : (customer.balance > 0 ? 'text-green-600' : ''); const balanceText = customer.balance < 0 ? ${Math.abs(customer.balance).toFixed(2)}- (مدين) : ${customer.balance.toFixed(2)}+ (دائن); const row = tableBody.insertRow(); row.className = 'border-b border-gray-200'; row.innerHTML = ` <td class="py-2 px-4">${customer.name}</td> <td class="py-2 px-4">${customer.phone}</td> <td class="py-2 px-4 ${balanceClass}">${balanceText}</td> <td class="py-2 px-4 text-center"> <button class="bg-blue-500 text-white px-3 py-1 rounded-md text-sm hover:bg-blue-600 transition-colors ml-2" onclick="editCustomer('${customer.docId}')">تعديل</button> <button class="bg-red-500 text-white px-3 py-1 rounded-md text-sm hover:bg-red-600 transition-colors" onclick="confirmDeleteItem('${customer.docId}', 'customer')">حذف</button> </td> `; }); } window.editCustomer = function(docId) { const customer = customersData.find(c => c.docId === docId); if (customer) { document.getElementById('customer_add_name').value = customer.name; document.getElementById('customer_add_phone').value = customer.phone === 'N/A' ? '' : customer.phone; document.getElementById('customer_add_address').value = customer.address === 'N/A' ? '' : customer.address; document.getElementById('customer_add_id_number').value = customer.idNumber === 'N/A' ? '' : customer.idNumber; editingCustomerId = docId; document.getElementById('customerFormSubmitBtn').textContent = 'تحديث العميل'; window.showMessage(تقوم الآن بتعديل العميل "${customer.name}"., 'info'); } } // --- Suppliers Management Section Logic --- let editingSupplierId = null; document.getElementById('supplierForm').addEventListener('submit', async function(event) { event.preventDefault(); const name = document.getElementById('supplier_add_name').value; const phone = document.getElementById('supplier_add_phone').value; const address = document.getElementById('supplier_add_address').value; const idNumber = document.getElementById('supplier_add_id_number').value; if (!name) { window.showMessage('الرجاء تعبئة اسم المورد.', 'error'); return; } const supplierData = { name, phone: phone || 'N/A', address: address || 'N/A', idNumber: idNumber || 'N/A', balance: 0 // Initialize balance }; let success = false; if (editingSupplierId) { const existingSupplier = suppliersData.find(s => s.docId === editingSupplierId); if (existingSupplier) { supplierData.balance = existingSupplier.balance; } success = await saveDataToFirestore(artifacts/${appId}/public/data/suppliers, supplierData, editingSupplierId); if (success) window.showMessage(تم تحديث المورد "${name}" بنجاح., 'success'); editingSupplierId = null; document.getElementById('supplierFormSubmitBtn').textContent = 'إضافة مورد'; } else { success = await saveDataToFirestore(artifacts/${appId}/public/data/suppliers, supplierData); if (success) window.showMessage(تم إضافة المورد "${name}" بنجاح., 'success'); } if (success) { document.getElementById('supplierForm').reset(); } }); window.renderSuppliersTable = function() { const tableBody = document.getElementById('suppliers-table-body'); tableBody.innerHTML = ''; suppliersData.forEach(supplier => { const balanceClass = supplier.balance < 0 ? 'text-red-600' : (supplier.balance > 0 ? 'text-green-600' : ''); const balanceText = supplier.balance < 0 ? ${Math.abs(supplier.balance).toFixed(2)}- (مدين) : ${supplier.balance.toFixed(2)}+ (دائن); const row = tableBody.insertRow(); row.className = 'border-b border-gray-200'; row.innerHTML = ` <td class="py-2 px-4">${supplier.name}</td> <td class="py-2 px-4">${supplier.phone}</td> <td class="py-2 px-4 ${balanceClass}">${balanceText}</td> <td class="py-2 px-4 text-center"> <button class="bg-blue-500 text-white px-3 py-1 rounded-md text-sm hover:bg-blue-600 transition-colors ml-2" onclick="editSupplier('${supplier.docId}')">تعديل</button> <button class="bg-red-500 text-white px-3 py-1 rounded-md text-sm hover:bg-red-600 transition-colors" onclick="confirmDeleteItem('${supplier.docId}', 'supplier')">حذف</button> </td> `; }); } window.editSupplier = function(docId) { const supplier = suppliersData.find(s => s.docId === docId); if (supplier) { document.getElementById('supplier_add_name').value = supplier.name; document.getElementById('supplier_add_phone').value = supplier.phone === 'N/A' ? '' : supplier.phone; document.getElementById('supplier_add_address').value = supplier.address === 'N/A' ? '' : supplier.address; document.getElementById('supplier_add_id_number').value = supplier.idNumber === 'N/A' ? '' : supplier.idNumber; editingSupplierId = docId; document.getElementById('supplierFormSubmitBtn').textContent = 'تحديث المورد'; window.showMessage(تقوم الآن بتعديل المورد "${supplier.name}"., 'info'); } } // --- General Utility Functions --- const modal = document.getElementById('modal-message'); const modalText = document.getElementById('modal-text'); window.showMessage = function(message, type = 'info') { modalText.textContent = message; modalText.className = 'text-lg mb-4 '; // Reset classes if (type === 'success') { modalText.classList.add('text-green-700'); } else if (type === 'error') { modalText.classList.add('text-red-700'); } else { modalText.classList.add('text-blue-700'); } modal.classList.remove('hidden'); } window.hideModal = function() { modal.classList.add('hidden'); } window.confirmDeleteItem = function(docId, type) { // Using a custom modal for confirmation instead of window.confirm window.showMessage("هل أنت متأكد من حذف هذا السجل؟ <br> <button onclick='window.executeDelete(\"" + docId + "\", \"" + type + "\")' class='bg-red-500 text-white px-3 py-1 rounded-md text-sm hover:bg-red-600 mt-4 mr-2'>تأكيد الحذف</button><button onclick='window.hideModal()' class='bg-gray-500 text-white px-3 py-1 rounded-md text-sm hover:bg-gray-600 mt-4'>إلغاء</button>"); modalText.classList.add('text-center'); // Center text for confirmation } window.executeDelete = async function(docId, type) { window.hideModal(); // Hide the confirmation modal let collectionPath; if (type === 'item') { collectionPath = artifacts/${appId}/public/data/items; } else if (type === 'customer') { collectionPath = artifacts/${appId}/public/data/customers; } else if (type === 'supplier') { collectionPath = artifacts/${appId}/public/data/suppliers; } else { console.error("Unknown type for deletion:", type); return; } const success = await deleteDataFromFirestore(collectionPath, docId); if (success) { window.showMessage("تم حذف السجل بنجاح.", 'success'); } } // This function will be called to update options related to sales invoice items. // It's a placeholder to resolve the ReferenceError. // In a real application, this would interact with item lookup, stock management, etc. window.updateSalesInvoiceItemOptions = function() { const customerDatalist = document.getElementById('customer-names'); customerDatalist.innerHTML = customersData.map(c => <option value="${c.name}"></option>).join(''); // Also update the item dropdowns in the sales invoice form document.querySelectorAll('#invoice-items-body .item-select').forEach(select => { const currentSelectedValue = select.value; // Preserve current selection if any select.innerHTML = '<option value="">اختر صنفاً</option>' + itemsData.map(i => <option value="${i.docId}" ${i.docId === currentSelectedValue ? 'selected' : ''}>${i.name} (${i.carat} قيراط)</option>).join(''); }); } // --- Theme Color Settings Logic --- const themeColors = { emerald: { '--color-primary-50': '#ecfdf5', '--color-primary-100': '#d1fae5', '--color-primary-200': '#a7f3d0', '--color-primary-300': '#6ee7b7', '--color-primary-400': '#34d399', '--color-primary-500': '#10b981', '--color-primary-600': '#059669', '--color-primary-700': '#047857', '--color-primary-800': '#065f46', '--color-primary-900': '#064e3b', '--color-primary-950': '#022c22' }, blue: { '--color-primary-50': '#eff6ff', '--color-primary-100': '#dbeafe', '--color-primary-200': '#bfdbfe', '--color-primary-300': '#93c5fd', '--color-primary-400': '#60a5fa', '--color-primary-500': '#3b82f6', '--color-primary-600': '#2563eb', '--color-primary-700': '#1d4ed8', '--color-primary-800': '#1e40af', '--color-primary-900': '#1e3a8a', '--color-primary-950': '#172554' }, purple: { '--color-primary-50': '#f5f3ff', '--color-primary-100': '#ede9fe', '--color-primary-200': '#ddd6fe', '--color-primary-300': '#c4b5fd', '--color-primary-400': '#a78bfa', '--color-primary-500': '#8b5cf6', '--color-primary-600': '#7c3aed', '--color-primary-700': '#6d28d9', '--color-primary-800': '#5b21b6', '--color-primary-900': '#4c1d95', '--color-primary-950': '#2e1065' } }; window.applyTheme = function(themeName) { const root = document.documentElement; const colors = themeColors[themeName] || themeColors['emerald']; // Fallback to emerald for (const [key, value] of Object.entries(colors)) { root.style.setProperty(key, value); } localStorage.setItem('selectedTheme', themeName); // Save preference } window.applyThemeFromSettings = function() { const savedTheme = localStorage.getItem('selectedTheme') || 'emerald'; document.getElementById('theme_color').value = savedTheme; window.applyTheme(savedTheme); } document.addEventListener('DOMContentLoaded', () => { // Initialize Firebase when the DOM is fully loaded initializeFirebase(); // Set initial date for sales invoice document.getElementById('invoice_date').valueAsDate = new Date(); // Generate initial invoice number document.getElementById('invoice_number').value = INV-${Date.now().toString().slice(-6)}; // Initial UI setup window.showSection('dashboard'); // Ensure at least one item row for sales invoice on first load window.addInvoiceItemRow(); // Apply saved theme or default on page load window.applyThemeFromSettings(); // Event listener for theme color change in settings document.getElementById('theme_color').addEventListener('change', (event) => { window.applyTheme(event.target.value); }); }); </script> </head> <body class="bg-gray-100 flex min-h-screen"> <!-- الشريط الجانبي للتنقل (Sidebar Navigation) --> <aside class="sidebar w-64 bg-emerald-950 text-white shadow-lg p-6 flex flex-col no-scrollbar overflow-y-auto"> <h1 class="text-3xl font-bold mb-4 text-center border-b pb-4 border-emerald-800">نظام الذهب</h1> <p id="current-user-id" class="text-xs text-center text-emerald-300 mb-6 break-words">ID: loading...</p> <nav class="flex-1"> <ul> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('dashboard')">الرئيسية</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('sales-invoice')">فاتورة مبيعات</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('sales-return')">مرتجع مبيعات</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('purchase-invoice')">فاتورة مشتريات</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('purchase-return')">مردود مشتريات</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('gold-stock')">صندوق المشغول</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('payment-receipt')">سند صرف وقبض</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('cash-scrap-box')">صندوق الكسر والريال</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('transfer-notice')">إشعار تحويل</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('customer-closing')">تسكير لعميل</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('main-closing')">تسكير عند رئيسي</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('closing-box')">صندوق تسكير</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('items')">الأصناف</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('customers')">العملاء</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('suppliers')">الموردين</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('chart-of-accounts')">شجرة محاسبية</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('general-ledger')">أستاذ عام</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('subsidiary-ledger')">أستاذ مساعد</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('account-statement')">كشف حساب</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('daily-journal')">كشف يومية</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('debt-statement')">كشف ديون</a> </li> <li class="mb-2"> <a href="#" class="block px-4 py-2 rounded-md hover:bg-emerald-700 transition-colors" onclick="showSection('settings')">الإعدادات</a> </li> </ul> </nav> </aside> <!-- منطقة المحتوى الرئيسية (Main Content Area) --> <main class="main-content flex-1 p-8 overflow-auto no-scrollbar"> <div id="content-area" class="bg-white rounded-lg shadow-xl p-8 min-h-full"> <!-- قسم لوحة التحكم الرئيسية (Dashboard) --> <section id="dashboard" class="hidden"> <h2 class="text-2xl font-semibold mb-6 text-center text-emerald-700">لوحة التحكم الرئيسية</h2> <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"> <div class="bg-emerald-100 p-6 rounded-lg shadow"> <h3 class="text-xl font-bold text-emerald-800 mb-2">مبيعات اليوم</h3> <p class="text-3xl font-extrabold text-emerald-900">15,000 ر.س</p> </div> <div class="bg-emerald-100 p-6 rounded-lg shadow"> <h3 class="text-xl font-bold text-emerald-800 mb-2">مشتريات اليوم</h3> <p class="text-3xl font-extrabold text-emerald-900">7,500 ر.س</p> </div> <div class="bg-emerald-100 p-6 rounded-lg shadow"> <h3 class="text-xl font-bold text-emerald-800 mb-2">رصيد الذهب (24 قيراط)</h3> <p class="text-3xl font-extrabold text-emerald-900">250 جرام</p> </div> <div class="bg-emerald-100 p-6 rounded-lg shadow"> <h3 class="text-xl font-bold text-emerald-800 mb-2">النقدية المتوفرة</h3> <p class="text-3xl font-extrabold text-emerald-900">50,000 ر.س</p> </div> </div> </section> <!-- قسم فاتورة المبيعات --> <section id="sales-invoice" class="hidden"> <h2 class="text-2xl font-semibold mb-6 text-center text-emerald-700 no-print">فاتورة مبيعات</h2> <div class="flex justify-end mb-4 no-print"> <button class="bg-emerald-600 text-white px-6 py-3 rounded-md hover:bg-emerald-700 transition-colors ml-2" onclick="printInvoice()">طباعة الفاتورة</button> </div> <form id="salesInvoiceForm" class="bg-gray-50 p-6 rounded-lg shadow-inner"> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <div> <label for="invoice_date" class="block text-gray-700 text-sm font-bold mb-2">تاريخ الفاتورة:</label> <input type="date" id="invoice_date" name="invoice_date" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" required> </div> <div> <label for="customer_name" class="block text-gray-700 text-sm font-bold mb-2">اسم العميل:</label> <input type="text" id="customer_name" name="customer_name" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" list="customer-names" required> <datalist id="customer-names"> <!-- Customers will be populated here by JavaScript --> </datalist> </div> <div> <label for="customer_id" class="block text-gray-700 text-sm font-bold mb-2">رقم العميل:</label> <input type="text" id="customer_id" name="customer_id" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" readonly> </div> <div> <label for="invoice_number" class="block text-gray-700 text-sm font-bold mb-2">رقم الفاتورة:</label> <input type="text" id="invoice_number" name="invoice_number" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 bg-gray-100 leading-tight focus:outline-none focus:shadow-outline" readonly> </div> <div> <label for="payment_method" class="block text-gray-700 text-sm font-bold mb-2">طريقة الدفع:</label> <select id="payment_method" name="payment_method" class="shadow border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"> <option value="cash">نقداً</option> <option value="credit">آجل</option> </select> </div> </div> <h3 class="text-xl font-semibold mb-4 text-emerald-600">تفاصيل الأصناف</h3> <div class="overflow-x-auto mb-6"> <table class="min-w-full bg-white rounded-md shadow"> <thead> <tr class="bg-emerald-100 text-emerald-800"> <th class="py-3 px-4 text-right">الصنف</th> <th class="py-3 px-4 text-right">الوزن (جرام)</th> <th class="py-3 px-4 text-right">العيار</th> <th class="py-3 px-4 text-right">سعر الذهب (للجرام)</th> <th class="py-3 px-4 text-right">المصنعية</th> <th class="py-3 px-4 text-right">الإجمالي</th> <th class="py-3 px-4 text-center no-print">الإجراءات</th> </tr> </thead> <tbody id="invoice-items-body"> <!-- Item rows will be added here by JavaScript --> </tbody> </table> </div> <div class="flex justify-start mb-6 no-print"> <button type="button" class="bg-blue-500 text-white px-4 py-2 rounded-md hover:bg-blue-600 transition-colors" onclick="addInvoiceItemRow()">+ إضافة صنف</button> </div> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <div> <label for="subtotal_amount" class="block text-gray-700 text-sm font-bold mb-2">المبلغ الإجمالي قبل الخصم:</label> <input type="number" id="subtotal_amount" name="subtotal_amount" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 bg-gray-100 leading-tight focus:outline-none focus:shadow-outline" readonly value="0.00"> </div> <div> <label for="discount_amount" class="block text-gray-700 text-sm font-bold mb-2">الخصم:</label> <input type="number" step="0.01" id="discount_amount" name="discount_amount" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" value="0.00" oninput="calculateInvoiceTotals()"> </div> <div> <label for="total_amount" class="block text-gray-700 text-sm font-bold mb-2">المبلغ الإجمالي المستحق:</label> <input type="number" id="total_amount" name="total_amount" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 bg-gray-100 leading-tight focus:outline-none focus:shadow-outline text-2xl font-bold" readonly value="0.00"> </div> <div> <label for="notes" class="block text-gray-700 text-sm font-bold mb-2">ملاحظات:</label> <textarea id="notes" name="notes" rows="3" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"></textarea> </div> </div> <div class="flex justify-end space-x-reverse space-x-4 mt-8 no-print"> <button type="submit" class="bg-emerald-600 text-white px-6 py-3 rounded-md hover:bg-emerald-700 transition-colors"> <span class="mr-2">&#x2713;</span> حفظ الفاتورة </button> <button type="button" class="bg-gray-500 text-white px-6 py-3 rounded-md hover:bg-gray-600 transition-colors" onclick="resetSalesInvoiceForm()"> <span class="mr-2">&#x2718;</span> إلغاء </button> </div> </form> </section> <!-- قسم مرتجع المبيعات --> <section id="sales-return" class="hidden"> <h2 class="text-2xl font-semibold mb-6 text-center text-emerald-700">مرتجع مبيعات</h2> <form class="bg-gray-50 p-6 rounded-lg shadow-inner"> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <div> <label for="return_sales_invoice_num" class="block text-gray-700 text-sm font-bold mb-2">رقم الفاتورة الأصلية:</label> <input type="text" id="return_sales_invoice_num" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" required> </div> <div> <label for="return_sales_date" class="block text-gray-700 text-sm font-bold mb-2">تاريخ الارتجاع:</label> <input type="date" id="return_sales_date" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" value="2025-06-15" required> </div> <div> <label for="return_sales_customer" class="block text-gray-700 text-sm font-bold mb-2">اسم العميل:</label> <input type="text" id="return_sales_customer" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" required> </div> <div> <label for="return_sales_weight" class="block text-gray-700 text-sm font-bold mb-2">الوزن المرتجع (جرام):</label> <input type="number" step="0.01" id="return_sales_weight" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" required> </div> <div> <label for="return_sales_carat" class="block text-gray-700 text-sm font-bold mb-2">العيار المرتجع:</label> <select id="return_sales_carat" class="shadow border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" required> <option value="24">24 قيراط</option> <option value="22">22 قيراط</option> <option value="21">21 قيراط</option> <option value="18">18 قيراط</option> </select> </div> <div> <label for="return_sales_amount" class="block text-gray-700 text-sm font-bold mb-2">المبلغ المرتجع:</label> <input type="number" step="0.01" id="return_sales_amount" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" required> </div> </div> <div class="mb-4"> <label for="return_sales_reason" class="block text-gray-700 text-sm font-bold mb-2">سبب الارتجاع:</label> <textarea id="return_sales_reason" rows="3" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"></textarea> </div> <div class="flex justify-end"> <button type="submit" class="bg-blue-500 text-white px-6 py-3 rounded-md hover:bg-blue-600"> <span class="mr-2">&#x2713;</span> تسجيل الارتجاع </button> </div> </form> </section> <!-- قسم فاتورة المشتريات --> <section id="purchase-invoice" class="hidden"> <h2 class="text-2xl font-semibold mb-6 text-center text-emerald-700">فاتورة مشتريات</h2> <form id="purchaseInvoiceForm" class="bg-gray-50 p-6 rounded-lg shadow-inner"> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <div> <label for="purchase_invoice_date" class="block text-gray-700 text-sm font-bold mb-2">تاريخ الفاتورة:</label> <input type="date" id="purchase_invoice_date" name="purchase_invoice_date" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" value="2025-06-15" required> </div> <div> <label for="supplier_name_purchase" class="block text-gray-700 text-sm font-bold mb-2">اسم المورد:</label> <input type="text" id="supplier_name_purchase" name="supplier_name_purchase" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" list="supplier-names" required> <datalist id="supplier-names"> <!-- Suppliers will be populated here by JavaScript --> </datalist> </div> <div> <label for="purchase_invoice_number" class="block text-gray-700 text-sm font-bold mb-2">رقم الفاتورة:</label> <input type="text" id="purchase_invoice_number" name="purchase_invoice_number" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 bg-gray-100 leading-tight focus:outline-none focus:shadow-outline" readonly value="PUR-001"> </div> <div> <label for="purchase_payment_method" class="block text-gray-700 text-sm font-bold mb-2">طريقة الدفع:</label> <select id="purchase_payment_method" name="purchase_payment_method" class="shadow border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"> <option value="cash">نقداً</option> <option value="credit">آجل</option> </select> </div> </div> <h3 class="text-xl font-semibold mb-4 text-emerald-600">تفاصيل الأصناف المشتراة</h3> <div class="overflow-x-auto mb-6"> <table class="min-w-full bg-white rounded-md shadow"> <thead> <tr class="bg-emerald-100 text-emerald-800"> <th class="py-3 px-4 text-right">الصنف</th> <th class="py-3 px-4 text-right">الوزن (جرام)</th> <th class="py-3 px-4 text-right">العيار</th> <th class="py-3 px-4 text-right">سعر الشراء (للجرام)</th> <th class="py-3 px-4 text-right">المصاريف الإضافية</th> <th class="py-3 px-4 text-right">الإجمالي</th> <th class="py-3 px-4 text-center no-print">الإجراءات</th> </tr> </thead> <tbody id="purchase-items-body"> <tr> <td class="py-2 px-4"><input type="text" class="shadow border rounded w-full py-2 px-3 text-gray-700"></td> <td class="py-2 px-4"><input type="number" step="0.01" class="shadow border rounded w-full py-2 px-3 text-gray-700"></td> <td class="py-2 px-4"> <select class="shadow border rounded w-full py-2 px-3 text-gray-700"> <option value="24">24 قيراط</option> <option value="21">21 قيراط</option> <option value="18">18 قيراط</option> </select> </td> <td class="py-2 px-4"><input type="number" step="0.01" class="shadow border rounded w-full py-2 px-3 text-gray-700"></td> <td class="py-2 px-4"><input type="number" step="0.01" class="shadow border rounded w-full py-2 px-3 text-gray-700"></td> <td class="py-2 px-4"><input type="number" step="0.01" class="shadow border rounded w-full py-2 px-3 text-gray-700 bg-gray-100" readonly></td> <td class="py-2 px-4 text-center no-print"> <button type="button" class="bg-red-500 text-white px-3 py-1 rounded-md text-sm hover:bg-red-600">حذف</button> </td> </tr> </tbody> </table> </div> <div class="flex justify-start mb-6 no-print"> <button type="button" class="bg-blue-500 text-white px-4 py-2 rounded-md hover:bg-blue-600 transition-colors">+ إضافة صنف</button> </div> <div class="flex justify-end space-x-reverse space-x-4 mt-8 no-print"> <button type="submit" class="bg-emerald-600 text-white px-6 py-3 rounded-md hover:bg-emerald-700 transition-colors">حفظ الفاتورة</button> <button type="button" class="bg-gray-500 text-white px-6 py-3 rounded-md hover:bg-gray-600 transition-colors">إلغاء</button> </div> </form> </section> <!-- قسم مردود المشتريات --> <section id="purchase-return" class="hidden"> <h2 class="text-2xl font-semibold mb-6 text-center text-emerald-700">مردود مشتريات</h2> <form class="bg-gray-50 p-6 rounded-lg shadow-inner"> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <div> <label for="return_purchase_invoice_num" class="block text-gray-700 text-sm font-bold mb-2">رقم الفاتورة الأصلية:</label> <input type="text" id="return_purchase_invoice_num" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" required> </div> <div> <label for="return_purchase_date" class="block text-gray-700 text-sm font-bold mb-2">تاريخ الارتجاع:</label> <input type="date" id="return_purchase_date" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" value="2025-06-15" required> </div> <div> <label for="return_purchase_supplier" class="block text-gray-700 text-sm font-bold mb-2">اسم المورد:</label> <input type="text" id="return_purchase_supplier" class="shadow appearance-none border rounded w-full

نظام محاسبيالذهبالمجوهرات6/16/2025

نظام محاسبة الذهب

برامج محاسبيةar
4.0

📌 واجهة عربية بالكامل 📌 شغال Offline بدون إنترنت 📌 سهل التعديل حسب احتياجك سندقبض وصرف وخانة جرام اشاعارتحويل دائن ومدين اشعارتسكيرلعميل واشعارتسكيرعندرئيسي كل النظام اجل/نقدا فاتورة مبيعات مرتجع مبيعات فاتورة مشتريات مردودمشتريات كشف حساب كشف يومية ديون عملاء موردين شجرةالحسابات قائمةالذخل الخسائروالارباح استاذعام استاذمساعد مخزن صندوق كسروريال مخزن صندوق المشغول مخزن صندوق التسكير صندوق فرق العيار وعيارات24,22,21,18 نسخ احتياطي نسخ جوجل درايف اعدادات وتغيرالالون قائمة الديون لنظام كامل اضافة اصناف ⏱ بنرنامج محاسبة محلات الذهب جملة وقطاعي...) 📤 تقدر تحفظ البيانات وتصدرها بسهولة 🔒 وأمان كامل بكلمة سر للإدارة نظام متكامل وجذاب وسلس عالي المواصفات (رابط ويب) نشاء نظام محاسبة محلات الذهب مبيعات مرتجع مبيعات مشتريات مردود مشتريات عملاء موردين سندصرف وقبض تحويل تسكيرلعميل تسكير عندرئيسي صندوق كسروريال مخزن مشغول شجرة الحسابات اجل/ نقدا فتح حساب طباعة تعديل حذف العا اعدادت تغيرالوان تسجيل دخول كشف حساب كشف يومة كشف ديون قائمة الذخل الارباح والخسائر استاذعام استاذمساعد نسخ احتياطي نسخة جوجل درايف حفظ يشتغل بنت وبدون نت كمبيوتر اوفيس وتاب اولاين//اضافة خانة وزن ذهب عيارات 24و22و21و18 اصناف ومخازن وديونرابط ويب نظام محاسبة كامل وجذاب ضرب السعراوالاجرة في الكمية اوالوزن يساوري الاجمالي معادة اعمل افضل نظام متكامل وسلس يدوي اضافة قاعدة بيانات اضافة شجرة الحسابات قائم الذخل الخسائر والارباح كشف حساب كشف يومية كشف ديون مساعد عام اسثاذمساعد عملاءموردين مبيعات مرتجع مبيعات مشتروات مردود مشتروات سندقبض سندصرفمخزن صندوق مخزن مشغول اشعارتحويل اشعارتسكيرلعميلالذهب للزبون الريال للمحل تسكيرعندرئيسي الذهب للمحل الريال لزبون نسخ احطياطي نسخ جوجل درايف خانة وزن ذهب سعراجرةالسعرضرب الكمية يساوي الاجمالي اجمالي نظام متكامل وجذاب طباعة تعديل حذف الغاء اكمل النواقص للبرنامج اعم برنامج محاسبي للذهب والمجورات متابعت المصروفات والايرادات والرصيد سحابي رابط ويب ابني لي نظام محاسبي للذهب والمجوهرات الواجهة عربي كامل فاتورة مبيعت مرتجع مبيعات فاتورة مشتريات مردود مشتريات صندوق المشغول سندصرف وقبض صندوق الكسروالريال اشعارتحويل تسكيرلعميل وتسكيرعندرئيسي صندوق تسكير اصناف العملاء الموردين شجرةمحاسبية استاذعام واستاذمساعد كشف حساب وكشف يومية وكشف ديون اعدادت تغيرالوان واعدادات تسجيل دخول تسجيل خروج طباعة تعديل حذف الغا نظام محاسبي للذهب والمجوهرات مرتجع مبيعات مردودمشتريات اشعارتحويل اشعارتسكيرلعميل اشعارتسكيرعند رئيسي/: لفهم طلبك بشكل أفضل، أنت تريد نظام محاسبي مخصص لمحلات الذهب والمجوهرات يعمل عبر الويب (Web-based) ويحتوي على الخصائص التالية: الخصائص المطلوبة: 1. إدارة الأصناف حسب العيار: تقسيم الذهب حسب العيارات: 24، 22، 21، 18. إدارة المخزون لكل عيار على حدة. 2. أنواع الفواتير: فاتورة مبيعات. مرتجع مبيعات. فاتورة مشتريات. مردود مشتريات. 3. طرق الدفع: نقدي. آجل (حسابات عملاء). 4. القيود والسندات: سند قبض. سند صرف. قيد تحويل (تحويل بين الحسابات أو بين الفروع). 5. إغلاق الحسابات (التسكير): لوحة جانبية على اليمين تسكير حساب عميل.-الواجهة على اليمين تسكير عند رئيسي (محاسبة مركزية أو مراجعة الحسابات). [ // استدعاعم من الكود السابق فعل الناظام // تسجيل دخول ابني لي نظام محاسبي للذهب والمجوهرات الواجهة عربي كامل فاتورة مبيعت مرتجع مبيعات فاتورة مشتريات مردود مشتريات صندوق المشغول سندصرف وقبض صندوق الكسروالريال اشعارتحويل تسكيرلعميل وتسكيرعندرئيسي صندوق تسكير اصناف العملاء الموردين شجرةمحاسبية استاذعام واستاذمساعد كشف حساب وكشف يومية وكشف ديون اعدادت تغيرالوان واعدادات طباعة تعديل حذف الغا نظام محاسبي للذهب والمجوهرات فعلي وفعلة نظام عملي

محاسبة الذهبنظام محاسبيإدارة المخزون6/16/2025

نظام محاسبة الذهب

برامج محاسبيةar
4.0

📌 واجهة عربية بالكامل 📌 شغال Offline بدون إنترنت 📌 سهل التعديل حسب احتياجك سندقبض وصرف وخانة جرام اشاعارتحويل دائن ومدين اشعارتسكيرلعميل واشعارتسكيرعندرئيسي كل النظام اجل/نقدا فاتورة مبيعات مرتجع مبيعات فاتورة مشتريات مردودمشتريات كشف حساب كشف يومية ديون عملاء موردين شجرةالحسابات قائمةالذخل الخسائروالارباح استاذعام استاذمساعد مخزن صندوق كسروريال مخزن صندوق المشغول مخزن صندوق التسكير صندوق فرق العيار وعيارات24,22,21,18 نسخ احتياطي نسخ جوجل درايف اعدادات وتغيرالالون قائمة الديون لنظام كامل اضافة اصناف ⏱ بنرنامج محاسبة محلات الذهب جملة وقطاعي...) 📤 تقدر تحفظ البيانات وتصدرها بسهولة 🔒 وأمان كامل بكلمة سر للإدارة نظام متكامل وجذاب وسلس عالي المواصفات (رابط ويب) نشاء نظام محاسبة محلات الذهب مبيعات مرتجع مبيعات مشتريات مردود مشتريات عملاء موردين سندصرف وقبض تحويل تسكيرلعميل تسكير عندرئيسي صندوق كسروريال مخزن مشغول شجرة الحسابات اجل/ نقدا فتح حساب طباعة تعديل حذف العا اعدادت تغيرالوان تسجيل دخول كشف حساب كشف يومة كشف ديون قائمة الذخل الارباح والخسائر استاذعام استاذمساعد نسخ احتياطي نسخة جوجل درايف حفظ يشتغل بنت وبدون نت كمبيوتر اوفيس وتاب اولاين//اضافة خانة وزن ذهب عيارات 24و22و21و18 اصناف ومخازن وديونرابط ويب نظام محاسبة كامل وجذاب ضرب السعراوالاجرة في الكمية اوالوزن يساوري الاجمالي معادة اعمل افضل نظام متكامل وسلس يدوي اضافة قاعدة بيانات اضافة شجرة الحسابات قائم الذخل الخسائر والارباح كشف حساب كشف يومية كشف ديون مساعد عام اسثاذمساعد عملاءموردين مبيعات مرتجع مبيعات مشتروات مردود مشتروات سندقبض سندصرفمخزن صندوق مخزن مشغول اشعارتحويل اشعارتسكيرلعميلالذهب للزبون الريال للمحل تسكيرعندرئيسي الذهب للمحل الريال لزبون نسخ احطياطي نسخ جوجل درايف خانة وزن ذهب سعراجرةالسعرضرب الكمية يساوي الاجمالي اجمالي نظام متكامل وجذاب طباعة تعديل حذف الغاء اكمل النواقص للبرنامج اعم برنامج محاسبي للذهب والمجورات متابعت المصروفات والايرادات والرصيد سحابي رابط ويب ابني لي نظام محاسبي للذهب والمجوهرات الواجهة عربي كامل فاتورة مبيعت مرتجع مبيعات فاتورة مشتريات مردود مشتريات صندوق المشغول سندصرف وقبض صندوق الكسروالريال اشعارتحويل تسكيرلعميل وتسكيرعندرئيسي صندوق تسكير اصناف العملاء الموردين شجرةمحاسبية استاذعام واستاذمساعد كشف حساب وكشف يومية وكشف ديون اعدادت تغيرالوان واعدادات تسجيل دخول تسجيل خروج طباعة تعديل حذف الغا نظام محاسبي للذهب والمجوهرات مرتجع مبيعات مردودمشتريات اشعارتحويل اشعارتسكيرلعميل اشعارتسكيرعند رئيسي/: لفهم طلبك بشكل أفضل، أنت تريد نظام محاسبي مخصص لمحلات الذهب والمجوهرات يعمل عبر الويب (Web-based) ويحتوي على الخصائص التالية: الخصائص المطلوبة: 1. إدارة الأصناف حسب العيار: تقسيم الذهب حسب العيارات: 24، 22، 21، 18. إدارة المخزون لكل عيار على حدة. 2. أنواع الفواتير: فاتورة مبيعات. مرتجع مبيعات. فاتورة مشتريات. مردود مشتريات. 3. طرق الدفع: نقدي. آجل (حسابات عملاء). 4. القيود والسندات: سند قبض. سند صرف. قيد تحويل (تحويل بين الحسابات أو بين الفروع). 5. إغلاق الحسابات (التسكير): لوحة جانبية على اليمين تسكير حساب عميل.-الواجهة على اليمين تسكير عند رئيسي (محاسبة مركزية أو مراجعة الحسابات). [ // استدعاعم من الكود السابق فعل الناظام // تسجيل دخول

محاسبة الذهبنظام محاسبيإدارة المخزون6/16/2025

نظام محاسبة محلات الذهب

برامج محاسبيةar
4.0

📌 واجهة عربية بالكامل 📌 شغال Offline بدون إنترنت 📌 سهل التعديل حسب احتياجك سندقبض وصرف وخانة جرام اشاعارتحويل دائن ومدين اشعارتسكيرلعميل واشعارتسكيرعندرئيسي كل النظام اجل/نقدا فاتورة مبيعات مرتجع مبيعات فاتورة مشتريات مردودمشتريات كشف حساب كشف يومية ديون عملاء موردين شجرةالحسابات قائمةالذخل الخسائروالارباح استاذعام استاذمساعد مخزن صندوق كسروريال مخزن صندوق المشغول مخزن صندوق التسكير صندوق فرق العيار وعيارات24,22,21,18 نسخ احتياطي نسخ جوجل درايف اعدادات وتغيرالالون قائمة الديون لنظام كامل اضافة اصناف ⏱ بنرنامج محاسبة محلات الذهب جملة وقطاعي...) 📤 تقدر تحفظ البيانات وتصدرها بسهولة 🔒 وأمان كامل بكلمة سر للإدارة نظام متكامل وجذاب وسلس عالي المواصفات (رابط ويب) نشاء نظام محاسبة محلات الذهب مبيعات مرتجع مبيعات مشتريات مردود مشتريات عملاء موردين سندصرف وقبض تحويل تسكيرلعميل تسكير عندرئيسي صندوق كسروريال مخزن مشغول شجرة الحسابات اجل/ نقدا فتح حساب طباعة تعديل حذف العا اعدادت تغيرالوان تسجيل دخول كشف حساب كشف يومة كشف ديون قائمة الذخل الارباح والخسائر استاذعام استاذمساعد نسخ احتياطي نسخة جوجل درايف حفظ يشتغل بنت وبدون نت كمبيوتر اوفيس وتاب اولاين//اضافة خانة وزن ذهب عيارات 24و22و21و18 اصناف ومخازن وديونرابط ويب نظام محاسبة كامل وجذاب ضرب السعراوالاجرة في الكمية اوالوزن يساوري الاجمالي معادة اعمل افضل نظام متكامل وسلس يدوي اضافة قاعدة بيانات اضافة شجرة الحسابات قائم الذخل الخسائر والارباح كشف حساب كشف يومية كشف ديون مساعد عام اسثاذمساعد عملاءموردين مبيعات مرتجع مبيعات مشتروات مردود مشتروات سندقبض سندصرفمخزن صندوق مخزن مشغول اشعارتحويل اشعارتسكيرلعميلالذهب للزبون الريال للمحل تسكيرعندرئيسي الذهب للمحل الريال لزبون نسخ احطياطي نسخ جوجل درايف خانة وزن ذهب سعراجرةالسعرضرب الكمية يساوي الاجمالي اجمالي نظام متكامل وجذاب طباعة تعديل حذف الغاء اكمل النواقص للبرنامج اعم برنامج محاسبي للذهب والمجورات متابعت المصروفات والايرادات والرصيد سحابي رابط ويب ابني لي نظام محاسبي للذهب والمجوهرات الواجهة عربي كامل فاتورة مبيعت مرتجع مبيعات فاتورة مشتريات مردود مشتريات صندوق المشغول سندصرف وقبض صندوق الكسروالريال اشعارتحويل تسكيرلعميل وتسكيرعندرئيسي صندوق تسكير اصناف العملاء الموردين شجرةمحاسبية استاذعام واستاذمساعد كشف حساب وكشف يومية وكشف ديون اعدادت تغيرالوان واعدادات تسجيل دخول تسجيل خروج طباعة تعديل حذف الغا نظام محاسبي للذهب والمجوهرات مرتجع مبيعات مردودمشتريات اشعارتحويل اشعارتسكيرلعميل اشعارتسكيرعند رئيسي/: لفهم طلبك بشكل أفضل، أنت تريد نظام محاسبي مخصص لمحلات الذهب والمجوهرات يعمل عبر الويب (Web-based) ويحتوي على الخصائص التالية: الخصائص المطلوبة: 1. إدارة الأصناف حسب العيار: تقسيم الذهب حسب العيارات: 24، 22، 21، 18. إدارة المخزون لكل عيار على حدة. 2. أنواع الفواتير: فاتورة مبيعات. مرتجع مبيعات. فاتورة مشتريات. مردود مشتريات. 3. طرق الدفع: نقدي. آجل (حسابات عملاء). 4. القيود والسندات: سند قبض. سند صرف. قيد تحويل (تحويل بين الحسابات أو بين الفروع). 5. إغلاق الحسابات (التسكير): تسكير حساب عميل. تسكير عند رئيسي (محاسبة مركزية أو مراجعة الحسابات). [٢٥/‏٥, ٢:٤١ ص] جمال الجابر: const express = require('express'); const app = express(); app.use(express.json()); // استدعاء authenticateToken من الكود السابق const Product = require('./models/Product'); // إنشاء منتج app.post('/api/products', authenticateToken, async (req, res) => { try { const product = new Product(req.body); await product.save(); res.json(product); } catch (err) { res.status(500).json({ message: 'خطأ في إنشاء المنتج' }); } }); // جلب كل المنتجات app.get('/api/products', authenticateToken, async (req, res) => { try { const products = await Product.find(); res.json(products); } catch { res.status(500).json({ message: 'خطأ في جلب المنتجات' }); } }); // تعديل منتج app.put('/api/products/:id', authenticateToken, async (req, res) => { try { const product = await Product.findByIdAndUpdate(req.params.id, req.body, { new: true }); res.json(product); } catch { res.status(500).json({ message: 'خطأ في تعديل المنتج' }); } }); // حذف منتج app.delete('/api/products/:id', authenticateToken, async (req, res) => { try { await Product.findByIdAndDelete(req.params.id); res.json({ message: 'تم الحذف' }); } catch { res.status(500).json({ message: 'خطأ في حذف المنتج' }); } }); [: import ProductManagement from './pages/ProductManagement'; // داخل Routes <Route path="/products" element={ <PrivateRoute> <ProductManagement /> </PrivateRoute> } /> [: const express = require('express'); const mongoose = require('mongoose'); const cors = require('cors'); const jwt = require('jsonwebtoken'); require('dotenv').config(); const app = express(); app.use(cors()); app.use(express.json()); // اتصال MongoDB mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true, }).then(() => console.log('MongoDB connected')) .catch(err => console.error(err)); // موديلات (منتجات + مستخدمين + عملاء + فواتير - باختصار) // نموذج مستخدم const UserSchema = new mongoose.Schema({ username: String, password: String, }); const User = mongoose.model('User', UserSchema); // نموذج منتج const ProductSchema = new mongoose.Schema({ name: String, karat: Number, weight: Number, pricePerGram: Number, }); const Product = mongoose.model('Product', ProductSchema); // نموذج عميل const ClientSchema = new mongoose.Schema({ name: String, phone: String, }); const Client = mongoose.model('Client', ClientSchema); // نموذج فاتورة const InvoiceSchema = new mongoose.Schema({ invoiceType: { type: String, enum: ['sale', 'return'] }, clientId: { type: mongoose.Schema.Types.ObjectId, ref: 'Client' }, paymentType: { type: String, enum: ['cash', 'credit'] }, items: [{ productId: { type: mongoose.Schema.Types.ObjectId, ref: 'Product' }, quantity: Number, }], createdAt: { type: Date, default: Date.now }, }); const Invoice = mongoose.model('Invoice', InvoiceSchema); // Middleware توثيق function authenticateToken(req, res, next) { const token = req.headers.authorization; if (!token) return res.status(401).json({ message: 'No token provided' }); jwt.verify(token, process.env.JWT_SECRET, (err, user) => { if (err) return res.status(403).json({ message: 'Invalid token' }); req.user = user; next(); }); } // تسجيل مستخدم (تجريبي) app.post('/api/register', async (req, res) => { const { username, password } = req.body; const user = new User({ username, password }); // لاحقاً استخدم تشفير! await user.save(); res.json({ message: 'User registered' }); }); // تسجيل دخول app.post('/api/login', async (req, res) => { const { username, password } = req.body; const user = await User.findOne({ username, password }); if (!user) return res.status(400).json({ message: 'Invalid credentials' }); const token = jwt.sign({ username }, process.env.JWT_SECRET, { expiresIn: '1d' }); res.json({ token }); }); // APIs محمية app.use(authenticateToken); // CRUD المنتجات app.get('/api/products', async (req, res) => { const products = await Product.find(); res.json(products); }); app.post('/api/products', async (req, res) => { const p = new Product(req.body); await p.save(); res.json(p); }); app.put('/api/products/:id', async (req, res) => { const p = await Product.findByIdAndUpdate(req.params.id, req.body, { new: true }); res.json(p); }); app.delete('/api/products/:id', async (req, res) => { await Product.findByIdAndDelete(req.params.id); res.json({ message: 'Deleted' }); }); // CRUD العملاء app.get('/api/clients', async (req, res) => { const clients = await Client.find(); res.json(clients); }); app.post('/api/clients', async (req, res) => { const c = new Client(req.body); await c.save(); res.json(c); }); // CRUD الفواتير app.post('/api/invoices', async (req, res) => { const inv = new Invoice(req.body); await inv.save(); res.json(inv); }); app.get('/api/invoices', async (req, res) => { const invoices = await Invoice.find().populate('clientId').populate('items.productId'); res.json(invoices); }); // بدء السيرفر const PORT = process.env.PORT || 5000; app.listen(PORT, () => console.log(Server started on port ${PORT}));

محاسبة الذهبإدارة المخزونفاتورة مبيعات6/16/2025