adding subtotal+vat+cst+round to grand total
function update_totals()
{
var grand_total = 0;
var grand_subtotal = 0;
var vat=0;
var cst=0;
var rounds = parseInt($('.round').val());
var vat_percent = parseInt($('.vat-percent').val());
if ( (vat_percent < 0) || (vat_percent > 90) ) { vat_percent=10; $('.vat-percent').find('input').val(10); }
var cst_percent = parseInt($('.cst-percent').val());
if ( (cst_percent < 0) || (cst_percent > 90) ) { cst_percent=10; $('.cst-percent').find('input').val(10); }
$('#invoice-items .cell').children('.subtotal-cell').each(function(){
grand_subtotal += parseFloat( $(this).find('input').val() );
});
vat=(grand_subtotal * (vat_percent/100)).toFixed(2);
cst=(grand_subtotal * (cst_percent/100)).toFixed(2);
grand_total = (grand_subtotal + vat + cst rounds);
grand_subtotal = grand_subtotal.toFixed(2);
grand_total =(grand_subtotal) + (vat);
//update dom
$('.sub-total').val(grand_subtotal);
$('.vat').val(vat);
$('.cst').val(cst);
$('.grand-total').val(grand_total);
}
look for error in picture two values and adding side by side adding to grand_total =grand_subtotal + vat + cst + round it shows 25.001.25 in this 25.00 is subtotal 1.25 is vat
thanks