Loan Calculator

Loan Calculator

1. Project Cost

Total Project Cost:

2. Source of Funds




3. SBA 504 Debenture Pricing

Subtotal:

Gross Debenture:

Balance to Borrower:

4. Debt Service

Bank Loan Monthly Payment:

SBA 504 Loan Monthly Payment:

Total Monthly Payment:

Annual Debt Service:

<script type="text/javascript">

function calculate() {

// Get input values

const landCost = parseFloat(document.getElementById("landCost").value) || 0;

const constructionCost = parseFloat(document.getElementById("constructionCost").value) || 0;

const equipmentCost = parseFloat(document.getElementById("equipmentCost").value) || 0;

const professionalFees = parseFloat(document.getElementById("professionalFees").value) || 0;

const bankLoanPercentage = parseFloat(document.getElementById("bankLoanPercentage").value) / 100;

const sbaLoanPercentage = parseFloat(document.getElementById("sbaLoanPercentage").value) / 100;

const borrowerInjectionPercentage = parseFloat(document.getElementById("borrowerInjectionPercentage").value) / 100;

const closingCosts = parseFloat(document.getElementById("closingCosts").value) || 0;

const bankLoanInterestRate = parseFloat(document.getElementById("bankLoanInterestRate").value) / 100 / 12;

// Get selected bank loan term

const bankLoanTermSelect = document.getElementById("bankLoanTerm");

const bankLoanTermYears = parseInt(bankLoanTermSelect.options[bankLoanTermSelect.selectedIndex].value);

const bankLoanTerm = bankLoanTermYears * 12;

const sbaLoanInterestRate = parseFloat(document.getElementById("sbaLoanInterestRate").value) / 100 / 12;

// Get selected sba loan term

const sbaLoanTermSelect = document.getElementById("sbaLoanTerm");

const sbaLoanTermYears = parseInt(sbaLoanTermSelect.options[sbaLoanTermSelect.selectedIndex].value);

const sbaLoanTerm = sbaLoanTermYears * 12;

// Calculate total project cost

const totalProjectCost = landCost + constructionCost + equipmentCost + professionalFees;

document.getElementById("totalProjectCost").textContent = totalProjectCost.toFixed(2);

// Calculate loan amounts

const bankLoanAmount = totalProjectCost * bankLoanPercentage;

document.getElementById("bankLoanAmount").textContent = "$" + bankLoanAmount.toFixed(2);

const sbaLoanAmount = totalProjectCost * sbaLoanPercentage;

document.getElementById("sbaLoanAmount").textContent = "$" + sbaLoanAmount.toFixed(2);

const borrowerInjectionAmount = totalProjectCost * borrowerInjectionPercentage;

document.getElementById("borrowerInjectionAmount").textContent = "$" + borrowerInjectionAmount.toFixed(2);

// Calculate SBA 504 Debenture Pricing

const fundingFee = sbaLoanAmount * 0.0025;

document.getElementById("fundingFee").textContent = fundingFee.toFixed(2);

const cdcProcessingFee = sbaLoanAmount * 0.015;

document.getElementById("cdcProcessingFee").textContent = cdcProcessingFee.toFixed(2);

const underwritersFee = sbaLoanAmount * 0.004;

document.getElementById("underwritersFee").textContent = underwritersFee.toFixed(2);

const subtotal = sbaLoanAmount + fundingFee + cdcProcessingFee + closingCosts + underwritersFee;

document.getElementById("subtotal").textContent = subtotal.toFixed(2);

const grossDebenture = Math.ceil(subtotal / 1000) * 1000;

document.getElementById("grossDebenture").textContent = grossDebenture;

const balanceToBorrower = grossDebenture - subtotal;

document.getElementById("balanceToBorrower").textContent = balanceToBorrower.toFixed(2);

// Calculate monthly payments

const bankLoanMonthlyPayment = calculateMonthlyPayment(bankLoanInterestRate, bankLoanTerm, bankLoanAmount);

document.getElementById("bankLoanMonthlyPayment").textContent = "$" + bankLoanMonthlyPayment.toFixed(2);

const sbaLoanMonthlyPayment = calculateMonthlyPayment(sbaLoanInterestRate, sbaLoanTerm, grossDebenture);

document.getElementById("sbaLoanMonthlyPayment").textContent = "$" + sbaLoanMonthlyPayment.toFixed(2);

// Calculate total monthly payment

const totalMonthlyPayment = bankLoanMonthlyPayment + sbaLoanMonthlyPayment;

document.getElementById("totalMonthlyPayment").textContent = "$" + totalMonthlyPayment.toFixed(2);

// Calculate annual debt service

const annualDebtService = totalMonthlyPayment * 12;

document.getElementById("annualDebtService").textContent = "$" + annualDebtService.toFixed(2);

// Display interest rates with % symbol

document.getElementById("bankLoanInterestRate").nextElementSibling.textContent = "%";

document.getElementById("sbaLoanInterestRate").nextElementSibling.textContent = "%";

// Display bank loan percentage with % symbol

document.getElementById("bankLoanPercentage").nextElementSibling.textContent = "%";

// Display SBA loan percentage with % symbol

document.getElementById("sbaLoanPercentage").nextElementSibling.textContent = "%";

// Display Borrower Injection percentage with % symbol

document.getElementById("borrowerInjectionPercentage").nextElementSibling.textContent = "%";

}

// Update HTML without extra spans

document.getElementById("subtotal").textContent = subtotal.toFixed(2);

document.getElementById("grossDebenture").textContent = grossDebenture;

document.getElementById("balanceToBorrower").textContent = balanceToBorrower.toFixed(2);

// Helper function for calculating monthly payment

function calculateMonthlyPayment(interestRate, term, principal) {

if (interestRate === 0) {

return principal / term; // If interest rate is 0, use simple division

} else {

return (principal * interestRate) / (1 - Math.pow(1 + interestRate, -term));

}

}

</script>