Calculator Tools Calculator Tools

Monthly Targets

Dec 19, 2023

About this app

Calculate ISM incentives based on monthly targets

javascript // This will run when the DOM is ready. document.addEventListener("DOMContentLoaded", function() { // Calculate and display the incentives based on the target and achieved values function calculateIncentives() { var monthlyTarget = parseInt($("#monthlyTarget").val()); var achievedValueFirstCycle = parseInt($("#achievedValueFirstCycle").val()); var achievedValueSecondCycle = parseInt($("#achievedValueSecondCycle").val()); var cycleTarget = monthlyTarget / 2; var cycleTargetFirstCycle = Math.round(cycleTarget); var cycleTargetSecondCycle = cycleTarget - cycleTargetFirstCycle; var incentiveFirstCycle = 0; var incentiveSecondCycle = 0; if (achievedValueFirstCycle >= cycleTargetFirstCycle) { incentiveFirstCycle = Math.round((achievedValueFirstCycle - cycleTargetFirstCycle) * 0.05); if (incentiveFirstCycle > 0) { incentiveFirstCycle += Math.round(cycleTargetFirstCycle * 0.03); } } else if (achievedValueFirstCycle === monthlyTarget) { incentiveFirstCycle = 15000; } if (achievedValueSecondCycle >= cycleTargetSecondCycle) { incentiveSecondCycle = Math.round((achievedValueSecondCycle - cycleTargetSecondCycle) * 0.05); if (incentiveSecondCycle > 0) { incentiveSecondCycle += Math...

Put this on your site

Source

                    javascript
// This will run when the DOM is ready.
document.addEventListener("DOMContentLoaded", function() {
// Calculate and display the incentives based on the target and achieved values
function calculateIncentives() {
var monthlyTarget = parseInt($("#monthlyTarget").val());
var achievedValueFirstCycle = parseInt($("#achievedValueFirstCycle").val());
var achievedValueSecondCycle = parseInt($("#achievedValueSecondCycle").val());

var cycleTarget = monthlyTarget / 2;
var cycleTargetFirstCycle = Math.round(cycleTarget);
var cycleTargetSecondCycle = cycleTarget - cycleTargetFirstCycle;

var incentiveFirstCycle = 0;
var incentiveSecondCycle = 0;

if (achievedValueFirstCycle >= cycleTargetFirstCycle) {
incentiveFirstCycle = Math.round((achievedValueFirstCycle - cycleTargetFirstCycle) * 0.05);
if (incentiveFirstCycle > 0) {
incentiveFirstCycle += Math.round(cycleTargetFirstCycle * 0.03);
}
} else if (achievedValueFirstCycle === monthlyTarget) {
incentiveFirstCycle = 15000;
}

if (achievedValueSecondCycle >= cycleTargetSecondCycle) {
incentiveSecondCycle = Math.round((achievedValueSecondCycle - cycleTargetSecondCycle) * 0.05);
if (incentiveSecondCycle > 0) {
incentiveSecondCycle += Math.round(cycleTargetSecondCycle * 0.03);
}
}

var totalIncentive = incentiveFirstCycle + incentiveSecondCycle;

$("#incentiveFirstCycle").text(incentiveFirstCycle.toLocaleString());
$("#incentiveSecondCycle").text(incentiveSecondCycle.toLocaleString());
$("#totalIncentive").text(totalIncentive.toLocaleString());
}

// Handle calculate button click
$("#calculateButton").click(function() {
calculateIncentives();
});

// Calculate incentives immediately on page load
calculateIncentives();
});