From: Maxime Bourget Date: Fri, 14 Jun 2013 21:40:45 +0000 (+0100) Subject: Display quantity left to pick for picked item instead of stock. X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=a372cf641c223420caaaa451922b3b7f03605ded;p=order_line_extra.git Display quantity left to pick for picked item instead of stock. --- diff --git a/haxe/ItemScheduler.hx b/haxe/ItemScheduler.hx index 57928f9..fb5a04f 100644 --- a/haxe/ItemScheduler.hx +++ b/haxe/ItemScheduler.hx @@ -143,9 +143,9 @@ class ItemScheduler { for(order in orders) { var quantity : Int = Std.parseInt(order.quantity); + var to_pick = toPick(order); // We don't need to remove the quantity which is picked // as we have already counted it in the initial location calculation. - quantity -= toPick(order); while(0 >= left && locationIter.hasNext()) { location = locationIter.next(); @@ -154,10 +154,13 @@ class ItemScheduler { left += quantityForLocation; formatLocation(location, "Delivery", left); } - left -= quantity; + if(to_pick>0) + qoh -= quantity + else + left -= quantity; var now = Date.now(); - formatOrder(order, left, now.getTime() > location.delivery.getTime() ? now : location.delivery, now); + formatOrder(order, to_pick>0 ? qoh : left, now.getTime() > location.delivery.getTime() ? now : location.delivery, now); } // display the left locations diff --git a/hincludes/lib/ItemScheduler.class.php b/hincludes/lib/ItemScheduler.class.php index 1c6b9ea..868dab2 100644 --- a/hincludes/lib/ItemScheduler.class.php +++ b/hincludes/lib/ItemScheduler.class.php @@ -236,7 +236,7 @@ class ItemScheduler { $order = $orders[$_g]; ++$_g; $quantity = Std::parseInt($order->quantity); - $quantity -= $this->toPick($order); + $to_pick = $this->toPick($order); while(0 >= $left && $locationIter->hasNext()) { $location = $locationIter->next(); $quantityForLocation = $location->quantityOnHand($this->stock_id, null) + $location->quantityOnOrder($this->stock_id); @@ -247,10 +247,14 @@ class ItemScheduler { $this->formatLocation($location, "Delivery", $left); unset($quantityForLocation); } - $left -= $quantity; + if($to_pick > 0) { + $qoh -= $quantity; + } else { + $left -= $quantity; + } $now = Date::now(); - $this->formatOrder($order, $left, ItemScheduler_6($this, $_g, $left, $location, $locationIter, $locations, $now, $order, $orders, $qoh, $quantity, $startDate, $total_picked), $now); - unset($quantity,$order,$now); + $this->formatOrder($order, (($to_pick > 0) ? $qoh : $left), ItemScheduler_6($this, $_g, $left, $location, $locationIter, $locations, $now, $order, $orders, $qoh, $quantity, $startDate, $to_pick, $total_picked), $now); + unset($to_pick,$quantity,$order,$now); } } while(0 >= $left && $locationIter->hasNext()) { @@ -338,7 +342,7 @@ function ItemScheduler_5(&$locations, &$startDate, $a, $b) { } } } -function ItemScheduler_6(&$»this, &$_g, &$left, &$location, &$locationIter, &$locations, &$now, &$order, &$orders, &$qoh, &$quantity, &$startDate, &$total_picked) { +function ItemScheduler_6(&$»this, &$_g, &$left, &$location, &$locationIter, &$locations, &$now, &$order, &$orders, &$qoh, &$quantity, &$startDate, &$to_pick, &$total_picked) { if($now->getTime() > $location->delivery->getTime()) { return $now; } else {