We are creating a tuition reimbursement form where the employee is reimbursed 90% of the total cost of the course taken. We have been able to calculate a subtotal for each row in the course table and calculate a grand total, but have not been able to successfully multiply the grand total by .9 to calculate the amount the employee would be reimbursed. Any assistance would be greatly appreciated.
Form Table:
JS / CSS Screen showing table:
JS currently being used:
$(document).ready(function () {
$('.cf-table-block').on('blur', 'input', sumtotal);
function sumtotal() {
var sum = 0;
$('.cf-table-block tbody tr').each(function () {
var s = 0;
$(this).find('.price input').each(function () {
s += parseNumber($(this).val());
});
$(this).find('.subtotal input').val(s);
sum += s;
});
$('.total input').val(sum);
}
function parseNumber(n) {
var f = parseFloat(n); //Convert to float number.
return isNaN(f) ? 0 : f; //treat invalid input as 0;
}
});