473,382 Members | 1,204 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Price calculation

I am need of a simple price calculation script that will give users a price on a Printed Circuit Board.

Here is an example:

I have a panel that is 18 dm˛. A customers wants 1 PCB that is 100mm X 200mm (=2 dm˛). The price is 20 € pr dm˛ which will give the customer a price that says 40 €.

The situation can also be that he wants more than 1 PCB.

What i then need in my script is for it to calculate the PCB's width and length (100mm X 200mm) and convert it to dm˛ and then multiple that number with the quantity of boards and then the price per dm˛.

Like so: 100mm x 200mm = (2dm˛) x 4 PCB's x 20€ = 160€

Additionally there could be some static values that should be added to the price. For example if the customer wants the board to be electrical tested he should pay 10 € extra, which would then be added to the final cost price.

Hope someone can get me started with this script.

I would be very gratefull to anyone who could help me.

Best regards
Jun 17 '08 #1
3 1575
acoder
16,027 Expert Mod 8TB
What have you managed so far? First get your form ready so you can code the script to take the variables and output the calculation.
Jun 17 '08 #2
Here is what i have so far:

[HTML]<form name="Onlinepriceform" method="post" action="onlineprice2.php">
<table>
<tr>
<td>Part Name</td>
<td>
<input type="text" name="part_name" id="part_name" />
</td>
</tr>
<tr>
<td>Quantity</td>
<td>
<input type="text" name="quantity" id="quantity" size="10" />
</td>
</tr>
<tr>
<td>Layers</td>
<td><select name="layers" id="layers" size="1">
<option selected="selected" value="2">2</option>
<option value="4">4</option>
<option value="6">6</option>
</select>
</td>
</tr>
<tr>
<td>Board size (width)</td>
<td>
<input name="Board_size_x" type="text" id="Board_size_x" size="10">
</td>
</tr>
<tr>
<td>Board size (lenght)</td>
<td>
<input name="Board_size_y" type="text" id="Board_size_y" size="10">
</td>
</tr>
<tr>
<td>Board thickness</td>
<td>
<input type="text" name="Board_thickness" size="10" id="Board_thickness" />
</td>
</tr>
<tr>
<td>Delivery (days)</td>
<td>
<select name="Delivery" id="Delivery">
<option selected="selected" value="4 days">4 days</option>
<option value="5 days">5 days</option>
<option value="6 days">6 days</option>
</select>
</td>
</tr>
<tr>
<td>Electrical Test</td>
<td>No<input name="e-test" type="radio" value="No" />
<br />
Yes<input name="e-test" type="radio" value="Yes" />
</td>
</tr>
<tr>
<td><input type="image" src="images/opnext.gif" name="send" style="border-style:none"></td>
</tr>
</table>
</form>[/HTML]
Jun 17 '08 #3
acoder
16,027 Expert Mod 8TB
Where are you going to display the price? What's going to trigger the price calculations? A button click or on each key press, or onchange or selection?

To get an element value, use document.getElementById(id).value. To convert it into an integer, use parseInt(). Try and see what you can come up with.
Jun 17 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Aspersion | last post by:
I'm building an ASP page that has a lot of text and graphics. There is a calculation facility on the page. The user enters several numbers in a form and presses a button to see the calculated...
5
by: Mark 123 | last post by:
Hi I have a form with the input fields: ProductName Quantity and output fields: ProductPrice
0
by: anaxamandr | last post by:
Hi. I have a long loop in ASP that performs a rather lengthy calculation. I would love for my users to be able to stop that calculation, if they so choose, mid way through the process. I attempted...
2
by: Del | last post by:
Thanks in advance for any help. I have a database that was created in Access 2000. Several users have been upgraded to Access 2003. Since upgrading to 2003 we have noticed that some of the...
1
by: cdelaney | last post by:
I have a form that I created a calculation on using 2003. The calculation works exactly like I want it to but ONLY on the first and last record. The calculation does not work/exist on records in...
4
by: Michiel Alsters | last post by:
Hello everybody, I hope anybody can help me. I'll try to give a brief overview of my problem. I have running a program that performs a heavy calculation. To give the user feedback what the...
5
by: The alMIGHTY N | last post by:
Hi all, Let's say I have a simple math formula: sum (x * y / 1000) / (sum z / 1000) I have to do this across 50 items, each with an x, y and z value, when the page first loads AND when a...
3
by: mattmao | last post by:
Okay, I was asked by a friend about the result of this limit: http://bbs.newwise.com/attdata/forumid_14/20070922_fe7f77c81050413a20fbDWYOGm7zeRj3.jpg Not n->zero but n-> + infinite I really...
12
by: brossyg | last post by:
I have a very simple price times quantity calculation. The input is STWCORQuant: <input name="STWCORQuant" class="contactitalicbold" id="STWCORQuant" onChange="javascript:STWCORPrice();"...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.