BullGuard Antivirus Sale - 60% Off with openElement !
Forum Home Forum Home >

openElement

> Scripts for Your Website
  New Posts New Posts RSS Feed - Calculation script
  FAQ FAQ  Forum Search   Register Register  Login Login

Calculation script

 Post Reply Post Reply Page  <12
Author
Message
Hobby001 View Drop Down
Admin Group
Admin Group
Avatar

Joined: Jun 05 2018
Location: Canada, Québec
Status: Offline
Points: 6194
Post Options Post Options   Thanks (0) Thanks(0)   Quote Hobby001 Quote  Post ReplyReply Direct Link To This Post Posted: Nov 26 2020 at 8:09am
If you plan to use different factors depending on the drop list selection, there are other changes to do
Back to Top
Hobby001 View Drop Down
Admin Group
Admin Group
Avatar

Joined: Jun 05 2018
Location: Canada, Québec
Status: Offline
Points: 6194
Post Options Post Options   Thanks (0) Thanks(0)   Quote Hobby001 Quote  Post ReplyReply Direct Link To This Post Posted: Nov 26 2020 at 9:01am
Just in case my assumption is good

Change the value of each selection in the drop list

Click to select => 0
Bonding Plaster Primer => 3.6
etc

Then use the following code:

$('#WEcombo_primer select').change(
function(){
calculate_quantity();
}
);

$('.Chosen_Fields input').keyup(
function(){
calculate_quantity();
}
);

function calculate_quantity(){
var $area = $('#WEedit_primer_width input').val() * $('#WEedit_primer_height input').val();
if (($area>0)&&($('#WEcombo_primer select').val()>0)){
$('#WEedit_primer_qty_calc input').val(Math.ceil($area / $('#WEcombo_primer select').val()));
} else {
$('#WEedit_primer_qty_calc input').val("");
}
}




Edited by Hobby001 - Nov 26 2020 at 9:04am
Back to Top
sevens View Drop Down
Newbie
Newbie
Avatar

Joined: Nov 25 2020
Location: Namibia
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote sevens Quote  Post ReplyReply Direct Link To This Post Posted: Nov 26 2020 at 9:14am
Invaluable assistance, thank you very much. I would have been totally lost in the dark. 

Off the calculation script topic, I cannot seem to get the dropdown list element to have the same height as the text input fields height, it thus looks a bit odd on the page.

The next headache would be to be able to save the selected & entered values by date and time to a database that can be navigated, and as it is navigated, re calculated...
Riaan S
Back to Top
sevens View Drop Down
Newbie
Newbie
Avatar

Joined: Nov 25 2020
Location: Namibia
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote sevens Quote  Post ReplyReply Direct Link To This Post Posted: Nov 26 2020 at 9:23am
Yes, your assumption is spot on, the "paint spreadrate" differ by paint type and substrate, and needs to be calculated differently for each type, as it is selected.

Too make it fancier, the calculated total could be split into quantities of 20L, 5L & 1L buckets. For example if the total is 126L, paint buckets would be 6 x 20L + 1 x 5L + 1 x 1L.
Riaan S
Back to Top
Hobby001 View Drop Down
Admin Group
Admin Group
Avatar

Joined: Jun 05 2018
Location: Canada, Québec
Status: Offline
Points: 6194
Post Options Post Options   Thanks (0) Thanks(0)   Quote Hobby001 Quote  Post ReplyReply Direct Link To This Post Posted: Nov 26 2020 at 9:25am


Back to Top
Hobby001 View Drop Down
Admin Group
Admin Group
Avatar

Joined: Jun 05 2018
Location: Canada, Québec
Status: Offline
Points: 6194
Post Options Post Options   Thanks (0) Thanks(0)   Quote Hobby001 Quote  Post ReplyReply Direct Link To This Post Posted: Nov 26 2020 at 9:27am
On the database side you need good knowledge of php and sql

Do you have the required skills?
Back to Top
Hobby001 View Drop Down
Admin Group
Admin Group
Avatar

Joined: Jun 05 2018
Location: Canada, Québec
Status: Offline
Points: 6194
Post Options Post Options   Thanks (0) Thanks(0)   Quote Hobby001 Quote  Post ReplyReply Direct Link To This Post Posted: Nov 26 2020 at 9:30am
You can also save the data to a text file that you can download and rework using excel or access
Back to Top
sevens View Drop Down
Newbie
Newbie
Avatar

Joined: Nov 25 2020
Location: Namibia
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote sevens Quote  Post ReplyReply Direct Link To This Post Posted: Nov 26 2020 at 9:46am
I have done a few sql queries many years ago, using delphi with a firebird database. Mostly just linking invisible & visible components in delphi to the db & writing a few queries to extrct view and sort data.
Riaan S
Back to Top
Hobby001 View Drop Down
Admin Group
Admin Group
Avatar

Joined: Jun 05 2018
Location: Canada, Québec
Status: Offline
Points: 6194
Post Options Post Options   Thanks (0) Thanks(0)   Quote Hobby001 Quote  Post ReplyReply Direct Link To This Post Posted: Nov 26 2020 at 10:37am
If you want do do it on your WEB site 

You need to know 

what's available on your hosting service MySql or MySQLi.
how to handle database connections to your page
how to secure your data
how to write php code
how to write sql queries and display them on a web page
and maybe more than that

Otherwise you will need to contract it out.

As an alternate solution, using php, you can save your data on a text file on your host and download it when required to rework it with whatever tool you know.


Edited by Hobby001 - Nov 26 2020 at 11:37am
Back to Top
 Post Reply Post Reply Page  <12
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.078 seconds.