01.
function
calcS(){
02.
numitems=document.getElementById(
'tbl_sitems'
).rows.length-1;
03.
itemsqty = document.getElementsByName(
'itemsqty[]'
);
04.
itemstax = document.getElementsByName(
'itemstax[]'
);
05.
itemstotaltax = document.getElementsByName(
'itemstotaltax[]'
);
06.
itemsuprice = document.getElementsByName(
'itemsuprice[]'
);
07.
itemsprice = document.getElementsByName(
'itemsprice[]'
);
08.
itemstotalprice = document.getElementsByName(
'itemstotalprice[]'
);
09.
10.
var
tax = 0;
11.
var
total = 0;
12.
for
(i=0;i<numitems;i++){
13.
iqty = parseInt(itemsqty[i].value);
14.
tip = iqty*toCurrency(parseFloat(itemsprice[i].value));
15.
titax = iqty*toCurrency(parseFloat(itemsuprice[i].value))*toCurrency(parseFloat(itemstax[i].value)/100);
16.
tax += titax;
17.
total += tip;
18.
itemstotaltax[i].value = toCurrency(titax);
19.
itemstotalprice[i].value = toCurrency(tip);
20.
}
21.
total = toCurrency(total);
22.
tax = toCurrency(tax);
23.
var
subtotal = toCurrency(total-tax);
24.
document.getElementById(
'vtax'
).value=tax;
25.
document.getElementById(
'vsubtotal'
).value=subtotal;
26.
document.getElementById(
'vtotal'
).value=total;
27.
28.
document.getElementById(
'findcustomertext'
).value=
''
;
29.
document.getElementById(
'findcustomertext'
).focus();
30.
document.getElementById(
'num'
).value=
"0"
;
31.
}