This topic is locked
[SOLVED]

 Master detail reverse autofill

4/8/2017 7:00:26 AM
PHPRunner General questions
jgeorgiou author

Hi
I have a table order

On add page i use lookup to choose article and i get via autofill price and works fine

after that user fills the quantity and saves.
Question is how can i update articles table that has a field quantity and i should remove the last order's quantity.
So what should i do to update it when i add an order?
PS

I dont use it as master-detail , i just use lookup when someone adds an order to choose article and get the price of it (via autofill)

jgeorgiou author 4/8/2017

i use lookup when i add an order to choose article and i use autofill option to get price too (from articles table) and using it.

While saving order i want to update quantity of articles table (to remove the quantity used to order)
Is it DAL best practice? (something like that to an event?)
global $dal;

$tblitems = $dal->Table("articles");

$tblitems->Param["article"]= (what should i use here for article field of order table?)

$tblitems->Value["quantity"]= (what should i use here for quantity field of order table decreased by 1?)

$tblitems->Update();

romaldus 4/8/2017



Hi
I have a table order

On add page i use lookup to choose article and i get via autofill price and works fine

after that user fills the quantity and saves.
Question is how can i update articles table that has a field quantity and i should remove the last order's quantity.
So what should i do to update it when i add an order?
PS

I dont use it as master-detail , i just use lookup when someone adds an order to choose article and get the price of it (via autofill)


What do you mean with....."

romaldus 4/9/2017

For example, in after record added event:



global $conn;

$strSQLUpdate = "UPDATE articles_table SET qty = 0 WHERE. article_id = ".$values['article'].")";

db_exec($strSQLInsert,$conn);