code = $obj->loc_code; $this->name = $obj->location_name; $this->comment = $obj->delivery_address; $config_date = OrderXtraConfig::delivery($this->code); $this->delivery = (($config_date !== null) ? Date::fromString($config_date) : null); }} public function quantityOnHand($stock_id, $date) { if($this->qoh_cache === null || $stock_id !== $this->stock_id_cache) { $this->qoh_cache = get_qoh_on_date($stock_id, $this->code, $date); $this->stock_id_cache = $stock_id; } return $this->qoh_cache; } public function quantityOnOrder($stock_id) { $TB = FA::tb(); $sql = "SELECT SUM(quantity_ordered - quantity_received) as quantity\x0A\x09\x09\x09FROM " . $TB . "purch_order_details\x0A\x09\x09\x09NATURAL JOIN " . $TB . "purch_orders\x0A\x09\x09\x09WHERE item_code = \"" . $stock_id . "\" AND into_stock_location = \"" . $this->code . "\"\x0A\x09\x09\x09AND quantity_ordered > quantity_received\x0A\x09\x09\x09ORDER by delivery_date"; $result = FA::query($sql); if($result->hasNext()) { $row = php_Lib::objectOfAssociativeArray($result->next()); return $row->quantity; } else { return 0; } } public $stock_id_cache; public $qoh_cache; public $delivery; public $comment; public $name; public $code; public function __call($m, $a) { if(isset($this->$m) && is_callable($this->$m)) return call_user_func_array($this->$m, $a); else if(isset($this->»dynamics[$m]) && is_callable($this->»dynamics[$m])) return call_user_func_array($this->»dynamics[$m], $a); else if('toString' == $m) return $this->__toString(); else throw new HException('Unable to call «'.$m.'»'); } function __toString() { return 'Location'; } }