It was working fine until I added the alert code. I can't seem to see anything that would stop it from running. Can you please take a look? I get an error on the status bar on the bottom of the page that says "error with page".
function ItemTotal(which,txtValue)
{
var Qty=eval(which.value);
var PrevTotal=eval(document.getElementById('txtTotal').value) * 1;
var PrevSubTotal=eval(document.getElementById('txtSubTotal').value) * 1;
var CurrReOrd=eval(document.getElementById(txtValue+'ReOrder').value) * 1;
var PrevQtyOnHand=eval(document.getElementById(txtValue+'QtOnHand').value) * 1;
var unitprice=eval(document.getElementById(txtValue+'UPrice').value) * 1;
var NewQtyOnHand=PrevQtyOnHand - Qty;
if (Qty > PrevQtyOnHand)
{
alert('Not Enough items in stock to fulfill this order. There are/is only '+PrevQtyOnHand+' items in stock');
return (false);
}
else
if (NewQtyOnHand <= CurrReOrd)
{
alert ('ReOrder point has been reached for this product. There is enough in stock for this order');
return (false);
}
else
{
var tot = Qty * unitprice;
document.getElementById(txtValue+'QtOnHand').value = NewQtyOnHand;
document.getElementById(txtValue+'Total').value = tot;
document.getElementById('txtSubTotal').value = PrevSubTotal + tot;
document.getElementById('txtTotal').value = PrevTotal + tot;
return (true);
}
}
Thanks
Mo
function ItemTotal(which,txtValue)
{
var Qty=eval(which.value);
var PrevTotal=eval(document.getElementById('txtTotal').value) * 1;
var PrevSubTotal=eval(document.getElementById('txtSubTotal').value) * 1;
var CurrReOrd=eval(document.getElementById(txtValue+'ReOrder').value) * 1;
var PrevQtyOnHand=eval(document.getElementById(txtValue+'QtOnHand').value) * 1;
var unitprice=eval(document.getElementById(txtValue+'UPrice').value) * 1;
var NewQtyOnHand=PrevQtyOnHand - Qty;
if (Qty > PrevQtyOnHand)
{
alert('Not Enough items in stock to fulfill this order. There are/is only '+PrevQtyOnHand+' items in stock');
return (false);
}
else
if (NewQtyOnHand <= CurrReOrd)
{
alert ('ReOrder point has been reached for this product. There is enough in stock for this order');
return (false);
}
else
{
var tot = Qty * unitprice;
document.getElementById(txtValue+'QtOnHand').value = NewQtyOnHand;
document.getElementById(txtValue+'Total').value = tot;
document.getElementById('txtSubTotal').value = PrevSubTotal + tot;
document.getElementById('txtTotal').value = PrevTotal + tot;
return (true);
}
}
Thanks
Mo