Adaugare TVA
Scris: Vin Mar 13, 2015
Salut,
cum se adauga functia de calcul TVA la codul urmator?
cum se adauga functia de calcul TVA la codul urmator?
Cod: Selectaţi tot
function update_total() {
var total = 0;
$('.price').each(function(i){
price = $(this).html().replace(" Lei","");
if (!isNaN(price)) total += Number(price);
});
total = roundNumber(total,2);
$('#subtotal').html(total+" Lei");
$('#total').html(total+" Lei");
update_balance();
}
function update_balance() {
var due = $("#total").html().replace(" Lei","") - $("#paid").val().replace(" Lei","");
due = roundNumber(due,2);
$('.due').html(due+" Lei");
}
function update_price() {
var row = $(this).parents('.item-row');
var price = row.find('.cost').val().replace(" Lei","") * row.find('.qty').val();
price = roundNumber(price,2);
isNaN(price) ? row.find('.price').html("N/A") : row.find('.price').html(price+" Lei");
update_total();
}
function bind() {
$(".cost").blur(update_price);
$(".qty").blur(update_price);
}