This topic is locked

Calculate order totals on the fly issues

2/16/2020 5:30:50 AM
PHPRunner General questions
J
jacktonghk authorDevClub member

I have followed the calculate order totals on the fly sample by admin. However, I have 2 issues in my work.

  1. When I open an existing order and append new details to the end, the total only includes the newly added value but not adding up the existing values
  2. My codes do not work when I cancel/delete a detail record.
    I believe I might miss something. Could anyone let me know how to make it work? Thank you in advancec.

Sergey Kornilov admin 2/18/2020

I'm not sure what article you referring to but this is the suggested approach in the manual and it takes care of inline add, edit and delete:

https://xlinesoft.com/phprunner/docs/show_order_total_on_the_edit_page_as_the_details_table_is_updated.htm

J
jacktonghk authorDevClub member 2/19/2020



I'm not sure what article you referring to but this is the suggested approach in the manual and it takes care of inline add, edit and delete:

https://xlinesoft.com/phprunner/docs/show_order_total_on_the_edit_page_as_the_details_table_is_updated.htm


Thank you for your reply. I followed the instructions and it works. However, it seems that it does not work when I start from scratch, ie., no existing detail records. How can I do the same for brand new details? Thanks again.

Sergey Kornilov admin 2/19/2020

Yes, it should work in all cases.

J
jacktonghk authorDevClub member 2/22/2020

After I moved the total field to the header page, it worked.
But now I have another issue. I used the same logic for another field, share the same CHANGE event. But changing the new field value didn't invoke the change event. How can I debug the coding? Thanks.

Sergey Kornilov admin 2/24/2020

If you want to learn how to debug Javascript I recommend to start by watching this video:

https://www.youtube.com/watch?v=H0XScE08hy8

J
jacktonghk authorDevClub member 3/1/2020



If you want to learn how to debug Javascript I recommend to start by watching this video:

https://www.youtube.com/watch?v=H0XScE08hy8


I have fixed the issue. Thank you. Now I have 2 calculated fields in the header page, namely 'cr_amt' and 'dr_amt'. I would like to compare these two values before I save the header. I think I should use the onload event in the header page but how can I read the value of the calculated fields? Thanks.