From 0cc327b488a6c9cffec55a115c301bf6a3725b7d Mon Sep 17 00:00:00 2001 From: Thomas Mudrunka Date: Wed, 19 Jun 2013 00:52:24 +0200 Subject: [PATCH] Odstraneni podpory veci na pocet z kodu (jeste je potreba odstranit podporu z modelu) --- assistants/sell.inc.php | 43 +++++---------------------------- assistants/stats/roster.inc.php | 6 ++--- assistants/store.inc.php | 29 +++++----------------- 3 files changed, 14 insertions(+), 64 deletions(-) diff --git a/assistants/sell.inc.php b/assistants/sell.inc.php index 268f88f..d152714 100644 --- a/assistants/sell.inc.php +++ b/assistants/sell.inc.php @@ -34,42 +34,12 @@ switch($SUBPATH[0]) { $model_price_in = $this->db->map_unique('model_id', $model_id, 'model_price_in', 'model'); $model_price_out = $this->db->map_unique('model_id', $model_id, 'model_price_out', 'model'); - $model_countable = $this->db->map_unique('model_id', $model_id, 'model_countable', 'model'); - if($model_countable) { - $current[$item_id]['status_id'] = $status_id; - $current[$item_id]['item_customer'] = $item_customer; - $item_quantity = 1; - $current[$item_id]['item_price_out'] = $model_price_out; - $current[$item_id]['item_date_sold'] = date('Y-m-d'); - $hide_cols = $hide_cols_common; - } else { - $hide_cols = array_merge($hide_cols_common,array('item_price_out','item_note','item_customer','item_date_sold','location_id')); - $quantity_removed = $_GET['quantity']; - if($quantity_removed <= 0) $this->post_redirect_get("$URL_INTERNAL/1","Can't dispose non-possitive amount of items!"); - if(!is_numeric($quantity_removed)) $quantity_removed = 1; - $quantity_stored = $this->db->map_unique('item_serial', $item_serial, 'item_quantity', 'item', false); - if(!is_numeric($quantity_stored)) $quantity_stored = 0; - $item_quantity = $quantity_stored - $quantity_removed; - if($item_quantity < 0) $this->post_redirect_get("$URL_INTERNAL/1","You don't have enough stored items!"); - - - echo("Stock: ".$quantity_stored."
Disposing/Selling: ".$quantity_removed."
Keeping: ".$item_quantity); - - $current[$item_id]['item_quantity'] = $item_quantity; - $current[$item_id]['item_price_in'] -= $quantity_removed * $model_price_in; - $current[$item_id]['item_price_out'] -= $quantity_removed * $model_price_out; - - $forked_item[$item_id]['item_id'] = ''; - $forked_item[$item_id]['item_serial'] .= '@'.time(); - $forked_item[$item_id]['status_id'] = $status_id; - $forked_item[$item_id]['item_quantity'] = $quantity_removed; - $forked_item[$item_id]['item_price_in'] = $quantity_removed * $model_price_in; - $forked_item[$item_id]['item_price_out'] = $quantity_removed * $model_price_out; - $forked_item[$item_id]['item_customer'] = $item_customer; - $forked_item[$item_id]['item_date_sold'] = date('Y-m-d'); - - $forked_hide_cols = array_merge($hide_cols_common,array('item_price_out')); - } + $current[$item_id]['status_id'] = $status_id; + $current[$item_id]['item_customer'] = $item_customer; + $item_quantity = 1; + $current[$item_id]['item_price_out'] = $model_price_out; + $current[$item_id]['item_date_sold'] = date('Y-m-d'); + $hide_cols = $hide_cols_common; $columns = $this->db->get_columns('item'); $selectbox = $this->db->columns_get_selectbox($columns, 'item'); @@ -78,7 +48,6 @@ switch($SUBPATH[0]) { //echo $this->html->render_insert_form('item', $columns, $selectbox, $current, $hide_cols, $action); $insert_form[]=array('item', $columns, $selectbox, $current, $hide_cols, $action, false); - if(!$model_countable) $insert_form[]=array('item', $columns, $selectbox, $forked_item, $forked_hide_cols, $action, false); echo $this->html->render_insert_form_multi($insert_form); break; } diff --git a/assistants/stats/roster.inc.php b/assistants/stats/roster.inc.php index 6b525e4..e7a3dd6 100644 --- a/assistants/stats/roster.inc.php +++ b/assistants/stats/roster.inc.php @@ -1,7 +1,5 @@ - "select model_id, model_name, barcode_name, COUNT(item_serial), GROUP_CONCAT(item_serial separator ', ') from item LEFT JOIN barcode USING(barcode_id) LEFT JOIN model USING(model_id) WHERE item_valid_till=0 AND status_id=1 AND model_countable=1 GROUP BY model_id ORDER BY model_name", - "Inventurni soupiska věcí na počet (Warehouse roster uncountable)"=> - "select model_id, model_name, barcode_name, SUM(item_quantity) from item LEFT JOIN barcode USING(barcode_id) LEFT JOIN model USING(model_id) WHERE item_valid_till=0 AND status_id=1 AND model_countable=0 AND item_quantity>0 GROUP BY model_id ORDER BY model_name" + "Inventurni soupiska (Warehouse roster)"=> + "select model_id, model_name, barcode_name, COUNT(item_serial), GROUP_CONCAT(item_serial separator ', ') from item LEFT JOIN barcode USING(barcode_id) LEFT JOIN model USING(model_id) WHERE item_valid_till=0 AND status_id=1 GROUP BY model_id ORDER BY model_name", ); diff --git a/assistants/store.inc.php b/assistants/store.inc.php index 7e02e50..97e8922 100644 --- a/assistants/store.inc.php +++ b/assistants/store.inc.php @@ -26,36 +26,19 @@ switch($SUBPATH[0]) { $item_price_out = $this->db->map_unique('item_serial', $barcode, 'item_price_out', 'item', false); //$vendor_id = $this->db->map_unique('barcode_id', $barcode_id, 'vendor_id', 'item', false); - $countable = $this->db->map_unique('model_id', $model_id, 'model_countable', 'model'); - $serials=explode("\n",trim($_GET['serials'])); - if(!$countable || trim($_GET['serials']) == '') $serials = array(''); + if(trim($_GET['serials']) == '') $serials = array(''); foreach($serials as $serial) { $serial=trim($serial); $disable_cols = array('barcode_id','status_id','item_price_out','item_customer', 'model_id','item_quantity','item_date_sold','location_id','vendor_id','room_id'); - if($countable) { - $multi_insert = true; - //$disable_cols[] = 'item_quantity'; - $item_serial = $serial; - $item_quantity = $quantity_added = 1; - $action = $_SERVER['SCRIPT_NAME'].'/item/new'; - } else { - $multi_insert = false; - $quantity_added = $_GET['quantity']; - if($quantity_added <= 0) $this->post_redirect_get("$URL_INTERNAL/1","Can't store non-possitive amount of items!"); - if(!is_numeric($quantity_added)) $quantity_added = 1; - $quantity_stored = $this->db->map_unique('item_serial', $barcode, 'item_quantity', 'item', false); - if(!is_numeric($quantity_stored)) $quantity_stored = 0; - - $disable_cols[] = 'item_serial'; - $item_serial = $barcode; - $item_quantity = $quantity_stored + $quantity_added; - $action = $_SERVER['SCRIPT_NAME'].'/item/0/edit'; - echo('Stock: '.$quantity_stored.'
Storing: '.$quantity_added.'
Total: '.$item_quantity); - } + $multi_insert = true; + //$disable_cols[] = 'item_quantity'; + $item_serial = $serial; + $item_quantity = $quantity_added = 1; + $action = $_SERVER['SCRIPT_NAME'].'/item/new'; //print_r(array('
', $selectbox));
 			//foreach($selectbox['model_id'] as $id => $name) if($id != $model_id) unset($selectbox['model_id'][$id]);
-- 
2.30.2