energy0m
10-17-2004, 10:10 PM
so maybe i posted a bit too much info the first time ....
the premise here is to create an online tax and use form the form currently lives at
http://students.uat.edu/marjunea/test (non working stuff commented out)
and the excel it is based off of lives just nextdoor at
http://students.uat.edu/marjunea/test/excel.xls
take a look at this part.. its the part im having most trouble with and im not so sure the syntax is correct .. if any one can help id be forever greateful
function calculate(obj) {
timething=parseInt(obj.telltime.value);
/* these are here to make calculations based on hidden calculations */
//start da funky ride
dafunkyvars=eval(Math.round(timething)/31);
percenthing=eval(dafunkyvars*.05);
perthing2=eval(IF (dafunkyvars>0) (0.15/365*dafunkyvars) );
calcy1=eval(percenthing*SalesUse20);
calcy2=eval(perthing2*SalesUse20);
//end da funky ride
SalesUse21=eval(Math.round(IF (calcy1 >0) (calcy1)));
SalesUse22=eval(Math.round(IF (calcy2 >0) (calcy2)));
SalesUse23=eval(SalesUse21+SalesUse22);
SalesUse24=eval(z);
SalesUse25=eval(IF ((SalesUse23+SalesUse24) >0) (rounding(SalesUse23+SalesUse24) ));
SalesUse26=eval(IF ((SalesUse23+SalesUse24) <0) (rounding(SalesUse23+SalesUse24) ));
SalesUse28=(a)
SalesUse29=(b)
obj.SalesUse19.value=(SalesUse19);
obj.SalesUse20.value=(SalesUse20);
obj.SalesUse21.value=(SalesUse21);
obj.SalesUse22.value=(SalesUse22);
obj.SalesUse23.value=(SalesUse23);
obj.SalesUse24.value=(SalesUse24);
obj.SalesUse25.value=(SalesUse25);
obj.SalesUse26.value=(SalesUse26);
}
function rounding(n)
{
pennies = n * 100 ;
pennies = Math.round(pennies) ;
strPennies = "" + pennies ;
len = strPennies.length ;
return strPennies.substring(0, len - 2) + "." + strPennies.substring((len - 2), len);
}
my main question is this
are the if statements in there structured correctly and more so if the if statements are based of excel formulas
{for instance
perthing2=eval(IF (dafunkyvars>0) (0.15/365*dafunkyvars) );
is baesed off the excel formula
=IF(G91>0,0.15/365*(F90-F91),0)
}
are these equivalent ?
if they aren equivalent how would you structure them so they are?
thanx!!!
the premise here is to create an online tax and use form the form currently lives at
http://students.uat.edu/marjunea/test (non working stuff commented out)
and the excel it is based off of lives just nextdoor at
http://students.uat.edu/marjunea/test/excel.xls
take a look at this part.. its the part im having most trouble with and im not so sure the syntax is correct .. if any one can help id be forever greateful
function calculate(obj) {
timething=parseInt(obj.telltime.value);
/* these are here to make calculations based on hidden calculations */
//start da funky ride
dafunkyvars=eval(Math.round(timething)/31);
percenthing=eval(dafunkyvars*.05);
perthing2=eval(IF (dafunkyvars>0) (0.15/365*dafunkyvars) );
calcy1=eval(percenthing*SalesUse20);
calcy2=eval(perthing2*SalesUse20);
//end da funky ride
SalesUse21=eval(Math.round(IF (calcy1 >0) (calcy1)));
SalesUse22=eval(Math.round(IF (calcy2 >0) (calcy2)));
SalesUse23=eval(SalesUse21+SalesUse22);
SalesUse24=eval(z);
SalesUse25=eval(IF ((SalesUse23+SalesUse24) >0) (rounding(SalesUse23+SalesUse24) ));
SalesUse26=eval(IF ((SalesUse23+SalesUse24) <0) (rounding(SalesUse23+SalesUse24) ));
SalesUse28=(a)
SalesUse29=(b)
obj.SalesUse19.value=(SalesUse19);
obj.SalesUse20.value=(SalesUse20);
obj.SalesUse21.value=(SalesUse21);
obj.SalesUse22.value=(SalesUse22);
obj.SalesUse23.value=(SalesUse23);
obj.SalesUse24.value=(SalesUse24);
obj.SalesUse25.value=(SalesUse25);
obj.SalesUse26.value=(SalesUse26);
}
function rounding(n)
{
pennies = n * 100 ;
pennies = Math.round(pennies) ;
strPennies = "" + pennies ;
len = strPennies.length ;
return strPennies.substring(0, len - 2) + "." + strPennies.substring((len - 2), len);
}
my main question is this
are the if statements in there structured correctly and more so if the if statements are based of excel formulas
{for instance
perthing2=eval(IF (dafunkyvars>0) (0.15/365*dafunkyvars) );
is baesed off the excel formula
=IF(G91>0,0.15/365*(F90-F91),0)
}
are these equivalent ?
if they aren equivalent how would you structure them so they are?
thanx!!!