Sum is coming in (-) and value is adding up
$(function() {
//mask
$('#total_payment,#deductions').mask('#,##,##,###',{reverse : true});
//function that will get the total amount by each class
var net_payable = function() {
var sum=0;
$('#total_payment,#deductions').each(function(){
var num = $(this).val().replace(',','');
if(num != 0) {
sum -= parseFloat(num);
}
});
$('#net_payable').val(sum);
}
//key handler
$('#total_payment,#deductions').keyup(function(){
net_payable();
});
});