Hi,
I create an orders(parent table) and order_details(sub-form table), I would like to sum the Amount of sub-form table and update to the field called SubTotal of the parent table:
// OrderID_D - sub-form field that contain order id, Amount - total of each item
// SubTotal - parent field to keep total item amount of sub-form table
$id = makeSafe($data['OrderID_D']);
$tot = sqlValue("SELECT SUM(Amount) FROM order_details WHERE OrderID_D='$id' ");
sql("UPDATE orders SET SubTotal = '$tot' WHERE OrderID='$id'", $eo);
I get zero SubTotal after keeping the above code in the sub-form function order_details_after_update($data, $memberInfo, &$args), am I coded wrongly or keeping at the wrong function?
Any help will be appreciated.
Regards
Thomas Pang
Calculating total amount of detail sub-form.
-
- Posts: 11
- Joined: 2015-04-14 16:16
Calculating total amount of detail sub-form.
-----------------------------------
Thomas Pang
[email protected]
AppGini 25.13
Summary Report 3.4
Customizing AppGini web applications (Udemy)
Thomas Pang
[email protected]
AppGini 25.13
Summary Report 3.4
Customizing AppGini web applications (Udemy)
-
- Veteran Member
- Posts: 45
- Joined: 2015-04-15 06:33
- Location: Hyderabad
- Contact:
Re: Calculating total amount of detail sub-form.
Hello Thomas,
Please Check Your PM.
Please Check Your PM.
Re: Calculating total amount of detail sub-form.
Hi Thomas, did you manage to work out how to do it?