From: Maxime Bourget Date: Sat, 15 Jun 2013 09:05:06 +0000 (+0100) Subject: topick insertion works! X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=98a1e4a1e70773415bffc6d286adf37b1c50996e;p=order_line_extra.git topick insertion works! --- diff --git a/haxe/ItemScheduler.hx b/haxe/ItemScheduler.hx index 95f55f6..1ff94e0 100644 --- a/haxe/ItemScheduler.hx +++ b/haxe/ItemScheduler.hx @@ -416,8 +416,7 @@ function update() { untyped __call__ ('update_order_detail_priority', order.id, new_priority.toString()); // Update to pick table if needed - if (Std.parseInt(order.quantity) != toPick(order)) { - //untyped __call__ ('update_pick', order.id, toPick(order)); + if (Std.parseInt(order.to_pick) != toPick(order)) { untyped __call__ ('update_pick', order.id, toPick(order)); } diff --git a/hincludes/lib/ItemScheduler.class.php b/hincludes/lib/ItemScheduler.class.php index c6ca68d..89fb784 100644 --- a/hincludes/lib/ItemScheduler.class.php +++ b/hincludes/lib/ItemScheduler.class.php @@ -35,7 +35,7 @@ class ItemScheduler { ++$_g; $new_priority = DateTools::delta($p, 1000 * $position); update_order_detail_priority($order->id, $new_priority->toString()); - if(Std::parseInt($order->quantity) !== $this->toPick($order)) { + if(Std::parseInt($order->to_pick) !== $this->toPick($order)) { update_pick($order->id, $this->toPick($order)); } $position += 1; diff --git a/includes/picking.inc b/includes/picking.inc index b65d23f..7e8beb3 100644 --- a/includes/picking.inc +++ b/includes/picking.inc @@ -125,14 +125,16 @@ function insert_pick($sku, $order_id, $detail_id, $debtor_no, $branch_code, $to_ } function update_pick($detail_id, $to_pick) { - echo $detail_id, " ", $to_pick, "
"; // delete existing $sql = "DELETE FROM ".TB_PREF."topick WHERE detail_id = $detail_id "; - echo db_query($sql); - $sql = "SELECT stk_code AS stock_id, order_no AS order_id, debtor_no, branch_code, quantity-qty_sent AS quantity + $sql = "SELECT stk_code AS stock_id + , order_no AS order_id + , debtor_no + , branch_code + , quantity-qty_sent AS quantity FROM ".TB_PREF."sales_orders so NATURAL JOIN ".TB_PREF."sales_order_details sod WHERE sod.id = $detail_id @@ -141,7 +143,7 @@ function update_pick($detail_id, $to_pick) { $row = db_fetch($result); foreach($row as $key => $value) { $$key = $value; } - + insert_pick($stock_id, $order_id, $detail_id, $debtor_no, $branch_code, $to_pick, $quantity); }