Need help with commission calculator

Reply

Join Date: Aug 2004
Posts: 8
Reputation: holmberg is an unknown quantity at this point 
Solved Threads: 0
holmberg holmberg is offline Offline
Newbie Poster

Need help with commission calculator

 
0
  #1
Aug 4th, 2004
I'm trying to add a commission calculator to my new website, and it works
properly for the first two of three form entries, but I wish to add a 3rd
level calculation.

I'm not familiar with javascript at all really, so I have no clue what to add
to the script to get it to process the third field into the calculation.

You can see the form on this page:
http://dmp.safelistsynergy.com

And the script code is this:

function calculate(intDirect, intIndirect){
var intResult = 0;
tp=0;
if (((isNaN(intDirect)) || (isNaN(intIndirect))) || ((intDirect == "") || (intIndirect == ""))){
document.frmCalculator.txtPartner.value = "$";
}
else
{
intResult = (intDirect * 5);
tp = intIndirect * intDirect;
intResult += (tp * 2) - 10;




document.frmCalculator.txtPartner.value = formatCurrency("" + Math.round(intResult));
}
}

function formatCurrency(strValue)
{
var intCount = 0;
var i = 0;
var strChar = "";
var strTemp1 = "";
var strTemp2 = "";

for (i = strValue.length - 1; i >= 0; i--)
{
strChar = strValue.charAt(i);

if (intCount == 3)
{
strTemp1 += ",";
strTemp1 += strChar;
intCount = 1;
continue;
}
else
{
strTemp1 += strChar;
intCount ++;
}
}

for (i = strTemp1.length - 1; i >= 0; i--)
{
strChar = strTemp1.charAt(i);
strTemp2 += strChar;
}

strTemp2 = "$" + strTemp2;

return strTemp2;
}



What I wish to do is name the 3rd level entry intIndirectb and have it
calculated into the total. The level payments are:
1st: 5
2nd: 2
3rd: 2

The first two calculate properly, but I need to include the third level
and process the outcome minus 10 as it is currently doing for the first two
levels.

Probably really simple, but I just don't know java.

If you can get this running it would be greatly appreciated.

Neil Holmberg
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 8
Reputation: holmberg is an unknown quantity at this point 
Solved Threads: 0
holmberg holmberg is offline Offline
Newbie Poster

Re: Need help with commission calculator

 
0
  #2
Aug 6th, 2004
Seriously...is nobody versed in math? :mrgreen:

I thought for sure someone would have a simple answer for this problem?

Please help...anyone? :o

Originally Posted by holmberg
I'm trying to add a commission calculator to my new website, and it works
properly for the first two of three form entries, but I wish to add a 3rd
level calculation.

I'm not familiar with javascript at all really, so I have no clue what to add
to the script to get it to process the third field into the calculation.

You can see the form on this page:
http://dmp.safelistsynergy.com

And the script code is this:

function calculate(intDirect, intIndirect){
var intResult = 0;
tp=0;
if (((isNaN(intDirect)) || (isNaN(intIndirect))) || ((intDirect == "") || (intIndirect == ""))){
document.frmCalculator.txtPartner.value = "$";
}
else
{
intResult = (intDirect * 5);
tp = intIndirect * intDirect;
intResult += (tp * 2) - 10;




document.frmCalculator.txtPartner.value = formatCurrency("" + Math.round(intResult));
}
}

function formatCurrency(strValue)
{
var intCount = 0;
var i = 0;
var strChar = "";
var strTemp1 = "";
var strTemp2 = "";

for (i = strValue.length - 1; i >= 0; i--)
{
strChar = strValue.charAt(i);

if (intCount == 3)
{
strTemp1 += ",";
strTemp1 += strChar;
intCount = 1;
continue;
}
else
{
strTemp1 += strChar;
intCount ++;
}
}

for (i = strTemp1.length - 1; i >= 0; i--)
{
strChar = strTemp1.charAt(i);
strTemp2 += strChar;
}

strTemp2 = "$" + strTemp2;

return strTemp2;
}



