trans_id>='$from' GROUP BY stock_id";
$result = db_query($sql, "The deliveries could not be updated");
$row = db_fetch_row($result);
trans_id>='$from' GROUP BY stock_id";
$result = db_query($sql, "The deliveries could not be updated");
$row = db_fetch_row($result);
$sql = "SELECT IF(type=".ST_SUPPRECEIVE." OR type=".ST_SUPPCREDIT.", price, standard_cost)
FROM ".TB_PREF."stock_moves
WHERE stock_id=".db_escape($stock_id)
$sql = "SELECT IF(type=".ST_SUPPRECEIVE." OR type=".ST_SUPPCREDIT.", price, standard_cost)
FROM ".TB_PREF."stock_moves
WHERE stock_id=".db_escape($stock_id)
trans_id<'$from' GROUP BY stock_id";
$result = db_query($sql, "The deliveries could not be updated");
$qoh = db_fetch_row($result);
trans_id<'$from' GROUP BY stock_id";
$result = db_query($sql, "The deliveries could not be updated");
$qoh = db_fetch_row($result);
$qty = $row[0] - $qoh[0]; //QOH prior to -ve stock is subtracted
$final_cost = $row[1] - $qoh[0]*$cost[0];
$qty = $row[0] - $qoh[0]; //QOH prior to -ve stock is subtracted
$final_cost = $row[1] - $qoh[0]*$cost[0];