Calculating order totals on the fly |
7/30/2015 5:37:44 PM |
PHPRunner Tips and Tricks | |
Sergey Kornilov
Lets consider a simple order entry form where users create order and order details on the same screen. It will be handy to calculate order totals on the fly to save them in 'total' field of 'Orders' table. Here is how it's going to look in generated application.
{$footer} {END body} <script type="text/javascript" src="include/totals.js"> </script> </body> </html>
var ctrlPrice = Runner.getControl(pageid, 'price'); |
|
milver 2/22/2016 | |
How to do, to cancel or delete a OrderDetails decrease the value of excluded OrderDetails the total value of the Order? Lets consider a simple order entry form where users create order and order details on the same screen. It will be handy to calculate order totals on the fly to save them in 'total' field of 'Orders' table. Here is how it's going to look in generated application. This is how this can be done in your project. Note that this approach is purely Javascript-based and will work exactly the same way in ASPRunner.NET/ASPRunnerPro applications. [size="4"]1. Database structure[/size] [size="4"]2. Javascript code that calculates totals[/size] Create a text file named totals.js and save it in <output>/include folder. Paste the following code there:
var ctrlPrice = Runner.getControl(pageid, 'price'); |
jadachDevClub member 2/22/2016 | |
Looks like all JavaScript. I assume this can be used "as is" in ASPRunner.Net? |
Sergey Kornilov 2/22/2016 | |
Jerry, |
A
|
aalekizoglou 6/15/2016 |
Sergey, |
A
|
aalekizoglou 6/15/2016 |
Sergey, on a similar solution I have I a trying to call CalcTotals when deleting an item. So after seeing javascript struck I was lead to onDetailsDeleted function. Is there a way I can override this, or is there another solution to recalculate totals when deleting an order line or all of them
|
P
|
peterp 7/26/2016 |
Lets consider a simple order entry form where users create order and order details on the same screen. It will be handy to calculate order totals on the fly to save them in 'total' field of 'Orders' table. Here is how it's going to look in generated application. This is how this can be done in your project. Note that this approach is purely Javascript-based and will work exactly the same way in ASPRunner.NET/ASPRunnerPro applications. [size="4"]1. Database structure[/size] [size="4"]2. Javascript code that calculates totals[/size] Create a text file named totals.js and save it in <output>/include folder. Paste the following code there:
var ctrlPrice = Runner.getControl(pageid, 'price');
|
P
|
peterp 7/27/2016 |
Hi All, I have been trying to replicate this demonstration of totals being calculated on the fly and it seems I have missed something because I am unable to get this to perform as shown. I have setup the database to be exactly the same and I think that I have set all of the other parameters as I get the Orders and the orders detail on the same page and when I insert data into the fields the total field in the order header does not change. There must be something I'm not setting up I need this functionality as I'm developing a system for a client. Could somebody please help me as I have spent many hours on this trying to get some result, any help will be greatly appreciated. Best Regards, Peterp
|
J
|
jianwong 1/10/2020 |
Lets consider a simple order entry form where users create order and order details on the same screen. It will be handy to calculate order totals on the fly to save them in 'total' field of 'Orders' table. Here is how it's going to look in generated application. This is how this can be done in your project. Note that this approach is purely Javascript-based and will work exactly the same way in ASPRunner.NET/ASPRunnerPro applications. [size="4"]1. Database structure[/size] [size="4"]2. Javascript code that calculates totals[/size] Create a text file named totals.js and save it in <output>/include folder. Paste the following code there:
var ctrlPrice = Runner.getControl(pageid, 'price');
|
J
|
jianwong 1/10/2020 |
Hi Sergey I found this useful and replicated it in my project built with version 10.3. Do the javascript codes applicable to version 10.3? Because it won't calculate Total. Please advise. Thanks.
|
J
|
jacktonghkDevClub member 2/14/2020 |
Please don't bother. It works now. Thanks.
|
ruzgarajans 12/25/2020 | |
Hello to everyone, |
fhumanes 12/29/2020 | |
Hello: |
ruzgarajans 12/30/2020 | |
(I hope the dictionary has been translated successfully <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=93411&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />
|