Add QOH in MOP
authorMaxime Bourget <bmx007@gmail.com>
Sat, 15 Jun 2013 12:05:14 +0000 (13:05 +0100)
committerMaxime Bourget <bmx007@gmail.com>
Sat, 15 Jun 2013 12:05:14 +0000 (13:05 +0100)
includes/picking.inc

index 2713dc16bfab6312101eda8c010f152613a24197..d4141dc233e9972544361c683acabd69fe7e5e13 100644 (file)
@@ -86,7 +86,8 @@ function pick_query() {
 
 }
 
-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);
@@ -122,6 +123,21 @@ function insert_pick($sku, $order_id, $detail_id, $debtor_no, $branch_code, $to_
                        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) {