I have the following code to do charges calculation.
Strictly confidential external
Rajitha Lakmal
to Rajitha
4 hours agoDetails
<!DOCTYPE html>
<html>
<head>
<title>Loan Calculator</title>
</head>
<body>
<h1>Loan Calculator</h1>
<label for="loan-type">Select loan type:</label>
<select id="loan-type">
<option value="primary-commercial">Primary Mortgage - Commercial Loans</option>
<option value="additional-commercial">Additional Mortgage - Commercial Loans</option>
<option value="nivahana-housing">Primary and Additional Mortgages - Nivahana Housing Loans</option>
</select>
<br><br>
<label for="loan-amount">Loan amount:</label>
<input type="number" id="loan-amount">
<br><br>
<button onclick="calculateLoan()">Calculate</button>
<br><br>
<p id="result"></p>
<script>
function calculateLoan() {
let loanType = document.getElementById("loan-type").value;
let loanAmount = document.getElementById("loan-amount").value;
let result = document.getElementById("result");
if (loanType === "primary-commercial") {
if (loanAmount < 1000000) {
result.innerHTML = "Total payment: " + (loanAmount * 0.01);
} else if (loanAmount < 25000000) {
result.innerHTML = "Total payment: " + ((loanAmount - 1000000) * 0.0075 + 10000);
} else if (loanAmount < 50000000) {
result.innerHTML = "Total payment: " + ((loanAmount - 25000000) * 0.006 + 190000);
} else if (loanAmount < 75000000) {
result.innerHTML = "Total payment: " + ((loanAmount - 50000000) * 0.006 + 340000);
} else if (loanAmount < 100000000) {
result.innerHTML = "Total payment: " + ((loanAmount - 75000000) * 0.005 + 465000);
} else {
result.innerHTML = "Total payment: " + ((loanAmount - 100000000) * 0.001 + 527500);
}
} else if (loanType === "additional-commercial") {
if (loanAmount < 25000000) {
result.innerHTML = "Total payment: " + (loanAmount * 0.004);
} else if (loanAmount < 50000000) {
result.innerHTML = "Total payment: " + ((loanAmount - 25000000) * 0.0025 + 100000);
} else if (loanAmount < 100000000) {
result.innerHTML = "Total payment: " + ((loanAmount - 50000000) * 0.0015 + 162500);
} else {
result.innerHTML = "Total payment: " + ((loanAmount - 100000000) * 0.00075 + 237500);
}
} else if (loanType === "nivahana-housing") {
if (loanAmount < 25000000) {
result.innerHTML = "Total payment: " + (loanAmount * 0.0075);
} else {
result.innerHTML = "Total payment: " + ((loanAmount - 25000000) * 0.0025 + 187500);
}
}
}
</script>
</body>
</html
I want to Add ” Declaration Charge – Rs. 1000.00 and get a sub total.
After sub total Add 2.56% as a Tax. After get total add 15% from that amount. And get total.