jriver12
asked on
Please help with this script mod.
I have this script that took forever for me and others here to develop, however I need to modify it.
I need to recalculate totalcost in a differnt maner if tablecount is defined.
here is what the calculation is for the total cost if table count is difined > 0
totalcost = if 1 table =800
if 2 tables = 500
if 3 tables then 700
if the tablecount is defined then all other calculation are nixed with the exceptions of converting the total cost to words which I have also included below.
your help is always greatfully appreciated.
\\performs calculations for form
function CheckForm(){
var today = new Date(today)
var bl = (document.boothinformation .BT_B1_Dim _1.value);
var bw = (document.boothinformation .BT_B1_Dim _2.value);
var columns = (document.boothinformation .BT_Post.v alue);
var ismember = (document.boothinformation .BT_Member .value);
var corners = (document.boothinformation .BT_Corner s.value);
var deposit = (document.boothinformation .BT_Deposi t.value);
var contractDate = (document.boothinformation .BT_Contra ctDate.val ue);
var compstate = (document.boothinformation .compstate .value);
var country = (document.boothinformation .country.v alue);
var cancelled = (document.boothinformation .BT_Cancel led.value) ;
var cancelledDate = (document.boothinformation .BT_Cancel ledDate.va lue);
var cdstat = (document.boothinformation .bt_CD_Sta tus.value) ;
var cddate = (document.boothinformation .BT_cd_Dat e.value);
var manstat = (document.boothinformation .bt_Manual _Status.va lue);
var mandate = (document.boothinformation .BT_Manual Date.value );
var fpr = (document.boothinformation .BT_FPR.va lue);
var fprDate = (document.boothinformation .BT_FPRDat e.value);
var DepositDate = (document.boothinformation .BT_Deposi tDate.valu e);
<!--- added to support vendors jr 09092004 --->
var Tassign = (document.boothinformation .tableassi gn.value);
var Tcount = (document.boothinformation .tablecoun t.value);
<!--- var testdate = (document.boothinformation .OutDate.v alue); --->
var moy = today.getMonth() + 1;
//does the arithmatic for the total sq ft.
///changed to "must have non zero value" (not a NAN either)
if((bl >0) && (bw >0) || columns>0){
var columnsqft = (columns * 5);
if(bl<1 || bw<1)
{ var totalsqft = (document.boothinformation .BT_TotalS QFT.value - (columnsqft));
}
else {
var totalsqft = ((bl*bw) - (columnsqft));
}
document.boothinformation. BT_TotalSQ FT.value = totalsqft;
}
//calculates member and non member cost
totalsqft=document.boothin formation. BT_TotalSQ FT.value
if (ismember == 1){
var totalcost = ((totalsqft * 10) + (corners * 200));
var memdiscount = (totalsqft);
}
if (ismember == 0) {
var totalcost = ((totalsqft * 11) + (corners * 200));
var memdiscount = (0);
}
document.boothinformation. BT_TotalCo st.value = totalcost;
document.boothinformation. BT_MemberD .value = memdiscount;
if (compstate == 'NA')
{
document.boothinformation. BT_TotalCo st.value = totalcost;
}
if (compstate != 'NA')
{
document.boothinformation. BT_TotalCo st.value = (0);
}
<!--- calculate all with under the month of august the country =usa --->
if ((totalsqft >= 301))
{
document.boothinformation. BT_FPR.val ue = (0);
document.boothinformation. BT_FPRDate .value = ('');
document.boothinformation. BT_Deposit .value = ((totalcost) * .25);
document.boothinformation. BT_Deposit Date.value = (setNewDate(document.booth informatio n.BT_Contr actDate.va lue));
}
if ((totalsqft <= 300 ))
{
document.boothinformation. BT_FPR.val ue = (1);
document.boothinformation. BT_FPRDate .value = (setNewDate(document.booth informatio n.BT_Contr actDate.va lue));
document.boothinformation. BT_Deposit .value = (0);
document.boothinformation. BT_Deposit Date.value = ('');
}
if (moy>=9)
{
document.boothinformation. BT_FPR.val ue = (1);
document.boothinformation. BT_FPRDate .value = (setNewDate(document.booth informatio n.BT_Contr actDate.va lue));
document.boothinformation. BT_Deposit .value = (0);
document.boothinformation. BT_Deposit Date.value = ('');
}
if (((country != 'USA') ) && ((country != 'Canada')))
{
document.boothinformation. BT_FPR.val ue = (1);
document.boothinformation. BT_FPRDate .value = (setNewDate(document.booth informatio n.BT_Contr actDate.va lue));
document.boothinformation. BT_Deposit .value = (0);
document.boothinformation. BT_Deposit Date.value = ('');
}
}
-->
</SCRIPT>
I need to recalculate totalcost in a differnt maner if tablecount is defined.
here is what the calculation is for the total cost if table count is difined > 0
totalcost = if 1 table =800
if 2 tables = 500
if 3 tables then 700
if the tablecount is defined then all other calculation are nixed with the exceptions of converting the total cost to words which I have also included below.
your help is always greatfully appreciated.
\\performs calculations for form
function CheckForm(){
var today = new Date(today)
var bl = (document.boothinformation
var bw = (document.boothinformation
var columns = (document.boothinformation
var ismember = (document.boothinformation
var corners = (document.boothinformation
var deposit = (document.boothinformation
var contractDate = (document.boothinformation
var compstate = (document.boothinformation
var country = (document.boothinformation
var cancelled = (document.boothinformation
var cancelledDate = (document.boothinformation
var cdstat = (document.boothinformation
var cddate = (document.boothinformation
var manstat = (document.boothinformation
var mandate = (document.boothinformation
var fpr = (document.boothinformation
var fprDate = (document.boothinformation
var DepositDate = (document.boothinformation
<!--- added to support vendors jr 09092004 --->
var Tassign = (document.boothinformation
var Tcount = (document.boothinformation
<!--- var testdate = (document.boothinformation
var moy = today.getMonth() + 1;
//does the arithmatic for the total sq ft.
///changed to "must have non zero value" (not a NAN either)
if((bl >0) && (bw >0) || columns>0){
var columnsqft = (columns * 5);
if(bl<1 || bw<1)
{ var totalsqft = (document.boothinformation
}
else {
var totalsqft = ((bl*bw) - (columnsqft));
}
document.boothinformation.
}
//calculates member and non member cost
totalsqft=document.boothin
if (ismember == 1){
var totalcost = ((totalsqft * 10) + (corners * 200));
var memdiscount = (totalsqft);
}
if (ismember == 0) {
var totalcost = ((totalsqft * 11) + (corners * 200));
var memdiscount = (0);
}
document.boothinformation.
document.boothinformation.
if (compstate == 'NA')
{
document.boothinformation.
}
if (compstate != 'NA')
{
document.boothinformation.
}
<!--- calculate all with under the month of august the country =usa --->
if ((totalsqft >= 301))
{
document.boothinformation.
document.boothinformation.
document.boothinformation.
document.boothinformation.
}
if ((totalsqft <= 300 ))
{
document.boothinformation.
document.boothinformation.
document.boothinformation.
document.boothinformation.
}
if (moy>=9)
{
document.boothinformation.
document.boothinformation.
document.boothinformation.
document.boothinformation.
}
if (((country != 'USA') ) && ((country != 'Canada')))
{
document.boothinformation.
document.boothinformation.
document.boothinformation.
document.boothinformation.
}
}
-->
</SCRIPT>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
dakyd,
I am getting a undifined error in the totalcost form.field.
I would be glad to send you the code. I dont think that it would be greatly appreciated by the comm if I posted 1100 lines of code on this thread.
I am getting a undifined error in the totalcost form.field.
I would be glad to send you the code. I dont think that it would be greatly appreciated by the comm if I posted 1100 lines of code on this thread.
Is it available online anywhere? A link would be just as good. If not, my email address is in my profile, and I'll take a look at it.
ASKER
I sent it this morn, did you receive it.
Oddly enough, I haven't received it. I checked my bulk/junk folder just in case, but I don't see it there either. Try sending it again, just in case it was a freak occurrence?
ASKER
just resent to dakyd@yahoo.com?
with 38 kb txt attachment.
with 38 kb txt attachment.
I don't have Cold Fusion, so it's hard for me to sift through the <cf___> tags, but I just realized that Tcount is a string, not an integer (the value of an input is always a string). Try changing this line:
var Tcount = (document.boothinformation .tablecoun t.value);
to:
var Tcount = parseInt(document.boothinf ormation.t ablecount. value);
Not entirely sure if that'll fix your problem, but it should at least help. Let me know if you still have problems after that.
var Tcount = (document.boothinformation
to:
var Tcount = parseInt(document.boothinf
Not entirely sure if that'll fix your problem, but it should at least help. Let me know if you still have problems after that.
As long as nobody comments in your question in JavaScript TA you can delete that question on your own.