public function getStockBalance() { if ($this->stitem) { $locations = $this->despatch_from->rules_list('from_whlocation_id'); $balance = new STBalance(); return $balance->getStockBalance($this->stitem_id, $locations); } return 0; }