Petrol Pump Accounting In Excel Sheet Download 【REAL • Anthology】

<div class="excel-table" id="excelTableContainer"> <!-- dynamic table will be injected --> </div> <div class="footer"> * Double-click any cell to edit. Sales & expenses auto update profit. Stock closing = Opening + Received - Sold. </div> </div>

// 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;

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();

function resetDemo() salesData = [ product: "Petrol (MS)", liters: 1250, rate: 102.50, amount: 128125 , product: "Diesel (HSD)", liters: 980, rate: 94.80, amount: 92904 , product: "Premium Petrol", liters: 320, rate: 115.00, amount: 36800 , product: "Engine Oil (Lube)", liters: 45, rate: 850, amount: 38250 ]; 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 ]; stockData = [ product: "Petrol (MS)", opening: 5200, received: 8000, sold: 1250, closing: 11950, unitPrice: 102.50 , product: "Diesel (HSD)", opening: 4300, received: 7000, sold: 980, closing: 10320, unitPrice: 94.80 , product: "Premium Petrol", opening: 1100, received: 2000, sold: 320, closing: 2780, unitPrice: 115.00 , product: "Engine Oil (Lube)", opening: 180, received: 120, sold: 45, closing: 255, unitPrice: 850.00 ]; recomputeSales(); recomputeStock(); renderTables(); petrol pump accounting in excel sheet download

<script> // ---------- DATA MODEL (Mimicking excel rows) ---------- // We'll maintain two sections: Sales Register, Expenses Register, Stock Register // For simplicity, we use separate tables but inside one downloadable sheet. // Actually to give an integrated feel, we create 3 mini tables inside main container.

function getTotalExpenses() return expensesData.reduce((sum, exp) => sum + exp.amount, 0);

let stockData = [ product: "Petrol (MS)", opening: 5200, received: 8000, sold: 1250, closing: 11950, unitPrice: 102.50 , product: "Diesel (HSD)", opening: 4300, received: 7000, sold: 980, closing: 10320, unitPrice: 94.80 , product: "Premium Petrol", opening: 1100, received: 2000, sold: 320, closing: 2780, unitPrice: 115.00 , product: "Engine Oil (Lube)", opening: 180, received: 120, sold: 45, closing: 255, unitPrice: 850.00 ]; document

// 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;

function expenseChangeHandler(e) const idx = parseInt(e.target.getAttribute('data-idx')); if (!isNaN(idx)) let newAmt = parseFloat(e.target.value)

// Download as Excel (XLS format - HTML table wrapper) function downloadExcel() // Generate full workbook style HTML let exportHtml = ` <html> <head><meta charset="UTF-8"><title>PetrolPump_Accounting.xls</title> <style> th background: #4c8b5e; color: #fff; td border: 1px solid #ccc; </style> </head> <body> <h2>Petrol Pump Financial Statement</h2> <h3>Sales Register</h3> <table border="1">$document.querySelector('#salesTable') ? document.querySelector('#salesTable').outerHTML : ''</table> <h3>Expenses Register</h3> <table border="1">$document.querySelector('#expensesTable') ? document.querySelector('#expensesTable').outerHTML : ''</table> <h3>Stock Management</h3> <table border="1">$document.querySelector('#stockTable') ? document.querySelector('#stockTable').outerHTML : ''</table> <br/> <p><strong>Total Sales:</strong> $getTotalSales().toFixed(2)</p> <p><strong>Total Expenses:</strong> $getTotalExpenses().toFixed(2)</p> <p><strong>Net Profit:</strong> $getNetProfit().toFixed(2)</p> <p><strong>Closing Stock Value:</strong> $getTotalClosingStockValue().toFixed(2)</p> </body></html>`; const blob = new Blob([exportHtml], type: "application/vnd.ms-excel" ); const link = document.createElement('a'); const url = URL.createObjectURL(blob); link.href = url; link.download = "Petrol_Pump_Accounts.xls"; document.body.appendChild(link); link.click(); document.body.removeChild(link); URL.revokeObjectURL(url); document.querySelector('#salesTable').outerHTML : ''&lt

let salesData = [ product: "Petrol (MS)", liters: 1250, rate: 102.50, amount: 128125 , product: "Diesel (HSD)", liters: 980, rate: 94.80, amount: 92904 , product: "Premium Petrol", liters: 320, rate: 115.00, amount: 36800 , product: "Engine Oil (Lube)", liters: 45, rate: 850, amount: 38250 ];

function getNetProfit() return getTotalSales() - getTotalExpenses();