}
left -= quantity;
- formatOrder(order, left, location.delivery);
+ var now = Date.now();
+ //formatOrder(order, left, location.delivery); // now.getTime() > location.delivery ? now : location.delivery);
+ formatOrder(order, left, now.getTime() > location.delivery.getTime() ? now : location.delivery);
}
// display the left locations
/* The order can also be late if we need
* to wait for a delivery to get it
+ * or early if the item is on hold.
*/
var required_by : Date = FA.sql2date(order.required_date);
- if(required_by == null) required_by = FA.sql2date(order.delivery_date);
- if(required_by.getTime() < date.getTime()) {
+ if(required_by == null) required_by = FA.sql2date(order.expiry_date);
+ if(required_by != null && required_by.getTime() < date.getTime()) {
classes.push('late');
}
else {
- classes.push('on_time');
+ var hold_until : Date = FA.sql2date(order.hold_until_date);
+ php.Lib.print(hold_until);
+ php.Lib.print(date);
+ if(hold_until == null) hold_until = FA.sql2date(order.delivery_date);
+ if(hold_until.getTime() > date.getTime()) {
+ classes.push('early');
+ }
+ else {
+ classes.push('on_time');
+ }
}
var cells : Array <Dynamic> = [
order.order_id
,before
,left
,order.from_stk_loc
- ,order.delivery_date
+ ,order.hold_until_date
,order.required_date
,order.comment
];
}
$required_by = FA::sql2date($order->required_date);
if($required_by === null) {
- $required_by = FA::sql2date($order->delivery_date);
+ $required_by = FA::sql2date($order->expiry_date);
}
- if($required_by->getTime() < $date->getTime()) {
+ if($required_by !== null && $required_by->getTime() < $date->getTime()) {
$classes->push("late");
} else {
- $classes->push("on_time");
+ $hold_until = FA::sql2date($order->hold_until_date);
+ php_Lib::hprint($hold_until);
+ php_Lib::hprint($date);
+ if($hold_until === null) {
+ $hold_until = FA::sql2date($order->delivery_date);
+ }
+ if($hold_until->getTime() > $date->getTime()) {
+ $classes->push("early");
+ } else {
+ $classes->push("on_time");
+ }
}
- $cells = new _hx_array(array($order->order_id, "<a href=\"/modules/order_line_extra/order_lines_view.php?customer_id=" . Std::string($order->debtor_no) . "\">" . Std::string($order->deliver_to) . "</a>", "<input type=\"text\" name=\"" . $row_id . "[quantity]\" value=\"" . Std::string($order->quantity) . "\">", $before, $left, $order->from_stk_loc, $order->delivery_date, $order->required_date, $order->comment));
+ $cells = new _hx_array(array($order->order_id, "<a href=\"/modules/order_line_extra/order_lines_view.php?customer_id=" . Std::string($order->debtor_no) . "\">" . Std::string($order->deliver_to) . "</a>", "<input type=\"text\" name=\"" . $row_id . "[quantity]\" value=\"" . Std::string($order->quantity) . "\">", $before, $left, $order->from_stk_loc, $order->hold_until_date, $order->required_date, $order->comment));
$attributes->push("class=\"" . $classes->join(" ") . "\"");
$this->printRow($cells, $attributes);
}
unset($quantityForLocation);
}
$left -= $quantity;
- $this->formatOrder($order, $left, $location->delivery);
- unset($quantity,$order);
+ $now = Date::now();
+ $this->formatOrder($order, $left, ItemScheduler_4($this, $_g, $_g1, $left, $location, $locationIter, $locations, $now, $order, $qoh, $quantity, $startDate));
+ unset($quantity,$order,$now);
}
}
while(0 >= $left && $locationIter->hasNext()) {
}
}
}
+function ItemScheduler_4(&$»this, &$_g, &$_g1, &$left, &$location, &$locationIter, &$locations, &$now, &$order, &$qoh, &$quantity, &$startDate) {
+ if($now->getTime() > $location->delivery->getTime()) {
+ return $now;
+ } else {
+ return $location->delivery;
+ }
+}
$detail_id = $detail['id'];
$priority = $detail['priority'];
+ $priority_offset = 1;
$order_no = $detail['order_no'];
$trans_type = $detail['trans_type'];
$set = new SqlSet();
$set->addDate($first->start_date, 'hold_until_date')
->addDate($first->end_date, 'expiry_date')
- ->add($first->quantity, 'quantity', false)
- ->add($priority, 'priority');
+ ->add($first->quantity, 'quantity', false);
display_warning($set->toString());
db_query("UPDATE ".TB_PREF."sales_order_details
SET {$set->toString()}
// Compute common field for each split
$common_set = new SqlSet();
$common_set->add($order_no, 'order_no', false)
- ->add($priority, 'priority')
->add($trans_type, 'trans_type')
->add($detail['required_date'], 'required_date')
->add($detail['comment'], 'comment')
->add($split->quantity, 'quantity', false);
display_warning($set->toString());
db_query("INSERT INTO ".TB_PREF."sales_order_details
- SET {$set->toString()}"
+ SET {$set->toString()}
+ , priority = '$priority' + INTERVAL ${priority_offset} second"
,"Problem spliting order details $detail_id");
+ $priority_offset++;
}
return true;
tr.late {
background: #fc8;
}
+tr.early {
+ background: #def;
+ color: blue;
+}
tr.soldout {
background: pink;
,_("Quantity") => array('type' => 'qty', 'dec' => 0)
,_("Available") => array('fun' => 'available_quantity', 'dec' => 0, 'ord' => '')
,_("Before") => 'skip'
- ,_("Priority") => array('fun' => 'input_priority_date_details', 'ord' => '')
+ ,_("Priority") => array('type' => 'time', 'ord' => '')
,_("Hold Until") => array('fun' => 'input_hold_until_date_details', 'ord' => '')
,_("Require By") => array('fun' => 'input_required_date_details', 'ord' => '')
,_("Expiry Date") => array('fun' => 'input_expiry_date_details', 'ord' => '')