}
-function insert_pick($sku, $order_id, $detail_id, $debtor_no, $branch_code, $to_pick, $quantity) {
+function insert_pick($sku, $order_id, $detail_id, $debtor_no, $branch_code, $to_pick, $quantity, $qoh_location=null) {
+ if($qoh_location == null) $qoh_location = OrderXtraConfig::$default_location;
$item_link = "/modules/order_line_extra/item_schedule.php?stock_id=$sku";
$order_link = "/sales/sales_order_entry.php?OrderNumber=$order_id";
$base = substr($sku, 0, 8);
type = 'booked'";
db_query($sql, 'There was a problem inserting the picking information.');
+ # add QOH
+ $qoh = get_qoh_on_date($sku, $qoh_location);
+ $sql = "INSERT INTO ".TB_PREF."topick SET
+ order_id = $order_id,
+ order_link = '$order_link',
+ location = '$location',
+ sku = '$sku',
+ item_link = '$item_link',
+ base = '$base',
+ variation = '$variation',
+ quantity = $qoh,
+ detail_id = $detail_id,
+ type = 'stock'";
+ db_query($sql, 'There was a problem inserting the picking information.');
+
}
function update_pick($detail_id, $to_pick) {