// Helper: recompute amounts for sales (liters * rate) function recomputeSales() for (let i = 0; i < salesData.length; i++) salesData[i].amount = salesData[i].liters * salesData[i].rate;
// Attach all event listeners dynamically attachInputEvents(); attachDeleteButtons(); attachAddRowButtons(); updateCards(); petrol pump accounting in excel sheet download
// Build HTML with three sections let html = `<style>td input border:1px solid #ddd; border-radius:6px; padding:6px; text-align:center; td vertical-align: middle; </style>`; // Helper: recompute amounts for sales (liters *
// Recompute stock closing & stock value function recomputeStock() for (let i = 0; i < stockData.length; i++) let s = stockData[i]; s.closing = s.opening + s.received - s.sold; td input border:1px solid #ddd
let expensesData = [ date: "01-Apr-2026", category: "Electricity", amount: 5500 , date: "05-Apr-2026", category: "Staff Salary", amount: 28500 , date: "10-Apr-2026", category: "Maintenance", amount: 3200 , date: "15-Apr-2026", category: "Misc", amount: 1750 ];
function stockChangeHandler(e) const idx = parseInt(e.target.getAttribute('data-idx')); if (isNaN(idx)) return; let opening = parseFloat(document.querySelector(`.stock-opening[data-idx='$idx']`)?.value)
function deleteHandler(e) const btn = e.currentTarget; const type = btn.getAttribute('data-type'); const idx = parseInt(btn.getAttribute('data-idx')); if (type === 'sales') salesData.splice(idx, 1); else if (type === 'expense') expensesData.splice(idx, 1); else if (type === 'stock') stockData.splice(idx, 1); renderTables();