<script language="javascript">
function fncCal()
{
var tot = 0;
var sum = 0;
var sum2 = 0;
for(i=1;i<=document.form1.hdnLine.value;i++)
{
tot = (parseInt(eval("document.form1.quntity"+i+".value")) * parseInt(eval("document.form1.unit"+i+".value")))-parseInt(eval("document.form1.discount"+i+".value"))
eval("document.form1.amount"+i+".value="+tot);
sum = tot + sum;
sum2 = sum + parseInt(eval("document.form1.vat.value"))+ (parseInt(eval("document.form1.frees.value"))+parseInt(eval("document.form1.trasit.value")));
document.form1.totalsum.value=sum2;
}
}
</script>