1 Attachment(s)
not working properly without alert box
Hi,
I have a prob in my application.. its totally based on calculations.
Here is sample image for calculations..in the below code i place alert box..if i remove alert box from there i don't get values properly
Attachment 5328
and code is here
Code:
function xyz(ival){
var qty = parseInt($('#qty_'+ival).val());
var unitPrice = parseInt($('#unitPrice_'+ival).val());
var id = "select#product_id_"+ival+" option:selected";
var PriceListId = $('#price_list_id_'+ival).val();
var Tax = $('#tax_'+ival).val();
var product_id = $(id).val();
if(unitPrice!=0){
$('#total_'+ival).val(qty * unitPrice);
$.post('/other/api/get-discount/', {product_id: product_id, price_list_id: PriceListId, price: qty}, function(response){
if(response){
$("#discount_"+ival).val(response);
}
});
}
var total = parseInt($('#total_'+ival).val());
alert();
if(total!=0){
var discount = $('#discount_'+ival).val();
if(discount!=0){
$('#tad_'+ival).val(total - ((total * discount)/100));
$('#netTotal_'+ival).val(total - ((total * discount)/100));
$('#grandTotal').val($('#netTotal_'+ival).val());
}else{
$('#tad_'+ival).val(total - 0);
$('#netTotal_'+ival).val(total - 0);
$('#grandTotal').val($('#netTotal_'+ival).val());
}
}
if(Tax!=0){
var tad = parseInt($('#tad_'+ival).val());
var tax = parseInt($('#tax_'+ival).val());
if(tax!=0){
$('#netTotal_'+ival).val(tad + ((tad * tax)/100) );
$('#grandTotal').val($('#netTotal_'+ival).val());
}
}
$( "#tax_"+ival ).keyup(function() {
var tad = parseInt($('#tad_'+ival).val());
var tax = parseInt($('#tax_'+ival).val());
if(tax!=0){
$('#netTotal_'+ival).val(tad + ((tad * tax)/100) );
$('#grandTotal').val($('#netTotal_'+ival).val());
}
});
}
help me out please..