BAR CHECKLIST

This is the checklist to be used for all of the items that needs to be completed on this day. 

document.addEventListener('DOMContentLoaded', function () { const inventoryTable = document.getElementById('inventoryTable'); const calculateOrderButton = document.getElementById('calculateOrder'); const totalOrderCostDisplay = document.getElementById('totalOrderCost'); const totalReduceCostDisplay = document.getElementById('totalreduceCost'); const summaryDiv = document.getElementById('summary'); function validateAndUpdateRow(cell) { const value = cell.textContent.trim(); if (!/^[-+]?\d+(\.\d+)?$/.test(value)) { alert('Please enter a valid positive or negative number.'); cell.textContent = ''; // Clear the invalid input return false; } return true; } function updateInventoryRow(row) { const idealStockCell = row.querySelector('.ideal-stock'); const stockOnHandCell = row.querySelector('.stock-on-hand'); const neededCell = row.querySelector('.green'); const costPerUnitCell = row.querySelector('.cost-per-unit'); const orderCostCell = row.querySelector('.order-cost'); const idealStock = parseFloat(idealStockCell.textContent) || 0; const stockOnHand = parseFloat(stockOnHandCell.textContent) || 0; const costPerUnit = parseFloat(costPerUnitCell.textContent) || 0; const needed = idealStock - stockOnHand; neededCell.textContent = needed >= 0 ? `+${needed}` : `${needed}`; const orderCost = needed * costPerUnit; orderCostCell.textContent = orderCost.toFixed(2); } function calculateTotals() { let totalOrderCost = 0; let totalReduceCost = 0; let summaryHTML = `

Summary

`; const rows = inventoryTable.querySelectorAll('tr'); rows.forEach(function (row) { const sectionCell = row.querySelector('.section'); const itemCell = row.querySelector('.item'); const idealStockCell = row.querySelector('.ideal-stock'); const stockOnHandCell = row.querySelector('.stock-on-hand'); const neededCell = row.querySelector('.green'); const costPerUnitCell = row.querySelector('.cost-per-unit'); const orderCostCell = row.querySelector('.order-cost'); if ( stockOnHandCell && stockOnHandCell.textContent.trim() !== '' && // Only include rows with user input idealStockCell && neededCell && costPerUnitCell && orderCostCell ) { const idealStock = parseFloat(idealStockCell.textContent) || 0; const stockOnHand = parseFloat(stockOnHandCell.textContent) || 0; const needed = parseFloat(neededCell.textContent) || 0; const costPerUnit = parseFloat(costPerUnitCell.textContent) || 0; const orderCost = parseFloat(orderCostCell.textContent) || 0; // Add row to the summary table summaryHTML += ` `; // Update totals if (needed > 0) { totalOrderCost += orderCost; } else if (needed < 0) { totalReduceCost += Math.abs(orderCost); } } }); summaryHTML += `
Section Item Ideal Stock Stock On Hand Needed (+/-) Cost per Unit Order Cost
${sectionCell ? sectionCell.textContent : ''} ${itemCell ? itemCell.textContent : ''} ${idealStock} ${stockOnHand} ${needed >= 0 ? `+${needed}` : needed} ${costPerUnit.toFixed(2)} ${orderCost.toFixed(2)}
Total Items Order Cost: ${totalOrderCost.toFixed(2)}
Total Reduce from Over stock: ${totalReduceCost.toFixed(2)}
`; summaryDiv.innerHTML = summaryHTML; // Update the summary totalOrderCostDisplay.textContent = totalOrderCost.toFixed(2); totalReduceCostDisplay.textContent = totalReduceCost.toFixed(2); } // Add event listener to each stock-on-hand cell const stockCells = inventoryTable.querySelectorAll('.stock-on-hand'); stockCells.forEach(function (cell) { cell.addEventListener('input', function () { if (validateAndUpdateRow(cell)) { const row = cell.closest('tr'); updateInventoryRow(row); } }); }); // Add event listener to the Calculate Order button calculateOrderButton.addEventListener('click', calculateTotals); // Initial calculation for all rows on page load const rows = inventoryTable.querySelectorAll('tr'); rows.forEach(function (row) { updateInventoryRow(row); }); }); function sendEmail() { // Generate the summary text const summaryHTML = document.getElementById('summary').innerText; // Encode the summary text const body = encodeURIComponent(summaryHTML); // Construct the mailto URL with subject and body const email = "operations@myenchantedranch.com"; const subject = "Summary Report"; // Open the default email client with the mailto URL window.location.href = `mailto:${email}?subject=${subject}&body=${body}`; }
Print Button Example

Print Button Example

This is an example of a page with a print button.