Blue Book Renew Charge | Bill Book Calculator with Fine

Blue Book Tax Calculator

function calculateTax() { const engineCC = parseInt(document.getElementById(‘engineCC’).value); const expiryDateInput = document.getElementById(‘expiryDate’).value;if (isNaN(engineCC) || engineCC <= 0 || expiryDateInput === "") { document.getElementById('result').innerText = "Please enter valid values."; return; }// Calculate the number of days expired const expiryDate = new Date(expiryDateInput); const currentDate = new Date(); const timeDifference = currentDate – expiryDate; const daysExpired = Math.floor(timeDifference / (1000 * 60 * 60 * 24));// Determine the tax based on engine CC let taxAmount; if (engineCC <= 125) { taxAmount = 3000; } else if (engineCC <= 150) { taxAmount = 5000; } else if (engineCC <= 225) { taxAmount = 6500; } else if (engineCC <= 400) { taxAmount = 12000; } else if (engineCC <= 650) { taxAmount = 25000; } else { taxAmount = 35000; }// Add renewal charge const renewalCharge = 300; taxAmount += renewalCharge;// Calculate fine based on days expired let finePercentage = 0; if (daysExpired <= 30) { finePercentage = 5; } else if (daysExpired <= 45) { finePercentage = 10; } else if (daysExpired 90) { taxAmount += taxAmount * 1; // 100% renewal charge fine }// Apply fine percentage to the tax amount const fineAmount = (taxAmount * finePercentage) / 100; const totalAmount = taxAmount + fineAmount;// Apply discounted fine if applicable if (daysExpired >= 2920 && daysExpired <= 4380) { // Approx 8-12 years const discountedFine = (fineAmount * 0.16); totalAmount -= discountedFine; }document.getElementById('result').innerText = "Total Tax Amount: NRs. " + totalAmount.toFixed(2) + " (Days Expired: " + daysExpired + ")"; }
Visited 1 times, 1 visit(s) today

Comments are closed.

Close