-
- function check_qoh($location, $date_, $reverse)
- {
- global $SysPrefs;
-
- if (!$SysPrefs->allow_negative_stock())
- {
- if (has_stock_holding($this->mb_flag))
- {
- $quantity = $this->quantity;
- if ($reverse)
- $quantity = -$this->quantity;
-
- if ($quantity >= 0)
- return null;
-
- $qoh = get_qoh_on_date($this->stock_id, $location, $date_);
- if ($quantity + $qoh < 0)
- {
- return $this;
- }
- }
- }
-
- return null;
- }