I'm trying to do the following complex formula. I want to be able to calculate tInterest (Total Interest Due) = fDays (# of days) * .0002739726 (interest rate) * PrincipalAmt (principal) but ONLY IF fDays > 90 or if CheckBox1 is checked then fDays > 180, otherwise tInterest = 0.
See, I'm trying to create a form for my state judiciary where the bond forfeiture amount is to be calculated. Interest is only to be calculated on the bond amount from the fail to appear date (StartDate) if 90 days has elapsed OR 180 days has elapsed if an extension was granted. Either way, interest is to be calculated from StartDate.
Is this possible?
var tInterest = 0; // the default
if ((fDays >= 90) && (fDays <=180)) {
tInterest = fDays * .0002739726 * PrincipalAmt ;
}
else if ((fdays > 180) && (document.getElementById("checkBox1").checked)) {
tInterest = fDays * .0002739726 * PrincipalAmt ;
}
tInterest = tInterest.toFixed(2); // result to 2 decimal places