Quantcast
Channel: ASPRunner forums
Viewing all articles
Browse latest Browse all 2586

after record added delete records other table

$
0
0
Hi,

I have two tables
1 stock table with a number_part column
2 table export with a number_part column
and wanted to add the data in export to delete it from stock. it's possible?

I did tests with the afetr aded event
with this code
global $conn;

$StockData = $pageObject->getMasterRecord(); // Returns an array of the master record
$StockData["part_stock"]; //Get current stock count


IF($values["mvt_type"] == "I")
{
$NewStock = $StockData["part_stock"] + $values["mvt_qty"]; // Add value to current stock
}
ELSE
{
$NewStock = $StockData["part_stock"] - $values["mvt_qty"]; // Deduct value from current stocck
}

//Update the new stock count to the parent stock part number
$StockUpdate = "UPDATE stock SET `part_stock` = ".$NewStock." where `part_no` = ".$values["part_no"]."";
db_exec($StockUpdate,$conn);

Viewing all articles
Browse latest Browse all 2586

Trending Articles