What I wish to do is name the 3rd level entry intIndirectb and have it
calculated into the total. The level payments are:
1st: 5
2nd: 2
3rd: 2

The first two calculate properly, but I need to include the third level
and process the outcome minus 10 as it is currently doing for the first two
levels.

Probably really simple, but I just don't know java.

If you can get this running it would be greatly appreciated.

Neil Holmberg
Reply With Quote Quick reply to this message  
Join Date: Jun 2003
Posts: 313
Reputation: red_evolve is on a distinguished road 
Solved Threads: 0
red_evolve's Avatar
red_evolve red_evolve is offline Offline
Posting Whiz

Re: Need help with commission calculator

 
0
  #3
Aug 6th, 2004
Greetings, Neil.
I'd like to help but could you please check your form?
I cannot view it. Thanks.
"Study the past if you would define the future" - Confucius
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 8
Reputation: holmberg is an unknown quantity at this point 
Solved Threads: 0
holmberg holmberg is offline Offline
Newbie Poster

Re: Need help with commission calculator

 
0
  #4
Aug 6th, 2004
:o OOPS

wrong url...

http://dpm.safelistsynergy.com

so sorry :o
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 8
Reputation: holmberg is an unknown quantity at this point 
Solved Threads: 0
holmberg holmberg is offline Offline
Newbie Poster

Re: Need help with commission calculator

 
0
  #5
Aug 8th, 2004
PLEAAASE...anyone???

HELP???

:eek:
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 8
Reputation: holmberg is an unknown quantity at this point 
Solved Threads: 0
holmberg holmberg is offline Offline
Newbie Poster

Re: Need help with commission calculator

 
0
  #6
Aug 13th, 2004
Red Evolve,

are you out there? I'm desperate for help with this!

Please? Anyone?

Neil
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 3
Reputation: heymichelle is an unknown quantity at this point 
Solved Threads: 0
heymichelle heymichelle is offline Offline
Newbie Poster

Re: Need help with commission calculator

 
0
  #7
Aug 24th, 2004
Originally Posted by holmberg
Red Evolve,

are you out there? I'm desperate for help with this!

Please? Anyone?

Neil

Hi Neil, HeyMichelle Here

all you need to do is add this:

intResult = intDirect * 1;
tp = intIndirect * intDirect;

so it would be like this for a total of 3 levels:

intResult = intDirect * 1;
tp = intIndirect * intDirect;
intResult += tp * 1;
tp = tp * intIndirect;
intResult += tp * 1;
tp = tp * intIndirect;

Of course replacing the 1, for what ever price you are using.

Hope this helps!
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 8
Reputation: holmberg is an unknown quantity at this point 
Solved Threads: 0
holmberg holmberg is offline Offline
Newbie Poster

Re: Need help with commission calculator

 
0
  #8
Aug 25th, 2004
Thank You :p
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 8
Reputation: holmberg is an unknown quantity at this point 
Solved Threads: 0
holmberg holmberg is offline Offline
Newbie Poster

Re: Need help with commission calculator

 
0
  #9
Aug 30th, 2004
Ummm, I'm feeling pretty dumb at this point, but can anyone tell me what to put in this portion of the code if I want to name the third form input "intIndirectb"? The third level input cannot have the same name as the second level(intIndirect) can it?

function calculate(intDirect, intIndirect){
var intResult = 0;
tp=0;
if (((isNaN(intDirect)) || (isNaN(intIndirect))) || ((intDirect == "") || (intIndirect == ""))){
document.frmCalculator.txtPartner.value = "$";
}
else

I don't understand the reasoning behind the brackets and how many go where to encompass what?!?

Thanks,
Neil
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 3
Reputation: heymichelle is an unknown quantity at this point 
Solved Threads: 0
heymichelle heymichelle is offline Offline
Newbie Poster

Re: Need help with commission calculator

 
0
  #10
Aug 31st, 2004
I sent you a complete form for this, did you get it?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC