Help - Search - Members - Calendar
Full Version: Complex Calculations possibly in realtime
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
Daeidon
I'm not sure if this is the right place to start this thread, just let me know if I should put it somewhere else.

I'm attempting to convert a spreadsheet calculator into a web page for more wide spread use. I'll need 5 or 6 boxes for data/number entry and then multiple lines of output listed below. My question is first, is this even possible? Second, if it is what do I need to look into or learn to get the code right? If it could be done in real time that would be great but I'm also open to using a "Calculate" button. Below is some of the spreadsheet calculations to give you an idea on what I'm trying to accomplish.

Data entry boxes:
C3 = Miles
C4 = Tolls
C5 = Additional Costs
C6 = Wait Time
C7 = Return w/Crew or Pickup Crew
C8 = Return Trip
C9 = Supervisor Response

"Location 1" =((450)+(C3*10)+C4+C5+(C6*100))+(C7*100)+((C8*450)+(C8*(C3*10)))
"Location 2" =IF(C3<=15,(325+C4+C5+(C6*75)+(C7*150)+(C8*325)+(C9*150)),(C3<15)+(325+((C3-15)*9.07))+C4+C5+(C6*75)+(C7*150)+(C8*(325+((C3-15)*9.07))+(C9*150)))
"Location 3" =IF((C3)>20,(((C3-20)*7)+C4+C5+(C6*100))+(C7*100)+((C8*((C3-20)*7))),(C3<21)*0)

The point of this calculator is to figure out how much it would cost a customer to transport from a location based on the above list.

Any help at all with this would be appreciated.
Christian J
To do it in real time you need to use javascript. If you use a button, any server-side scripting language can be used (e.g. PHP).
Daeidon
Okay Javascript or PHP, is Javascript or any web code able to handle the complex math I'm attempting? I'm able to find simple stuff of course adding, subtracting, division, multiplication.

Is there javascript out there that can handle If/then? Less than or greater than?
Christian J
QUOTE(Daeidon @ Aug 27 2017, 10:59 PM) *

Okay Javascript or PHP, is Javascript or any web code able to handle the complex math I'm attempting? I'm able to find simple stuff of course adding, subtracting, division, multiplication.

That shouldn't be a problem, except perhaps for rounding errors. Take a look at this thread, it's a very similar project to your's: http://forums.htmlhelp.com/index.php?showtopic=59313

QUOTE
Is there javascript out there that can handle If/then? Less than or greater than?

Yes, this reference is a bit old now but should still explain it:
http://www.javascriptkit.com/jsref/conditionals.shtml
http://www.javascriptkit.com/jsref/arithme...operators.shtml


Daeidon
QUOTE(Christian J @ Aug 27 2017, 05:21 PM) *

QUOTE(Daeidon @ Aug 27 2017, 10:59 PM) *

Okay Javascript or PHP, is Javascript or any web code able to handle the complex math I'm attempting? I'm able to find simple stuff of course adding, subtracting, division, multiplication.

That shouldn't be a problem, except perhaps for rounding errors. Take a look at this thread, it's a very similar project to your's: http://forums.htmlhelp.com/index.php?showtopic=59313

QUOTE
Is there javascript out there that can handle If/then? Less than or greater than?

Yes, this reference is a bit old now but should still explain it:
http://www.javascriptkit.com/jsref/conditionals.shtml
http://www.javascriptkit.com/jsref/arithme...operators.shtml



Thank you, I'll dig into all of this.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.