From: Thomas Mudrunka Date: Tue, 24 Jul 2012 13:48:02 +0000 (+0200) Subject: Fix vetsiny veci co se posraly presunutim barcodu do zvlastni tabulky X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=eca3fc1db94c023c08354046b96cca0401fc49fc;p=mirrors%2FSokoMan.git Fix vetsiny veci co se posraly presunutim barcodu do zvlastni tabulky --- diff --git a/assistants/sell.inc.php b/assistants/sell.inc.php index ecdd3c6..73e096e 100644 --- a/assistants/sell.inc.php +++ b/assistants/sell.inc.php @@ -29,7 +29,8 @@ switch($SUBPATH[0]) { $current[$item_id]['item_author'] = $this->db->auth->get_user_id(); $forked_item = $current; - $model_id = $this->db->map_unique('item_serial', $item_serial, 'model_id', 'item'); + $barcode_id = $this->db->map_unique('item_id', $item_id, 'barcode_id', 'item'); + $model_id = $this->db->map_unique('barcode_id', $barcode_id, 'model_id', 'barcode'); $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'); diff --git a/assistants/stats/reserve.inc.php b/assistants/stats/reserve.inc.php index a2a4c13..b60ec2d 100644 --- a/assistants/stats/reserve.inc.php +++ b/assistants/stats/reserve.inc.php @@ -1,14 +1,16 @@ 'SELECT model_id,model_name,model_barcode,model_reserve,model_reserve as item_quantity_to_buy'. ' FROM model'. ' WHERE model_reserve>0 AND NOT EXISTS'. ' (SELECT item_id FROM item WHERE model.model_id=item.model_id AND status_id=1 AND item_quantity>0 AND item_valid_till=0)', +*/ "Nakoupit: Dochází (WishList)" => 'SELECT model_id,model_name,model_barcode,model_reserve,'. ' COUNT(item_id),SUM(item_quantity),model_reserve-SUM(item_quantity) as item_quantity_to_buy'. - ' FROM item LEFT JOIN model USING(model_id)'. + ' 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'. ' HAVING SUM(item_quantity) - "select model_id, model_name, model_barcode, COUNT(item_serial), GROUP_CONCAT(item_serial separator ', ') from item 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", + "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, model_barcode, SUM(item_quantity) from item LEFT JOIN model USING(model_id) WHERE item_valid_till=0 AND status_id=1 AND model_countable=0 GROUP BY model_id ORDER BY model_name" + "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 GROUP BY model_id ORDER BY model_name" ); diff --git a/assistants/stats/stock.inc.php b/assistants/stats/stock.inc.php index b71d022..1cec846 100644 --- a/assistants/stats/stock.inc.php +++ b/assistants/stats/stock.inc.php @@ -2,8 +2,8 @@ $queries += array( "Ceník + Počet kusů skladem (PriceList + Stock)" => 'SELECT room_id,room_name,model_id,model_name,model_barcode,model_price_out,COUNT(item_id),SUM(item_quantity)'. - ' FROM item LEFT JOIN model USING(model_id) LEFT JOIN room USING(room_id)'. + ' FROM item LEFT JOIN barcode USING(barcode_id) LEFT JOIN model USING(model_id) LEFT JOIN room USING(room_id)'. ' WHERE item_valid_till=0 AND status_id=1'. ' GROUP BY model_id,room_id'. - ' ORDER BY room_id,model_id;', + ' ORDER BY room_id,model_id;' ); diff --git a/assistants/store.inc.php b/assistants/store.inc.php index 7b9bf27..6c11653 100644 --- a/assistants/store.inc.php +++ b/assistants/store.inc.php @@ -5,24 +5,27 @@ switch($SUBPATH[0]) { echo $this->html->form("$URL/2", 'GET', array( array('barcode',$barcode,'text',false,'autofocus','model_barcode:'), array('quantity','1','text',false,false,'quantity:'), - array('serials',$barcode,'textarea',false,'autofocus','serial(s):'), + array('serials','','textarea',false,'autofocus','serial(s):'), array(false,'STORE','submit') )); break; case 2: $barcode=$_GET['barcode']; - $countable = $this->db->map_unique('model_barcode', $barcode, 'model_countable', 'model'); + + $barcode_id = $this->db->map_unique('barcode_name', $barcode, 'barcode_id', 'barcode'); + $model_id = $this->db->map_unique('barcode_id', $barcode_id, 'model_id', 'barcode'); + $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'); + $item_price_in = $this->db->map_unique('item_serial', $barcode, 'item_price_in', 'item', false); + $item_price_out = $this->db->map_unique('item_serial', $barcode, 'item_price_out', '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(''); foreach($serials as $serial) { $serial=trim($serial); - $model_id = $this->db->map_unique('model_barcode', $barcode, 'model_id', 'model'); - $item_price_in = $this->db->map_unique('item_serial', $barcode, 'item_price_in', 'item', false); - $item_price_out = $this->db->map_unique('item_serial', $barcode, 'item_price_out', 'item', false); - $model_price_in = $this->db->map_unique('model_barcode', $barcode, 'model_price_in', 'model'); - $model_price_out = $this->db->map_unique('model_barcode', $barcode, 'model_price_out', 'model'); $disable_cols = array('status_id','item_price_out','item_customer', 'model_id','item_quantity','item_date_sold'); if($countable) { @@ -52,7 +55,7 @@ switch($SUBPATH[0]) { //print_r(array('
', $selectbox));
 			//foreach($selectbox['model_id'] as $id => $name) if($id != $model_id) unset($selectbox['model_id'][$id]);
 			$current = array(array(
-				'model_id' => $model_id,
+				'barcode_id' => $barcode_id,
 				'item_serial' => $item_serial,
 				'item_quantity' => $item_quantity,
 				'status_id' => 1,
diff --git a/index.php b/index.php
index c944d1a..cf90185 100755
--- a/index.php
+++ b/index.php
@@ -364,6 +364,11 @@ EOF;
 				'barcode_name' => array(array('store','assistant/%d?barcode=%v')),
 				'model_name' => array(array('google','http://google.com/search?q=%v')) //TODO: add manufacturer to google query
 			),
+			'barcode' => array(
+				'model_id' => array(array('model',$where_url)),
+				'barcode_id' => array(array('item',$where_url),array('edit','barcode/%v/edit/')),
+				'barcode_name' => array(array('store','assistant/%d?barcode=%v')),
+			),
 			'item' => array(
 				'item_serial' => array(array('dispose','assistant/%d?serial=%v','in_stock'),array('sell','assistant/%d?serial=%v','in_stock')),
 				'item_id' => array(array('edit','item/%v/edit/'))
diff --git a/install.sql b/install.sql
index 8c238cc..c69ac1a 100644
--- a/install.sql
+++ b/install.sql
@@ -230,7 +230,7 @@ UNLOCK TABLES;
 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
 
--- Dump completed on 2012-07-24 15:03:20
+-- Dump completed on 2012-07-24 15:47:56
 
 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
 /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@@ -273,7 +273,7 @@ CREATE TABLE `item` (
   CONSTRAINT `item_ibfk_6` FOREIGN KEY (`vendor_id`) REFERENCES `vendor` (`vendor_id`),
   CONSTRAINT `item_ibfk_8` FOREIGN KEY (`status_id`) REFERENCES `status` (`status_id`),
   CONSTRAINT `item_ibfk_9` FOREIGN KEY (`room_id`) REFERENCES `room` (`room_id`)
-) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
+) ENGINE=InnoDB AUTO_INCREMENT=46 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
 /*!40101 SET character_set_client = @saved_cs_client */;
 DROP TABLE IF EXISTS `model`;
 /*!40101 SET @saved_cs_client     = @@character_set_client */;