The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Complex Calculations possibly in realtime, I need some guidance on how to handle complex calculations in realtime
Daeidon
post Aug 27 2017, 09:41 AM
Post #1





Group: Members
Posts: 3
Joined: 27-August 17
Member No.: 26,483



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Aug 27 2017, 10:13 AM
Post #2


.
********

Group: WDG Moderators
Posts: 9,630
Joined: 10-August 06
Member No.: 7



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).
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Daeidon
post Aug 27 2017, 03:59 PM
Post #3





Group: Members
Posts: 3
Joined: 27-August 17
Member No.: 26,483



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?

This post has been edited by Daeidon: Aug 27 2017, 04:00 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Aug 27 2017, 04:21 PM
Post #4


.
********

Group: WDG Moderators
Posts: 9,630
Joined: 10-August 06
Member No.: 7



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


User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Daeidon
post Aug 27 2017, 06:29 PM
Post #5





Group: Members
Posts: 3
Joined: 27-August 17
Member No.: 26,483



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th March 2024 - 05:24 AM