PDA

View Full Version : creating total values from subvalues


cybereaper
04-13-2004, 10:36 PM
This is my next question breaking my original post into two parts so I can post the script and make the question more simple (I hope):

At the end of each subtotal section is the following:
function subtotal2(item1sub, item2sub, item3sub, item4sub)
{
var subtotal1 = new Number(item1sub);
var subtotal2 = new Number(item2sub);
var subtotal3 = new Number(item3sub);
var subtotal4 = new Number(item4sub);
var tempsubtotal = new Number(subtotal1 + subtotal2 + subtotal3
+ subtotal4);
var subval = LabOne(tempsubtotal) - 0;
document.form1.ordersub.value = LabOne(tempsubtotal);
There are four sections, eachone creating a new subval and a new ordersub, ie.
dsisubval, dsiordersub; clrsubval, clrordersub;
These subvalues are calculated and appear correctly on the form. However, the person who helped me with this left me the following script for only one ordersub and subval:
if (subval == 0)
{
document.form1.total.value = "";
}
else
{
var temptotal = new Number(subval + shipval + wrapval);
var roundtotal = LabOne(temptotal);
document.form1.total.value = roundtotal;
}

How would I convert the above to include the other subval's thus creating one running grandtotal for each subtotal field.
Confused? I sure as heck am. I LOVE Java, I HATE programming. Two great tastes that just don't tast great together. Appreciate any help - thanks... :)