<?php
$queries += array(
-/*
- "Nakoupit: Došlo úplně (Urgent WishList)" //TODO: Reinvent
- => 'SELECT model_id,model_name,model_barcode,model_reserve,model_reserve as item_quantity_to_buy'.
- ' FROM model'.
+ "Nakoupit: Došlo úplně (Urgent WishList)"
+ => 'SELECT model_id,model_name,barcode_name,model_reserve,model_reserve as item_quantity_to_buy'.
+ ' FROM model LEFT JOIN barcode USING(model_id)'.
' 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)',
-*/
+ ' (SELECT item_id FROM item WHERE barcode.barcode_id=item.barcode_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,'.
+ => 'SELECT model_id,model_name,barcode_name,model_reserve,'.
' COUNT(item_id),SUM(item_quantity),model_reserve-SUM(item_quantity) as item_quantity_to_buy'.
' FROM item LEFT JOIN barcode USING(barcode_id) LEFT JOIN model USING(model_id)'.
' WHERE item_valid_till=0 AND status_id=1'.
<?php
$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)'.
+ => 'SELECT room_id,room_name,model_id,model_name,barcode_name,model_price_out,COUNT(item_id),SUM(item_quantity)'.
' 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'.
$relations = array( //TODO: Autodetect??? //TODO: Add [edit] link to all classes
'model' => array(
'model_id' => array(array('item',$where_url),array('barcode',$where_url),array('edit','model/%v/edit/'),array('barcode',$insert_url)),
- //'model_barcode' => array(array('store','assistant/%d?barcode=%v')),
+ 'model_barcode' => array(array('store','assistant/%d?barcode=%v')),
'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
),
function table_hide_columns(&$table, $class) { //TODO: Move to build_query_select() !!! :-)))
$fields_hide = array(
- 'model' => array('model_barcode','barcode_name'),
- 'barcode' => array('model_barcode','model_price_in','model_price_out','model_reserve','producer_name','producer_note','model_eshop_hide','category_name','model_countable','model_descript'),
+ 'model' => array('barcode_name'),
+ 'barcode' => array('model_price_in','model_price_out','model_reserve','producer_name','producer_note','model_eshop_hide','category_name','model_countable','model_descript'),
'item' => array('model_descript','model_price_in','model_price_out','barcode_name','model_barcode','model_countable','model_reserve','model_eshop_hide','room_descript','room_author','producer_name','producer_note','vendor_note','location_author','location_gps','location_description')
);
//print_r($table); die();
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2012-07-24 15:47:56
+-- Dump completed on 2012-07-25 23:41:18
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
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=46 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
+) ENGINE=InnoDB AUTO_INCREMENT=47 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 */;
`model_name` varchar(64) COLLATE utf8_czech_ci NOT NULL,
`producer_id` int(11) NOT NULL DEFAULT '0',
`category_id` int(11) NOT NULL DEFAULT '0',
- `model_barcode` varchar(128) COLLATE utf8_czech_ci NOT NULL,
`model_countable` int(1) NOT NULL DEFAULT '1',
`model_price_in` decimal(9,2) DEFAULT NULL,
`model_price_out` decimal(9,2) DEFAULT NULL,
`model_eshop_hide` int(1) unsigned NOT NULL DEFAULT '0',
`model_descript` varchar(1024) COLLATE utf8_czech_ci NOT NULL,
PRIMARY KEY (`model_id`),
- UNIQUE KEY `model_barcode` (`model_barcode`),
KEY `category_id` (`category_id`),
KEY `producer_id` (`producer_id`),
CONSTRAINT `model_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `category` (`category_id`),
PRIMARY KEY (`barcode_id`),
KEY `model_id` (`model_id`),
CONSTRAINT `barcode_ibfk_1` FOREIGN KEY (`model_id`) REFERENCES `model` (`model_id`)
-) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
+) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;