X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fui%2Fitems_cart.inc;h=12e1ab244694ddbc2f9673aa43205ed4d1f3b06b;hb=628583995e3be96a346a9c078a41cf5ee0eab238;hp=2178fba1dfe5a467d34df7cc01b8bcdc77d2d720;hpb=a5242af68e65661edb7175412444dce536a7f311;p=fa-stable.git diff --git a/includes/ui/items_cart.inc b/includes/ui/items_cart.inc index 2178fba1..12e1ab24 100644 --- a/includes/ui/items_cart.inc +++ b/includes/ui/items_cart.inc @@ -18,8 +18,6 @@ class items_cart var $line_items; var $gl_items; - var $gl_item_count; - var $order_id; var $editing_item, $deleting_item; @@ -32,7 +30,8 @@ class items_cart var $memo_; var $person_id; var $branch_id; - + var $reference; + function items_cart($type) { $this->trans_type = $type; @@ -102,9 +101,7 @@ class items_cart if (isset($code_id) && $code_id != "" && isset($amount) && isset($dimension_id) && isset($dimension2_id)) { - $this->gl_items[$this->gl_item_count] = new gl_item($this->gl_item_count, - $code_id, $dimension_id, $dimension2_id, $amount, $reference, $description); - $this->gl_item_count++; + $this->gl_items[] = new gl_item($code_id, $dimension_id, $dimension2_id, $amount, $reference, $description); return true; } else @@ -116,24 +113,23 @@ class items_cart return false; } - function update_gl_item($index, $dimension_id, $dimension2_id, $amount, $reference, $description=null) + function update_gl_item($index, $code_id, $dimension_id, $dimension2_id, $amount, $reference, $description=null) { - $this->gl_items[$index]->index = $index; + $this->gl_items[$index]->code_id = $code_id; $this->gl_items[$index]->dimension_id = $dimension_id; $this->gl_items[$index]->dimension2_id = $dimension2_id; $this->gl_items[$index]->amount = $amount; $this->gl_items[$index]->reference = $reference; - if ($description != null) + if ($description == null) + $this->gl_items[$index]->description = get_gl_account_name($code_id); + else $this->gl_items[$index]->description = $description; } function remove_gl_item($index) { - if (isset($index)) - { - array_splice($this->gl_items, $line_no, 1); - } + array_splice($this->gl_items, $index, 1); } function count_gl_items() @@ -180,7 +176,6 @@ class items_cart unset($this->gl_items); $this->gl_items = array(); - $this->gl_item_count = 1; } } @@ -226,7 +221,9 @@ class line_item function check_qoh($location, $date_, $reverse) { - if (!sys_prefs::allow_negative_stock()) + global $SysPrefs; + + if (!$SysPrefs->allow_negative_stock()) { if (has_stock_holding($this->mb_flag)) { @@ -254,7 +251,6 @@ class line_item class gl_item { - var $index; var $code_id; var $dimension_id; var $dimension2_id; @@ -262,7 +258,7 @@ class gl_item var $reference; var $description; - function gl_item($index, $code_id, $dimension_id, $dimension2_id, $amount, $reference, + function gl_item($code_id, $dimension_id, $dimension2_id, $amount, $reference, $description=null) { //echo "adding $index, $code_id, $dimension_id, $amount, $reference
"; @@ -272,7 +268,6 @@ class gl_item else $this->description = $description; - $this->index = $index; $this->code_id = $code_id; $this->dimension_id = $dimension_id; $this->dimension2_id = $dimension2_id;