I am trying to calculate the final payment in an amortization schedule. My problem is the event.value = Math.floor(this.getField("TermMonth").value) works fine if I manually enter in the (TotalPayment) field, but because (TotalPayment) is autopopulated, the (AmountPaid) field does not calculate.
Because the (TermMonths) result is typically a decimal number, [a month plus a portion of a month], I need to round down to the nearest whole number in order to multiply the (TermMonthRounded) x (Payment) to calculate the amount that will be paid during that time period (AmountPaid), then subtract (AmountPaid) from (Balancefield) to calculate the difference (FinalPayment)
Addtionally, when I try to use the formula with the event.value script the script and some of the calcuations actually disappear for no apparent reason. I have scoured this forum for hours for some alternatives to no avail.
I either need another way to calculate this or use another round down script that works from in a calculation using auto-populated fields.
NOTE: The difference in (TotalPayment) vs. (Payment) is not relevant in this formula.
Balancefield [5000)
TotalPayment (550.50) * PaydownRate (33.00%) = Payment (181.67)
Balancefield [5000) / Payment (181.67) = TermMonths (27.52)
“TermMonthRounded” (27) * “Payment” (181.67) = “ AmountPaid” ( 4904.96)
“Balancefield” [5000) - “AmountPaid” 4904.96 = “FinalPayment “ (95.04)
If anyone can assist me I would be greatly appreciated.
I want to thank everyone that contributes to this forum. Your advice and examples have been invaluable. This is my first post so I apologize if I am unclear on anything.
It's possible the field calculation order is incorrect, so confirm that it is set to whatever makes sense for your form.