The Fill Rate Calculator helps businesses understand how effectively they are meeting customer demand for their products. A high fill rate indicates that a company is able to supply the requested quantity of goods, minimizing stockouts and lost sales. This metric is crucial for inventory management, customer satisfaction, and overall operational efficiency.
function calculateFillRate() {
var totalOrders = document.getElementById("totalOrders").value;
var ordersFulfilled = document.getElementById("ordersFulfilled").value;
var resultDiv = document.getElementById("result");
// Clear previous results
resultDiv.innerHTML = "";
// Input validation
if (isNaN(totalOrders) || isNaN(ordersFulfilled) || totalOrders <= 0 || ordersFulfilled parseFloat(totalOrders)) {
resultDiv.innerHTML = "Number of orders fulfilled cannot be greater than the total number of orders received.";
return;
}
// Calculation
var fillRate = (parseFloat(ordersFulfilled) / parseFloat(totalOrders)) * 100;
// Display result
resultDiv.innerHTML =
"Your Fill Rate is: " + fillRate.toFixed(2) + "%" +
"This means that " + fillRate.toFixed(2) + "% of your received orders were fulfilled completely.";
}
.calculator-container {
font-family: Arial, sans-serif;
border: 1px solid #ccc;
padding: 20px;
border-radius: 8px;
max-width: 500px;
margin: 20px auto;
background-color: #f9f9f9;
}
.calculator-container h2 {
text-align: center;
margin-bottom: 20px;
color: #333;
}
.input-section label {
display: block;
margin-bottom: 8px;
font-weight: bold;
color: #555;
}
.input-section input {
width: calc(100% – 22px);
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
.calculator-container button {
display: block;
width: 100%;
padding: 12px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s ease;
}
.calculator-container button:hover {
background-color: #0056b3;
}
#result {
margin-top: 20px;
padding: 15px;
border-radius: 4px;
text-align: center;
}
.result-message {
font-size: 18px;
color: #28a745;
font-weight: bold;
}
.error {
color: #dc3545;
font-weight: bold;
}