๐Ÿš Kings Packaging

No customer selected
sales@kingspackaging.com.au | ABN: [Your ABN] | Ph: [Your Phone]
GST SALE
Subtotal:$0.00
GST (10%):$0.00
TOTAL: $0.00
CASH SALE
Subtotal:$0.00
GST (10%):$0.00
TOTAL: $0.00
๐Ÿ“Š Cost Prices & Margins

๐Ÿ”’ Admin Access Required

Please enter the admin password to view cost prices and margins.


๐Ÿ’ต Cash Sales History
`; // Save cash sales if (type === 'cash') { cashSales.push({ invoiceNum: invoiceNum, date: now.toISOString(), customer: currentCustomer || 'Walk-in', total: total, items: cart.map(i => ({name: i.name, size: i.size, qty: i.qty, price: i.price})) }); localStorage.setItem('kp_cashSales', JSON.stringify(cashSales)); } const frame = document.getElementById('printFrame'); frame.contentDocument.write(printContent); frame.contentDocument.close(); clearCart(type); alert('Invoice printed! ' + invoiceNum); } // Customers function renderCustomers() { const container = document.getElementById('customersList'); container.innerHTML = customers.map(c => `
${c.name}
${c.phone ? '๐Ÿ“ž ' + c.phone : ''} ${c.email ? 'โœ‰๏ธ ' + c.email : ''}
`).join(''); } function filterCustomers() { const search = document.getElementById('customerSearch').value.toLowerCase(); document.querySelectorAll('.customer-card').forEach(card => { const name = card.querySelector('.customer-name').textContent.toLowerCase(); card.style.display = name.includes(search) ? 'block' : 'none'; }); } function startCustomerInvoice(name) { selectCustomer(name); document.getElementById('gstCustomerSelect').value = name; document.getElementById('cashCustomerSelect').value = name; showScreen('screen-gst'); } function viewCustomer(name) { alert('Customer: ' + name + '\nComing soon: Full customer history'); } function showAddCustomer() { document.getElementById('customerModal').classList.add('active'); } function closeCustomerModal() { document.getElementById('customerModal').classList.remove('active'); } function saveCustomer() { const name = document.getElementById('newCustomerName').value; const phone = document.getElementById('newCustomerPhone').value; const email = document.getElementById('newCustomerEmail').value; if (name) { customers.push({ name, phone, email }); localStorage.setItem('kp_customers', JSON.stringify(customers)); renderCustomers(); populateCustomerSelects(); closeCustomerModal(); } } // Cost Table function renderCostTable() { if (!costUnlocked) return; const tbody = document.getElementById('costTableBody'); if (!tbody) return; tbody.innerHTML = products.map(p => { const retail = Math.min(...p.prices); const margin = ((retail - p.cost) / retail * 100).toFixed(1); const marginClass = margin > 30 ? 'margin-good' : 'margin-bad'; return ` ${p.name}
${p.category} $${p.cost.toFixed(2)} $${retail.toFixed(2)} ${margin}% `; }).join(''); } // Cash History function renderCashHistory() { const container = document.getElementById('cashHistoryList'); if (cashSales.length === 0) { container.innerHTML = '
No cash sales yet
'; return; } container.innerHTML = cashSales.slice().reverse().map(sale => `
${new Date(sale.date).toLocaleDateString()} $${sale.total.toFixed(2)}
${sale.invoiceNum} - ${sale.customer}
${sale.items.map(i => i.qty + 'x ' + i.name).join(', ')}
`).join(''); } // Initialize on load init();