H
|
Henny Sol 11/14/2022 |
I guess you have some WorkOrder table for a Client in which you insert Spares amounts and Labour amounts. |
S
|
Sun author 11/14/2022 |
Yes Henny Sol. you are right |
H
|
Henny Sol 11/14/2022 |
I assume your WorkOrder table has a Key field Id1 and your Spares and Labour tables have as a Key Id1 (the WorkOrder) and Id2 (the Spares / Labour component you add to the order). A possible solution is:
// TotSpares
global $pageObject; |
S
|
Sun author 11/14/2022 |
Much appreciated. Shall give it a shot. |
S
|
Sun author 11/15/2022 |
Hi. i am still stuck. On attempting to implement this code i keep getting this error. Fatal error: Uncaught Error: Call to a member function fetchAssoc() on boolean in C:\projects phprunner\include\client_events.php:67 Stack trace: #0 C:\projects phprunner\classes\listpage.php(1489): eventclass_client->BeforeProcessRowList(Array, Object(ListPage_Simple)) #1 C:\projects phprunner\classes\listpage.php(1542): ListPage->beforeProccessRow() #2 C:\projects phprunner\classes\listpage.php(2310): ListPage->fillGridData() #3 C:\projects phprunner\client_list.php(154): ListPage->prepareForBuildPage() #4 {main} thrown in C:\projects phprunner\include\client_events.php on line 67 |
H
|
Henny Sol 11/15/2022 |
I'm puzzled about your data model. I would expect a Client table for your customers, an Order table for your workorders and Spares and Labour tables for the spares and labour you "consume" in the workorder. A client can "have" several orders. So in your error message I would expect a Listpage of an Order table and NOT of your Client table. I assume you want to see on the Order Listpage for each workorder the total amount (sum of spares and labour for each workorder). Maybe I misunderstood? |
S
|
Sun author 11/15/2022 |
Thanks Honey for your assistance. Your code works great. I only had to add a single curly bracket at the end. In the actual project the culprit was on the spelling of labour. |