Petrol Pump Accounting In Excel Sheet Download Apr 2026

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

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

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

// Update UI cards function updateCards() document.getElementById("totalSalesVal").innerText = getTotalSales().toFixed(2); document.getElementById("totalExpVal").innerText = getTotalExpenses().toFixed(2); document.getElementById("netProfitVal").innerText = getNetProfit().toFixed(2); document.getElementById("closingStockVal").innerText = getTotalClosingStockValue().toFixed(2); petrol pump accounting in excel sheet download

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

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)

container.innerHTML = html;

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

// 1. Sales Register Table html += `<h3 style="margin:15px 0 5px 0; color:#1e4a2f;">📊 Sales Register</h3>`; html += `<table id="salesTable" class="editable-table">`; html += `<thead><tr><th>Product</th><th>Liters Sold</th><th>Rate (₹/Liter)</th><th>Amount (₹)</th><th></th></tr></thead><tbody>`; for (let i = 0; i < salesData.length; i++) let row = salesData[i]; html += `<tr data-type="sales" data-index="$i"> <td style="background:#faf3e0;">$row.product</td> <td><input type="number" step="0.01" class="sales-lit" value="$row.liters" data-idx="$i"></td> <td><input type="number" step="0.01" class="sales-rate" value="$row.rate" data-idx="$i"></td> <td class="sales-amount">$row.amount.toFixed(2)</td> <td><button class="delRowBtn" data-type="sales" data-idx="$i" style="background:#b33; padding:4px 8px;">🗑️</button></td> </tr>`; html += `<tr><td colspan="4"><button id="addSalesRowBtn" style="background:#3c8c40;">+ Add Sale Item</button></td><td></td></tr>`; html += `</tbody></table>`;

// Get total sales sum function getTotalSales() return salesData.reduce((sum, item) => sum + item.amount, 0); // Build HTML with three sections let html

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

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

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

function expenseChangeHandler(e) const idx = parseInt(e.target.getAttribute('data-idx')); if (!isNaN(idx)) 0; expensesData[idx].amount = newAmt; updateCards(); const row = e.target.closest('tr'); if (row) // no extra cell needed