left -= quantity;
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);
+ formatOrder(order, left, now.getTime() > location.delivery.getTime() ? now : location.delivery, now);
}
// display the left locations
return 'order_'+order.id;
}
- function formatOrder(order : Dynamic, left : Int, date : Date) {
+ function formatOrder(order : Dynamic, left : Int, date : Date, now : Date) {
var row_id = orderId(order);
var attributes = ['id = "'+row_id+'"'];
var classes = [];
}
else {
var hold_until : Date = FA.sql2date(order.hold_until_date);
- php.Lib.print(hold_until);
- php.Lib.print(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() - FA.preHoldOffset()) > date.getTime()) {
classes.push('early');
classes.push('on_time');
}
}
+
+ // Check if the order is expired
+ var expiry_date : Date = FA.sql2date(order.expiry_date);
+ if(expiry_date != null && (now.getTime() > expiry_date.getTime())) classes.push('expired');
var cells : Array <Dynamic> = [
- order.order_id
+ order.order_id
, '<a href="/modules/order_line_extra/order_lines_view.php?customer_id='+Std.string(order.debtor_no)+'">'+order.deliver_to+'</a>'
,'<input type="text" name="'+row_id+'[quantity]" value="'+order.quantity+'">'
,before
JOIN "+tb+"sales_orders so ON (so.order_no = d.order_id)
WHERE stock_id = '"+this.stock_id+"'
AND od.trans_type = 30
- ORDER by d.priority";
+ ORDER by quantity_before, d.priority";
return FA.query(sql);
}
}
public function loadOrders() {
$tb = TB_PREF;
- $sql = "SELECT * , d.quantity as qty, d.priority AS pp\x0A\x09\x09FROM " . $tb . "denorm_order_details_queue d\x0A\x09\x09JOIN " . $tb . "sales_order_details od ON (od.id = d.id)\x0A\x09\x09JOIN " . $tb . "sales_orders so ON (so.order_no = d.order_id)\x0A\x09\x09WHERE stock_id = '" . $this->stock_id . "'\x0A\x09\x09AND od.trans_type = 30\x0A\x09\x09ORDER by d.priority";
+ $sql = "SELECT * , d.quantity as qty, d.priority AS pp\x0A\x09\x09FROM " . $tb . "denorm_order_details_queue d\x0A\x09\x09JOIN " . $tb . "sales_order_details od ON (od.id = d.id)\x0A\x09\x09JOIN " . $tb . "sales_orders so ON (so.order_no = d.order_id)\x0A\x09\x09WHERE stock_id = '" . $this->stock_id . "'\x0A\x09\x09AND od.trans_type = 30\x0A\x09\x09ORDER by quantity_before, d.priority";
return FA::query($sql);
}
public function formatLocation($location, $type, $left) {
$cells = new _hx_array(array($type, $location->name, $location->quantityOnHand($this->stock_id, null), $left - $location->quantityOnHand($this->stock_id, null), $left, $location->code, ((_hx_equal($location->delivery->getTime(), 0)) ? "" : DateTools::format($location->delivery, "%F")), "", ""));
$this->printRow($cells, new _hx_array(array("class = \"tableheader location\"", "id = \"loc_" . $location->code . "\"")));
}
- public function formatOrder($order, $left, $date) {
+ public function formatOrder($order, $left, $date, $now) {
$row_id = ItemScheduler::orderId($order);
$attributes = new _hx_array(array("id = \"" . $row_id . "\""));
$classes = new _hx_array(array());
$classes->push("late");
} else {
$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);
}
$classes->push("on_time");
}
}
+ $expiry_date = FA::sql2date($order->expiry_date);
+ if($expiry_date !== null && $now->getTime() > $expiry_date->getTime()) {
+ $classes->push("expired");
+ }
$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);
}
$left -= $quantity;
$now = Date::now();
- $this->formatOrder($order, $left, ItemScheduler_4($this, $_g, $_g1, $left, $location, $locationIter, $locations, $now, $order, $qoh, $quantity, $startDate));
+ $this->formatOrder($order, $left, ItemScheduler_4($this, $_g, $_g1, $left, $location, $locationIter, $locations, $now, $order, $qoh, $quantity, $startDate), $now);
unset($quantity,$order,$now);
}
}