diff --git a/db/dump/dumpedFixtures.sql b/db/dump/dumpedFixtures.sql index 203c76f2f..05171dbfa 100644 --- a/db/dump/dumpedFixtures.sql +++ b/db/dump/dumpedFixtures.sql @@ -1,6 +1,6 @@ USE `util`; --- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64) +-- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- -- Host: db.verdnatura.es Database: util -- ------------------------------------------------------ @@ -36,9 +36,9 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-11-26 14:02:56 +-- Dump completed on 2019-12-13 12:42:57 USE `account`; --- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64) +-- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- -- Host: db.verdnatura.es Database: account -- ------------------------------------------------------ @@ -94,9 +94,9 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-11-26 14:02:57 +-- Dump completed on 2019-12-13 12:42:57 USE `salix`; --- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64) +-- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- -- Host: db.verdnatura.es Database: salix -- ------------------------------------------------------ @@ -142,9 +142,9 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-11-26 14:02:57 +-- Dump completed on 2019-12-13 12:42:57 USE `vn`; --- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64) +-- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- -- Host: db.verdnatura.es Database: vn -- ------------------------------------------------------ @@ -227,7 +227,7 @@ UNLOCK TABLES; LOCK TABLES `tag` WRITE; /*!40000 ALTER TABLE `tag` DISABLE KEYS */; -INSERT INTO `tag` VALUES (1,'color','Color',0,0,'ink',NULL,NULL),(2,'','Forma',1,0,NULL,NULL,NULL),(3,'','Material',1,0,NULL,NULL,NULL),(4,'','Longitud',1,1,NULL,'mm',NULL),(5,'','Diámetro',1,1,NULL,'mm',NULL),(6,'','Perímetro',1,1,NULL,'mm',NULL),(7,'','Ancho de la base',1,1,NULL,'mm',NULL),(8,'','Altura',1,1,NULL,'mm',NULL),(9,'','Volumen',1,1,NULL,'ml',NULL),(10,'','Densidad',1,1,NULL,NULL,NULL),(11,'','Calidad',1,0,NULL,NULL,NULL),(12,'','Textura',1,0,NULL,NULL,NULL),(13,'','Material del mango',1,0,NULL,NULL,NULL),(14,'','Compra mínima',1,0,NULL,NULL,NULL),(15,'','Nº pétalos',1,1,NULL,NULL,NULL),(16,'','Ancho',1,1,NULL,'mm',NULL),(18,'','Profundidad',1,1,NULL,'mm',NULL),(19,'','Largo',1,1,NULL,'mm',NULL),(20,'','Ancho superior',1,1,NULL,'mm',NULL),(21,'','Ancho inferior',1,1,NULL,'mm',NULL),(22,'','Gramaje',1,1,NULL,'g',NULL),(23,'stems','Tallos',1,1,NULL,NULL,NULL),(24,'','Estado',1,0,NULL,NULL,NULL),(25,'','Color principal',0,0,'ink',NULL,NULL),(26,'','Color secundario',0,0,'ink',NULL,NULL),(27,'','Longitud(cm)',1,1,NULL,'cm',NULL),(28,'','Diámetro base',1,1,'','mm',NULL),(29,'','Colección',1,0,NULL,NULL,NULL),(30,'','Uds / caja',1,1,NULL,NULL,NULL),(31,'','Contenido',1,0,NULL,NULL,NULL),(32,'','Peso',1,1,NULL,'g',NULL),(33,'','Grosor',1,1,NULL,'mm',NULL),(34,'','Marca',1,0,NULL,NULL,NULL),(35,'origin','Origen',0,0,'origin',NULL,NULL),(36,'','Proveedor',1,0,NULL,NULL,NULL),(37,'producer','Productor',0,0,'producer',NULL,NULL),(38,'','Duración',1,1,NULL,'s',NULL),(39,'','Flor',1,0,NULL,NULL,NULL),(40,'','Soporte',1,0,NULL,NULL,NULL),(41,'','Tamaño flor',1,0,NULL,NULL,NULL),(42,'','Apertura',1,0,NULL,NULL,NULL),(43,'','Tallo',1,0,NULL,NULL,NULL),(44,'','Nº hojas',1,1,NULL,NULL,NULL),(45,'','Dimensiones',1,0,NULL,NULL,NULL),(46,'','Diámetro boca',1,1,NULL,'mm',NULL),(47,'','Nº flores',1,1,NULL,NULL,NULL),(48,'','Uds / paquete',1,1,NULL,NULL,NULL),(49,'','Maceta',1,1,NULL,'cm',NULL),(50,'','Textura flor',1,0,NULL,NULL,NULL),(51,'','Textura hoja',1,0,NULL,NULL,NULL),(52,'','Tipo de IVA',1,0,NULL,NULL,NULL),(53,'','Tronco',1,0,NULL,NULL,NULL),(54,'','Hoja',1,0,NULL,NULL,NULL),(55,'','Formato',1,0,NULL,NULL,NULL),(56,'','Genero',1,0,NULL,NULL,NULL),(57,'','Especie',1,0,NULL,NULL,NULL),(58,'','Variedad',1,0,NULL,NULL,NULL),(59,'','Medida grande',1,0,NULL,NULL,NULL),(60,'','Medida mediano',1,0,NULL,NULL,NULL),(61,'','Medida pequeño',1,0,NULL,NULL,NULL),(62,'','Medida pequeño',1,0,NULL,NULL,NULL),(63,'','Recipiente interior',1,0,NULL,NULL,NULL),(64,'','Material secundario',1,0,NULL,NULL,NULL),(65,'','Colores',1,0,NULL,NULL,NULL),(66,'','Referencia',1,0,NULL,NULL,NULL),(67,'','Categoria',1,0,NULL,NULL,NULL),(68,'','Amb',1,0,NULL,NULL,NULL),(69,'','Anchura',1,1,NULL,'cm',NULL),(70,'','Hueco interior',1,0,NULL,NULL,NULL),(71,'','Tamaño',1,0,NULL,NULL,NULL),(72,'','Color botón',1,0,NULL,NULL,NULL),(73,'','Tamaño minimo del botón',1,0,NULL,NULL,NULL),(74,'','Obtentor',1,0,NULL,NULL,NULL),(75,'','Longitud del brote',1,0,NULL,NULL,NULL),(76,'','Tallos / u.v.',1,0,NULL,NULL,NULL),(77,'','Madera de',1,0,NULL,NULL,NULL),(78,'','Unidad de venta',1,0,NULL,NULL,NULL),(79,'','Temporal',1,0,NULL,NULL,NULL),(80,'','Gramaje/tallo',1,1,NULL,'g',NULL),(81,'','Peso/paquete',1,1,NULL,'g',NULL),(82,'','Flexibilidad del tallo',1,0,NULL,NULL,NULL),(83,'','Nº planchas',1,1,NULL,NULL,NULL),(84,'','Nº páginas',1,1,NULL,NULL,NULL),(85,'','Editorial',1,0,NULL,NULL,NULL),(86,'','Idioma',1,0,NULL,NULL,NULL),(87,'','Fecha publicación',1,0,NULL,NULL,NULL),(88,'','Cubierta',1,0,NULL,NULL,NULL),(89,'','Encuadernación',1,0,NULL,NULL,NULL),(90,'','Autor',1,0,NULL,NULL,NULL),(91,'','Envoltorio',1,0,NULL,NULL,NULL),(92,'','Nombre temporal',1,0,NULL,NULL,NULL),(93,'','Modelo',1,0,NULL,NULL,NULL),(94,'','Producto',1,0,NULL,NULL,NULL),(95,'','Título',1,0,NULL,NULL,NULL),(96,'','Tomo',1,0,NULL,NULL,NULL),(97,'','Articulo',1,0,NULL,NULL,NULL),(98,'','Metodo de cultivo',1,0,NULL,NULL,NULL),(99,'','Edad',1,0,NULL,NULL,NULL),(100,'','Agotado',1,0,NULL,NULL,NULL),(101,'','Altura con asa',1,1,NULL,'cm',NULL),(102,'','Nº tallos',1,1,NULL,NULL,NULL),(103,'','Cultivo',1,0,NULL,NULL,NULL),(104,'','Sabor',1,0,NULL,NULL,NULL),(105,'','Talla',1,0,NULL,NULL,NULL),(106,'','Calibre',1,1,NULL,NULL,NULL),(107,'','Dulzura',1,1,NULL,'bx',NULL),(108,'','Piezas',1,0,NULL,NULL,NULL),(109,'','Altura con patas',1,0,NULL,NULL,NULL); +INSERT INTO `tag` VALUES (1,'color','Color',0,0,'ink',NULL,NULL),(2,'','Forma',1,0,NULL,NULL,NULL),(3,'','Material',1,0,NULL,NULL,NULL),(4,'','Longitud',1,1,NULL,'mm',NULL),(5,'','Diámetro',1,1,NULL,'mm',NULL),(6,'','Perímetro',1,1,NULL,'mm',NULL),(7,'','Ancho de la base',1,1,NULL,'mm',NULL),(8,'','Altura',1,1,NULL,'mm',NULL),(9,'','Volumen',1,1,NULL,'ml',NULL),(10,'','Densidad',1,1,NULL,NULL,NULL),(11,'','Calidad',1,0,NULL,NULL,NULL),(12,'','Textura',1,0,NULL,NULL,NULL),(13,'','Material del mango',1,0,NULL,NULL,NULL),(14,'','Compra mínima',1,0,NULL,NULL,NULL),(15,'','Nº pétalos',1,1,NULL,NULL,NULL),(16,'','Ancho',1,1,NULL,'mm',NULL),(18,'','Profundidad',1,1,NULL,'mm',NULL),(19,'','Largo',1,1,NULL,'mm',NULL),(20,'','Ancho superior',1,1,NULL,'mm',NULL),(21,'','Ancho inferior',1,1,NULL,'mm',NULL),(22,'','Gramaje',1,1,NULL,'g',NULL),(23,'stems','Tallos',1,1,NULL,NULL,NULL),(24,'','Estado',1,0,NULL,NULL,NULL),(25,'','Color principal',0,0,'ink',NULL,NULL),(26,'','Color secundario',0,0,'ink',NULL,NULL),(27,'','Longitud(cm)',1,1,NULL,'cm',NULL),(28,'','Diámetro base',1,1,'','mm',NULL),(29,'','Colección',1,0,NULL,NULL,NULL),(30,'','Uds / caja',1,1,NULL,NULL,NULL),(31,'','Contenido',1,0,NULL,NULL,NULL),(32,'','Peso',1,1,NULL,'g',NULL),(33,'','Grosor',1,1,NULL,'mm',NULL),(34,'','Marca',1,0,NULL,NULL,NULL),(35,'origin','Origen',0,0,'origin',NULL,NULL),(36,'','Proveedor',1,0,NULL,NULL,NULL),(37,'producer','Productor',0,0,'producer',NULL,NULL),(38,'','Duración',1,1,NULL,'s',NULL),(39,'','Flor',1,0,NULL,NULL,NULL),(40,'','Soporte',1,0,NULL,NULL,NULL),(41,'','Tamaño flor',1,0,NULL,NULL,NULL),(42,'','Apertura',1,0,NULL,NULL,NULL),(43,'','Tallo',1,0,NULL,NULL,NULL),(44,'','Nº hojas',1,1,NULL,NULL,NULL),(45,'','Dimensiones',1,0,NULL,NULL,NULL),(46,'','Diámetro boca',1,1,NULL,'mm',NULL),(47,'','Nº flores',1,1,NULL,NULL,NULL),(48,'','Uds / paquete',1,1,NULL,NULL,NULL),(49,'','Maceta',1,1,NULL,'cm',NULL),(50,'','Textura flor',1,0,NULL,NULL,NULL),(51,'','Textura hoja',1,0,NULL,NULL,NULL),(52,'','Tipo de IVA',1,0,NULL,NULL,NULL),(53,'','Tronco',1,0,NULL,NULL,NULL),(54,'','Hoja',1,0,NULL,NULL,NULL),(55,'','Formato',1,0,NULL,NULL,NULL),(56,'','Genero',1,0,NULL,NULL,NULL),(57,'','Especie',1,0,NULL,NULL,NULL),(58,'','Variedad',1,0,NULL,NULL,NULL),(59,'','Medida grande',1,0,NULL,NULL,NULL),(60,'','Medida mediano',1,0,NULL,NULL,NULL),(61,'','Medida pequeño',1,0,NULL,NULL,NULL),(62,'','Medida pequeño',1,0,NULL,NULL,NULL),(63,'','Recipiente interior',1,0,NULL,NULL,NULL),(64,'','Material secundario',1,0,NULL,NULL,NULL),(65,'','Colores',1,0,NULL,NULL,NULL),(66,'','Referencia',1,0,NULL,NULL,NULL),(67,'','Categoria',1,0,NULL,NULL,NULL),(68,'','Amb',1,0,NULL,NULL,NULL),(69,'','Anchura',1,1,NULL,'cm',NULL),(70,'','Hueco interior',1,0,NULL,NULL,NULL),(71,'','Tamaño',1,0,NULL,NULL,NULL),(72,'','Color botón',1,0,NULL,NULL,NULL),(73,'','Tamaño minimo del botón',1,0,NULL,NULL,NULL),(74,'','Obtentor',1,0,NULL,NULL,NULL),(75,'','Longitud del brote',1,0,NULL,NULL,NULL),(76,'','Tallos / u.v.',1,0,NULL,NULL,NULL),(77,'','Madera de',1,0,NULL,NULL,NULL),(78,'','Unidad de venta',1,0,NULL,NULL,NULL),(79,'','Temporal',1,0,NULL,NULL,NULL),(80,'','Gramaje/tallo',1,1,NULL,'g',NULL),(81,'','Peso/paquete',1,1,NULL,'g',NULL),(82,'','Flexibilidad del tallo',1,0,NULL,NULL,NULL),(83,'','Nº planchas',1,1,NULL,NULL,NULL),(84,'','Nº páginas',1,1,NULL,NULL,NULL),(85,'','Editorial',1,0,NULL,NULL,NULL),(86,'','Idioma',1,0,NULL,NULL,NULL),(87,'','Fecha publicación',1,0,NULL,NULL,NULL),(88,'','Cubierta',1,0,NULL,NULL,NULL),(89,'','Encuadernación',1,0,NULL,NULL,NULL),(90,'','Autor',1,0,NULL,NULL,NULL),(91,'','Envoltorio',1,0,NULL,NULL,NULL),(92,'','Nombre temporal',1,0,NULL,NULL,NULL),(93,'','Modelo',1,0,NULL,NULL,NULL),(94,'','Producto',1,0,NULL,NULL,NULL),(95,'','Título',1,0,NULL,NULL,NULL),(96,'','Tomo',1,0,NULL,NULL,NULL),(97,'','Articulo',1,0,NULL,NULL,NULL),(98,'','Metodo de cultivo',1,0,NULL,NULL,NULL),(99,'','Edad',1,0,NULL,NULL,NULL),(100,'','Agotado',1,0,NULL,NULL,NULL),(101,'','Altura con asa',1,1,NULL,'cm',NULL),(102,'','Nº tallos',1,1,NULL,NULL,NULL),(103,'','Cultivo',1,0,NULL,NULL,NULL),(104,'','Sabor',1,0,NULL,NULL,NULL),(105,'','Talla',1,0,NULL,NULL,NULL),(106,'','Calibre',1,1,NULL,NULL,NULL),(107,'','Dulzura',1,1,NULL,'bx',NULL),(108,'','Piezas',1,0,NULL,NULL,NULL),(109,'','Altura con patas',1,0,NULL,NULL,NULL),(110,'','Envase',1,0,NULL,NULL,NULL); /*!40000 ALTER TABLE `tag` ENABLE KEYS */; UNLOCK TABLES; @@ -320,9 +320,9 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-11-26 14:02:57 +-- Dump completed on 2019-12-13 12:42:57 USE `bi`; --- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64) +-- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- -- Host: db.verdnatura.es Database: bi -- ------------------------------------------------------ @@ -368,9 +368,9 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-11-26 14:02:57 +-- Dump completed on 2019-12-13 12:42:57 USE `cache`; --- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64) +-- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- -- Host: db.verdnatura.es Database: cache -- ------------------------------------------------------ @@ -406,9 +406,9 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-11-26 14:02:57 +-- Dump completed on 2019-12-13 12:42:57 USE `hedera`; --- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64) +-- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- -- Host: db.verdnatura.es Database: hedera -- ------------------------------------------------------ @@ -464,9 +464,9 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-11-26 14:02:57 +-- Dump completed on 2019-12-13 12:42:58 USE `postgresql`; --- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64) +-- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- -- Host: db.verdnatura.es Database: postgresql -- ------------------------------------------------------ @@ -539,7 +539,7 @@ UNLOCK TABLES; LOCK TABLES `workcenter` WRITE; /*!40000 ALTER TABLE `workcenter` DISABLE KEYS */; -INSERT INTO `workcenter` VALUES (1,'Silla',20,1026,1),(2,'Mercaflor',19,NULL,NULL),(3,'Marjales',26,20007,NULL),(4,'VNH',NULL,NULL,3),(5,'Madrid',28,2851,5),(6,'Vilassar',88,88031,2),(7,'Tenerife',NULL,NULL,10),(8,'Silla-Agrario',26,2,NULL); +INSERT INTO `workcenter` VALUES (1,'Silla',20,1026,1),(2,'Mercaflor',19,NULL,NULL),(3,'Marjales',26,20008,NULL),(4,'VNH',NULL,NULL,3),(5,'Madrid',28,2851,5),(6,'Vilassar',88,88031,2),(7,'Tenerife',NULL,NULL,10),(8,'Silla-Agrario',26,2,NULL); /*!40000 ALTER TABLE `workcenter` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -552,4 +552,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-11-26 14:02:57 +-- Dump completed on 2019-12-13 12:42:58 diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index d54b28bb7..b57575e02 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1,4 +1,3 @@ --- FIXME: cuando se eliminen los procedimientos de la cache, se podra eliminar esta linea CREATE SCHEMA IF NOT EXISTS `vn2008`; CREATE SCHEMA IF NOT EXISTS `tmp`; @@ -21,9 +20,12 @@ INSERT INTO `vn`.`bionicConfig` (`generalInflationCoeficient`, `minimumDensityVo VALUES (1.30, 167.00, 138000, 71); +UPDATE `account`.`role` SET id = 100 WHERE id = 0; + INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active`,`email`, `lang`) SELECT id, name, CONCAT(name, 'Nick'),MD5('nightmare'), id, 1, CONCAT(name, '@mydomain.com'), 'es' - FROM `account`.`role` WHERE id <> 20; + FROM `account`.`role` WHERE id <> 20 + ORDER BY id; INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `userFk`, `bossFk`) SELECT id,UPPER(LPAD(role, 3, '0')), name, name, id, 9 @@ -529,32 +531,32 @@ INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `des (10, 23, 4, 'Reclama ticket: 8'), (11, 24, 4, 'Reclama ticket: 7'); -INSERT INTO `vn`.`ticketTracking`(`id`, `ticketFk`, `stateFk`, `workerFk`, `created`) +INSERT INTO `vn`.`ticketTracking`(`ticketFk`, `stateFk`, `workerFk`, `created`) VALUES - (1, 1, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (2, 2, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (3, 3, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), - (4, 4, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -3 MONTH)), - (5, 5, 16, 18, DATE_ADD(CURDATE(), INTERVAL -4 MONTH)), - (6, 6, 16, 18, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (7, 7, 10, 18, CURDATE()), - (8, 8, 5, 19, CURDATE()), - (9, 9, 5, 19, CURDATE()), - (10, 10, 5, 19, CURDATE()), - (11, 11, 3, 19, CURDATE()), - (12, 12, 3, 19, CURDATE()), - (13, 13, 3, 19, CURDATE()), - (14, 14, 3, 19, CURDATE()), - (15, 15, 3, 19, CURDATE()), - (16, 16, 3, 19, CURDATE()), - (17, 17, 3, 19, CURDATE()), - (18, 18, 3, 19, CURDATE()), - (19, 19, 17, 19, CURDATE()), - (20, 20, 1, 19, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), - (21, 21, 1, 19, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), - (22, 22, 1, 19, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), - (23, 23, 16, 21, CURDATE()), - (24, 24, 16, 21, CURDATE()); + (1, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (2, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (3, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), + (4, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -3 MONTH)), + (5, 16, 18, DATE_ADD(CURDATE(), INTERVAL -4 MONTH)), + (6, 16, 18, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (7, 10, 18, CURDATE()), + (8, 5, 19, CURDATE()), + (9, 5, 19, CURDATE()), + (10, 5, 19, CURDATE()), + (11, 3, 19, CURDATE()), + (12, 3, 19, CURDATE()), + (13, 3, 19, CURDATE()), + (14, 3, 19, CURDATE()), + (15, 3, 19, CURDATE()), + (16, 3, 19, CURDATE()), + (17, 3, 19, CURDATE()), + (18, 3, 19, CURDATE()), + (19, 17, 19, CURDATE()), + (20, 1, 19, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), + (21, 1, 19, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), + (22, 1, 19, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), + (23, 16, 21, CURDATE()), + (24, 16, 21, CURDATE()); INSERT INTO `vn`.`stowaway`(`id`, `shipFk`, `created`) VALUES diff --git a/db/dump/structure.sql b/db/dump/structure.sql index c33b63dcd..761f07c39 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -1,4 +1,4 @@ --- MySQL dump 10.13 Distrib 8.0.18, for osx10.15 (x86_64) +-- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- -- Host: db.verdnatura.es Database: account -- ------------------------------------------------------ @@ -7,7 +7,7 @@ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!50503 SET NAMES utf8 */; +/*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -29,7 +29,7 @@ USE `account`; DROP TABLE IF EXISTS `account`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `account` ( `id` int(10) unsigned NOT NULL, PRIMARY KEY (`id`), @@ -85,7 +85,7 @@ DELIMITER ; DROP TABLE IF EXISTS `accountConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `accountConfig` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `homedir` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The base folder for users home directories', @@ -96,17 +96,17 @@ CREATE TABLE `accountConfig` ( `warn` smallint(6) NOT NULL, `inact` smallint(6) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration parameters for accounts'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration parameters for accounts'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `accountDovecot` +-- Temporary table structure for view `accountDovecot` -- DROP TABLE IF EXISTS `accountDovecot`; /*!50001 DROP VIEW IF EXISTS `accountDovecot`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `accountDovecot` AS SELECT 1 AS `name`, 1 AS `password`*/; @@ -118,7 +118,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `accountLog`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `accountLog` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `msg` varchar(255) COLLATE utf8_unicode_ci NOT NULL, @@ -132,13 +132,13 @@ CREATE TABLE `accountLog` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `emailUser` +-- Temporary table structure for view `emailUser` -- DROP TABLE IF EXISTS `emailUser`; /*!50001 DROP VIEW IF EXISTS `emailUser`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `emailUser` AS SELECT 1 AS `userFk`, 1 AS `email`*/; @@ -150,7 +150,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `ldapConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ldapConfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `host` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The hostname of LDAP server', @@ -159,7 +159,7 @@ CREATE TABLE `ldapConfig` ( `baseDn` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The base DN to do the query', `filter` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Filter to apply to the query', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='LDAP server configuration parameters'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='LDAP server configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -168,14 +168,14 @@ CREATE TABLE `ldapConfig` ( DROP TABLE IF EXISTS `mailAlias`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `mailAlias` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `alias` varchar(50) CHARACTER SET utf8 NOT NULL, `isPublic` tinyint(4) NOT NULL DEFAULT '1', PRIMARY KEY (`id`), UNIQUE KEY `alias` (`alias`) -) ENGINE=InnoDB AUTO_INCREMENT=83 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Mail aliases'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Mail aliases'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -184,7 +184,7 @@ CREATE TABLE `mailAlias` ( DROP TABLE IF EXISTS `mailAliasAccount`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `mailAliasAccount` ( `mailAlias` int(10) unsigned NOT NULL, `account` int(10) unsigned NOT NULL, @@ -201,12 +201,12 @@ CREATE TABLE `mailAliasAccount` ( DROP TABLE IF EXISTS `mailConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `mailConfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `domain` varchar(255) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -215,7 +215,7 @@ CREATE TABLE `mailConfig` ( DROP TABLE IF EXISTS `mailForward`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `mailForward` ( `account` int(10) unsigned NOT NULL, `forwardTo` varchar(250) CHARACTER SET utf8 NOT NULL, @@ -225,25 +225,25 @@ CREATE TABLE `mailForward` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `myRole` +-- Temporary table structure for view `myRole` -- DROP TABLE IF EXISTS `myRole`; /*!50001 DROP VIEW IF EXISTS `myRole`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `myRole` AS SELECT 1 AS `id`*/; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `myUser` +-- Temporary table structure for view `myUser` -- DROP TABLE IF EXISTS `myUser`; /*!50001 DROP VIEW IF EXISTS `myUser`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `myUser` AS SELECT 1 AS `id`, 1 AS `name`, @@ -261,7 +261,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `role`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `role` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(14) COLLATE utf8_unicode_ci NOT NULL COMMENT 'MySQL doesn''t support more than 14 chars for proxied user names', @@ -271,7 +271,7 @@ CREATE TABLE `role` ( `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Roles'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Roles'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -280,12 +280,12 @@ CREATE TABLE `role` ( DROP TABLE IF EXISTS `roleConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `roleConfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identifier', `mysqlPassword` varchar(255) NOT NULL COMMENT 'The password used for MySQL user roles, base64 encoded', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='Role configuration parameters'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COMMENT='Role configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -294,7 +294,7 @@ CREATE TABLE `roleConfig` ( DROP TABLE IF EXISTS `roleInherit`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `roleInherit` ( `role` int(10) unsigned NOT NULL, `inheritsFrom` int(10) unsigned NOT NULL, @@ -311,7 +311,7 @@ CREATE TABLE `roleInherit` ( DROP TABLE IF EXISTS `roleRole`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `roleRole` ( `role` int(10) unsigned NOT NULL, `inheritsFrom` int(10) unsigned NOT NULL, @@ -325,7 +325,7 @@ CREATE TABLE `roleRole` ( DROP TABLE IF EXISTS `sambaConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `sambaConfig` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `host` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT 'The hosname of Samba server', @@ -333,7 +333,7 @@ CREATE TABLE `sambaConfig` ( `sshPass` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The SSH password base64 encoded', `uidBase` int(10) unsigned NOT NULL DEFAULT '10000' COMMENT 'The base for Unix uids', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration parameters for accounts'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration parameters for accounts'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -342,7 +342,7 @@ CREATE TABLE `sambaConfig` ( DROP TABLE IF EXISTS `user`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `user` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(30) CHARACTER SET utf8 NOT NULL, @@ -365,7 +365,7 @@ CREATE TABLE `user` ( KEY `nickname` (`nickname`), KEY `lang` (`lang`), CONSTRAINT `user_ibfk_2` FOREIGN KEY (`role`) REFERENCES `role` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=17017 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global users'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global users'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -416,6 +416,11 @@ BEGIN SET NEW.bcryptPassword = NULL; SET NEW.lastPassChange = NOW(); END IF; + + /*borrar el lunes*/ + IF (NEW.`id` = 14255) THEN + SET NEW.role = 9; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -457,12 +462,12 @@ DELIMITER ; DROP TABLE IF EXISTS `userConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `userConfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `loginKey` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -471,7 +476,7 @@ CREATE TABLE `userConfig` ( DROP TABLE IF EXISTS `userPassword`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `userPassword` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `length` tinyint(3) unsigned NOT NULL, @@ -480,7 +485,7 @@ CREATE TABLE `userPassword` ( `nDigits` tinyint(3) unsigned NOT NULL, `nPunct` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Restrictions on user passwords'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Restrictions on user passwords'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -1810,7 +1815,7 @@ USE `bi`; DROP TABLE IF EXISTS `Equalizator`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `Equalizator` ( `Vista` int(11) NOT NULL, `Pedido` int(11) DEFAULT NULL, @@ -1826,7 +1831,7 @@ CREATE TABLE `Equalizator` ( DROP TABLE IF EXISTS `Greuge_Evolution`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `Greuge_Evolution` ( `Id_Cliente` int(11) NOT NULL, `Fecha` date NOT NULL, @@ -1845,7 +1850,7 @@ CREATE TABLE `Greuge_Evolution` ( DROP TABLE IF EXISTS `Greuge_comercial_recobro`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `Greuge_comercial_recobro` ( `Id_Trabajador` int(11) NOT NULL, `recobro` decimal(10,2) NOT NULL DEFAULT '0.00', @@ -1860,7 +1865,7 @@ CREATE TABLE `Greuge_comercial_recobro` ( DROP TABLE IF EXISTS `Greuges_comercial_detail`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `Greuges_comercial_detail` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, `Id_Trabajador` int(10) unsigned NOT NULL, @@ -1868,7 +1873,7 @@ CREATE TABLE `Greuges_comercial_detail` ( `Importe` decimal(10,2) NOT NULL, `Fecha` datetime DEFAULT NULL, PRIMARY KEY (`Id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPACT; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPACT; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -1877,7 +1882,7 @@ CREATE TABLE `Greuges_comercial_detail` ( DROP TABLE IF EXISTS `Last_buy_id`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `Last_buy_id` ( `Id_Article` int(11) NOT NULL DEFAULT '90', `Id_Compra` int(11) NOT NULL DEFAULT '0', @@ -1894,7 +1899,7 @@ CREATE TABLE `Last_buy_id` ( DROP TABLE IF EXISTS `Ticket_Portes`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `Ticket_Portes` ( `Id_Ticket` int(11) NOT NULL, `rate` tinyint(4) NOT NULL COMMENT 'Tarifa', @@ -1910,7 +1915,7 @@ CREATE TABLE `Ticket_Portes` ( DROP TABLE IF EXISTS `XDiario_ALL`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `XDiario_ALL` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `empresa_id` int(5) NOT NULL, @@ -1923,7 +1928,7 @@ CREATE TABLE `XDiario_ALL` ( KEY `Cuenta` (`SUBCTA`), KEY `empresa` (`empresa_id`), KEY `Fecha` (`Fecha`) -) ENGINE=InnoDB AUTO_INCREMENT=16385456 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -1932,7 +1937,7 @@ CREATE TABLE `XDiario_ALL` ( DROP TABLE IF EXISTS `analisis_grafico_simple`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `analisis_grafico_simple` ( `Año` smallint(5) unsigned NOT NULL, `Semana` tinyint(3) unsigned NOT NULL, @@ -1942,13 +1947,13 @@ CREATE TABLE `analisis_grafico_simple` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `analisis_grafico_ventas` +-- Temporary table structure for view `analisis_grafico_ventas` -- DROP TABLE IF EXISTS `analisis_grafico_ventas`; /*!50001 DROP VIEW IF EXISTS `analisis_grafico_ventas`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `analisis_grafico_ventas` AS SELECT 1 AS `Año`, 1 AS `Semana`, @@ -1961,7 +1966,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `analisis_ventas`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `analisis_ventas` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `Familia` varchar(30) COLLATE utf8_unicode_ci NOT NULL, @@ -1977,7 +1982,7 @@ CREATE TABLE `analisis_ventas` ( `Importe` double NOT NULL, PRIMARY KEY (`id`), KEY `Año` (`Año`,`Semana`) -) ENGINE=InnoDB AUTO_INCREMENT=122757475 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -1986,7 +1991,7 @@ CREATE TABLE `analisis_ventas` ( DROP TABLE IF EXISTS `analisis_ventas_almacen_evolution`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `analisis_ventas_almacen_evolution` ( `Semana` int(11) NOT NULL, `Almacen` varchar(20) COLLATE utf8_unicode_ci NOT NULL, @@ -2004,7 +2009,7 @@ CREATE TABLE `analisis_ventas_almacen_evolution` ( DROP TABLE IF EXISTS `analisis_ventas_comprador_evolution`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `analisis_ventas_comprador_evolution` ( `semana` int(11) NOT NULL, `comprador` varchar(3) COLLATE utf8_unicode_ci NOT NULL, @@ -2022,7 +2027,7 @@ CREATE TABLE `analisis_ventas_comprador_evolution` ( DROP TABLE IF EXISTS `analisis_ventas_familia_evolution`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `analisis_ventas_familia_evolution` ( `semana` int(11) NOT NULL, `familia` varchar(50) COLLATE utf8_unicode_ci NOT NULL, @@ -2040,7 +2045,7 @@ CREATE TABLE `analisis_ventas_familia_evolution` ( DROP TABLE IF EXISTS `analisis_ventas_provincia_evolution`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `analisis_ventas_provincia_evolution` ( `semana` int(11) NOT NULL, `provincia` varchar(30) COLLATE utf8_unicode_ci NOT NULL, @@ -2058,7 +2063,7 @@ CREATE TABLE `analisis_ventas_provincia_evolution` ( DROP TABLE IF EXISTS `analisis_ventas_reino_evolution`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `analisis_ventas_reino_evolution` ( `semana` int(11) NOT NULL, `reino` varchar(20) COLLATE utf8_unicode_ci NOT NULL, @@ -2071,13 +2076,13 @@ CREATE TABLE `analisis_ventas_reino_evolution` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `analisis_ventas_simple` +-- Temporary table structure for view `analisis_ventas_simple` -- DROP TABLE IF EXISTS `analisis_ventas_simple`; /*!50001 DROP VIEW IF EXISTS `analisis_ventas_simple`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `analisis_ventas_simple` AS SELECT 1 AS `Año`, 1 AS `Semana`, @@ -2090,7 +2095,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `analisis_ventas_vendedor_evolution`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `analisis_ventas_vendedor_evolution` ( `semana` int(11) NOT NULL, `vendedor` varchar(3) COLLATE utf8_unicode_ci NOT NULL, @@ -2108,7 +2113,7 @@ CREATE TABLE `analisis_ventas_vendedor_evolution` ( DROP TABLE IF EXISTS `analisis_ventas_vista_evolution`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `analisis_ventas_vista_evolution` ( `semana` int(11) NOT NULL, `vista` varchar(45) COLLATE utf8_unicode_ci NOT NULL, @@ -2126,7 +2131,7 @@ CREATE TABLE `analisis_ventas_vista_evolution` ( DROP TABLE IF EXISTS `calidad_detalle`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `calidad_detalle` ( `Id_Cliente` int(11) NOT NULL, `calidad_parametros_id` int(2) NOT NULL, @@ -2143,7 +2148,7 @@ CREATE TABLE `calidad_detalle` ( DROP TABLE IF EXISTS `calidad_parametros`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `calidad_parametros` ( `calidad_parametros_id` int(2) NOT NULL, `descripcion` varchar(45) COLLATE utf8_unicode_ci NOT NULL, @@ -2157,7 +2162,7 @@ CREATE TABLE `calidad_parametros` ( DROP TABLE IF EXISTS `claims_ratio`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `claims_ratio` ( `Id_Cliente` int(11) NOT NULL DEFAULT '0', `Consumo` decimal(10,2) DEFAULT NULL, @@ -2176,7 +2181,7 @@ CREATE TABLE `claims_ratio` ( DROP TABLE IF EXISTS `customerDebtInventory`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `customerDebtInventory` ( `Id_Cliente` int(11) NOT NULL, `Debt` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT 'CREATE TABLE bi.customerDebtInventory\n\nSELECT Id_Cliente, sum(Euros) as Debt\n\nFROM \n(\nSELECT Id_Cliente, Entregado as Euros\n\nFROM Recibos \n\nWHERE Fechacobro < ''2017-01-01\n''\nUNION ALL\n\nSELECT Id_Cliente, - Importe \nFROM Facturas\nWHERE Fecha < ''2017-01-01''\n) sub \nGROUP BY Id_Cliente', @@ -2185,13 +2190,13 @@ CREATE TABLE `customerDebtInventory` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `customerRiskOverdue` +-- Temporary table structure for view `customerRiskOverdue` -- DROP TABLE IF EXISTS `customerRiskOverdue`; /*!50001 DROP VIEW IF EXISTS `customerRiskOverdue`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `customerRiskOverdue` AS SELECT 1 AS `customer_id`, 1 AS `amount`, @@ -2204,7 +2209,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `customer_risk`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `customer_risk` ( `customer_id` int(11) NOT NULL DEFAULT '0', `company_id` smallint(6) unsigned NOT NULL DEFAULT '0', @@ -2222,7 +2227,7 @@ CREATE TABLE `customer_risk` ( DROP TABLE IF EXISTS `defaulters`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `defaulters` ( `client` int(11) NOT NULL, `date` date NOT NULL, @@ -2242,7 +2247,7 @@ CREATE TABLE `defaulters` ( DROP TABLE IF EXISTS `defaulting`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `defaulting` ( `date` date NOT NULL, `amount` double NOT NULL, @@ -2256,7 +2261,7 @@ CREATE TABLE `defaulting` ( DROP TABLE IF EXISTS `f_tvc`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `f_tvc` ( `Id_Ticket` int(11) NOT NULL, PRIMARY KEY (`Id_Ticket`), @@ -2270,7 +2275,7 @@ CREATE TABLE `f_tvc` ( DROP TABLE IF EXISTS `facturacion_media_anual`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `facturacion_media_anual` ( `Id_Cliente` int(11) NOT NULL, `Consumo` double(17,0) DEFAULT NULL, @@ -2285,7 +2290,7 @@ CREATE TABLE `facturacion_media_anual` ( DROP TABLE IF EXISTS `lastaction`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `lastaction` ( `Id_Cliente` int(11) unsigned NOT NULL, `Cliente` varchar(50) COLLATE utf8_unicode_ci NOT NULL, @@ -2301,7 +2306,7 @@ CREATE TABLE `lastaction` ( DROP TABLE IF EXISTS `live_counter`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `live_counter` ( `odbc_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `amount` double NOT NULL, @@ -2315,7 +2320,7 @@ CREATE TABLE `live_counter` ( DROP TABLE IF EXISTS `partitioning_information`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `partitioning_information` ( `schema_name` varchar(10) CHARACTER SET utf8 NOT NULL, `table_name` varchar(20) CHARACTER SET utf8 NOT NULL, @@ -2332,7 +2337,7 @@ CREATE TABLE `partitioning_information` ( DROP TABLE IF EXISTS `primer_pedido`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `primer_pedido` ( `Id_Cliente` int(11) NOT NULL, `Id_Ticket` int(11) NOT NULL, @@ -2349,7 +2354,7 @@ CREATE TABLE `primer_pedido` ( DROP TABLE IF EXISTS `rotacion`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `rotacion` ( `Id_Article` int(11) NOT NULL, `warehouse_id` smallint(6) unsigned NOT NULL, @@ -2418,7 +2423,7 @@ DELIMITER ; DROP TABLE IF EXISTS `rutasBoard`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `rutasBoard` ( `id` int(11) NOT NULL AUTO_INCREMENT, `Id_Ruta` int(10) unsigned NOT NULL DEFAULT '0', @@ -2442,17 +2447,17 @@ CREATE TABLE `rutasBoard` ( KEY `rutasBoard_ix1` (`year`), KEY `rutasBoard_ix2` (`month`), KEY `rutasBoard_ix3` (`warehouse_id`) -) ENGINE=InnoDB AUTO_INCREMENT=204333 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `saleVolume` +-- Temporary table structure for view `saleVolume` -- DROP TABLE IF EXISTS `saleVolume`; /*!50001 DROP VIEW IF EXISTS `saleVolume`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `saleVolume` AS SELECT 1 AS `saleFk`, 1 AS `m3`*/; @@ -2464,7 +2469,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `tarifa_componentes`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `tarifa_componentes` ( `Id_Componente` int(11) NOT NULL AUTO_INCREMENT, `Componente` varchar(45) COLLATE utf8_unicode_ci NOT NULL, @@ -2477,7 +2482,7 @@ CREATE TABLE `tarifa_componentes` ( KEY `series_componentes_idx` (`tarifa_componentes_series_id`), KEY `comp` (`tarifa_class`), CONSTRAINT `serie_componente` FOREIGN KEY (`tarifa_componentes_series_id`) REFERENCES `tarifa_componentes_series` (`tarifa_componentes_series_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2486,7 +2491,7 @@ CREATE TABLE `tarifa_componentes` ( DROP TABLE IF EXISTS `tarifa_componentes_series`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `tarifa_componentes_series` ( `tarifa_componentes_series_id` int(11) NOT NULL AUTO_INCREMENT, `Serie` varchar(45) COLLATE utf8_unicode_ci NOT NULL, @@ -2494,7 +2499,7 @@ CREATE TABLE `tarifa_componentes_series` ( `margen` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`tarifa_componentes_series_id`), UNIQUE KEY `Serie_UNIQUE` (`Serie`) -) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Permite organizar de forma ordenada los distintos componentes'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Permite organizar de forma ordenada los distintos componentes'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2503,12 +2508,12 @@ CREATE TABLE `tarifa_componentes_series` ( DROP TABLE IF EXISTS `tarifa_premisas`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `tarifa_premisas` ( `Id_Premisa` int(11) NOT NULL AUTO_INCREMENT, `premisa` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`Id_Premisa`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2517,14 +2522,14 @@ CREATE TABLE `tarifa_premisas` ( DROP TABLE IF EXISTS `tarifa_warehouse`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `tarifa_warehouse` ( `Id_Tarifa_Warehouse` int(11) NOT NULL AUTO_INCREMENT, `warehouse_id` int(11) NOT NULL, `Id_Premisa` int(11) NOT NULL, `Valor` double NOT NULL, PRIMARY KEY (`Id_Tarifa_Warehouse`) -) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los valores de gasto por almacen'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los valores de gasto por almacen'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2914,55 +2919,55 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `analisis_ventas_update`() -BEGIN - DECLARE vLastMonth DATE; - - SET vLastMonth = util.firstDayOfMonth(TIMESTAMPADD(MONTH, -1, CURDATE())); - - DELETE FROM analisis_ventas - WHERE Año > YEAR(vLastMonth) - OR (Año = YEAR(vLastMonth) AND Mes >= MONTH(vLastMonth)); - - INSERT INTO analisis_ventas ( - Familia, - Reino, - Comercial, - Comprador, - Provincia, - almacen, - Año, - Mes, - Semana, - Vista, - Importe - ) - SELECT - tp.Tipo AS Familia, - r.reino AS Reino, - tr.CodigoTrabajador AS Comercial, - tr2.CodigoTrabajador AS Comprador, - p.name AS Provincia, - w.name AS almacen, - tm.year AS Año, - tm.month AS Mes, - tm.week AS Semana, - v.vista AS Vista, - bt.importe AS Importe - FROM bs.ventas bt - LEFT JOIN vn2008.Tipos tp ON tp.tipo_id = bt.tipo_id - LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id - LEFT JOIN vn2008.Clientes c on c.Id_Cliente = bt.Id_Cliente - LEFT JOIN vn2008.Trabajadores tr ON tr.Id_Trabajador = c.Id_Trabajador - LEFT JOIN vn2008.Trabajadores tr2 ON tr2.Id_Trabajador = tp.Id_Trabajador - JOIN vn2008.time tm ON tm.date = bt.fecha - JOIN vn2008.Movimientos m ON m.Id_Movimiento = bt.Id_Movimiento - LEFT JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia - LEFT JOIN vn2008.Vistas v ON v.vista_id = a.Vista - LEFT JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = t.Id_Consigna - LEFT JOIN vn2008.province p ON p.province_id = cs.province_id - LEFT JOIN vn2008.warehouse w ON w.id = t.warehouse_id - WHERE bt.fecha >= vLastMonth AND r.mercancia; +BEGIN + DECLARE vLastMonth DATE; + + SET vLastMonth = util.firstDayOfMonth(TIMESTAMPADD(MONTH, -1, CURDATE())); + + DELETE FROM analisis_ventas + WHERE Año > YEAR(vLastMonth) + OR (Año = YEAR(vLastMonth) AND Mes >= MONTH(vLastMonth)); + + INSERT INTO analisis_ventas ( + Familia, + Reino, + Comercial, + Comprador, + Provincia, + almacen, + Año, + Mes, + Semana, + Vista, + Importe + ) + SELECT + tp.Tipo AS Familia, + r.reino AS Reino, + tr.CodigoTrabajador AS Comercial, + tr2.CodigoTrabajador AS Comprador, + p.name AS Provincia, + w.name AS almacen, + tm.year AS Año, + tm.month AS Mes, + tm.week AS Semana, + v.vista AS Vista, + bt.importe AS Importe + FROM bs.ventas bt + LEFT JOIN vn2008.Tipos tp ON tp.tipo_id = bt.tipo_id + LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id + LEFT JOIN vn2008.Clientes c on c.Id_Cliente = bt.Id_Cliente + LEFT JOIN vn2008.Trabajadores tr ON tr.Id_Trabajador = c.Id_Trabajador + LEFT JOIN vn2008.Trabajadores tr2 ON tr2.Id_Trabajador = tp.Id_Trabajador + JOIN vn2008.time tm ON tm.date = bt.fecha + JOIN vn2008.Movimientos m ON m.Id_Movimiento = bt.Id_Movimiento + LEFT JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket + JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia + LEFT JOIN vn2008.Vistas v ON v.vista_id = a.Vista + LEFT JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = t.Id_Consigna + LEFT JOIN vn2008.province p ON p.province_id = cs.province_id + LEFT JOIN vn2008.warehouse w ON w.id = t.warehouse_id + WHERE bt.fecha >= vLastMonth AND r.mercancia; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -2980,33 +2985,33 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `call_add`() -BEGIN - DECLARE datSTART DATETIME DEFAULT '2012-03-01'/*CURDATE()*/ ; - - -- Seleccionamos la ultima fecha introducida - SELECT MAX(Fecha) INTO datSTART FROM `call`; - - -- Borramos todas las entradas del dia datSTART por si hubiese registros nuevos - DELETE FROM `call` WHERE Fecha = datSTART; - - INSERT INTO bi.`call`(CodTrabajadorCartera,CodTrabajadorTelefono,dur_in,dur_out,Fecha,`year`,`month`,`week`,`hour`,phone) - SELECT vn2008.Averiguar_ComercialCliente(pb.Id_Cliente,Fecha) CodTrabajadorCartera,ll.CodigoTrabajador, dur_in, - dur_out, ll.Fecha,YEAR(ll.Fecha) `year`, MONTH(ll.Fecha) `month`,WEEK(ll.Fecha,7) `week`, Hora,phone - FROM ( - SELECT Id_Trabajador,CodigoTrabajador, IFNULL(billsec,0) dur_in, 0 dur_out, 1 as Recibidas, NULL as Emitidas, calldate as Fecha, - hour(calldate) as Hora,src as phone - FROM vn2008.Trabajadores T - JOIN vn2008.cdr C ON C.dstchannel LIKE CONCAT('%', T.extension, '%') - WHERE calldate >= datSTART AND LENGTH(C.src) >=9 AND disposition = 'ANSWERED' AND duration - UNION ALL - SELECT Id_Trabajador,CodigoTrabajador,0 dur_in, IFNULL(billsec,0) dur_out, NULL as Recibidas, 1 as Emitidas, date(calldate), hour(calldate),dst - FROM vn2008.Trabajadores T - JOIN vn2008.cdr C ON C.src = T.extension - WHERE calldate >= datSTART AND LENGTH(C.dst) >=9 AND disposition = 'ANSWERED' AND duration - ) ll - JOIN vn2008.Permisos USING(Id_Trabajador) - LEFT JOIN vn2008.v_phonebook pb ON pb.Telefono = ll.phone - WHERE Id_Grupo = 6; +BEGIN + DECLARE datSTART DATETIME DEFAULT '2012-03-01'/*CURDATE()*/ ; + + -- Seleccionamos la ultima fecha introducida + SELECT MAX(Fecha) INTO datSTART FROM `call`; + + -- Borramos todas las entradas del dia datSTART por si hubiese registros nuevos + DELETE FROM `call` WHERE Fecha = datSTART; + + INSERT INTO bi.`call`(CodTrabajadorCartera,CodTrabajadorTelefono,dur_in,dur_out,Fecha,`year`,`month`,`week`,`hour`,phone) + SELECT vn2008.Averiguar_ComercialCliente(pb.Id_Cliente,Fecha) CodTrabajadorCartera,ll.CodigoTrabajador, dur_in, + dur_out, ll.Fecha,YEAR(ll.Fecha) `year`, MONTH(ll.Fecha) `month`,WEEK(ll.Fecha,7) `week`, Hora,phone + FROM ( + SELECT Id_Trabajador,CodigoTrabajador, IFNULL(billsec,0) dur_in, 0 dur_out, 1 as Recibidas, NULL as Emitidas, calldate as Fecha, + hour(calldate) as Hora,src as phone + FROM vn2008.Trabajadores T + JOIN vn2008.cdr C ON C.dstchannel LIKE CONCAT('%', T.extension, '%') + WHERE calldate >= datSTART AND LENGTH(C.src) >=9 AND disposition = 'ANSWERED' AND duration + UNION ALL + SELECT Id_Trabajador,CodigoTrabajador,0 dur_in, IFNULL(billsec,0) dur_out, NULL as Recibidas, 1 as Emitidas, date(calldate), hour(calldate),dst + FROM vn2008.Trabajadores T + JOIN vn2008.cdr C ON C.src = T.extension + WHERE calldate >= datSTART AND LENGTH(C.dst) >=9 AND disposition = 'ANSWERED' AND duration + ) ll + JOIN vn2008.Permisos USING(Id_Trabajador) + LEFT JOIN vn2008.v_phonebook pb ON pb.Telefono = ll.phone + WHERE Id_Grupo = 6; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -3024,205 +3029,205 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `claim_ratio_routine`() -BEGIN - DECLARE vMonthToRefund INT DEFAULT 4; - - /* - * PAK 2015-11-20 - * Se trata de añadir a la tabla Greuges todos los - * cargos que luego vamos a utilizar para calcular el recobro - */ - - -- descuentos comerciales COD 11 - - INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, Importe, Id_Ticket) - SELECT Fecha, Id_Cliente, Concat('COD11 : ',Concepte), - round(Cantidad * - Preu * (100 - Descuento) / 100 ,2) AS Importe, t.Id_Ticket - FROM vn2008.Tickets t - JOIN vn2008.Movimientos m ON m.Id_Ticket = t.Id_Ticket - WHERE Id_Article = 11 - AND Concepte NOT LIKE '$%' - AND Fecha > '2014-01-01' - HAVING nz(Importe) <> 0; - - DELETE mc.* - FROM vn2008.Movimientos_componentes mc - JOIN vn2008.Movimientos m ON m.Id_Movimiento = mc.Id_Movimiento - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - WHERE m.Id_Article = 11 - AND m.Concepte NOT LIKE '$%' - AND t.Fecha > '2017-01-01'; - - INSERT INTO vn2008.Movimientos_componentes(Id_Movimiento, Id_Componente, Valor) - SELECT m.Id_Movimiento, 34, round(m.Preu * (100 - m.Descuento)/100,4) - FROM vn2008.Movimientos m - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - WHERE m.Id_Article = 11 - AND m.Concepte NOT LIKE '$%' - AND t.Fecha > '2017-01-01'; - - UPDATE vn2008.Movimientos m - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - SET Concepte = CONCAT('$ ',Concepte) - WHERE Id_Article = 11 - AND Concepte NOT LIKE '$%' - AND Fecha > '2014-01-01'; - - -- Reclamaciones demasiado sensibles - - INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, - Importe, Greuges_type_id,Id_Ticket) - SELECT cm.Fecha - , cm.Id_Cliente - , concat('Claim ',cm.id,' : ', m.Concepte) - ,round( -1 * ((sensib -1)/4) * Cantidad * - Preu * (100 - Descuento) / 100, 2) AS Reclamaciones - , 4 - , m.Id_Ticket - FROM vn2008.Movimientos m - JOIN vn2008.cl_act ca USING(Id_Movimiento) - JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id - WHERE ca.cl_sol_id NOT IN (1,5) - AND ca.greuge = 0 - AND cm.cl_est_id = 3; - - -- Reclamaciones que pasan a Maná - - INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, - Importe , Greuges_type_id,Id_Ticket) - SELECT cm.Fecha - , cm.Id_Cliente - , concat('Claim_mana ',cm.id,' : ', m.Concepte) - ,round( ((sensib -1)/4) * Cantidad * Preu * (100 - Descuento) / 100, 2) - AS Reclamaciones - ,3 - ,m.Id_Ticket - FROM vn2008.Movimientos m - JOIN vn2008.cl_act ca USING(Id_Movimiento) - JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id - WHERE ca.cl_sol_id NOT IN (1,5) - AND ca.greuge = 0 - AND cm.cl_est_id = 3 - AND cm.mana; - - -- Marcamos para no repetir - UPDATE vn2008.cl_act ca - JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id - SET greuge = 1 - WHERE ca.cl_sol_id NOT IN (1,5) - AND ca.greuge = 0 - AND cm.cl_est_id = 3; - - -- Recobros - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; - CREATE TEMPORARY TABLE tmp.ticket_list - (PRIMARY KEY (Id_Ticket)) - SELECT DISTINCT t.Id_Ticket - FROM vn2008.Movimientos_componentes mc - JOIN vn2008.Movimientos m ON mc.Id_Movimiento = m.Id_Movimiento - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - JOIN vn2008.Tickets_state ts ON ts.Id_Ticket = t.Id_Ticket - JOIN vncontrol.inter i ON i.inter_id = ts.inter_id - JOIN vn2008.state s ON s.id = i.state_id - WHERE mc.Id_Componente = 17 - AND mc.greuge = 0 - AND t.Fecha >= '2016-10-01' - AND t.Fecha < CURDATE() - AND s.alert_level >= 3; - - DELETE g.* - FROM vn2008.Greuges g - JOIN tmp.ticket_list t ON g.Id_Ticket = t.Id_Ticket - WHERE Greuges_type_id = 2; - - INSERT INTO vn2008.Greuges (Id_Cliente,Comentario,Importe,Fecha, - Greuges_type_id, Id_Ticket) - SELECT Id_Cliente - ,concat('recobro ', m.Id_Ticket), - round(SUM(mc.Valor*Cantidad),2) - AS dif - ,date(t.Fecha) - , 2 - ,tt.Id_Ticket - FROM vn2008.Movimientos m - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - JOIN tmp.ticket_list tt ON tt.Id_Ticket = t.Id_Ticket - JOIN vn2008.Movimientos_componentes mc - ON mc.Id_Movimiento = m.Id_Movimiento AND mc.Id_Componente = 17 - GROUP BY t.Id_Ticket - HAVING ABS(dif) > 1; - - UPDATE vn2008.Movimientos_componentes mc - JOIN vn2008.Movimientos m ON m.Id_Movimiento = mc.Id_Movimiento - JOIN tmp.ticket_list tt ON tt.Id_Ticket = m.Id_Ticket - SET greuge = 1 - WHERE Id_Componente = 17; - - /* - * Recalculamos la ratio de las reclamaciones, que luego - * se va a utilizar en el recobro - */ - - REPLACE bi.claims_ratio(Id_Cliente, Consumo, Reclamaciones, Ratio, recobro) - SELECT Id_Cliente, 0,0,0,0 - FROM vn2008.Clientes; - - REPLACE bi.claims_ratio(Id_Cliente, Consumo, Reclamaciones, Ratio, recobro) - SELECT fm.Id_Cliente, 12 * fm.Consumo, Reclamaciones, - round(Reclamaciones / (12*fm.Consumo),4) AS Ratio, 0 - FROM bi.facturacion_media_anual fm - LEFT JOIN( - SELECT cm.Id_Cliente, round(sum(-1 * ((sensib -1)/4) * - Cantidad * Preu * (100 - Descuento) / 100)) - AS Reclamaciones - FROM vn2008.Movimientos m - JOIN vn2008.cl_act ca - ON ca.Id_Movimiento = m.Id_Movimiento - JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id - WHERE ca.cl_sol_id NOT IN (1,5) - AND cm.cl_est_id = 3 - AND cm.Fecha >= TIMESTAMPADD(YEAR, -1, CURDATE()) - GROUP BY cm.Id_Cliente - ) claims ON claims.Id_Cliente = fm.Id_Cliente; - - - -- Calculamos el porcentaje del recobro para añadirlo al precio de venta - UPDATE bi.claims_ratio cr - JOIN ( - SELECT Id_Cliente, nz(SUM(Importe)) AS Greuge - FROM vn2008.Greuges - WHERE Fecha <= CURDATE() - GROUP BY Id_Cliente - ) g ON g.Id_Cliente = cr.Id_Cliente - SET recobro = GREATEST(0,round(nz(Greuge) / - (nz(Consumo) * vMonthToRefund / 12 ) ,3)); - - -- Protección neonatos - UPDATE bi.claims_ratio cr - JOIN vn.firstTicketShipped fts ON fts.clientFk = cr.Id_Cliente - SET recobro = 0, Ratio = 0 - WHERE fts.shipped > TIMESTAMPADD(MONTH,-1,CURDATE()); - - -- CLIENTE 7983, JULIAN SUAU - UPDATE bi.claims_ratio SET recobro = LEAST(0.05, recobro) WHERE Id_Cliente = 7983; - - -- CLIENTE 4358 - UPDATE bi.claims_ratio SET recobro = GREATEST(0.05, recobro) WHERE Id_Cliente = 4358; - - -- CLIENTE 5523, VERDECORA +BEGIN + DECLARE vMonthToRefund INT DEFAULT 4; + + /* + * PAK 2015-11-20 + * Se trata de añadir a la tabla Greuges todos los + * cargos que luego vamos a utilizar para calcular el recobro + */ + + -- descuentos comerciales COD 11 + + INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, Importe, Id_Ticket) + SELECT Fecha, Id_Cliente, Concat('COD11 : ',Concepte), - round(Cantidad * + Preu * (100 - Descuento) / 100 ,2) AS Importe, t.Id_Ticket + FROM vn2008.Tickets t + JOIN vn2008.Movimientos m ON m.Id_Ticket = t.Id_Ticket + WHERE Id_Article = 11 + AND Concepte NOT LIKE '$%' + AND Fecha > '2014-01-01' + HAVING nz(Importe) <> 0; + + DELETE mc.* + FROM vn2008.Movimientos_componentes mc + JOIN vn2008.Movimientos m ON m.Id_Movimiento = mc.Id_Movimiento + JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket + WHERE m.Id_Article = 11 + AND m.Concepte NOT LIKE '$%' + AND t.Fecha > '2017-01-01'; + + INSERT INTO vn2008.Movimientos_componentes(Id_Movimiento, Id_Componente, Valor) + SELECT m.Id_Movimiento, 34, round(m.Preu * (100 - m.Descuento)/100,4) + FROM vn2008.Movimientos m + JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket + WHERE m.Id_Article = 11 + AND m.Concepte NOT LIKE '$%' + AND t.Fecha > '2017-01-01'; + + UPDATE vn2008.Movimientos m + JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket + SET Concepte = CONCAT('$ ',Concepte) + WHERE Id_Article = 11 + AND Concepte NOT LIKE '$%' + AND Fecha > '2014-01-01'; + + -- Reclamaciones demasiado sensibles + + INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, + Importe, Greuges_type_id,Id_Ticket) + SELECT cm.Fecha + , cm.Id_Cliente + , concat('Claim ',cm.id,' : ', m.Concepte) + ,round( -1 * ((sensib -1)/4) * Cantidad * + Preu * (100 - Descuento) / 100, 2) AS Reclamaciones + , 4 + , m.Id_Ticket + FROM vn2008.Movimientos m + JOIN vn2008.cl_act ca USING(Id_Movimiento) + JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id + WHERE ca.cl_sol_id NOT IN (1,5) + AND ca.greuge = 0 + AND cm.cl_est_id = 3; + + -- Reclamaciones que pasan a Maná + + INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, + Importe , Greuges_type_id,Id_Ticket) + SELECT cm.Fecha + , cm.Id_Cliente + , concat('Claim_mana ',cm.id,' : ', m.Concepte) + ,round( ((sensib -1)/4) * Cantidad * Preu * (100 - Descuento) / 100, 2) + AS Reclamaciones + ,3 + ,m.Id_Ticket + FROM vn2008.Movimientos m + JOIN vn2008.cl_act ca USING(Id_Movimiento) + JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id + WHERE ca.cl_sol_id NOT IN (1,5) + AND ca.greuge = 0 + AND cm.cl_est_id = 3 + AND cm.mana; + + -- Marcamos para no repetir + UPDATE vn2008.cl_act ca + JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id + SET greuge = 1 + WHERE ca.cl_sol_id NOT IN (1,5) + AND ca.greuge = 0 + AND cm.cl_est_id = 3; + + -- Recobros + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; + CREATE TEMPORARY TABLE tmp.ticket_list + (PRIMARY KEY (Id_Ticket)) + SELECT DISTINCT t.Id_Ticket + FROM vn2008.Movimientos_componentes mc + JOIN vn2008.Movimientos m ON mc.Id_Movimiento = m.Id_Movimiento + JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket + JOIN vn2008.Tickets_state ts ON ts.Id_Ticket = t.Id_Ticket + JOIN vncontrol.inter i ON i.inter_id = ts.inter_id + JOIN vn2008.state s ON s.id = i.state_id + WHERE mc.Id_Componente = 17 + AND mc.greuge = 0 + AND t.Fecha >= '2016-10-01' + AND t.Fecha < CURDATE() + AND s.alert_level >= 3; + + DELETE g.* + FROM vn2008.Greuges g + JOIN tmp.ticket_list t ON g.Id_Ticket = t.Id_Ticket + WHERE Greuges_type_id = 2; + + INSERT INTO vn2008.Greuges (Id_Cliente,Comentario,Importe,Fecha, + Greuges_type_id, Id_Ticket) + SELECT Id_Cliente + ,concat('recobro ', m.Id_Ticket), - round(SUM(mc.Valor*Cantidad),2) + AS dif + ,date(t.Fecha) + , 2 + ,tt.Id_Ticket + FROM vn2008.Movimientos m + JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket + JOIN tmp.ticket_list tt ON tt.Id_Ticket = t.Id_Ticket + JOIN vn2008.Movimientos_componentes mc + ON mc.Id_Movimiento = m.Id_Movimiento AND mc.Id_Componente = 17 + GROUP BY t.Id_Ticket + HAVING ABS(dif) > 1; + + UPDATE vn2008.Movimientos_componentes mc + JOIN vn2008.Movimientos m ON m.Id_Movimiento = mc.Id_Movimiento + JOIN tmp.ticket_list tt ON tt.Id_Ticket = m.Id_Ticket + SET greuge = 1 + WHERE Id_Componente = 17; + + /* + * Recalculamos la ratio de las reclamaciones, que luego + * se va a utilizar en el recobro + */ + + REPLACE bi.claims_ratio(Id_Cliente, Consumo, Reclamaciones, Ratio, recobro) + SELECT Id_Cliente, 0,0,0,0 + FROM vn2008.Clientes; + + REPLACE bi.claims_ratio(Id_Cliente, Consumo, Reclamaciones, Ratio, recobro) + SELECT fm.Id_Cliente, 12 * fm.Consumo, Reclamaciones, + round(Reclamaciones / (12*fm.Consumo),4) AS Ratio, 0 + FROM bi.facturacion_media_anual fm + LEFT JOIN( + SELECT cm.Id_Cliente, round(sum(-1 * ((sensib -1)/4) * + Cantidad * Preu * (100 - Descuento) / 100)) + AS Reclamaciones + FROM vn2008.Movimientos m + JOIN vn2008.cl_act ca + ON ca.Id_Movimiento = m.Id_Movimiento + JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id + WHERE ca.cl_sol_id NOT IN (1,5) + AND cm.cl_est_id = 3 + AND cm.Fecha >= TIMESTAMPADD(YEAR, -1, CURDATE()) + GROUP BY cm.Id_Cliente + ) claims ON claims.Id_Cliente = fm.Id_Cliente; + + + -- Calculamos el porcentaje del recobro para añadirlo al precio de venta + UPDATE bi.claims_ratio cr + JOIN ( + SELECT Id_Cliente, nz(SUM(Importe)) AS Greuge + FROM vn2008.Greuges + WHERE Fecha <= CURDATE() + GROUP BY Id_Cliente + ) g ON g.Id_Cliente = cr.Id_Cliente + SET recobro = GREATEST(0,round(nz(Greuge) / + (nz(Consumo) * vMonthToRefund / 12 ) ,3)); + + -- Protección neonatos + UPDATE bi.claims_ratio cr + JOIN vn.firstTicketShipped fts ON fts.clientFk = cr.Id_Cliente + SET recobro = 0, Ratio = 0 + WHERE fts.shipped > TIMESTAMPADD(MONTH,-1,CURDATE()); + + -- CLIENTE 7983, JULIAN SUAU + UPDATE bi.claims_ratio SET recobro = LEAST(0.05, recobro) WHERE Id_Cliente = 7983; + + -- CLIENTE 4358 + UPDATE bi.claims_ratio SET recobro = GREATEST(0.05, recobro) WHERE Id_Cliente = 4358; + + -- CLIENTE 5523, VERDECORA UPDATE bi.claims_ratio SET recobro = GREATEST(0.12, recobro) WHERE Id_Cliente = 5523; -- CLIENTE 15979, SERVEIS VETERINARIS - UPDATE bi.claims_ratio SET recobro = GREATEST(0.05, recobro) WHERE Id_Cliente = 15979; - - -- CLIENTE 5189 i 8942, son de CSR i son el mateix client - UPDATE bi.claims_ratio cr - JOIN (SELECT sum(Consumo * recobro)/sum(Consumo) as recobro - FROM bi.claims_ratio - WHERE Id_Cliente IN ( 5189,8942) - ) sub - SET cr.recobro = sub.recobro - WHERE Id_Cliente IN ( 5189,8942); + UPDATE bi.claims_ratio SET recobro = GREATEST(0.05, recobro) WHERE Id_Cliente = 15979; + + -- CLIENTE 5189 i 8942, son de CSR i son el mateix client + UPDATE bi.claims_ratio cr + JOIN (SELECT sum(Consumo * recobro)/sum(Consumo) as recobro + FROM bi.claims_ratio + WHERE Id_Cliente IN ( 5189,8942) + ) sub + SET cr.recobro = sub.recobro + WHERE Id_Cliente IN ( 5189,8942); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -3240,23 +3245,23 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `clean`() -BEGIN - DECLARE vDateShort DATETIME; - DECLARE vDateLong DATETIME; - DECLARE vOneYearAgo DATETIME; - - SET vDateShort = TIMESTAMPADD(MONTH, -2, CURDATE()); - SET vDateLong = TIMESTAMPADD(MONTH, -18,CURDATE()); - SET vOneYearAgo = TIMESTAMPADD(YEAR, -1,CURDATE()); - - -- DELETE FROM bi.comparativa_clientes WHERE Fecha < vDateLong; - - DELETE FROM bi.Greuge_Evolution - WHERE (Fecha < vDateShort AND weekday(Fecha) != 1) - OR Fecha < vOneYearAgo; - - DELETE FROM bi.defaulters WHERE `date` < vDateLong; - DELETE FROM bi.defaulting WHERE `date` < vDateLong; +BEGIN + DECLARE vDateShort DATETIME; + DECLARE vDateLong DATETIME; + DECLARE vOneYearAgo DATETIME; + + SET vDateShort = TIMESTAMPADD(MONTH, -2, CURDATE()); + SET vDateLong = TIMESTAMPADD(MONTH, -18,CURDATE()); + SET vOneYearAgo = TIMESTAMPADD(YEAR, -1,CURDATE()); + + -- DELETE FROM bi.comparativa_clientes WHERE Fecha < vDateLong; + + DELETE FROM bi.Greuge_Evolution + WHERE (Fecha < vDateShort AND weekday(Fecha) != 1) + OR Fecha < vOneYearAgo; + + DELETE FROM bi.defaulters WHERE `date` < vDateLong; + DELETE FROM bi.defaulting WHERE `date` < vDateLong; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -3734,18 +3739,18 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `facturacion_media_anual_update`() -BEGIN - TRUNCATE TABLE bi.facturacion_media_anual; - - REPLACE bi.facturacion_media_anual(Id_Cliente, Consumo) - SELECT clientFk, avg(Facturacion) - FROM ( - SELECT clientFk, YEAR(issued) year, MONTH(issued) month, sum(amount) as Facturacion - FROM vn.invoiceOut - WHERE issued BETWEEN TIMESTAMPADD(YEAR,-1,CURDATE()) AND TIMESTAMPADD(DAY, - DAY(CURDATE()),CURDATE()) - GROUP BY clientFk, year, month - ) vol - GROUP BY clientFk; +BEGIN + TRUNCATE TABLE bi.facturacion_media_anual; + + REPLACE bi.facturacion_media_anual(Id_Cliente, Consumo) + SELECT clientFk, avg(Facturacion) + FROM ( + SELECT clientFk, YEAR(issued) year, MONTH(issued) month, sum(amount) as Facturacion + FROM vn.invoiceOut + WHERE issued BETWEEN TIMESTAMPADD(YEAR,-1,CURDATE()) AND TIMESTAMPADD(DAY, - DAY(CURDATE()),CURDATE()) + GROUP BY clientFk, year, month + ) vol + GROUP BY clientFk; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -3865,116 +3870,116 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `Greuge_Evolution_Add`() -BEGIN -/* - Inserta en la tabla Greuge_Evolution el saldo acumulado de cada cliente, - así como las ventas acumuladas en los ultimos 365 dias, para poder controlar - su evolucion. -*/ - DECLARE datFEC DATE; - DECLARE datFEC_TOMORROW DATE; - DECLARE datFEC_LASTYEAR DATE; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN - - GET DIAGNOSTICS CONDITION 2 @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT; - SELECT CONCAT('ERROR ', IFNULL(@errno,0), ': ', ifnull(@text,'texto')); - INSERT INTO vn2008.mail (`to`,`subject`,`text`) VALUES ('jgallego@verdnatura.es', 'Greuge_Evolution_Add' ,CONCAT('ERROR ', IFNULL(@errno,0), ': ', ifnull(@text,'texto'))); - INSERT INTO vn2008.mail (`to`,`subject`,`text`) VALUES ('pako@verdnatura.es', 'Greuge_Evolution_Add' ,CONCAT('ERROR ', IFNULL(@errno,0), ': ', ifnull(@text,'texto'))); - - END; - - SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +BEGIN +/* + Inserta en la tabla Greuge_Evolution el saldo acumulado de cada cliente, + así como las ventas acumuladas en los ultimos 365 dias, para poder controlar + su evolucion. +*/ + DECLARE datFEC DATE; + DECLARE datFEC_TOMORROW DATE; + DECLARE datFEC_LASTYEAR DATE; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN + + GET DIAGNOSTICS CONDITION 2 @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT; + SELECT CONCAT('ERROR ', IFNULL(@errno,0), ': ', ifnull(@text,'texto')); + INSERT INTO vn2008.mail (`to`,`subject`,`text`) VALUES ('jgallego@verdnatura.es', 'Greuge_Evolution_Add' ,CONCAT('ERROR ', IFNULL(@errno,0), ': ', ifnull(@text,'texto'))); + INSERT INTO vn2008.mail (`to`,`subject`,`text`) VALUES ('pako@verdnatura.es', 'Greuge_Evolution_Add' ,CONCAT('ERROR ', IFNULL(@errno,0), ': ', ifnull(@text,'texto'))); + + END; + + SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; DELETE FROM bi.Greuge_Evolution WHERE Fecha >= TIMESTAMPADD(MONTH,-1,CURDATE()); - - SELECT TIMESTAMPADD(DAY,1,MAX(Fecha)), - TIMESTAMPADD(DAY,2,MAX(Fecha)) - INTO datFEC, - datFEC_TOMORROW - FROM bi.Greuge_Evolution; - - SET datFEC_LASTYEAR = TIMESTAMPADD(YEAR,-1,datFEC); - - DELETE FROM bi.Greuge_Evolution WHERE Fecha >= datFEC; - - DROP TEMPORARY TABLE IF EXISTS maxInvoice; - - CREATE TEMPORARY TABLE maxInvoice - (PRIMARY KEY (Id_Cliente)) - ENGINE = MEMORY - SELECT DISTINCT Id_Cliente, max(Fecha) as maxFecha - FROM vn2008.Facturas - GROUP BY Id_Cliente - HAVING maxFecha < timestampadd(month,-2,datFEC); - - WHILE datFEC < CURDATE() DO - - REPLACE bi.Greuge_Evolution(Id_Cliente, Fecha, Greuge, Ventas, Fosil) - - SELECT Id_Cliente, datFEC as Fecha, Greuge, Ventas, 0 - FROM ( - SELECT Id_Cliente, sum(Importe) as Greuge - FROM vn2008.Greuges - where Fecha <= datFEC - group by Id_Cliente - ) sub - RIGHT JOIN - - ( - - SELECT Id_Cliente, sum(Ventas) as Ventas - FROM - ( - - SELECT Id_Cliente, IF (fecha != datFEC, -1,1) * (importe + recargo) as Ventas - FROM bs.ventas - WHERE fecha = datFEC or fecha = datFEC_LASTYEAR - - UNION ALL - - SELECT Id_Cliente, Ventas - FROM bi.Greuge_Evolution - WHERE Fecha = TIMESTAMPADD(DAY, -1, datFEC) - - ) sub - group by Id_Cliente - - ) v using(Id_Cliente) - ; - - -- Ahora calcularemos el greuge muerto - - UPDATE bi.Greuge_Evolution ge - JOIN maxInvoice m using(Id_Cliente) - SET FOSIL = GREUGE - WHERE m.maxFecha < TIMESTAMPADD(MONTH,-2,ge.Fecha); - - -- Recobro - - UPDATE bi.Greuge_Evolution ge - JOIN ( - SELECT cs.Id_Cliente, sum(Valor * Cantidad) as Importe - FROM vn2008.Tickets t - JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna - JOIN vn2008.Movimientos m on m.Id_Ticket = t.Id_Ticket - JOIN vn2008.Movimientos_componentes mc on mc.Id_Movimiento = m.Id_Movimiento - WHERE t.Fecha >= datFEC - AND t.Fecha < datFEC_TOMORROW - AND mc.Id_Componente = 17 -- Recobro - GROUP BY cs.Id_Cliente - ) sub using(Id_Cliente) - SET Recobro = Importe - WHERE ge.Fecha = datFEC; - - SET datFEC = datFEC_TOMORROW; - SET datFEC_TOMORROW = TIMESTAMPADD(DAY,1,datFEC_TOMORROW); - SET datFEC_LASTYEAR = TIMESTAMPADD(YEAR,-1,datFEC); - - - END WHILE; - - DROP TEMPORARY TABLE IF EXISTS maxInvoice; + + SELECT TIMESTAMPADD(DAY,1,MAX(Fecha)), + TIMESTAMPADD(DAY,2,MAX(Fecha)) + INTO datFEC, + datFEC_TOMORROW + FROM bi.Greuge_Evolution; + + SET datFEC_LASTYEAR = TIMESTAMPADD(YEAR,-1,datFEC); + + DELETE FROM bi.Greuge_Evolution WHERE Fecha >= datFEC; + + DROP TEMPORARY TABLE IF EXISTS maxInvoice; + + CREATE TEMPORARY TABLE maxInvoice + (PRIMARY KEY (Id_Cliente)) + ENGINE = MEMORY + SELECT DISTINCT Id_Cliente, max(Fecha) as maxFecha + FROM vn2008.Facturas + GROUP BY Id_Cliente + HAVING maxFecha < timestampadd(month,-2,datFEC); + + WHILE datFEC < CURDATE() DO + + REPLACE bi.Greuge_Evolution(Id_Cliente, Fecha, Greuge, Ventas, Fosil) + + SELECT Id_Cliente, datFEC as Fecha, Greuge, Ventas, 0 + FROM ( + SELECT Id_Cliente, sum(Importe) as Greuge + FROM vn2008.Greuges + where Fecha <= datFEC + group by Id_Cliente + ) sub + RIGHT JOIN + + ( + + SELECT Id_Cliente, sum(Ventas) as Ventas + FROM + ( + + SELECT Id_Cliente, IF (fecha != datFEC, -1,1) * (importe + recargo) as Ventas + FROM bs.ventas + WHERE fecha = datFEC or fecha = datFEC_LASTYEAR + + UNION ALL + + SELECT Id_Cliente, Ventas + FROM bi.Greuge_Evolution + WHERE Fecha = TIMESTAMPADD(DAY, -1, datFEC) + + ) sub + group by Id_Cliente + + ) v using(Id_Cliente) + ; + + -- Ahora calcularemos el greuge muerto + + UPDATE bi.Greuge_Evolution ge + JOIN maxInvoice m using(Id_Cliente) + SET FOSIL = GREUGE + WHERE m.maxFecha < TIMESTAMPADD(MONTH,-2,ge.Fecha); + + -- Recobro + + UPDATE bi.Greuge_Evolution ge + JOIN ( + SELECT cs.Id_Cliente, sum(Valor * Cantidad) as Importe + FROM vn2008.Tickets t + JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna + JOIN vn2008.Movimientos m on m.Id_Ticket = t.Id_Ticket + JOIN vn2008.Movimientos_componentes mc on mc.Id_Movimiento = m.Id_Movimiento + WHERE t.Fecha >= datFEC + AND t.Fecha < datFEC_TOMORROW + AND mc.Id_Componente = 17 -- Recobro + GROUP BY cs.Id_Cliente + ) sub using(Id_Cliente) + SET Recobro = Importe + WHERE ge.Fecha = datFEC; + + SET datFEC = datFEC_TOMORROW; + SET datFEC_TOMORROW = TIMESTAMPADD(DAY,1,datFEC_TOMORROW); + SET datFEC_LASTYEAR = TIMESTAMPADD(YEAR,-1,datFEC); + + + END WHILE; + + DROP TEMPORARY TABLE IF EXISTS maxInvoice; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -4058,10 +4063,10 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `nigthlyAnalisisVentas`() -BEGIN - CALL analisis_ventas_update; - CALL analisis_ventas_simple; - CALL analisis_ventas_evolution_add; +BEGIN + CALL analisis_ventas_update; + CALL analisis_ventas_simple; + CALL analisis_ventas_evolution_add; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -4840,3456 +4845,6 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; --- --- Current Database: `bs` --- - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `bs` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; - -USE `bs`; - --- --- Temporary view structure for view `bajasLaborales` --- - -DROP TABLE IF EXISTS `bajasLaborales`; -/*!50001 DROP VIEW IF EXISTS `bajasLaborales`*/; -SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; -/*!50001 CREATE VIEW `bajasLaborales` AS SELECT - 1 AS `firstname`, - 1 AS `name`, - 1 AS `business_id`, - 1 AS `lastDate`, - 1 AS `endContract`, - 1 AS `type`, - 1 AS `dias`, - 1 AS `userFk`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `bancos_evolution` --- - -DROP TABLE IF EXISTS `bancos_evolution`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `bancos_evolution` ( - `Fecha` date NOT NULL, - `Id_Banco` int(11) NOT NULL, - `saldo` double NOT NULL DEFAULT '0', - `quilla` double NOT NULL DEFAULT '0', - `deuda` double NOT NULL DEFAULT '0', - `liquidez` double NOT NULL DEFAULT '0', - `disponibilidad ajena` double NOT NULL DEFAULT '0', - `saldo_aux` double NOT NULL DEFAULT '0' COMMENT 'Saldo auxiliar para el calculo de lo dispuesto en las polizas', - PRIMARY KEY (`Fecha`,`Id_Banco`), - KEY `fk_banco_evolution_idx` (`Id_Banco`), - CONSTRAINT `fk_banco_evolution` FOREIGN KEY (`Id_Banco`) REFERENCES `vn`.`bank` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los saldos bancarios'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `carteras` --- - -DROP TABLE IF EXISTS `carteras`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `carteras` ( - `CodigoTrabajador` varchar(3) CHARACTER SET latin1 NOT NULL, - `Año` int(11) NOT NULL, - `Mes` int(11) NOT NULL, - `Peso` decimal(10,2) DEFAULT NULL, - PRIMARY KEY (`CodigoTrabajador`,`Año`,`Mes`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `clientDied` --- - -DROP TABLE IF EXISTS `clientDied`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `clientDied` ( - `id` int(11) NOT NULL DEFAULT '0', - `clientName` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `lastInvoiced` date DEFAULT NULL, - `workerCode` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `Boss` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `Aviso` varchar(13) CHARACTER SET utf8 DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `clientNewBorn` --- - -DROP TABLE IF EXISTS `clientNewBorn`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `clientNewBorn` ( - `clientFk` int(11) NOT NULL, - `shipped` date NOT NULL, - PRIMARY KEY (`clientFk`), - CONSTRAINT `clientNewBorn_fk1` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Listado de clientes que se consideran nuevos a efectos de cobrar la comision adicional del comercial'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `compradores` --- - -DROP TABLE IF EXISTS `compradores`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `compradores` ( - `Id_Trabajador` int(11) NOT NULL, - `año` int(4) NOT NULL, - `semana` int(2) NOT NULL, - `importe` decimal(10,2) DEFAULT NULL, - `comision` decimal(10,2) DEFAULT NULL, - PRIMARY KEY (`Id_Trabajador`,`año`,`semana`), - CONSTRAINT `comprador_trabajador` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn`.`worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `compradores_evolution` --- - -DROP TABLE IF EXISTS `compradores_evolution`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `compradores_evolution` ( - `Id_Trabajador` int(11) NOT NULL, - `fecha` date NOT NULL, - `importe` decimal(10,2) DEFAULT NULL, - PRIMARY KEY (`Id_Trabajador`,`fecha`), - CONSTRAINT `evo_trabajador` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn`.`worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `experienceIberflora2016` --- - -DROP TABLE IF EXISTS `experienceIberflora2016`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `experienceIberflora2016` ( - `Id_Cliente` int(11) NOT NULL, - `isVisitor` tinyint(4) NOT NULL DEFAULT '0', - PRIMARY KEY (`Id_Cliente`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de clientes que participan en el estudio sobre la mejora del consumo tras la visita a las instalaciones de Silla'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `fondo_maniobra` --- - -DROP TABLE IF EXISTS `fondo_maniobra`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `fondo_maniobra` ( - `fecha` date NOT NULL, - `fondo` double DEFAULT NULL, - `clientes_facturas` double DEFAULT NULL, - `clientes_cobros` double DEFAULT NULL, - `proveedores_facturas` double DEFAULT NULL, - `proveedores_pagos` double DEFAULT NULL, - `fondo_medio` double DEFAULT NULL, - PRIMARY KEY (`fecha`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `indicators` --- - -DROP TABLE IF EXISTS `indicators`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `indicators` ( - `updated` date NOT NULL, - `lastYearSales` int(11) DEFAULT NULL, - `totalGreuge` int(11) DEFAULT NULL, - `latePaymentRate` decimal(5,4) DEFAULT NULL, - `countEmployee` decimal(10,2) DEFAULT NULL, - `averageMana` int(11) DEFAULT NULL, - `bankingPool` int(11) DEFAULT NULL, - `lastMonthActiveClients` int(11) DEFAULT NULL, - `lastMonthLostClients` int(11) DEFAULT NULL, - `lastMonthNewClients` int(11) DEFAULT NULL, - `lastMonthWebBuyingRate` decimal(5,4) DEFAULT NULL, - `productionHours` decimal(10,1) DEFAULT NULL, - `dailyWorkersCost` decimal(10,0) DEFAULT NULL, - `volumeM3` decimal(10,0) DEFAULT NULL, - `salesValue` decimal(10,0) DEFAULT NULL, - `valueM3` decimal(10,0) DEFAULT NULL, - `hoursM3` decimal(5,2) DEFAULT NULL, - `workerCostM3` decimal(10,1) DEFAULT NULL, - `salesWorkersCostRate` decimal(10,2) DEFAULT NULL, - `thisWeekSales` decimal(10,2) DEFAULT NULL, - `lastYearWeekSales` decimal(10,2) DEFAULT NULL, - PRIMARY KEY (`updated`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los valores actuales para una consulta diaria rápida por los directivos.'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary view structure for view `lastIndicators` --- - -DROP TABLE IF EXISTS `lastIndicators`; -/*!50001 DROP VIEW IF EXISTS `lastIndicators`*/; -SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; -/*!50001 CREATE VIEW `lastIndicators` AS SELECT - 1 AS `updated`, - 1 AS `lastYearSales`, - 1 AS `incLastYearSales`, - 1 AS `totalGreuge`, - 1 AS `incTotalGreuge`, - 1 AS `latePaymentRate`, - 1 AS `incLatePaymentRate`, - 1 AS `countEmployee`, - 1 AS `incCountEmployee`, - 1 AS `averageMana`, - 1 AS `incAverageMana`, - 1 AS `bankingPool`, - 1 AS `incbankingPool`, - 1 AS `lastMonthActiveClients`, - 1 AS `incLastMonthActiveClients`, - 1 AS `lastMonthLostClients`, - 1 AS `incLastMonthLostClients`, - 1 AS `lastMonthNewClients`, - 1 AS `incLastMonthNewClients`, - 1 AS `lastMonthWebBuyingRate`, - 1 AS `incLastMonthWebBuyingRate`, - 1 AS `productionHours`, - 1 AS `dailyWorkersCost`, - 1 AS `volumeM3`, - 1 AS `salesValue`, - 1 AS `valueM3`, - 1 AS `hoursM3`, - 1 AS `workerCostM3`, - 1 AS `salesWorkersCostRate`, - 1 AS `thisWeekSales`, - 1 AS `lastYearWeekSales`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `m3` --- - -DROP TABLE IF EXISTS `m3`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `m3` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `fecha` date NOT NULL, - `provinceFk` smallint(5) unsigned DEFAULT NULL, - `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT '0', - `m3` decimal(10,2) DEFAULT NULL, - `year` int(11) DEFAULT NULL, - `month` int(11) DEFAULT NULL, - `week` int(11) DEFAULT NULL, - `day` int(11) DEFAULT NULL, - `dayName` varchar(12) COLLATE utf8_unicode_ci DEFAULT NULL, - `euros` decimal(10,2) DEFAULT '0.00', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=393137 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary view structure for view `m3Silla` --- - -DROP TABLE IF EXISTS `m3Silla`; -/*!50001 DROP VIEW IF EXISTS `m3Silla`*/; -SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; -/*!50001 CREATE VIEW `m3Silla` AS SELECT - 1 AS `fecha`, - 1 AS `year`, - 1 AS `month`, - 1 AS `week`, - 1 AS `day`, - 1 AS `dayName`, - 1 AS `Volumen`, - 1 AS `Euros`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `m3analisis` --- - -DROP TABLE IF EXISTS `m3analisis`; -/*!50001 DROP VIEW IF EXISTS `m3analisis`*/; -SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; -/*!50001 CREATE VIEW `m3analisis` AS SELECT - 1 AS `fecha`, - 1 AS `year`, - 1 AS `month`, - 1 AS `week`, - 1 AS `day`, - 1 AS `dayName`, - 1 AS `Volumen`, - 1 AS `Euros`, - 1 AS `Departamento`, - 1 AS `Horas`, - 1 AS `Salarios`, - 1 AS `tiempoM3`, - 1 AS `valorM3`, - 1 AS `costeLaboralM3`, - 1 AS `costeEuros`, - 1 AS `precioHora`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `manaCustomer` --- - -DROP TABLE IF EXISTS `manaCustomer`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `manaCustomer` ( - `Id_Cliente` int(11) NOT NULL, - `Mana` decimal(10,0) NOT NULL DEFAULT '0', - `dated` date NOT NULL, - PRIMARY KEY (`Id_Cliente`,`dated`), - KEY `manaCustomerIdx1` (`dated`), - CONSTRAINT `cliente_fk` FOREIGN KEY (`Id_Cliente`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary view structure for view `manaSpellersExcluded` --- - -DROP TABLE IF EXISTS `manaSpellersExcluded`; -/*!50001 DROP VIEW IF EXISTS `manaSpellersExcluded`*/; -SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; -/*!50001 CREATE VIEW `manaSpellersExcluded` AS SELECT - 1 AS `workerFk`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `mana_spellers` --- - -DROP TABLE IF EXISTS `mana_spellers`; -/*!50001 DROP VIEW IF EXISTS `mana_spellers`*/; -SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; -/*!50001 CREATE VIEW `mana_spellers` AS SELECT - 1 AS `Id_Trabajador`, - 1 AS `size`, - 1 AS `used`, - 1 AS `prices_modifier_rate`, - 1 AS `prices_modifier_activated`, - 1 AS `minRate`, - 1 AS `maxRate`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `mana_spellers_excluded` --- - -DROP TABLE IF EXISTS `mana_spellers_excluded`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `mana_spellers_excluded` ( - `Id_Trabajador` int(11) NOT NULL, - PRIMARY KEY (`Id_Trabajador`), - CONSTRAINT `mana_spellers_excluded_fk1` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn`.`worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Usuarios que tienen que estar excluidos del cálculo del maná'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary view structure for view `mermas` --- - -DROP TABLE IF EXISTS `mermas`; -/*!50001 DROP VIEW IF EXISTS `mermas`*/; -SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; -/*!50001 CREATE VIEW `mermas` AS SELECT - 1 AS `Comprador`, - 1 AS `Familia`, - 1 AS `Referencia`, - 1 AS `Item`, - 1 AS `Cantidad`, - 1 AS `Coste_Unitario`, - 1 AS `Importe`, - 1 AS `Cliente`, - 1 AS `ticketFk`, - 1 AS `Fecha`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `mermasCache` --- - -DROP TABLE IF EXISTS `mermasCache`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `mermasCache` ( - `Comprador` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `año` int(4) NOT NULL, - `Valor_Compra` decimal(10,0) DEFAULT NULL, - `Faltas` decimal(10,0) DEFAULT NULL, - `Basura` decimal(10,0) DEFAULT NULL, - PRIMARY KEY (`Comprador`,`año`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `nightTask` --- - -DROP TABLE IF EXISTS `nightTask`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `nightTask` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `started` datetime DEFAULT NULL, - `finished` datetime DEFAULT NULL, - `lastFinished` datetime DEFAULT NULL, - `order` int(11) DEFAULT NULL, - `schema` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `procedure` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `error` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `errorCode` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `bs`.`nightTaskBeforeInsert` BEFORE INSERT ON `nightTask` FOR EACH ROW -BEGIN - - IF NOT (NEW.`schema`REGEXP '^[0-9a-zA-Z_]+$') OR NOT (NEW.`procedure`REGEXP '^[0-9a-zA-Z_]+$') THEN - - CALL util.throw('ONLY_ALPHANUMERICS_ALLOWED'); - - END IF; - -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `bs`.`nightTaskBeforeUpdate` BEFORE UPDATE ON `nightTask` FOR EACH ROW -BEGIN - - IF NOT (NEW.`schema`REGEXP '^[0-9a-zA-Z_]+$') OR NOT (NEW.`procedure`REGEXP '^[0-9a-zA-Z_]+$') THEN - - CALL util.throw('ONLY_ALPHANUMERICS_ALLOWED'); - - END IF; - -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; - --- --- Table structure for table `nightTaskConfig` --- - -DROP TABLE IF EXISTS `nightTaskConfig`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `nightTaskConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `logMail` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `payMethodClient` --- - -DROP TABLE IF EXISTS `payMethodClient`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `payMethodClient` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `dated` date NOT NULL, - `payMethodFk` tinyint(3) unsigned NOT NULL DEFAULT '0', - `clientFk` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - KEY `FkPayMethod_idx` (`payMethodFk`), - KEY `FkClientPayMethod_idx` (`clientFk`), - KEY `FkDateClientPayMethod` (`dated`,`clientFk`), - CONSTRAINT `FkClientPayMethod` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `FkPayMethodClient` FOREIGN KEY (`payMethodFk`) REFERENCES `vn`.`payMethod` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=6215710 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `payMethodClientEvolution` --- - -DROP TABLE IF EXISTS `payMethodClientEvolution`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `payMethodClientEvolution` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `dated` date NOT NULL, - `payMethodName` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `amountClient` int(11) NOT NULL, - `amount` decimal(10,2) NOT NULL, - `equalizationTax` decimal(10,2) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2048 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `productivity` --- - -DROP TABLE IF EXISTS `productivity`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `productivity` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `dated` date NOT NULL, - `hh` int(10) unsigned NOT NULL, - `mm` int(10) unsigned NOT NULL, - `m3` double NOT NULL DEFAULT '0', - `workers` int(11) NOT NULL DEFAULT '0', - `wCost` double NOT NULL DEFAULT '0', - `numCoordinadores` int(11) NOT NULL DEFAULT '0', - `costCoordinacion` double NOT NULL DEFAULT '0', - `numSacadores` int(11) NOT NULL DEFAULT '0', - `costSacado` double NOT NULL DEFAULT '0', - `numEncajadores` int(11) NOT NULL DEFAULT '0', - `costEncajado` double NOT NULL DEFAULT '0', - `numPaletizadores` int(11) NOT NULL DEFAULT '0', - `costPaletizado` double NOT NULL DEFAULT '0', - `numCamareros` int(11) NOT NULL DEFAULT '0', - `costCamara` double NOT NULL DEFAULT '0', - `numComplementos` int(11) NOT NULL DEFAULT '0', - `costComplementos` double NOT NULL DEFAULT '0', - `numArtificial` int(11) NOT NULL DEFAULT '0', - `costArtificial` double NOT NULL DEFAULT '0', - `m3FV` double NOT NULL DEFAULT '0', - `m3PCA` double NOT NULL DEFAULT '0', - `m3Artificial` decimal(10,2) NOT NULL DEFAULT '0.00', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=64091248 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `productivityDepartment` --- - -DROP TABLE IF EXISTS `productivityDepartment`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `productivityDepartment` ( - `dated` date NOT NULL, - `amountCoordinacion` decimal(10,2) NOT NULL DEFAULT '0.00', - `amountSacado` decimal(10,2) NOT NULL DEFAULT '0.00', - `amountEncajado` decimal(10,2) NOT NULL DEFAULT '0.00', - `amountPaletizado` decimal(10,2) NOT NULL DEFAULT '0.00', - `amountCamara` decimal(10,2) NOT NULL DEFAULT '0.00', - `amountComplementos` decimal(10,2) NOT NULL DEFAULT '0.00', - `amountArtificial` decimal(10,2) NOT NULL DEFAULT '0.00', - PRIMARY KEY (`dated`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `productivity_evolution` --- - -DROP TABLE IF EXISTS `productivity_evolution`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `productivity_evolution` ( - `dated` date NOT NULL, - `m3productionCost` decimal(10,2) NOT NULL DEFAULT '0.00', - PRIMARY KEY (`dated`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `salaries2018` --- - -DROP TABLE IF EXISTS `salaries2018`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `salaries2018` ( - `person_id` int(11) NOT NULL DEFAULT '0', - `sex` enum('M','F') CHARACTER SET utf8 NOT NULL DEFAULT 'F' COMMENT 'M Masculino F Femenino', - `edad` int(6) DEFAULT NULL, - `antiguedad` int(6) DEFAULT NULL, - `Modalidad` varchar(22) CHARACTER SET utf8mb4 NOT NULL DEFAULT '', - `reason` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `worker` varchar(82) CHARACTER SET utf8 DEFAULT NULL, - `totalDays` decimal(32,0) DEFAULT NULL, - `totalAnual` decimal(16,0) DEFAULT NULL, - `virtualMonthlySalary` decimal(16,0) DEFAULT NULL, - `departamento` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `category_name` varchar(50) CHARACTER SET utf8 NOT NULL, - `level_name` varchar(5) CHARACTER SET utf8 DEFAULT NULL, - `thisYearDateStart` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL, - PRIMARY KEY (`person_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `salePersonEvolution` --- - -DROP TABLE IF EXISTS `salePersonEvolution`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `salePersonEvolution` ( - `dated` date NOT NULL DEFAULT '0000-00-00', - `amount` decimal(10,2) NOT NULL DEFAULT '0.00', - `equalizationTax` decimal(10,2) NOT NULL DEFAULT '0.00', - `salesPersonFk` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`dated`,`salesPersonFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `salesByWeek` --- - -DROP TABLE IF EXISTS `salesByWeek`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `salesByWeek` ( - `week` int(11) NOT NULL, - `year` int(11) NOT NULL, - `sales` double DEFAULT NULL, - UNIQUE KEY `week` (`week`,`year`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `vendedores` --- - -DROP TABLE IF EXISTS `vendedores`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `vendedores` ( - `Id_Trabajador` int(11) NOT NULL, - `año` int(4) NOT NULL, - `mes` int(2) NOT NULL, - `importe` decimal(10,2) DEFAULT NULL, - `comision` decimal(10,2) DEFAULT NULL, - `comisionArrendada` decimal(10,2) DEFAULT NULL COMMENT 'comision proveniente de clientes que han sido donados. Ver tabla Clientes_cedidos', - `comisionCedida` decimal(10,2) DEFAULT NULL COMMENT 'comision generada por los clientes que han sido donados. Ver tabla Clientes_cedidos', - `comisionNuevos` decimal(10,2) DEFAULT NULL, - PRIMARY KEY (`Id_Trabajador`,`año`,`mes`), - CONSTRAINT `trabajador_trabajador` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn`.`worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `vendedores_evolution` --- - -DROP TABLE IF EXISTS `vendedores_evolution`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `vendedores_evolution` ( - `workerFk` int(11) NOT NULL, - `year` int(11) NOT NULL, - `sales` decimal(10,2) DEFAULT NULL, - `month` int(11) NOT NULL, - PRIMARY KEY (`workerFk`,`year`,`month`), - CONSTRAINT `evo_vendedor_trabajador` FOREIGN KEY (`workerFk`) REFERENCES `vn`.`worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `ventas` --- - -DROP TABLE IF EXISTS `ventas`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `ventas` ( - `Id_Movimiento` int(11) NOT NULL, - `importe` decimal(10,3) NOT NULL DEFAULT '0.000', - `recargo` decimal(10,3) NOT NULL DEFAULT '0.000', - `fecha` date NOT NULL, - `tipo_id` smallint(5) unsigned NOT NULL, - `Id_Cliente` int(11) NOT NULL DEFAULT '1', - `empresa_id` smallint(5) unsigned NOT NULL DEFAULT '442', - PRIMARY KEY (`Id_Movimiento`), - KEY `tip_to_tip_idx` (`tipo_id`), - KEY `clientes_bs_ventas_idx` (`Id_Cliente`), - KEY `empresa_bs_ventas_idx` (`empresa_id`), - KEY `fecha_bs` (`fecha`), - CONSTRAINT `clientes_bs_ventas` FOREIGN KEY (`Id_Cliente`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `empresa_bs_ventas` FOREIGN KEY (`empresa_id`) REFERENCES `vn`.`company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `mov_to_mov` FOREIGN KEY (`Id_Movimiento`) REFERENCES `vn`.`sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `tip_to_tip` FOREIGN KEY (`tipo_id`) REFERENCES `vn`.`itemType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `ventas_contables` --- - -DROP TABLE IF EXISTS `ventas_contables`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `ventas_contables` ( - `year` int(4) NOT NULL, - `month` int(2) NOT NULL, - `venta` decimal(10,2) DEFAULT NULL, - `grupo` int(1) NOT NULL, - `reino_id` int(10) unsigned NOT NULL, - `tipo_id` smallint(5) unsigned NOT NULL, - `empresa_id` int(4) NOT NULL, - `gasto` varchar(10) CHARACTER SET latin1 NOT NULL, - PRIMARY KEY (`year`,`month`,`grupo`,`reino_id`,`tipo_id`,`empresa_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `warehouseProduction_kk` --- - -DROP TABLE IF EXISTS `warehouseProduction_kk`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `warehouseProduction_kk` ( - `fecha` date NOT NULL, - `warehouse_id` smallint(6) unsigned NOT NULL, - `m3` decimal(10,0) NOT NULL DEFAULT '0', - `labourCost` decimal(10,0) NOT NULL DEFAULT '0', - `workerHours` decimal(10,0) NOT NULL DEFAULT '0', - PRIMARY KEY (`fecha`,`warehouse_id`), - KEY `warehouseProduction_fk1_idx` (`warehouse_id`), - CONSTRAINT `warehouseProduction_fk1` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary view structure for view `workerMana` --- - -DROP TABLE IF EXISTS `workerMana`; -/*!50001 DROP VIEW IF EXISTS `workerMana`*/; -SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; -/*!50001 CREATE VIEW `workerMana` AS SELECT - 1 AS `workerFk`, - 1 AS `amount`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `workerSpeed` --- - -DROP TABLE IF EXISTS `workerSpeed`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `workerSpeed` ( - `workerCode` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `accion` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT '1', - `LitrosMinuto` decimal(10,1) DEFAULT NULL, - `LitrosMinutoLastHour` decimal(10,1) DEFAULT NULL, - `lastUpdated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (`workerCode`,`warehouseFk`,`accion`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping events for database 'bs' --- -/*!50106 SET @save_time_zone= @@TIME_ZONE */ ; -/*!50106 DROP EVENT IF EXISTS `nightTask_launchAll` */; -DELIMITER ;; -/*!50003 SET @saved_cs_client = @@character_set_client */ ;; -/*!50003 SET @saved_cs_results = @@character_set_results */ ;; -/*!50003 SET @saved_col_connection = @@collation_connection */ ;; -/*!50003 SET character_set_client = utf8mb4 */ ;; -/*!50003 SET character_set_results = utf8mb4 */ ;; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; -/*!50003 SET @saved_time_zone = @@time_zone */ ;; -/*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `nightTask_launchAll` ON SCHEDULE EVERY 1 DAY STARTS '2017-08-27 02:00:00' ON COMPLETION NOT PRESERVE ENABLE DO CALL bs.nightTask_launchAll */ ;; -/*!50003 SET time_zone = @saved_time_zone */ ;; -/*!50003 SET sql_mode = @saved_sql_mode */ ;; -/*!50003 SET character_set_client = @saved_cs_client */ ;; -/*!50003 SET character_set_results = @saved_cs_results */ ;; -/*!50003 SET collation_connection = @saved_col_connection */ ;; -DELIMITER ; -/*!50106 SET TIME_ZONE= @save_time_zone */ ; - --- --- Dumping routines for database 'bs' --- -/*!50003 DROP FUNCTION IF EXISTS `tramo` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `tramo`(vDateTime DATETIME) RETURNS varchar(20) CHARSET utf8 COLLATE utf8_unicode_ci -BEGIN - - DECLARE vTramo VARCHAR(20); - DECLARE vHour INT; - - SET vHour = HOUR(vDateTime) ; - - SET vTramo = - CASE - WHEN vHour BETWEEN 0 AND 14 THEN 'Mañana' - WHEN vHour BETWEEN 15 AND 24 THEN 'Tarde' - END ; - -RETURN vTramo; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `analisisComponentes` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `analisisComponentes`() -BEGIN - -DECLARE vDateStart DATE DEFAULT '2016-01-01'; -DECLARE vDateEnd DATE DEFAULT '2016-11-30'; -DECLARE vDate DATE; - -SET vDate = vDateStart; - -DELETE FROM bs.ventasComponentes; - -WHILE vDate <= vDateEnd DO - - INSERT INTO bs.ventasComponentes - SELECT vDate as Fecha, mc.Id_Componente, cast(sum(m.Cantidad * mc.Valor) AS DECIMAL(10,2)) as Importe - FROM vn2008.Movimientos_componentes mc - JOIN vn2008.Movimientos m ON m.Id_Movimiento = mc.Id_Movimiento - JOIN bs.ventas v ON v.Id_Movimiento = mc.Id_Movimiento - WHERE v.fecha = vDate - AND empresa_id IN (442,567) - GROUP BY mc.Id_Componente; - - SET vDate = TIMESTAMPADD(DAY,1,vDate); - - IF DAY(vDate) MOD 28 = 0 THEN - - SELECT vDate; - - END IF; - -END WHILE; - - SELECT vDate; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `bancos_evolution_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `bancos_evolution_add`() -BEGIN - /* - - Inserta en la tabla bancos_evolution los saldos acumulados - - */ - - - DECLARE vCurrentDate DATE; - DECLARE vStartingDate DATE DEFAULT '2016-01-01'; - DECLARE vMaxDate DATE DEFAULT TIMESTAMPADD(MONTH, 7, CURDATE()); - - DELETE FROM bs.bancos_evolution WHERE Fecha > vStartingDate; - - SET vCurrentDate = vStartingDate; - - WHILE vCurrentDate < vMaxDate DO - - REPLACE bs.bancos_evolution( Fecha - ,Id_Banco - ,saldo) - - SELECT vCurrentDate - , Id_Banco - , sum(saldo) - - FROM - ( - - SELECT Id_Banco - ,saldo_aux as saldo - FROM bs.bancos_evolution - - WHERE Fecha = TIMESTAMPADD(DAY,-1,vCurrentDate) -- los saldos acumulados del dia anterior - - UNION ALL - - SELECT c.Id_Banco, IFNULL(sum(Entrada),0) - ifnull(sum(Salida),0) as saldo - FROM vn2008.Cajas c - JOIN vn2008.Bancos b using(Id_Banco) -- saldos de las cajas - WHERE cash IN (0,3) - AND Cajafecha = vCurrentDate - AND (Serie = 'MB' OR cash = 3) - GROUP BY Id_Banco - - UNION ALL - - SELECT id_banco, - importe -- pagos futuros - FROM vn2008.pago - WHERE fecha = vCurrentDate - AND fecha >= CURDATE() - AND NOT conciliado - - UNION ALL - - SELECT Id_Banco, Entregado -- cobros futuros - FROM vn2008.Recibos - WHERE Fechacobro = vCurrentDate - AND Fechacobro > CURDATE() - - UNION ALL - - SELECT sp.Id_Banco, Importe -- saldos de la tabla prevision - FROM vn2008.Saldos_Prevision sp - JOIN vn2008.Bancos b using(Id_Banco) - WHERE cash IN (0,3) - AND Fecha = vCurrentDate - - - - )sub - GROUP BY Id_Banco; - - -- Utilizamos el saldo_auxiliar para calcular lo dispuesto en las polizas - - UPDATE bs.bancos_evolution be - SET saldo_aux = saldo; - - -- Ahora actualizamos la quilla - UPDATE bs.bancos_evolution be - LEFT JOIN - ( - SELECT Id_Banco, - sum(importe) as quilla - FROM vn2008.Bancos_poliza - WHERE vCurrentDate between apertura AND IFNULL(cierre, vCurrentDate) - GROUP BY Id_Banco - ) sub using(Id_Banco) - SET be.quilla = sub.quilla - WHERE be.Fecha = vCurrentDate; - - - SET vCurrentDate = TIMESTAMPADD(DAY,1,vCurrentDate); - - END WHILE; - - - -- Deuda - UPDATE bs.bancos_evolution be - JOIN vn2008.Bancos using(Id_Banco) - SET be.deuda = IF(cash = 3, be.saldo_aux, 0) - , be.saldo = IF(cash = 3, 0, be.saldo_aux) - WHERE Fecha >= vStartingDate; - - - -- Liquidez - update bs.bancos_evolution set liquidez = saldo - quilla + deuda WHERE Fecha >= vStartingDate; - - -- Disponibilidad - update bs.bancos_evolution set `disponibilidad ajena` = - quilla + deuda WHERE Fecha >= vStartingDate; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `campaignComparative` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `campaignComparative`(vDateFrom DATE, vDateTo DATE) -BEGIN - SELECT - workerName, - id, - name, - CAST(SUM(previousAmmount) AS DECIMAL(10, 0)) AS previousAmmount, - CAST(SUM(currentAmmount) AS DECIMAL(10, 0)) AS currentAmmount - FROM ( - (SELECT - CONCAT(w.firstname, ' ', w.lastName) AS workerName, - c.id, - c.name, - SUM(v.importe) AS previousAmmount, - 0 currentAmmount - FROM bs.ventas v - INNER JOIN vn.`client` c ON v.Id_Cliente = c.id - INNER JOIN vn.worker w ON c.salesPersonFk = w.id - WHERE v.fecha BETWEEN DATE_ADD(vDateFrom, INTERVAL - 1 YEAR) - AND DATE_ADD(vDateTo, INTERVAL - 1 YEAR) - GROUP BY w.id, v.Id_Cliente) - UNION ALL - (SELECT - CONCAT(w.firstname, ' ', w.lastName) AS workerName, - c.id, - c.name, - 0 AS previousAmmount, - SUM(s.quantity * s.price) AS currentAmmount - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.client c ON c.id = t.clientFk - JOIN vn.worker w ON c.salesPersonFk = w.id - WHERE t.shipped BETWEEN vDateFrom - AND vDateTo - GROUP BY w.id, c.id) - ) comparative - GROUP BY workerName, id - HAVING (previousAmmount <> 0 OR currentAmmount <> 0) - ORDER BY workerName, id; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `carteras_add` */; -ALTER DATABASE `bs` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `carteras_add`() -BEGIN - -DELETE FROM bs.carteras -WHERE Año >= YEAR(CURDATE()) - 1; - -INSERT INTO bs.carteras(Año,Mes,CodigoTrabajador,Peso) -SELECT year as Año, month as Mes, CodigoTrabajador, sum(importe) as Peso -FROM vn2008.time t -JOIN bs.ventas v on t.date = v.fecha -JOIN vn2008.Clientes c on c.Id_Cliente = v.Id_Cliente -JOIN vn2008.Trabajadores tr on tr.Id_Trabajador = c.Id_Trabajador -WHERE t.year >= YEAR(CURDATE()) - 1 -GROUP BY CodigoTrabajador, Año, Mes; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -ALTER DATABASE `bs` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP PROCEDURE IF EXISTS `clientDied` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `clientDied`() -BEGIN - - IF DAY(CURDATE()) = 6 THEN - - SET @primerAviso := TIMESTAMPADD(MONTH,-1,CURDATE()); - SET @segundoAviso := TIMESTAMPADD(MONTH,-2,CURDATE()); - SET @tercerAviso := TIMESTAMPADD(MONTH,-3,CURDATE()); - - TRUNCATE TABLE bs.clientDied; - - INSERT INTO bs.clientDied - SELECT c.id, - c.name as clientName, - maxIssued as lastInvoiced, - w.code AS workerCode, - b.code AS Boss, - CASE - WHEN IFNULL(maxIssued,'2000-01-01') < @tercerAviso THEN 'Tercer Aviso' - WHEN maxIssued < @segundoAviso THEN 'Segundo Aviso' - WHEN maxIssued < @primerAviso THEN 'Primer Aviso' - END as Aviso - FROM vn.client c - JOIN vn.worker w ON w.id = c.salesPersonFk - JOIN vn2008.jerarquia j ON j.worker_id = w.id - JOIN vn.worker b ON b.id = j.boss_id - JOIN bs.mana_spellers ms ON ms.Id_Trabajador = c.salesPersonFk - LEFT JOIN (SELECT clientFk, max(issued) as maxIssued FROM vn.invoiceOut GROUP BY clientFk) io ON io.clientFk = c.id - WHERE (maxIssued IS NULL OR maxIssued < @primerAviso) - AND c.created < @tercerAviso; - - END IF; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `clientNewBorn_Update` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `clientNewBorn_Update`() -BEGIN - - DECLARE fromDated DATE DEFAULT '2019-04-01'; - - -- Eliminamos clientes que ya no son nuevos - DELETE FROM bs.clientNewBorn - WHERE shipped < TIMESTAMPADD(YEAR,-1,CURDATE()); - - -- Clientes nuevos - REPLACE bs.clientNewBorn(clientFk,shipped) - SELECT t.clientFk, MIN(t.shipped) as shipped - FROM vn.ticket t - WHERE shipped > '2001-01-01' - GROUP BY t.clientFk - HAVING shipped >= GREATEST(TIMESTAMPADD(YEAR,-1,CURDATE()), fromDated); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `comercialesCompleto` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `comercialesCompleto`(IN vWorker INT, vDate DATE) -BEGIN - -CALL vn.subordinateGetList(vWorker); - -SELECT - c.Id_Cliente id_cliente, - c.calidad, - c.Cliente cliente, - cr.recobro * 100 tarifa, - c.Telefono telefono, - c.movil, - c.POBLACION poblacion, - p.`name` provincia, - vn2008.red(f.futur) futur, - c.Credito credito, - pm.`name` forma_pago, - vn2008.red(c365 / 12) consumo_medio365, - vn2008.red(c365) consumo365, - vn2008.red(CmLy.peso) peso_mes_año_pasado, - vn2008.red(CmLy.peso * 1.19) objetivo, - tr.CodigoTrabajador, - vn2008.red(mes_actual.consumo) consumoMes, - vn2008.red(IFNULL(mes_actual.consumo, 0) - IFNULL(CmLy.peso * 1.19, 0)) como_lo_llevo, - DATE(LastTicket) ultimo_ticket, - dead.muerto, - g.Greuge, - cr.recobro -FROM - vn2008.Clientes c - LEFT JOIN - (SELECT Id_Cliente, CAST( SUM(Importe) as DECIMAL(12,2)) AS Greuge - FROM vn2008.Greuges - GROUP BY Id_Cliente - ) g ON g.Id_Cliente = c.Id_Cliente - LEFT JOIN - vn2008.province p ON p.province_id = c.province_id - JOIN - vn2008.pay_met pm ON pm.id = c.pay_met_id - LEFT JOIN - vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador - LEFT JOIN - bi.claims_ratio cr on cr.Id_Cliente = c.Id_Cliente - LEFT JOIN - (SELECT v.Id_Cliente, SUM(importe) c365 -- optimizat de 6s /5.3s/ 4.7s a 0.3/0.4/0.3 - FROM bs.ventas v - JOIN vn2008.Clientes c USING (Id_Cliente) - - WHERE v.fecha BETWEEN TIMESTAMPADD(YEAR, - 1, vDate) AND vDate - GROUP BY v.Id_Cliente) c365 ON c365.Id_Cliente = c.Id_Cliente - LEFT JOIN - (SELECT - Id_Cliente, SUM(importe) consumo - FROM - bs.ventas v - INNER JOIN vn2008.Clientes c USING (Id_Cliente) - LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador - WHERE - (c.Id_Trabajador = vWorker OR tr.boss = vWorker) - AND (v.fecha BETWEEN TIMESTAMPADD(DAY, - DAY(vDate) + 1, vDate) AND TIMESTAMPADD(DAY, - 1, vDate)) - GROUP BY Id_Cliente) mes_actual ON mes_actual.Id_Cliente = c.Id_Cliente - LEFT JOIN - (SELECT - t.Id_Cliente, - SUM(m.preu * m.Cantidad * (1 - m.Descuento / 100)) futur - FROM - vn2008.Tickets t - JOIN vn2008.Clientes c ON c.Id_Cliente = t.Id_Cliente - JOIN vn2008.Movimientos m ON m.Id_Ticket = t.Id_Ticket - LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador - WHERE - (c.Id_Trabajador = vWorker OR tr.boss = vWorker) - AND DATE(Fecha) BETWEEN vDate AND LAST_DAY(vDate) - GROUP BY Id_Cliente) f ON c.Id_Cliente = f.Id_Cliente - LEFT JOIN - (SELECT - MAX(t.Fecha) LastTicket, c.Id_Cliente - FROM - vn2008.Tickets t - JOIN vn2008.Clientes c ON c.Id_cliente = t.Id_Cliente - LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador - - WHERE - (c.Id_Trabajador = vWorker OR tr.boss = vWorker) - GROUP BY t.Id_Cliente) LastTicket ON LastTicket.Id_Cliente = c.Id_Cliente - LEFT JOIN - (SELECT - SUM(importe) peso, c.Id_Cliente - FROM - bs.ventas v - JOIN vn2008.Clientes c ON c.Id_Cliente = v.Id_Cliente - LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador - WHERE - MONTH(fecha) = MONTH(vDate) - AND YEAR(fecha) = YEAR(vDate) - 1 - AND (c.Id_Trabajador = vWorker OR tr.boss = vWorker) - GROUP BY c.Id_Cliente) CmLy ON CmLy.Id_Cliente = c.Id_Cliente - LEFT JOIN - (SELECT - c.Id_Cliente, - IF(MAX(Fecha) < DATE_FORMAT(TIMESTAMPADD(MONTH, - 1, vDate), '%Y- %m-01'), TRUE, FALSE) muerto - FROM - vn2008.Facturas f - JOIN vn2008.Clientes c ON c.Id_cliente = f.Id_Cliente - - LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador - WHERE - (c.Id_Trabajador = vWorker OR tr.boss = vWorker) - GROUP BY Id_Cliente) dead ON dead.Id_Cliente = c.Id_Cliente - JOIN tmp.subordinate s ON s.workerFk = c.Id_Trabajador; - -DROP TEMPORARY TABLE tmp.subordinate; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `compradores_add` */; -ALTER DATABASE `bs` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `compradores_add`(IN intYEAR INT, IN intWEEK_START INT, IN intWEEK_END INT) -BEGIN - -REPLACE bs.compradores - -SELECT tp.Id_Trabajador - , intYEAR as año - , tm.week as semana - , sum(importe) as importe - , 0 as comision - -FROM bs.ventas v -JOIN vn2008.time tm on tm.date = v.fecha -JOIN vn2008.Tipos tp using(tipo_id) -WHERE tm.year = intYEAR and tm.week between intWEEK_START and intWEEK_END -AND reino_id != 6 -GROUP BY tp.Id_Trabajador, tm.week; - - - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -ALTER DATABASE `bs` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP PROCEDURE IF EXISTS `compradores_add_launcher` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `compradores_add_launcher`() -BEGIN - - DECLARE vYear INT; - DECLARE vWeek INT; - DECLARE done BOOL DEFAULT FALSE; - - DECLARE rs CURSOR FOR - SELECT year, week - FROM vn.time - WHERE (year = vYear AND week >= vWeek) - OR year > vYear; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - SELECT MAX(año) INTO vYear - FROM compradores; - - SELECT MAX(semana) INTO vWeek - FROM compradores - WHERE año = vYear; - - OPEN rs; - - FETCH rs INTO vYear, vWeek; - - WHILE NOT done DO - - CALL compradores_add(vYear, vWeek, vWeek); - - FETCH rs INTO vYear, vWeek; - - END WHILE; - - CLOSE rs; - - CALL compradores_evolution_add; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `compradores_evolution_add` */; -ALTER DATABASE `bs` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `compradores_evolution_add`() -BEGIN -/* - -Inserta en la tabla compradores_evolution las ventas acumuladas en los ultimos 365 dias - -*/ - -DECLARE datFEC DATE; - - -SELECT TIMESTAMPADD(DAY,1,MAX(fecha)) INTO datFEC FROM bs.compradores_evolution; - - WHILE datFEC < CURDATE() DO - - SELECT datFEC; - - REPLACE bs.compradores_evolution( Id_Trabajador - , fecha - , importe) - - SELECT Id_Trabajador - , datFEC as fecha - , sum(importe) as importe - - FROM - ( - - SELECT Id_Trabajador - , importe - FROM bs.compradores_evolution - WHERE fecha = TIMESTAMPADD(DAY,-1,datFEC) -- las ventas acumuladas del dia anterior - - UNION ALL - - SELECT Id_Trabajador - , importe * IF(v.fecha < datFEC,-1,1) -- se restan las ventas del año anterior y se suman las del actual - FROM bs.ventas v - JOIN vn2008.Tipos tp using(tipo_id) - WHERE fecha IN (datFEC, TIMESTAMPADD(DAY,-365,datFEC)) - AND reino_id != 6 - - )sub - GROUP BY Id_Trabajador; - - - - - SET datFEC = TIMESTAMPADD(DAY,1,datFEC); - - END WHILE; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -ALTER DATABASE `bs` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP PROCEDURE IF EXISTS `fondo_evolution_add` */; -ALTER DATABASE `bs` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `fondo_evolution_add`() -BEGIN -/* - -Inserta en la tabla fondo_maniobra los saldos acumulados en los ultimos 365 dias - -*/ - -DECLARE datFEC DATE DEFAULT '2015-01-01'; - - -SELECT TIMESTAMPADD(DAY,1,MAX(fecha)) INTO datFEC FROM bs.fondo_maniobra; - - WHILE datFEC < CURDATE() DO - - -- esto solo sirve para no aburrirse mientras esperamos... - - IF day(datFEC) mod 28 = 0 then - SELECT datFEC; - end if; - - - REPLACE bs.fondo_maniobra(Fecha, clientes_facturas, clientes_cobros,proveedores_facturas,proveedores_pagos, fondo) - SELECT datFEC as Fecha, Facturas, Cobros,Recibidas,Pagos, Facturas + Cobros + Recibidas + Pagos - FROM - ( - SELECT Sum(Facturas.Importe) AS Facturas - FROM vn2008.Facturas - INNER JOIN vn2008.Clientes ON Facturas.Id_Cliente = Clientes.Id_cliente - WHERE Clientes.`real` - AND empresa_id <>1381 - AND Fecha between '2011-01-01' and datFEC) fac - JOIN - ( - SELECT - Sum(Entregado) AS Cobros - FROM vn2008.Recibos - INNER JOIN vn2008.Clientes ON Recibos.Id_Cliente = Clientes.Id_cliente - WHERE Clientes.`real` - AND empresa_id <> 1381 - AND Fechacobro Between '2011-01-01' and datFEC) cob - JOIN - ( - SELECT - Sum(cantidad) AS Recibidas - FROM vn2008.recibida - INNER JOIN vn2008.recibida_vencimiento ON recibida.id = recibida_vencimiento.recibida_id - WHERE empresa_id <> 1381 - AND recibida.fecha Between '2015-01-01' and datFEC) rec - JOIN - ( - SELECT Sum(importe) AS Pagos - FROM vn2008.pago - WHERE empresa_id <>1381 AND pago.fecha Between '2015-01-01' and datFEC) pag; - - - - UPDATE bs.fondo_maniobra - JOIN - (SELECT avg(fondo) as media - FROM bs.fondo_maniobra - WHERE fecha <= datFEC) sub - SET fondo_medio = media - WHERE fecha = datFEC; - - - SET datFEC = TIMESTAMPADD(DAY,1,datFEC); - - END WHILE; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -ALTER DATABASE `bs` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP PROCEDURE IF EXISTS `indicatorsUpdate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `indicatorsUpdate`(vDated DATE) -BEGIN - - DECLARE oneYearBefore DATE DEFAULT TIMESTAMPADD(YEAR,-1,vDated); - DECLARE twoMonthsBefore DATE DEFAULT TIMESTAMPADD(DAY,-60,vDated); - DECLARE oneMonthBefore DATE DEFAULT TIMESTAMPADD(DAY,-30,vDated); - DECLARE vWeek INT; - - REPLACE indicators(updated) - VALUES(vDated); - - -- Ventas totales del ultimo año - UPDATE indicators - SET lastYearSales = - ( - SELECT SUM(importe + recargo) - FROM bs.ventas v - JOIN vn2008.empresa e ON e.id = v.empresa_id - JOIN vn2008.empresa_grupo eg ON eg.empresa_grupo_id = e.empresa_grupo - WHERE fecha BETWEEN oneYearBefore AND vDated - AND eg.grupo = 'Verdnatura' - ) - WHERE updated = vDated; - - -- Greuge total acumulado - UPDATE indicators - SET totalGreuge = - ( - SELECT SUM(amount) - FROM vn.greuge - WHERE shipped <= vDated - ) - WHERE updated = vDated; - - - -- Tasa de morosidad con respecto a las ventas del último mes - UPDATE indicators - SET latePaymentRate = - (SELECT SUM(amount) FROM bi.defaulters WHERE date = vDated and amount > 0) - / - ( SELECT SUM(importe + recargo) FROM bs.ventas WHERE fecha BETWEEN oneMonthBefore AND vDated) - WHERE updated = vDated; - - -- Número de trabajadores activos - UPDATE indicators - SET countEmployee = - ( SELECT CAST(SUM(hours_week) / 40 AS DECIMAL (10 , 2 )) - FROM - postgresql.business AS b - JOIN postgresql.profile p ON p.profile_id = b.provider_id - JOIN postgresql.person pe ON pe.person_id = p.person_id - LEFT JOIN - postgresql.business_labour AS bl ON bl.business_id = b.business_id - LEFT JOIN - postgresql.calendar_labour_type AS cl ON cl.calendar_labour_type_id = bl.calendar_labour_type_id - WHERE - (vDated BETWEEN b.date_start AND b.date_end OR (b.date_end IS NULL AND b.date_start <= vDated)) - AND pe.name = 'VERDNATURA LEVANTE SL' - ) - WHERE updated = vDated; - - -- Maná medio acumulado por comercial - UPDATE indicators - SET averageMana = - (SELECT avg(used) - FROM bs.mana_spellers - ) - WHERE updated = vDated; - - -- Número de clientes que han comprado en los últimos 30 dias - UPDATE indicators - SET lastMonthActiveClients = - (SELECT COUNT(DISTINCT t.clientFk) - FROM vn.ticket t - WHERE t.shipped BETWEEN oneMonthBefore AND vDated - ) - WHERE updated = vDated; - - -- Número de clientes que no han comprado en los últimos 30 dias, pero compraron en los 30 anteriores - UPDATE indicators - SET lastMonthLostClients = - (SELECT COUNT(lm.clientFk) - FROM - ( - SELECT DISTINCT t.clientFk - FROM vn.ticket t - WHERE t.shipped BETWEEN oneMonthBefore AND vDated - ) cm - RIGHT JOIN - ( - SELECT DISTINCT t.clientFk - FROM vn.ticket t - WHERE t.shipped >= twoMonthsBefore - AND t.shipped < oneMonthBefore - ) lm ON lm.clientFk = cm.clientFk - WHERE cm.clientFk IS NULL - ) - WHERE updated = vDated; - - -- Número de clientes que han comprado en los últimos 30 dias, pero no compraron en los 30 anteriores - UPDATE indicators - SET lastMonthNewClients = - (SELECT COUNT(cm.clientFk) - FROM - ( - SELECT DISTINCT t.clientFk - FROM vn.ticket t - WHERE t.shipped BETWEEN oneMonthBefore AND vDated - ) cm - LEFT JOIN - ( - SELECT DISTINCT t.clientFk - FROM vn.ticket t - WHERE t.shipped >= twoMonthsBefore - AND t.shipped < oneMonthBefore - ) lm ON lm.clientFk = cm.clientFk - WHERE lm.clientFk IS NULL - ) - WHERE updated = vDated; - - -- Porcentaje de autopedidos sobre los pedidos totales - UPDATE indicators - SET lastMonthWebBuyingRate = - ( SELECT (SUM(source_app != '') - SUM(source_app = 'TPV')) / SUM(source_app != '') - FROM hedera.`order` - WHERE date_send BETWEEN oneMonthBefore AND vDated - ) - WHERE updated = vDated; - - -- Indicadores de producción - UPDATE indicators i - JOIN productionIndicators pi ON pi.dated = i.updated - SET i.productionHours = pi.productionHours, - i.dailyWorkersCost = pi.dailyWorkersCost, - i.volumeM3 = pi.volumeM3, - i.salesValue = pi.salesValue, - i.valueM3 = pi.valueM3, - i.hoursM3 = pi.hoursM3, - i.workerCostM3 = pi.workerCostM3, - i.salesWorkersCostRate = pi.salesWorkersCostRate - WHERE updated BETWEEN oneMonthBefore AND vDated; - - -- CAP Para el calculo de las ventas agrupado por semanas - - SELECT week - FROM vn.time - WHERE dated=vDated INTO vWeek; - - TRUNCATE `bs`.`salesByWeek`; - - INSERT INTO `bs`.`salesByWeek` (week,year,sales) - SELECT `t`.`week` AS `week`,`t`.`year` AS `year`, SUM(`v`.`importe` + `v`.`recargo`) AS `sales` - FROM `bs`.`ventas` `v` - LEFT JOIN `vn`.`time` `t` ON `t`.`dated` = fecha - GROUP BY `t`.`week` , `t`.`year` - ORDER BY `t`.`week` , `t`.`year`; - - -- CAP Indicador Ventas semana actual - UPDATE indicators i - JOIN `bs`.`salesByWeek` s ON s.week= vWeek AND s.year = YEAR(vDated) - SET i.thisWeekSales = s.sales - WHERE updated = vDated; - - -- CAP indicador ventas semana actual en el año pasado - UPDATE indicators i - JOIN `bs`.`salesByWeek` s ON s.week= vWeek AND s.year = YEAR(vDated)-1 - SET i.lastYearWeekSales = s.sales - WHERE updated = vDated; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `indicatorsUpdateLauncher` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `indicatorsUpdateLauncher`() -BEGIN - - DECLARE vDated DATE; - - SELECT IFNULL(TIMESTAMPADD(DAY,1,MAX(updated)), '2018-04-01') - INTO vDated - FROM bs.indicators; - - WHILE vDated < CURDATE() DO - - CALL indicatorsUpdate(vDated); - - SELECT TIMESTAMPADD(DAY,1,MAX(updated)) - INTO vDated - FROM bs.indicators; - - END WHILE; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `m3Add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `m3Add`() -BEGIN - - DECLARE datSTART DATE; - DECLARE datEND DATE; - - SELECT TIMESTAMPADD(WEEK, -1,MAX(fecha)) INTO datSTART - FROM bs.m3; - - SET datEND = TIMESTAMPADD(DAY,-1,CURDATE()); - - DELETE FROM bs.m3 - WHERE fecha >= datSTART; - - INSERT INTO bs.m3 (fecha, provinceFk, warehouseFk, m3, year, month, week, day, dayName, euros) - SELECT v.fecha, a.provinceFk, t.warehouseFk, sum(i.compression * s.quantity * r.cm3) / 1000000 AS m3, - tm.year, tm.month, tm.week, tm.day, dayname(v.fecha), sum(importe) - FROM vn.ticket t - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - JOIN bs.ventas v ON v.Id_Movimiento = s.id -- Filtra solo por ventas "buenas" - JOIN vn.time tm ON tm.dated = v.fecha - JOIN bi.rotacion r ON r.Id_Article = s.itemFk AND r.warehouse_id = t.warehouseFk - JOIN vn.address a ON a.id = t.addressFk - WHERE v.fecha BETWEEN datSTART AND datEND - AND s.quantity > 0 -- evita abonos - AND t.companyFk = 442 -- Verdnatura - GROUP BY t.warehouseFk, v.fecha, a.provinceFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `manaCustomerUpdate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `manaCustomerUpdate`() -BEGIN -DECLARE vToDated DATE; - DECLARE vFromDated DATE; - DECLARE vForDeleteDated DATE; - DECLARE vManaId INT DEFAULT 37; - DECLARE vManaAutoId INT DEFAULT 39; - DECLARE vManaBankId INT DEFAULT 66; - DECLARE vManaGreugeTypeId INT DEFAULT 3; - - SELECT IFNULL(max(dated), '2016-01-01') - INTO vFromDated - FROM bs.manaCustomer; - - DELETE - FROM bs.manaCustomer - WHERE dated = vFromDated; - - SELECT IFNULL(max(dated), '2016-01-01') - INTO vFromDated - FROM bs.manaCustomer; - - WHILE timestampadd(DAY,30,vFromDated) < CURDATE() DO - - SELECT - timestampadd(DAY,30,vFromDated), - timestampadd(DAY,-90,vFromDated) - INTO - vToDated, - vForDeleteDated; - - DELETE FROM bs.manaCustomer - WHERE dated <= vForDeleteDated; - - - INSERT INTO bs.manaCustomer(Id_Cliente, Mana, dated) - - SELECT - Id_Cliente, - cast(sum(mana) as decimal(10,2)) as mana, - vToDated as dated - FROM - - ( - SELECT cs.Id_Cliente, Cantidad * Valor as mana - FROM vn2008.Tickets t - JOIN vn2008.Consignatarios cs using(Id_Consigna) - JOIN vn2008.Movimientos m on m.Id_Ticket = t.Id_Ticket - JOIN vn2008.Movimientos_componentes mc on mc.Id_Movimiento = m.Id_Movimiento - WHERE Id_Componente IN (vManaAutoId, vManaId) - AND t.Fecha > vFromDated - AND date(t.Fecha) <= vToDated - - - UNION ALL - - SELECT r.Id_Cliente, - Entregado - FROM vn2008.Recibos r - WHERE Id_Banco = vManaBankId - AND Fechacobro > vFromDated - AND Fechacobro <= vToDated - - UNION ALL - - SELECT g.Id_Cliente, g.Importe - FROM vn2008.Greuges g - WHERE Greuges_type_id = vManaGreugeTypeId - AND Fecha > vFromDated - AND Fecha <= vToDated - - UNION ALL - - SELECT Id_Cliente, mana - FROM bs.manaCustomer - WHERE dated = vFromDated - ) sub - - GROUP BY Id_Cliente - HAVING Id_Cliente; - - SET vFromDated = vToDated; - - END WHILE; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `manaSpellers_actualize` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `manaSpellers_actualize`() -BEGIN - - /* PAK 2019/08/09 updated - * - * Recalcula el valor del campo con el modificador de precio para el componente de maná automático. - * La tabla mana_spellers es una caché - * - */ - - UPDATE mana_spellers me - JOIN - (SELECT Id_Trabajador, FLOOR(SUM(importe)/12) as pesoCarteraMensual - FROM bs.vendedores - WHERE año * 100 + mes >= (YEAR(CURDATE()) -1) * 100 + MONTH(CURDATE()) - GROUP BY Id_Trabajador - ) lastYearSales USING(Id_Trabajador) - SET me.prices_modifier_rate = GREATEST(me.minRate,LEAST(me.maxRate,ROUND(- me.used/lastYearSales.pesoCarteraMensual,3))) ; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `mermasCacheUpdate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `mermasCacheUpdate`() -BEGIN - - DECLARE vTimeRange INT DEFAULT 30; - DECLARE vCurYearStarted DATE DEFAULT TIMESTAMPADD(DAY, - vTimeRange, CURDATE()); - DECLARE vCurYearFinished DATE DEFAULT CURDATE(); - DECLARE vLastYearStarted DATE DEFAULT TIMESTAMPADD(YEAR, -1 , vCurYearStarted); - DECLARE vLastYearFinished DATE DEFAULT TIMESTAMPADD(YEAR, -1 , vCurYearFinished); - - REPLACE bs.mermasCache - SELECT Comprador, - IF(Fecha < vCurYearStarted, year(CURDATE()) - 1,year(CURDATE())) año, - CAST(sum(Importe) as DECIMAL(10,0)) as Valor_Compra, - CAST(sum(IF(Cliente LIKE 'FALTAS',Importe,0)) as DECIMAL(10,0)) as Faltas, - CAST(sum(IF(Cliente LIKE 'BASURA',Importe,0)) as DECIMAL(10,0)) as Basura - FROM bs.mermas - WHERE Fecha BETWEEN vCurYearStarted AND vCurYearFinished - OR Fecha BETWEEN vLastYearStarted AND vLastYearFinished - GROUP BY año, Comprador; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `nightTask_launchAll` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `nightTask_launchAll`() -BEGIN -/** - * Runs all nightly tasks. - */ - DECLARE vDone BOOL; - DECLARE vError VARCHAR(255); - DECLARE vErrorCode VARCHAR(255); - DECLARE vNErrors INT DEFAULT 0; - DECLARE vSchema VARCHAR(255); - DECLARE vProcedure VARCHAR(255); - DECLARE vLogMail VARCHAR(255); - DECLARE vId INT; - - DECLARE rs CURSOR FOR - SELECT id, `schema`, `procedure` - FROM nightTask - WHERE finished <= CURDATE() - OR finished IS NULL - ORDER BY `order`; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - - SET max_sp_recursion_depth = 3; - OPEN rs; - - myLoop: LOOP - SET vDone = FALSE; - FETCH rs INTO vId, vSchema, vProcedure; - - IF vDone THEN - LEAVE myLoop; - END IF; - - UPDATE nightTask - SET `started` = NOW(), - `finished` = NULL, - `error` = NULL, - `errorCode` = NULL - WHERE id = vId; - - SET vError = NULL; - CALL nightTask_launchTask( - vSchema, - vProcedure, - vError, - vErrorCode - ); - - IF vError IS NOT NULL THEN - SET vNErrors = vNErrors + 1; - - UPDATE nightTask - SET `error` = vError, - `errorCode` = vErrorCode - WHERE id = vId; - ELSE - UPDATE nightTask - SET finished = NOW(), - lastFinished = NOW() - WHERE id = vId; - END IF; - END LOOP; - - CLOSE rs; - - SELECT logMail INTO vLogMail - FROM nightTaskConfig LIMIT 1; - - IF vNErrors > 0 AND vLogMail IS NOT NULL THEN - INSERT INTO vn.mail SET - `sender` = vLogMail, - `subject` = 'Nightly task failed', - `body` = CONCAT( - vNErrors, ' procedures of nightly tasks have failed. ', - 'Please, see `', SCHEMA() ,'`.`nightTask` table for more info.' - ); - END IF; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `nightTask_launchTask` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `nightTask_launchTask`( - vSchema VARCHAR(255), - vProcedure VARCHAR(255), - OUT vError VARCHAR(255), - OUT vErrorCode VARCHAR(255) -) -BEGIN -/** - * Runs an specific procedure from nightly tasks, if an error - * occurs, instead of throw it, #vError and #vErrorCode variables - * are setted. - * - * @param vSchema The procedure schema - * @param vProcedure The procedure name - * @param vError The error message, if any - * @param vErrorCode The error code, if any - */ - DECLARE EXIT HANDLER FOR SQLEXCEPTION - GET DIAGNOSTICS CONDITION 1 - vError = MESSAGE_TEXT, - vErrorCode = RETURNED_SQLSTATE; - - CALL util.exec(CONCAT('CALL `', vSchema ,'`.`', vProcedure ,'`')); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `payMethodClientAdd` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `payMethodClientAdd`() -BEGIN - INSERT IGNORE INTO `bs`.`payMethodClient` (dated, payMethodFk, clientFk) - SELECT CURDATE(), c.payMethodFk, c.id - FROM vn.client c - JOIN vn.payMethod p ON c.payMethodFk = p.id; - - TRUNCATE `bs`.`payMethodClientEvolution` ; - - INSERT INTO `bs`.`payMethodClientEvolution` (dated, payMethodName, amountClient, amount, equalizationTax) - SELECT p.dated, pm.name, COUNT(p.clientFk), SUM(sub.importe) , SUM(sub.recargo) - FROM bs.payMethodClient p - JOIN (SELECT SUM(v.importe) AS importe, SUM(v.recargo) as recargo, v.fecha, v.Id_cliente - FROM bs.ventas v - WHERE v.fecha>= (SELECT MIN(dated) FROM bs. payMethodClient) - GROUP BY v.Id_cliente, v.fecha) sub ON sub.fecha = p.dated AND sub.Id_cliente = p.ClientFk - JOIN vn.payMethod pm ON p.payMethodFk = pm.id - GROUP BY dated,payMethodFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `productivityAdd` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `productivityAdd`(vDate DATE) -BEGIN - - DECLARE vDateStart DATETIME DEFAULT vDate; - DECLARE vDateEnd DATETIME DEFAULT util.dayEnd(vDate); - DECLARE myDepLft INT; - DECLARE myDepRgt INT; - - DROP TEMPORARY TABLE IF EXISTS tmp.productivity; - - CREATE TEMPORARY TABLE tmp.productivity - ENGINE = MEMORY - SELECT hh, - mm, - 000.00 as m3, - 000.00 as m3FV, - 000.00 as m3PCA, - 000.00 as m3Artificial, - 0 as workers, - 000.00 as wCost, - 0 as numCoordinadores, - 000.00 as costCoordinacion, - 0 as numSacadores, - 000.00 as costSacado, - 0 as numEncajadores, - 000.00 as costEncajado, - 0 as numPaletizadores, - 000.00 as costPaletizado, - 0 as numCamareros, - 000.00 as costCamara, - 0 as numComplementos, - 000.00 as costComplementos, - 0 as numArtificial, - 000.00 as costArtificial - FROM vn.dayMinute; - --- Trabajadores - CALL vn.dayMinuteWorker(vDateStart,vDateEnd); -- Genera la tabla tmp.dayMinuteWorker - CALL vn.workerDepartmentByDate(vDate); - - -- General - UPDATE tmp.productivity p - JOIN - (SELECT Hora, Minuto, count(*) as workers, sum(wdd.costeHora) / 60 as Bruto - FROM tmp.dayMinuteWorker dmw - JOIN tmp.workerDepartmentByDate wdd ON wdd.userFk = dmw.userFk - WHERE Almacen IN (1,44) - AND wdd.production - GROUP BY Hora, Minuto - ) sub ON p.hh = sub.Hora AND p.mm = sub.Minuto - SET p.workers = sub.workers, p.wCost = sub.Bruto; - - -- Coordinadores - SELECT lft, rgt INTO myDepLft, myDepRgt - FROM vn.department - WHERE name = 'COORDINACION'; - - UPDATE tmp.productivity p - JOIN - (SELECT Hora, Minuto, count(*) as workers, sum(wdd.costeHora) / 60 as Bruto - FROM tmp.dayMinuteWorker dmw - JOIN tmp.workerDepartmentByDate wdd ON wdd.userFk = dmw.userFk - JOIN vn.department d ON d.id = wdd.departmentFk - WHERE Almacen IN (1,44) - AND d.lft BETWEEN myDepLft AND myDepRgt - GROUP BY Hora, Minuto - ) sub ON p.hh = sub.Hora AND p.mm = sub.Minuto - SET p.numCoordinadores = sub.workers, p.costCoordinacion = sub.Bruto; - - -- Sacado - SELECT lft, rgt INTO myDepLft, myDepRgt - FROM vn.department - WHERE name = 'SACADO'; - - UPDATE tmp.productivity p - JOIN - (SELECT Hora, Minuto, count(*) as workers, sum(wdd.costeHora) / 60 as Bruto - FROM tmp.dayMinuteWorker dmw - JOIN tmp.workerDepartmentByDate wdd ON wdd.userFk = dmw.userFk - JOIN vn.department d ON d.id = wdd.departmentFk - WHERE Almacen IN (1,44) - AND d.lft BETWEEN myDepLft AND myDepRgt - GROUP BY Hora, Minuto - ) sub ON p.hh = sub.Hora AND p.mm = sub.Minuto - SET p.numSacadores = sub.workers, p.costSacado = sub.Bruto; - - -- Encajado - SELECT lft, rgt INTO myDepLft, myDepRgt - FROM vn.department - WHERE name = 'ENCAJADO'; - - UPDATE tmp.productivity p - JOIN - (SELECT Hora, Minuto, count(*) as workers, sum(wdd.costeHora) / 60 as Bruto - FROM tmp.dayMinuteWorker dmw - JOIN tmp.workerDepartmentByDate wdd ON wdd.userFk = dmw.userFk - JOIN vn.department d ON d.id = wdd.departmentFk - WHERE Almacen IN (1,44) - AND d.lft BETWEEN myDepLft AND myDepRgt - GROUP BY Hora, Minuto - ) sub ON p.hh = sub.Hora AND p.mm = sub.Minuto - SET p.numEncajadores = sub.workers, p.costEncajado = sub.Bruto; - - -- Paletizado - SELECT lft, rgt INTO myDepLft, myDepRgt - FROM vn.department - WHERE name = 'PALETIZADO'; - - UPDATE tmp.productivity p - JOIN - (SELECT Hora, Minuto, count(*) as workers, sum(wdd.costeHora) / 60 as Bruto - FROM tmp.dayMinuteWorker dmw - JOIN tmp.workerDepartmentByDate wdd ON wdd.userFk = dmw.userFk - JOIN vn.department d ON d.id = wdd.departmentFk - WHERE Almacen IN (1,44) - AND d.lft BETWEEN myDepLft AND myDepRgt - GROUP BY Hora, Minuto - ) sub ON p.hh = sub.Hora AND p.mm = sub.Minuto - SET p.numPaletizadores = sub.workers, p.costPaletizado = sub.Bruto; - - -- Cámara - SELECT lft, rgt INTO myDepLft, myDepRgt - FROM vn.department - WHERE name = 'CAMARA'; - - UPDATE tmp.productivity p - JOIN - (SELECT Hora, Minuto, count(*) as workers, sum(wdd.costeHora) / 60 as Bruto - FROM tmp.dayMinuteWorker dmw - JOIN tmp.workerDepartmentByDate wdd ON wdd.userFk = dmw.userFk - JOIN vn.department d ON d.id = wdd.departmentFk - WHERE Almacen IN (1,44) - AND d.lft BETWEEN myDepLft AND myDepRgt - GROUP BY Hora, Minuto - ) sub ON p.hh = sub.Hora AND p.mm = sub.Minuto - SET p.numCamareros = sub.workers, p.costCamara = sub.Bruto; - - -- Complementos - SELECT lft, rgt INTO myDepLft, myDepRgt - FROM vn.department - WHERE name = 'COMPLEMENTOS'; - - UPDATE tmp.productivity p - JOIN - (SELECT Hora, Minuto, count(*) as workers, sum(wdd.costeHora) / 60 as Bruto - FROM tmp.dayMinuteWorker dmw - JOIN tmp.workerDepartmentByDate wdd ON wdd.userFk = dmw.userFk - JOIN vn.department d ON d.id = wdd.departmentFk - WHERE Almacen IN (1,44) - AND d.lft BETWEEN myDepLft AND myDepRgt - GROUP BY Hora, Minuto - ) sub ON p.hh = sub.Hora AND p.mm = sub.Minuto - SET p.numComplementos = sub.workers, p.costComplementos = sub.Bruto; - - -- Artificial - SELECT lft, rgt INTO myDepLft, myDepRgt - FROM vn.department - WHERE name = 'ARTIFICIAL'; - - UPDATE tmp.productivity p - JOIN - (SELECT Hora, Minuto, count(*) as workers, sum(wdd.costeHora) / 60 as Bruto - FROM tmp.dayMinuteWorker dmw - JOIN tmp.workerDepartmentByDate wdd ON wdd.userFk = dmw.userFk - JOIN vn.department d ON d.id = wdd.departmentFk - WHERE Almacen IN (1,44) - AND d.lft BETWEEN myDepLft AND myDepRgt - GROUP BY Hora, Minuto - ) sub ON p.hh = sub.Hora AND p.mm = sub.Minuto - SET p.numArtificial = sub.workers, p.costArtificial = sub.Bruto; - - -- m3 - CALL vn.ticketBuiltTime(vDate); -- Genera la tabla tmp.ticketBuiltTime(ticketFk,builtTime) - CALL vn.ticketVolumeByDate_ventas(vDate); -- Genera la tabla tmp.ticketVolumeByDate(ticketFk,m3), filtrado por las ventas validas - CALL vn.ticketVolumeByDate_ventas_Artificial(vDate); -- Genera la tabla tmp.ticketVolumeByDate_ventas_Artificial - - UPDATE tmp.productivity p - JOIN - (SELECT HOUR(builtTime) hh, - MINUTE(builtTime) mm, - sum(tvd.m3) as m3, - sum(IF(t.warehouseFk = 1,tvd.m3,0)) as m3FV, - sum(IF(t.warehouseFk = 44,tvd.m3 - IFNULL(tvda.m3,0),0)) as m3PCA, - sum(IFNULL(tvda.m3,0)) as m3Artificial - FROM tmp.ticketBuiltTime tbt - JOIN tmp.ticketVolumeByDate tvd ON tvd.ticketFk = tbt.ticketFk - LEFT JOIN tmp.ticketVolumeByDate_Artificial tvda ON tvda.ticketFk = tbt.ticketFk - JOIN vn.ticket t ON t.id = tbt.ticketFk - WHERE t.warehouseFk IN (1,44) - GROUP BY hh,mm - ) v ON v.hh = p.hh AND v.mm = p.mm - SET p.m3 = v.m3, p.m3FV = v.m3FV, p.m3PCA = v.m3PCA, p.m3Artificial = v.m3Artificial; - - - - DELETE FROM bs.productivity - WHERE dated = vDate; - - INSERT INTO bs.productivity(dated, - hh, - mm, - m3, - m3FV, - m3PCA, - m3Artificial, - workers, - wCost, - numCoordinadores, - costCoordinacion, - numSacadores, - costSacado, - numEncajadores, - costEncajado, - numPaletizadores, - costPaletizado, - numCamareros, - costCamara, - numComplementos, - costComplementos, - numArtificial, - costArtificial) - SELECT vDate, - hh, - mm, - m3, - m3FV, - m3PCA, - m3Artificial, - workers, - wCost, - numCoordinadores, - costCoordinacion, - numSacadores, - costSacado, - numEncajadores, - costEncajado, - numPaletizadores, - costPaletizado, - numCamareros, - costCamara, - numComplementos, - costComplementos, - numArtificial, - costArtificial - FROM tmp.productivity p; - - -- Productivity Evolution - REPLACE bs.productivity_evolution(dated, m3productionCost) - SELECT CURDATE(), sum(wCost) / sum(m3) - FROM bs.productivity - WHERE dated BETWEEN TIMESTAMPADD(YEAR,-1,CURDATE()) AND CURDATE(); - - DROP TEMPORARY TABLE tmp.dayMinuteWorker; - DROP TEMPORARY TABLE tmp.productivity; - DROP TEMPORARY TABLE tmp.ticketBuiltTime; - DROP TEMPORARY TABLE tmp.ticketVolumeByDate; - DROP TEMPORARY TABLE tmp.workerDepartmentByDate; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `productivityDepartmentAdd` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `productivityDepartmentAdd`(IN vDateStartPeriod DATETIME, IN vDateEndPeriod DATETIME, IN vDateStart DATETIME) -BEGIN - - DECLARE vEndingDate DATETIME; - - SET vEndingDate = vDateStart; - - WHILE vEndingDate <= vDateEndPeriod DO - REPLACE INTO bs.productivityDepartment - SELECT vEndingDate, - CAST(((productivityCoordinacionLastYear - productivityCoordinacion) / 2) * m3 AS DECIMAL (10,2)) AS amountCoordinacion, - CAST(((productivitySacadoLastYear - productivitySacado) / 2) * m3 AS DECIMAL (10,2)) AS amountSacado, - CAST(((productivityEncajadoLastYear - productivityEncajado) / 2) * m3 AS DECIMAL (10,2)) AS amountEncajado, - CAST(((productivityPaletizadoLastYear - productivityPaletizado) / 2) * m3 AS DECIMAL (10,2)) AS amountPaletizado, - CAST(((productivityCamaraLastYear - productivityCamara) / 2) * m3FV AS DECIMAL (10,2)) AS amountCamara, - CAST(((productivityComplementosLastYear - productivityComplementos) / 2) * m3PCA AS DECIMAL (10,2)) AS amountComplementos, - CAST(((productivityArtificialLastYear - productivityArtificial) / 2) * m3Artificial AS DECIMAL (10,2)) AS amountArtificia - FROM - (SELECT - SUM(p.m3) AS m3, SUM(p.m3FV) as m3FV, SUM(p.m3PCA) as m3PCA, SUM(p.m3Artificial) as m3Artificial, - SUM(p.costCoordinacion) / SUM(p.m3) AS productivityCoordinacion, - SUM(p.costSacado) / SUM(p.m3) AS productivitySacado, - SUM(p.costEncajado) / SUM(p.m3) AS productivityEncajado, - SUM(p.costPaletizado) / SUM(p.m3) AS productivityPaletizado, - SUM(p.costCamara) / SUM(p.m3FV) AS productivityCamara, - SUM(p.costComplementos) / SUM(p.m3PCA) AS productivityComplementos, - SUM(p.costArtificial) / SUM(p.m3Artificial) AS productivityArtificial - FROM - bs.productivity p - WHERE - p.dated BETWEEN vDateStartPeriod AND vEndingDate) sub - JOIN - (SELECT - SUM(p.costCoordinacion) / SUM(p.m3) AS productivityCoordinacionLastYear, - SUM(p.costSacado) / SUM(p.m3) AS productivitySacadoLastYear, - SUM(p.costEncajado) / SUM(p.m3) AS productivityEncajadoLastYear, - SUM(p.costPaletizado) / SUM(p.m3) AS productivityPaletizadoLastYear, - SUM(p.costCamara) / SUM(p.m3FV) AS productivityCamaraLastYear, - SUM(p.costComplementos) / SUM(p.m3PCA) AS productivityComplementosLastYear, - SUM(p.costArtificial) / SUM(p.m3Artificial) AS productivityArtificialLastYear - FROM - bs.productivity p - WHERE - p.dated BETWEEN DATE_ADD(vDateStartPeriod, INTERVAL - 1 YEAR) AND DATE_ADD(vEndingDate, INTERVAL - 1 YEAR)) sub1; - - SET vEndingDate = TIMESTAMPADD(DAY,1, vEndingDate); - END WHILE; - END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `productivityDepartmentLauncher` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `productivityDepartmentLauncher`() -BEGIN - CALL bs.productivityDepartmentAdd('2019-05-06', CURDATE(),DATE_SUB(CURDATE(), INTERVAL 2 WEEK)); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `productivityLauncher` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `productivityLauncher`() -BEGIN - - DECLARE vDateFrom DATE; - - SELECT LEAST(TIMESTAMPADD(MONTH, -1, CURDATE()),MAX(dated)) - INTO vDateFrom - FROM bs.productivity; - - WHILE CURDATE() > vDateFrom DO - CALL bs.productivityAdd(vDateFrom); - SET vDateFrom = TIMESTAMPADD(DAY,1,vDateFrom); - END WHILE; - - SET vDateFrom = TIMESTAMPADD(MONTH, -13, CURDATE()); - - WHILE TIMESTAMPADD(MONTH, -12, CURDATE()) > vDateFrom DO - CALL bs.productivityAdd(vDateFrom); - SET vDateFrom = TIMESTAMPADD(DAY,1,vDateFrom); - END WHILE; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `productivityLauncher_manual` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `productivityLauncher_manual`(vDateFrom DATE, vToDate DATE) -BEGIN - - TRUNCATE tmp.log; - - WHILE vToDate >= vDateFrom DO - - INSERT INTO tmp.log(text) VALUES (vDateFrom); - CALL bs.productivityAdd(vDateFrom); - - CALL bs.productivityAdd(TIMESTAMPADD(YEAR, -1,vDateFrom)); - INSERT INTO tmp.log(text) VALUES (TIMESTAMPADD(YEAR, -1,vDateFrom)); - - SET vDateFrom = TIMESTAMPADD(DAY,1,vDateFrom); - - END WHILE; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `pruebas` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `pruebas`(IN vDateStart DATE, IN vDateEnd DATE) -BEGIN - -WHILE vDateStart <> vDateEnd -DO - UPDATE indicators - SET countEmployee = - ( SELECT CAST(SUM(hours_week) / 40 AS DECIMAL (10 , 2 )) - FROM - postgresql.business AS b - JOIN postgresql.profile p ON p.profile_id = b.provider_id - JOIN postgresql.person pe ON pe.person_id = p.person_id - LEFT JOIN - postgresql.business_labour AS bl ON bl.business_id = b.business_id - LEFT JOIN - postgresql.calendar_labour_type AS cl ON cl.calendar_labour_type_id = bl.calendar_labour_type_id - WHERE - (vDateStart BETWEEN b.date_start AND b.date_end OR (b.date_end IS NULL AND b.date_start <= vDateStart)) - AND pe.name = 'VERDNATURA LEVANTE SL' - ) - WHERE updated = vDateStart; - SET vDateStart = DATE_ADD(vDateStart, INTERVAL 1 DAY); - -END WHILE; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `salePersonEvolutionAdd` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `salePersonEvolutionAdd`(IN vDateStart DATETIME) -BEGIN - DELETE FROM bs.salePersonEvolution - WHERE dated <= DATE_SUB(CURDATE(), INTERVAL 1 YEAR); - - - INSERT INTO bs.salePersonEvolution (dated, amount, equalizationTax, salesPersonFk) - SELECT fecha dated, - CAST(SUM(importe) AS DECIMAL(10,2) ) amount, - CAST(SUM(recargo) AS DECIMAL(10,2) ) equalizationTax , - IFNULL(salesPersonFk,0) salesPersonFk - FROM bs.ventas v - JOIN vn.client c ON v.Id_Cliente = c.id - JOIN vn.company co ON co.id = v.empresa_id - WHERE co.code = "VNL" AND fecha >= vDateStart - GROUP BY v.fecha,c.salesPersonFk - ORDER BY salesPersonFk,dated ASC; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `userSundayRole` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `userSundayRole`() -BEGIN - -- 4996 Fran Natek Echevarria - DECLARE vDay INT; - SET vDay := (SELECT DAYOFWEEK(CURDATE())); - IF vDay = 1 THEN - UPDATE account.user u - JOIN account.role r - SET u.role = r.id - WHERE u.id = 4996 AND r.name = "salesAssistant"; - ELSE - UPDATE account.user u - JOIN account.role r - SET u.role = r.id - WHERE u.id = 4996 AND r.name = "salesPerson"; - END IF; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `vendedores_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `vendedores_add`(intYEAR INT, vQuarter INT) -BEGIN - - DECLARE comisionRate DOUBLE DEFAULT 0.029; - - REPLACE vendedores - SELECT c.Id_Trabajador - , intYEAR - , MONTH(v.fecha) intMONTH - , sum(importe) as importe - , sum(importe) * 0.029 as comision - , 0 as comisionCedida - , 0 as comisionArrendada - , 0 as comisionNuevos - - FROM ventas v - JOIN vn2008.Clientes c on v.Id_Cliente = c.Id_Cliente - JOIN vn2008.`time` t on t.`date` = v.fecha - WHERE c.Id_Trabajador is not null - AND t.`year` = intYEAR AND QUARTER(v.fecha) = vQuarter - GROUP BY c.Id_Trabajador, t.`month`; - - -- Ventas nuevas - UPDATE vendedores v - JOIN - ( - SELECT c.Id_Trabajador - , sum(importe) * 0.029 as comisionNueva - , t.`month` - , t.`year` - FROM ventas v - JOIN bs.clientNewBorn cnb on v.Id_Cliente = cnb.clientFk - JOIN vn2008.Clientes c ON c.Id_Cliente = v.Id_Cliente - JOIN vn2008.`time` t on t.`date` = v.fecha - WHERE c.Id_Trabajador is not null - AND t.`year` = intYEAR AND QUARTER(v.fecha) = vQuarter - GROUP BY c.Id_Trabajador, t.`month` - ) sub ON sub.Id_Trabajador = v.Id_Trabajador AND sub.`month` = v.mes AND sub.`year` = v.año - SET v.comisionNuevos = sub.comisionNueva, v.comision = v.comision - sub.comisionNueva; - - -- Ventas cedidas - UPDATE vendedores v - JOIN ( - SELECT cc.Id_Trabajador_old as Id_Trabajador - , sum(importe) * 0.029 * comision_old as cedido - , sum(importe) * 0.029 * comision_new as arrendada - , t.`month` - , t.`year` - FROM ventas v - JOIN vn2008.Clientes c on v.Id_Cliente = c.Id_Cliente - JOIN vn2008.Clientes_cedidos cc on cc.Id_Cliente = c.Id_Cliente AND v.fecha between datSTART and datEND - JOIN vn2008.`time` t on t.`date` = v.fecha - WHERE c.Id_Trabajador is not null - AND t.`year` = intYEAR AND QUARTER(v.fecha) = vQuarter - GROUP BY cc.Id_Trabajador_old, t.`month` - ) sub ON sub.Id_Trabajador = v.Id_Trabajador AND sub.`month` = v.mes AND sub.`year` = v.año - SET v.comisionCedida = sub.cedido, v.comision = v.comision - sub.cedido - sub.arrendada; - - -- Ventas arrendadas - UPDATE vendedores v - JOIN ( - SELECT cc.Id_Trabajador_new as Id_Trabajador - , sum(importe) * 0.029 * comision_new as arrendada - , t.`month` - , t.`year` - FROM ventas v - JOIN vn2008.Clientes c on v.Id_Cliente = c.Id_Cliente - JOIN vn2008.Clientes_cedidos cc on cc.Id_Cliente = c.Id_Cliente AND v.fecha between datSTART and datEND - JOIN vn2008.`time` t on t.`date` = v.fecha - WHERE c.Id_Trabajador is not null - AND t.`year` = intYEAR AND QUARTER(v.fecha) = vQuarter - GROUP BY cc.Id_Trabajador_new, t.`month` - ) sub ON sub.Id_Trabajador = v.Id_Trabajador AND sub.`month` = v.mes AND sub.`year` = v.año - SET v.comisionArrendada = sub.arrendada; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `vendedores_add_launcher` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `vendedores_add_launcher`() -BEGIN - - call bs.vendedores_add(YEAR(CURDATE()),QUARTER(CURDATE())); - - call bs.vendedores_evolution_add; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `vendedores_evolution_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `vendedores_evolution_add`() -BEGIN -/* - -Inserta en la tabla compradores_evolution las ventas acumuladas en el ultimo mes - -*/ - -DECLARE vYear, vMonth INTEGER; -DECLARE vCurYear, vCurMonth INTEGER; -DECLARE vFirstYear INTEGER DEFAULT 2017; -DECLARE vFirstMonth INTEGER DEFAULT 1; - -DECLARE vDateFrom DATE; -DECLARE vDateTo DATE; - -SET vCurYear = year(CURDATE()); -SET vCurMonth = month(CURDATE()); - -SELECT IFNULL(max(year),vFirstYear), IFNULL(max(month),vFirstMonth) - INTO vYear, vMonth - FROM bs.vendedores_evolution; - - WHILE (vYear < vCurYear) OR (vYear = vCurYear AND vMonth < vCurMonth) DO - - SELECT max(dated), TIMESTAMPADD(DAY,-364,max(dated)) INTO vDateTo, vDateFrom - FROM vn.time - WHERE year = vYear - AND month = vMonth; - - SELECT vDateTo, vDateFrom, vYear, vMonth; - - REPLACE bs.vendedores_evolution( workerFk - , year - , month - , sales) - SELECT c.salesPersonFk - , vYear as year - , vMonth as month - , sum(v.importe) as sales - FROM bs.ventas v - JOIN vn.client c on c.id = v.Id_Cliente - WHERE v.fecha BETWEEN vDateFrom AND vDateTo - AND c.salesPersonFk is not null - GROUP BY c.salesPersonFk; - - SET vMonth = vMonth + 1; - - IF vMonth = 13 THEN - - SET vMonth = 1; - SET vYear = vYear + 1; - - END IF; - - END WHILE; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `ventas_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ventas_add`(IN datSTART DATETIME, IN datEND DATETIME) -BEGIN - - DECLARE vStartingDate DATETIME; - DECLARE vEndingDate DATETIME; - DECLARE TIPO_PATRIMONIAL INT DEFAULT 188; - - IF datSTART < '2015-10-01' OR datEND < '2015-10-01' THEN - CALL util.throw('fechaDemasiadoAntigua'); - END IF; - - SET datEND = util.dayEnd(datEND); - SET vStartingDate = datSTART; - SET vEndingDate = vn2008.dayend(vStartingDate); - - DELETE - FROM ventas - WHERE fecha between vStartingDate and datEND; - - WHILE vEndingDate <= datEND DO - - REPLACE ventas(Id_Movimiento, importe, recargo, fecha, tipo_id, Id_Cliente, empresa_id) - SELECT Id_Movimiento, - SUM(IF(base, Cantidad * Valor, 0)) as importe, - SUM(IF(base, 0, Cantidad * Valor)) as recargo, - vStartingDate, - a.tipo_id, - cs.Id_Cliente, - t.empresa_id - FROM vn2008.Movimientos_componentes mc - JOIN bi.tarifa_componentes tc using(Id_Componente) - JOIN bi.tarifa_componentes_series tcs using(tarifa_componentes_series_id) - JOIN vn2008.Movimientos m using(Id_Movimiento) - JOIN vn2008.Articles a using(Id_Article) - JOIN vn2008.Tipos tp using(tipo_id) - JOIN vn2008.reinos r on r.id = tp.reino_id - JOIN vn2008.Tickets t using(Id_Ticket) - JOIN vn2008.Consignatarios cs using(Id_Consigna) - JOIN vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente - WHERE t.Fecha between vStartingDate and vEndingDate - AND c.typeFk IN ('Normal','handMaking','internalUse') - AND m.Cantidad <> 0 - AND a.tipo_id != TIPO_PATRIMONIAL - AND m.Descuento <> 100 - AND (m.Id_Article = 98 or m.Id_Article = 95 or r.mercancia != 0) - GROUP BY mc.Id_Movimiento - HAVING IFNULL(importe,0) <> 0 OR IFNULL(recargo,0) <> 0; - - SET vStartingDate = TIMESTAMPADD(DAY,1, vStartingDate); - SET vEndingDate = util.dayEnd(vStartingDate); - - END WHILE; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `ventas_add_launcher` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ventas_add_launcher`() -BEGIN - - call bs.ventas_add(timestampadd(week,-1,curdate()),curdate()); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `ventas_add__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ventas_add__`(IN datSTART DATETIME, IN datEND DATETIME) -BEGIN - - DECLARE vStartingDate DATETIME; - DECLARE vEndingDate DATETIME; - DECLARE TIPO_PATRIMONIAL INT DEFAULT 188; - - SET datEND = util.dayEnd(datEND); - SET vStartingDate = GREATEST('2015-10-01',datSTART); - SET vEndingDate = vn2008.dayend(vStartingDate); - - DELETE - FROM ventas - WHERE fecha between vStartingDate and datEND; - - WHILE vEndingDate <= datEND DO - - REPLACE ventas(Id_Movimiento, importe, recargo, fecha, tipo_id, Id_Cliente, empresa_id) - SELECT Id_Movimiento, - SUM(IF(base, Cantidad * Valor, 0)) as importe, - SUM(IF(base, 0, Cantidad * Valor)) as recargo, - vStartingDate, - a.tipo_id, - cs.Id_Cliente, - t.empresa_id - FROM vn2008.Movimientos_componentes mc - JOIN bi.tarifa_componentes tc using(Id_Componente) - JOIN bi.tarifa_componentes_series tcs using(tarifa_componentes_series_id) - JOIN vn2008.Movimientos m using(Id_Movimiento) - JOIN vn2008.Articles a using(Id_Article) - JOIN vn2008.Tipos tp using(tipo_id) - JOIN vn2008.reinos r on r.id = tp.reino_id - JOIN vn2008.Tickets t using(Id_Ticket) - JOIN vn2008.Consignatarios cs using(Id_Consigna) - JOIN vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente - WHERE t.Fecha between vStartingDate and vEndingDate - AND datEND >= '2015-10-01' - AND c.typeFk IN ('Normal','handMaking','internalUse') - AND m.Cantidad <> 0 - AND a.tipo_id != TIPO_PATRIMONIAL - AND c.Id_Trabajador IS NOT NULL - AND m.Descuento <> 100 - AND (m.Id_Article = 98 or m.Id_Article = 95 or r.mercancia != 0) - GROUP BY mc.Id_Movimiento - HAVING IFNULL(importe,0) <> 0 OR IFNULL(recargo,0) <> 0; - - SET vStartingDate = TIMESTAMPADD(DAY,1, vStartingDate); - SET vEndingDate = util.dayEnd(vStartingDate); - - END WHILE; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `ventas_contables_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ventas_contables_add`(IN vYear INT, IN vMonth INT) -BEGIN -/** - * Reemplaza las ventas contables. Es el origen de datos para el balance de Entradas - * - * @param vYear Año a reemplazar - * @param vMonth Mes a reemplazar - * - * - **/ -DECLARE TIPO_PATRIMONIAL INT DEFAULT 188; - -DELETE FROM bs.ventas_contables - WHERE year = vYear - AND month = vMonth; - -DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; - -CREATE TEMPORARY TABLE tmp.ticket_list - (PRIMARY KEY (Id_Ticket)) - SELECT Id_Ticket - FROM vn2008.Tickets t - JOIN vn2008.Facturas f ON f.Id_Factura = t.Factura - WHERE year(f.Fecha) = vYear - AND month(f.Fecha) = vMonth; - - -INSERT INTO bs.ventas_contables(year - , month - , venta - , grupo - , reino_id - , tipo_id - , empresa_id - , gasto) - - SELECT vYear - , vMonth - , round(sum(Cantidad * Preu * (100 - m.Descuento)/100)) - , if( - e.empresa_grupo = e2.empresa_grupo - ,1 - ,if(e2.empresa_grupo,2,0) - ) as grupo - , tp.reino_id - , a.tipo_id - , t.empresa_id - , 7000000000 - + if(e.empresa_grupo = e2.empresa_grupo - ,1 - ,if(e2.empresa_grupo,2,0) - ) * 1000000 - + tp.reino_id * 10000 as Gasto - FROM vn2008.Movimientos m - JOIN vn2008.Tickets t on t.Id_Ticket = m.Id_Ticket - JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna - JOIN vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente - JOIN tmp.ticket_list tt on tt.Id_Ticket = t.Id_Ticket - JOIN vn2008.Articles a on m.Id_Article = a.Id_Article - JOIN vn2008.empresa e on e.id = t.empresa_id - LEFT JOIN vn2008.empresa e2 on e2.Id_Cliente = c.Id_Cliente - JOIN vn2008.Tipos tp on tp.tipo_id = a.tipo_id - WHERE Cantidad <> 0 - AND Preu <> 0 - AND m.Descuento <> 100 - AND a.tipo_id != TIPO_PATRIMONIAL - GROUP BY grupo, reino_id, tipo_id, empresa_id, Gasto; - - -DROP TEMPORARY TABLE tmp.ticket_list; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `ventas_contables_add_launcher` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ventas_contables_add_launcher`() -BEGIN - - call bs.ventas_contables_add(YEAR(TIMESTAMPADD(MONTH,-1,CURDATE())), MONTH(TIMESTAMPADD(MONTH,-1,CURDATE()))); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `ventas_contables_por_cliente` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ventas_contables_por_cliente`(IN vYear INT, IN vMonth INT) -BEGIN - - -DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; - -CREATE TEMPORARY TABLE tmp.ticket_list - (PRIMARY KEY (Id_Ticket)) - SELECT Id_Ticket - FROM vn2008.Tickets t - JOIN vn2008.Facturas f ON f.Id_Factura = t.Factura - WHERE year(f.Fecha) = vYear - AND month(f.Fecha) = vMonth; - - - - SELECT vYear Año - , vMonth Mes - , t.Id_Cliente - , round(sum(Cantidad * Preu * (100 - m.Descuento)/100)) Venta - , if( - e.empresa_grupo = e2.empresa_grupo - ,1 - ,if(e2.empresa_grupo,2,0) - ) as grupo - , t.empresa_id empresa - FROM vn2008.Movimientos m - JOIN vn2008.Tickets t on t.Id_Ticket = m.Id_Ticket - JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna - JOIN vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente - JOIN tmp.ticket_list tt on tt.Id_Ticket = t.Id_Ticket - JOIN vn2008.Articles a on m.Id_Article = a.Id_Article - JOIN vn2008.empresa e on e.id = t.empresa_id - LEFT JOIN vn2008.empresa e2 on e2.Id_Cliente = c.Id_Cliente - JOIN vn2008.Tipos tp on tp.tipo_id = a.tipo_id - WHERE Cantidad <> 0 - AND Preu <> 0 - AND m.Descuento <> 100 - AND a.tipo_id != 188 - GROUP BY t.Id_Cliente, grupo,t.empresa_id; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `vivosMuertos` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `vivosMuertos`() -BEGIN - -SET @datSTART = TIMESTAMPADD(YEAR,-2,CURDATE()); -SET @datEND = TIMESTAMPADD(DAY,-DAY(CURDATE()),CURDATE()); - -DROP TEMPORARY TABLE IF EXISTS tmp.VivosMuertos; - -CREATE TEMPORARY TABLE tmp.VivosMuertos -SELECT c.Id_Cliente, tm.yearMonth, f.Compra, 0 as Nuevo, 0 as Muerto -FROM vn2008.Clientes c -JOIN (SELECT DISTINCT yearMonth FROM vn2008.time WHERE date BETWEEN @datSTART AND @datEND ) tm -LEFT JOIN - (SELECT DISTINCT tm.yearMonth, f.Id_Cliente , 1 as Compra - FROM vn2008.Facturas f - JOIN vn2008.time tm ON tm.date = f.Fecha - WHERE Fecha BETWEEN @datSTART AND @datEND) f ON f.yearMonth = tm.yearMonth AND f.Id_Cliente = c.Id_Cliente; - -UPDATE tmp.VivosMuertos vm -JOIN ( - SELECT MIN(tm.yearMonth) firstMonth, f.Id_Cliente - FROM vn2008.Facturas f - JOIN vn2008.time tm ON tm.date = f.Fecha - WHERE Fecha BETWEEN @datSTART AND @datEND - GROUP BY f.Id_Cliente ) fm ON fm.firstMonth = vm.yearMonth AND fm.Id_Cliente = vm.Id_Cliente -SET Nuevo = 1; - -SELECT max(yearMonth) INTO @lastYearMonth FROM tmp.VivosMuertos; - -UPDATE tmp.VivosMuertos vm -JOIN ( - SELECT MAX(tm.yearMonth) firstMonth, f.Id_Cliente - FROM vn2008.Facturas f - JOIN vn2008.time tm ON tm.date = f.Fecha - WHERE Fecha BETWEEN @datSTART AND @datEND - GROUP BY f.Id_Cliente ) fm ON fm.firstMonth = vm.yearMonth AND fm.Id_Cliente = vm.Id_Cliente -SET Muerto = 1 -WHERE yearMonth < @lastYearMonth; - - SELECT * FROM tmp.VivosMuertos; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerSpeed` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `workerSpeed`() -BEGIN - - /* #UPDATED PAK 2019/09/02 - * #PENDING REVIEW - * - * - * - * - */ - - DECLARE vLastUpdated DATETIME; - DECLARE vSecondsDelay INT DEFAULT 300; - - SELECT IFNULL(MAX(lastUpdated),CURDATE()) INTO vLastUpdated - FROM bs.workerSpeed; - - IF TIMESTAMPDIFF(SECOND, vLastUpdated, NOW()) > vSecondsDelay THEN - - DELETE FROM bs.workerSpeed ; - -- WHERE lastUpdated < CURDATE(); - - -- Sacadores - REPLACE bs.workerSpeed - SELECT workerCode, - accion, - warehouseFk, - CAST(60 * sumaLitros / time_to_sec(timediff(finished, started)) AS DECIMAL(10,1)) as LitrosMinuto, - CAST(sumaLitrosLastHour / 60 AS DECIMAL(10,1)) as LitrosMinutoLastHour, - now() as lastUpdated - FROM - ( - SELECT warehouseFk, - accion, - workerCode, - sum(litros) as sumaLitros, - min(created) as started, - max(created) as finished, - sum(IF(created >= TIMESTAMPADD(HOUR, -1, NOW()),litros, 0)) as sumaLitrosLastHour - FROM - ( - SELECT t.warehouseFk, - st.saleFk, - st.isChecked, - st.originalQuantity, - a.accion, - st.created, - e.code, - w.firstname, - w.lastName, - w.code as workerCode, - r.cm3 * s.quantity / 1000 as litros, - s.concept - FROM vn.saleTracking st - LEFT JOIN - (SELECT saleFk - FROM vn.saleTracking st - JOIN vn.state e ON e.id = st.stateFk - WHERE st.created > CURDATE() - AND e.code LIKE 'PREVIOUS_PREPARATION') prevPrepSales ON prevPrepSales.saleFk = st.saleFk - JOIN vn.sale s ON s.id = st.saleFk - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN bi.rotacion r ON r.warehouse_id = t.warehouseFk AND r.Id_Article = s.itemFk - JOIN vn.worker w ON w.id = st.workerFk - JOIN vn.state e ON e.id = st.stateFk - JOIN vncontrol.accion a ON a.accion_id = st.actionFk - WHERE st.created > TIMESTAMPADD(HOUR,-1,NOW()) - AND prevPrepSales.saleFk IS NULL - ) sub - GROUP BY warehouseFk, accion, workerCode - ) sub2; - - -- Encajadores - REPLACE bs.workerSpeed - SELECT code as workerCode, - 'ENCAJAR' as accion, - warehouseFk, - CAST(60 * sum(Litros) / time_to_sec(timediff(MAX(finished), MIN(started))) AS DECIMAL(10,1)) as LitrosMinuto, - CAST(sum(litrosUltimaHora) / 60 AS DECIMAL(10,1)) as LitrosMinutoLastHour, - now() as lastUpdated - FROM ( - SELECT sv.ticketFk, - sum(sv.litros) as litros, - sum(IF(started > TIMESTAMPADD(HOUR,-1,NOW()),sv.litros,0)) as litrosUltimaHora, - code, - started, - finished, - cajas, - warehouseFk - FROM vn.saleVolume sv - JOIN - ( - SELECT ticketFk, - min(e.created) as started, - max(e.created) as finished, - max(counter) as cajas, - w.code, - t.warehouseFk - FROM vn.expedition e - JOIN vn.worker w ON w.id = e.workerFk - JOIN vn.ticket t ON t.id = e.ticketFk - WHERE e.created > CURDATE() - GROUP BY ticketFk - ) sub ON sub.ticketFk = sv.ticketFk - GROUP BY sv.ticketFk) sub2 - GROUP BY code; - - END IF; - - SELECT * FROM bs.workerSpeed; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerSpeed_detail` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `workerSpeed_detail`(vWorkerCode VARCHAR(3), vAction VARCHAR(25)) -BEGIN - - SELECT * FROM - ( - SELECT time_format(st.created,'%H:%i') as hora, - t.warehouseFk as Almacen, - t.id as ticketFk, - floor(sum(s.quantity * r.cm3) / 1000) as Litros - - FROM vn.saleTracking st - JOIN vn.sale s ON s.id = st.saleFk - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN bi.rotacion r ON r.warehouse_id = t.warehouseFk AND r.Id_Article = s.itemFk - JOIN vn.worker w ON w.id = st.workerFk - JOIN vn.state e ON e.id = st.stateFk - JOIN vncontrol.accion a ON a.accion_id = st.actionFk - WHERE st.created > CURDATE() - AND a.accion LIKE vAction - AND w.code LIKE vWorkerCode - GROUP BY t.id) sub - ORDER BY hora; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; - -- -- Current Database: `cache` -- @@ -8304,7 +4859,7 @@ USE `cache`; DROP TABLE IF EXISTS `available`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `available` ( `calc_id` int(10) unsigned NOT NULL, `item_id` int(11) NOT NULL, @@ -8320,14 +4875,14 @@ CREATE TABLE `available` ( DROP TABLE IF EXISTS `cache`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `cache` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) CHARACTER SET utf8 NOT NULL, `lifetime` time NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8336,7 +4891,7 @@ CREATE TABLE `cache` ( DROP TABLE IF EXISTS `cache_calc`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `cache_calc` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `cache_id` int(10) unsigned NOT NULL, @@ -8351,7 +4906,7 @@ CREATE TABLE `cache_calc` ( KEY `cache_id` (`cache_id`), KEY `cacheName` (`cacheName`), KEY `expires` (`expires`) -) ENGINE=InnoDB AUTO_INCREMENT=446148 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8360,12 +4915,12 @@ CREATE TABLE `cache_calc` ( DROP TABLE IF EXISTS `cache_valid`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `cache_valid` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `valid` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=MEMORYDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8374,7 +4929,7 @@ CREATE TABLE `cache_valid` ( DROP TABLE IF EXISTS `departure_limit`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `departure_limit` ( `warehouse_id` smallint(6) unsigned NOT NULL, `fecha` date NOT NULL, @@ -8391,7 +4946,7 @@ CREATE TABLE `departure_limit` ( DROP TABLE IF EXISTS `last_buy`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `last_buy` ( `item_id` int(10) unsigned NOT NULL, `warehouse_id` smallint(5) unsigned NOT NULL, @@ -8409,7 +4964,7 @@ CREATE TABLE `last_buy` ( DROP TABLE IF EXISTS `prod_graphic_source`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `prod_graphic_source` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `m3` double NOT NULL DEFAULT '0', @@ -8419,7 +4974,7 @@ CREATE TABLE `prod_graphic_source` ( `alert_level` int(11) NOT NULL DEFAULT '0', `Agencia` varchar(45) CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2833411 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8428,7 +4983,7 @@ CREATE TABLE `prod_graphic_source` ( DROP TABLE IF EXISTS `stock`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `stock` ( `warehouse_id` smallint(5) unsigned NOT NULL, `item_id` int(10) unsigned NOT NULL, @@ -8444,7 +4999,7 @@ CREATE TABLE `stock` ( DROP TABLE IF EXISTS `visible`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `visible` ( `calc_id` int(10) unsigned NOT NULL, `item_id` int(11) NOT NULL, @@ -8854,9 +5409,9 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `cacheCalc_clean`() -BEGIN - DECLARE vCleanTime DATETIME DEFAULT TIMESTAMPADD(MINUTE, -5, NOW()); - DELETE FROM cache_calc WHERE expires < vCleanTime; +BEGIN + DECLARE vCleanTime DATETIME DEFAULT TIMESTAMPADD(MINUTE, -5, NOW()); + DELETE FROM cache_calc WHERE expires < vCleanTime; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -8874,27 +5429,27 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `cache_calc_end`(IN `v_calc` INT) -BEGIN - DECLARE v_cache_name VARCHAR(255); - DECLARE v_params VARCHAR(255); - - -- Libera el bloqueo y actualiza la fecha de ultimo refresco. - - UPDATE cache_calc cc JOIN cache c ON c.id = cc.cache_id - SET - cc.last_refresh = NOW(), - cc.expires = ADDTIME(NOW(), c.lifetime), - cc.connection_id = NULL - WHERE cc.id = v_calc; - - SELECT c.name, ca.params INTO v_cache_name, v_params - FROM cache c - JOIN cache_calc ca ON c.id = ca.cache_id - WHERE ca.id = v_calc; - - IF v_cache_name IS NOT NULL THEN - DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, ''))); - END IF; +BEGIN + DECLARE v_cache_name VARCHAR(255); + DECLARE v_params VARCHAR(255); + + -- Libera el bloqueo y actualiza la fecha de ultimo refresco. + + UPDATE cache_calc cc JOIN cache c ON c.id = cc.cache_id + SET + cc.last_refresh = NOW(), + cc.expires = ADDTIME(NOW(), c.lifetime), + cc.connection_id = NULL + WHERE cc.id = v_calc; + + SELECT c.name, ca.params INTO v_cache_name, v_params + FROM cache c + JOIN cache_calc ca ON c.id = ca.cache_id + WHERE ca.id = v_calc; + + IF v_cache_name IS NOT NULL THEN + DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, ''))); + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -8912,88 +5467,88 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `cache_calc_start`(OUT `v_calc` INT, INOUT `v_refresh` INT, IN `v_cache_name` VARCHAR(50), IN `v_params` VARCHAR(100)) -proc: BEGIN - DECLARE v_valid BOOL; - DECLARE v_lock_id VARCHAR(100); - DECLARE v_cache_id INT; - DECLARE v_expires DATETIME; - DECLARE v_clean_time DATETIME; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - IF v_lock_id IS NOT NULL THEN - DO RELEASE_LOCK(v_lock_id); - END IF; - - RESIGNAL; - END; - - SET v_params = IFNULL(v_params, ''); - - -- Si el servidor se ha reiniciado invalida todos los calculos. - - SELECT COUNT(*) > 0 INTO v_valid FROM cache_valid; - - IF !v_valid - THEN - DELETE FROM cache_calc; - INSERT INTO cache_valid (valid) VALUES (TRUE); - END IF; - - -- Obtiene un bloqueo exclusivo para que no haya problemas de concurrencia. - - SET v_lock_id = CONCAT_WS('/', v_cache_name, v_params); - - IF !GET_LOCK(v_lock_id, 30) - THEN - SET v_calc = NULL; - SET v_refresh = FALSE; - LEAVE proc; - END IF; - - -- Comprueba si el calculo solicitado existe y esta actualizado. - - SELECT c.id, ca.id, ca.expires - INTO v_cache_id, v_calc, v_expires - FROM cache c - LEFT JOIN cache_calc ca - ON ca.cache_id = c.id AND ca.params = v_params COLLATE 'utf8_general_ci' - WHERE c.name = v_cache_name COLLATE 'utf8_general_ci'; - - -- Si existe una calculo valido libera el bloqueo y devuelve su identificador. - - IF !v_refresh AND NOW() < v_expires - THEN - DO RELEASE_LOCK(v_lock_id); - SET v_refresh = FALSE; - LEAVE proc; - END IF; - - -- Si el calculo no existe le crea una entrada en la tabla de calculos. - - IF v_calc IS NULL - THEN - INSERT INTO cache_calc SET - cache_id = v_cache_id, - cacheName = v_cache_name, - params = v_params, - last_refresh = NULL, - expires = NULL, - connection_id = CONNECTION_ID(); - - SET v_calc = LAST_INSERT_ID(); - ELSE - UPDATE cache_calc - SET - last_refresh = NULL, - expires = NULL, - connection_id = CONNECTION_ID() - WHERE id = v_calc; - END IF; - - -- Si se debe recalcular mantiene el bloqueo y devuelve su identificador. - - SET v_refresh = TRUE; +proc: BEGIN + DECLARE v_valid BOOL; + DECLARE v_lock_id VARCHAR(100); + DECLARE v_cache_id INT; + DECLARE v_expires DATETIME; + DECLARE v_clean_time DATETIME; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + IF v_lock_id IS NOT NULL THEN + DO RELEASE_LOCK(v_lock_id); + END IF; + + RESIGNAL; + END; + + SET v_params = IFNULL(v_params, ''); + + -- Si el servidor se ha reiniciado invalida todos los calculos. + + SELECT COUNT(*) > 0 INTO v_valid FROM cache_valid; + + IF !v_valid + THEN + DELETE FROM cache_calc; + INSERT INTO cache_valid (valid) VALUES (TRUE); + END IF; + + -- Obtiene un bloqueo exclusivo para que no haya problemas de concurrencia. + + SET v_lock_id = CONCAT_WS('/', v_cache_name, v_params); + + IF !GET_LOCK(v_lock_id, 30) + THEN + SET v_calc = NULL; + SET v_refresh = FALSE; + LEAVE proc; + END IF; + + -- Comprueba si el calculo solicitado existe y esta actualizado. + + SELECT c.id, ca.id, ca.expires + INTO v_cache_id, v_calc, v_expires + FROM cache c + LEFT JOIN cache_calc ca + ON ca.cache_id = c.id AND ca.params = v_params COLLATE 'utf8_general_ci' + WHERE c.name = v_cache_name COLLATE 'utf8_general_ci'; + + -- Si existe una calculo valido libera el bloqueo y devuelve su identificador. + + IF !v_refresh AND NOW() < v_expires + THEN + DO RELEASE_LOCK(v_lock_id); + SET v_refresh = FALSE; + LEAVE proc; + END IF; + + -- Si el calculo no existe le crea una entrada en la tabla de calculos. + + IF v_calc IS NULL + THEN + INSERT INTO cache_calc SET + cache_id = v_cache_id, + cacheName = v_cache_name, + params = v_params, + last_refresh = NULL, + expires = NULL, + connection_id = CONNECTION_ID(); + + SET v_calc = LAST_INSERT_ID(); + ELSE + UPDATE cache_calc + SET + last_refresh = NULL, + expires = NULL, + connection_id = CONNECTION_ID() + WHERE id = v_calc; + END IF; + + -- Si se debe recalcular mantiene el bloqueo y devuelve su identificador. + + SET v_refresh = TRUE; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -9011,24 +5566,24 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `cache_calc_unlock`(IN `v_calc` INT) -proc: BEGIN - DECLARE v_cache_name VARCHAR(50); - DECLARE v_params VARCHAR(100); - - IF v_calc IS NULL THEN - LEAVE proc; - END IF; - - SELECT c.name, ca.params INTO v_cache_name, v_params - FROM cache c - JOIN cache_calc ca ON c.id = ca.cache_id - WHERE ca.id = v_calc; - - DELETE FROM cache_calc WHERE id = v_calc; - - IF v_cache_name IS NOT NULL THEN - DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, ''))); - END IF; +proc: BEGIN + DECLARE v_cache_name VARCHAR(50); + DECLARE v_params VARCHAR(100); + + IF v_calc IS NULL THEN + LEAVE proc; + END IF; + + SELECT c.name, ca.params INTO v_cache_name, v_params + FROM cache c + JOIN cache_calc ca ON c.id = ca.cache_id + WHERE ca.id = v_calc; + + DELETE FROM cache_calc WHERE id = v_calc; + + IF v_cache_name IS NOT NULL THEN + DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, ''))); + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -9047,9 +5602,9 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `cache_clean`() NO SQL -BEGIN - CALL available_clean; - CALL visible_clean; +BEGIN + CALL available_clean; + CALL visible_clean; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -9067,13 +5622,13 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `clean`() -BEGIN - - DECLARE vDateShort DATETIME; - - SET vDateShort = TIMESTAMPADD(MONTH, -1, CURDATE()); - - DELETE FROM cache.departure_limit WHERE Fecha < vDateShort; +BEGIN + + DECLARE vDateShort DATETIME; + + SET vDateShort = TIMESTAMPADD(MONTH, -1, CURDATE()); + + DELETE FROM cache.departure_limit WHERE Fecha < vDateShort; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -9702,7 +6257,7 @@ USE `edi`; DROP TABLE IF EXISTS `PriceDetails`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `PriceDetails` ( `ID` int(11) NOT NULL, `SuplyResponseID` int(11) NOT NULL, @@ -9729,7 +6284,7 @@ CREATE TABLE `PriceDetails` ( DROP TABLE IF EXISTS `VMPSettings`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `VMPSettings` ( `VMPID` int(11) NOT NULL, `MessageID` int(11) NOT NULL, @@ -9743,7 +6298,7 @@ CREATE TABLE `VMPSettings` ( DROP TABLE IF EXISTS `bucket`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `bucket` ( `bucket_id` int(11) unsigned NOT NULL, `bucket_type_id` mediumint(8) unsigned NOT NULL, @@ -9766,7 +6321,7 @@ CREATE TABLE `bucket` ( DROP TABLE IF EXISTS `bucket_type`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `bucket_type` ( `bucket_type_id` mediumint(8) unsigned NOT NULL, `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, @@ -9783,7 +6338,7 @@ CREATE TABLE `bucket_type` ( DROP TABLE IF EXISTS `deliveryInformation`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `deliveryInformation` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `DeliveryType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -9803,7 +6358,7 @@ CREATE TABLE `deliveryInformation` ( KEY `fgbSupplyResponse_idx2` (`FirstOrderDateTime`), KEY `fgbSupplyResponse_idx3` (`LatestOrderDateTime`), CONSTRAINT `fgbSupplyResponse` FOREIGN KEY (`supplyResponseID`) REFERENCES `supplyResponse` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=25319964 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9812,7 +6367,7 @@ CREATE TABLE `deliveryInformation` ( DROP TABLE IF EXISTS `ekt`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ekt` ( `id` int(11) NOT NULL AUTO_INCREMENT, `barcode` char(15) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -9861,7 +6416,7 @@ CREATE TABLE `ekt` ( KEY `barcode` (`barcode`), KEY `fec` (`fec`), KEY `putOrderFk` (`putOrderFk`) -) ENGINE=InnoDB AUTO_INCREMENT=1133448 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9870,7 +6425,7 @@ CREATE TABLE `ekt` ( DROP TABLE IF EXISTS `exchange`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `exchange` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `mailFk` int(10) unsigned NOT NULL, @@ -9882,7 +6437,7 @@ CREATE TABLE `exchange` ( KEY `buy_edi_id` (`ektFk`), CONSTRAINT `exchange_ibfk_1` FOREIGN KEY (`mailFk`) REFERENCES `mail` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `exchange_ibfk_2` FOREIGN KEY (`ektFk`) REFERENCES `ekt` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=674008 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9891,7 +6446,7 @@ CREATE TABLE `exchange` ( DROP TABLE IF EXISTS `exchangeConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `exchangeConfig` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `logMail` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Mail where the log information is sent', @@ -9901,7 +6456,7 @@ CREATE TABLE `exchangeConfig` ( PRIMARY KEY (`id`), KEY `presale_id` (`presaleFk`), CONSTRAINT `exchangeConfig_ibfk_1` FOREIGN KEY (`presaleFk`) REFERENCES `exchangeType` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuration parameters'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9910,7 +6465,7 @@ CREATE TABLE `exchangeConfig` ( DROP TABLE IF EXISTS `exchangeType`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `exchangeType` ( `id` mediumint(8) unsigned NOT NULL, `description` varchar(50) COLLATE utf8_unicode_ci NOT NULL, @@ -9924,7 +6479,7 @@ CREATE TABLE `exchangeType` ( DROP TABLE IF EXISTS `feature`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `feature` ( `item_id` int(11) unsigned NOT NULL, `feature_type_id` varchar(3) COLLATE utf8_unicode_ci NOT NULL, @@ -9942,7 +6497,7 @@ CREATE TABLE `feature` ( DROP TABLE IF EXISTS `fileConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `fileConfig` ( `fileName` varchar(2) COLLATE utf8_unicode_ci NOT NULL, `toTable` varchar(15) COLLATE utf8_unicode_ci NOT NULL, @@ -9959,14 +6514,14 @@ CREATE TABLE `fileConfig` ( DROP TABLE IF EXISTS `ftpConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ftpConfig` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `host` varchar(255) CHARACTER SET utf8 NOT NULL, `user` varchar(50) CHARACTER SET utf8 NOT NULL, `password` varchar(50) CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuration parameters'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9975,7 +6530,7 @@ CREATE TABLE `ftpConfig` ( DROP TABLE IF EXISTS `genus`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `genus` ( `genus_id` mediumint(8) unsigned NOT NULL, `latin_genus_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, @@ -9992,7 +6547,7 @@ CREATE TABLE `genus` ( DROP TABLE IF EXISTS `goodCharacteristic`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `goodCharacteristic` ( `supplyResponse` varchar(26) COLLATE utf8_unicode_ci NOT NULL, `type` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'edi.type', @@ -10007,7 +6562,7 @@ CREATE TABLE `goodCharacteristic` ( DROP TABLE IF EXISTS `imapConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `imapConfig` ( `id` tinyint(3) unsigned NOT NULL, `host` varchar(150) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'localhost', @@ -10026,7 +6581,7 @@ CREATE TABLE `imapConfig` ( DROP TABLE IF EXISTS `item`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `item` ( `id` int(11) unsigned NOT NULL, `product_name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -10049,7 +6604,7 @@ CREATE TABLE `item` ( DROP TABLE IF EXISTS `item_feature`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `item_feature` ( `item_id` int(11) NOT NULL, `presentation_order` tinyint(11) unsigned NOT NULL, @@ -10088,7 +6643,7 @@ DELIMITER ; DROP TABLE IF EXISTS `item_group`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `item_group` ( `group_code` int(11) unsigned NOT NULL, `dutch_group_description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, @@ -10105,7 +6660,7 @@ CREATE TABLE `item_group` ( DROP TABLE IF EXISTS `item_track`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `item_track` ( `item_id` int(10) unsigned NOT NULL, `s1` tinyint(3) NOT NULL DEFAULT '0', @@ -10131,7 +6686,7 @@ CREATE TABLE `item_track` ( DROP TABLE IF EXISTS `mail`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `mail` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `senderFk` int(10) unsigned DEFAULT NULL, @@ -10144,7 +6699,7 @@ CREATE TABLE `mail` ( UNIQUE KEY `mail_id` (`messageId`), KEY `sender_id` (`senderFk`), CONSTRAINT `mail_ibfk_2` FOREIGN KEY (`senderFk`) REFERENCES `mailSender` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=703783 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -10153,14 +6708,14 @@ CREATE TABLE `mail` ( DROP TABLE IF EXISTS `mailSender`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `mailSender` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `mail` varchar(150) COLLATE utf8_unicode_ci NOT NULL, `kop` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `mail` (`mail`) -) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='List of allowed mailers'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='List of allowed mailers'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -10169,7 +6724,7 @@ CREATE TABLE `mailSender` ( DROP TABLE IF EXISTS `marketPlace`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `marketPlace` ( `id` varchar(13) COLLATE utf8_unicode_ci NOT NULL, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, @@ -10184,7 +6739,7 @@ CREATE TABLE `marketPlace` ( DROP TABLE IF EXISTS `param`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `param` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `code` varchar(30) COLLATE utf8_unicode_ci NOT NULL, @@ -10195,7 +6750,7 @@ CREATE TABLE `param` ( `required` tinyint(3) unsigned NOT NULL DEFAULT '1', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`,`subname`) -) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Parameters to capture of every exchange'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Parameters to capture of every exchange'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -10204,7 +6759,7 @@ CREATE TABLE `param` ( DROP TABLE IF EXISTS `plant`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `plant` ( `plant_id` mediumint(8) unsigned NOT NULL, `genus_id` mediumint(8) unsigned NOT NULL, @@ -10222,7 +6777,7 @@ CREATE TABLE `plant` ( DROP TABLE IF EXISTS `putOrder`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `putOrder` ( `id` int(11) NOT NULL AUTO_INCREMENT, `deliveryInformationID` int(11) DEFAULT NULL, @@ -10236,7 +6791,7 @@ CREATE TABLE `putOrder` ( `isOrderProcessed` tinyint(4) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `orderTradelineItemID_UNIQUE` (`orderTradelineItemID`) -) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -10269,7 +6824,7 @@ DELIMITER ; DROP TABLE IF EXISTS `specie`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `specie` ( `specie_id` mediumint(8) unsigned NOT NULL, `genus_id` mediumint(8) unsigned NOT NULL, @@ -10287,7 +6842,7 @@ CREATE TABLE `specie` ( DROP TABLE IF EXISTS `supplier`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `supplier` ( `supplier_id` int(10) unsigned NOT NULL COMMENT 'FHRegistrationNr', `glnAddressCode` varchar(13) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -10306,7 +6861,7 @@ CREATE TABLE `supplier` ( DROP TABLE IF EXISTS `supplyResponse`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `supplyResponse` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `NumberBunchesPerCask` int(11) DEFAULT NULL, @@ -10359,7 +6914,7 @@ CREATE TABLE `supplyResponse` ( PRIMARY KEY (`ID`), UNIQUE KEY `ID_UNIQUE` (`ID`), KEY `IX_TransNumber` (`TransactionNumber`) COMMENT 'Agregado por Ernesto 11.6.2019\nSe ejecutaba 1 consulta por segundo desde MAIL y consumia un 20% de CPU de todo el servidor !!!!!\nCPU usada es mas estable que Indice en SendererID, cpu vs espacio que ocupa?\n' -) ENGINE=InnoDB AUTO_INCREMENT=9313265 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -10368,7 +6923,7 @@ CREATE TABLE `supplyResponse` ( DROP TABLE IF EXISTS `type`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `type` ( `type_id` varchar(3) COLLATE utf8_unicode_ci NOT NULL, `type_group_id` tinyint(3) unsigned NOT NULL, @@ -10386,7 +6941,7 @@ CREATE TABLE `type` ( DROP TABLE IF EXISTS `value`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `value` ( `type_id` varchar(3) COLLATE utf8_unicode_ci NOT NULL, `type_value` varchar(3) COLLATE utf8_unicode_ci NOT NULL, @@ -10537,158 +7092,158 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `ekt_load`(IN `vSelf` INT) -BEGIN - DECLARE vRef INT; - DECLARE vBuy INT; - DECLARE vItem INT; - DECLARE vQty INT; - DECLARE vPackage INT; - DECLARE vIsLot BOOLEAN; - DECLARE vForceToPacking INT DEFAULT 2; - - -- Carga los datos necesarios del EKT - - SELECT ref, qty, package INTO vRef, vQty, vPackage - FROM ekt e - LEFT JOIN item i ON e.ref = i.id - WHERE e.id = vSelf; - - -- Inserta el cubo si no existe - - IF vPackage = 800 - THEN - SET vPackage = 800 + vQty; - - INSERT IGNORE INTO vn2008.Cubos SET - Id_Cubo = vPackage, - x = 7200 / vQty, - y = 1; - ELSE - INSERT IGNORE INTO vn2008.Cubos (Id_Cubo, X, Y, Z) - SELECT bucket_id, ROUND(x_size/10), ROUND(y_size/10), ROUND(z_size/10) - FROM bucket WHERE bucket_id = vPackage; - - IF ROW_COUNT() > 0 - THEN - INSERT INTO vn2008.mail SET - `subject` = 'Cubo añadido', - `text` = CONCAT('Se ha añadido el cubo: ', vPackage), - `to` = 'ekt@verdnatura.es'; - END IF; - END IF; - - -- Intenta obtener el artículo en base a los atributos holandeses - - INSERT IGNORE INTO item_track SET - item_id = vRef; - - SELECT c.Id_Compra, c.Id_Article INTO vBuy, vItem - FROM vn2008.buy_edi e - JOIN item_track t ON t.item_id = e.ref - LEFT JOIN vn2008.buy_edi l ON l.ref = e.ref - LEFT JOIN vn2008.Compres c ON c.buy_edi_id = l.id - JOIN vn2008.config cfg - WHERE e.id = vSelf - AND l.id != vSelf - AND c.Id_Article != cfg.generic_item - AND IF(t.s1, l.s1 = e.s1, TRUE) - AND IF(t.s2, l.s2 = e.s2, TRUE) - AND IF(t.s3, l.s3 = e.s3, TRUE) - AND IF(t.s4, l.s4 = e.s4, TRUE) - AND IF(t.s5, l.s5 = e.s5, TRUE) - AND IF(t.s6, l.s6 = e.s6, TRUE) - AND IF(t.kop, l.kop = e.kop, TRUE) - AND IF(t.pac, l.pac = e.pac, TRUE) - AND IF(t.cat, l.cat = e.cat, TRUE) - AND IF(t.ori, l.ori = e.ori, TRUE) - AND IF(t.pro, l.pro = e.pro, TRUE) - AND IF(t.sub, l.sub = e.sub, TRUE) - AND IF(t.package, l.package = e.package, TRUE) - AND c.Id_Article < 170000 - ORDER BY l.now DESC, c.Id_Compra ASC LIMIT 1; - - -- Determina si el articulo se vende por lotes - - IF vItem - THEN - SELECT COUNT(*) > 0 INTO vIsLot - FROM vn2008.Articles a - LEFT JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id - WHERE a.Id_Article = vItem - AND t.`transaction`; - - -- Si el articulo se vende por lotes se inserta un nuevo artículo - - IF vIsLot - THEN - INSERT INTO vn2008.Articles ( - Article - ,Medida - ,Categoria - ,Id_Origen - ,iva_group_id - ,Foto - ,Color - ,Codintrastat - ,tipo_id - ,Tallos - ) - SELECT - i.`name` - ,IFNULL(e.s1, e.pac) - ,e.cat - ,IFNULL(o.id, 17) - ,IFNULL(a.iva_group_id, 1) - ,a.Foto - ,a.Color - ,a.Codintrastat - ,IFNULL(a.tipo_id, 10) - ,IF(a.tipo_id = 15, 0, 1) - FROM vn2008.buy_edi e - LEFT JOIN item i ON i.id = e.ref - LEFT JOIN vn2008.Origen o ON o.Abreviatura = e.ori - LEFT JOIN vn2008.Articles a ON a.Id_Article = vItem - WHERE e.id = vSelf; - - SET vItem = LAST_INSERT_ID(); - END IF; - END IF; - - -- Inserta la compra asociada al EKT - - INSERT INTO vn2008.Compres - ( - Id_Entrada - ,buy_edi_id - ,Costefijo - ,Id_Article - ,`grouping` - ,caja - ,Packing - ,Cantidad - ,Productor - ,Etiquetas - ,Id_Cubo - ) - SELECT - cfg.edi_entry - ,vSelf - ,(@t := IF(a.Tallos, a.Tallos, 1)) * e.pri - ,IFNULL(vItem, cfg.generic_item) - ,IFNULL(c.`grouping`, e.pac) - ,vForceToPacking - ,@pac := e.pac / @t - ,@pac * e.qty - ,s.company_name - ,e.qty - ,IFNULL(c.Id_Cubo, e.package) - FROM vn2008.buy_edi e - LEFT JOIN vn2008.Compres c ON c.Id_Compra = vBuy - LEFT JOIN vn2008.Articles a ON a.Id_Article = c.Id_Article - LEFT JOIN supplier s ON e.pro = s.supplier_id - JOIN vn2008.config cfg - WHERE e.id = vSelf - LIMIT 1; +BEGIN + DECLARE vRef INT; + DECLARE vBuy INT; + DECLARE vItem INT; + DECLARE vQty INT; + DECLARE vPackage INT; + DECLARE vIsLot BOOLEAN; + DECLARE vForceToPacking INT DEFAULT 2; + + -- Carga los datos necesarios del EKT + + SELECT ref, qty, package INTO vRef, vQty, vPackage + FROM ekt e + LEFT JOIN item i ON e.ref = i.id + WHERE e.id = vSelf; + + -- Inserta el cubo si no existe + + IF vPackage = 800 + THEN + SET vPackage = 800 + vQty; + + INSERT IGNORE INTO vn2008.Cubos SET + Id_Cubo = vPackage, + x = 7200 / vQty, + y = 1; + ELSE + INSERT IGNORE INTO vn2008.Cubos (Id_Cubo, X, Y, Z) + SELECT bucket_id, ROUND(x_size/10), ROUND(y_size/10), ROUND(z_size/10) + FROM bucket WHERE bucket_id = vPackage; + + IF ROW_COUNT() > 0 + THEN + INSERT INTO vn2008.mail SET + `subject` = 'Cubo añadido', + `text` = CONCAT('Se ha añadido el cubo: ', vPackage), + `to` = 'ekt@verdnatura.es'; + END IF; + END IF; + + -- Intenta obtener el artículo en base a los atributos holandeses + + INSERT IGNORE INTO item_track SET + item_id = vRef; + + SELECT c.Id_Compra, c.Id_Article INTO vBuy, vItem + FROM vn2008.buy_edi e + JOIN item_track t ON t.item_id = e.ref + LEFT JOIN vn2008.buy_edi l ON l.ref = e.ref + LEFT JOIN vn2008.Compres c ON c.buy_edi_id = l.id + JOIN vn2008.config cfg + WHERE e.id = vSelf + AND l.id != vSelf + AND c.Id_Article != cfg.generic_item + AND IF(t.s1, l.s1 = e.s1, TRUE) + AND IF(t.s2, l.s2 = e.s2, TRUE) + AND IF(t.s3, l.s3 = e.s3, TRUE) + AND IF(t.s4, l.s4 = e.s4, TRUE) + AND IF(t.s5, l.s5 = e.s5, TRUE) + AND IF(t.s6, l.s6 = e.s6, TRUE) + AND IF(t.kop, l.kop = e.kop, TRUE) + AND IF(t.pac, l.pac = e.pac, TRUE) + AND IF(t.cat, l.cat = e.cat, TRUE) + AND IF(t.ori, l.ori = e.ori, TRUE) + AND IF(t.pro, l.pro = e.pro, TRUE) + AND IF(t.sub, l.sub = e.sub, TRUE) + AND IF(t.package, l.package = e.package, TRUE) + AND c.Id_Article < 170000 + ORDER BY l.now DESC, c.Id_Compra ASC LIMIT 1; + + -- Determina si el articulo se vende por lotes + + IF vItem + THEN + SELECT COUNT(*) > 0 INTO vIsLot + FROM vn2008.Articles a + LEFT JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id + WHERE a.Id_Article = vItem + AND t.`transaction`; + + -- Si el articulo se vende por lotes se inserta un nuevo artículo + + IF vIsLot + THEN + INSERT INTO vn2008.Articles ( + Article + ,Medida + ,Categoria + ,Id_Origen + ,iva_group_id + ,Foto + ,Color + ,Codintrastat + ,tipo_id + ,Tallos + ) + SELECT + i.`name` + ,IFNULL(e.s1, e.pac) + ,e.cat + ,IFNULL(o.id, 17) + ,IFNULL(a.iva_group_id, 1) + ,a.Foto + ,a.Color + ,a.Codintrastat + ,IFNULL(a.tipo_id, 10) + ,IF(a.tipo_id = 15, 0, 1) + FROM vn2008.buy_edi e + LEFT JOIN item i ON i.id = e.ref + LEFT JOIN vn2008.Origen o ON o.Abreviatura = e.ori + LEFT JOIN vn2008.Articles a ON a.Id_Article = vItem + WHERE e.id = vSelf; + + SET vItem = LAST_INSERT_ID(); + END IF; + END IF; + + -- Inserta la compra asociada al EKT + + INSERT INTO vn2008.Compres + ( + Id_Entrada + ,buy_edi_id + ,Costefijo + ,Id_Article + ,`grouping` + ,caja + ,Packing + ,Cantidad + ,Productor + ,Etiquetas + ,Id_Cubo + ) + SELECT + cfg.edi_entry + ,vSelf + ,(@t := IF(a.Tallos, a.Tallos, 1)) * e.pri + ,IFNULL(vItem, cfg.generic_item) + ,IFNULL(c.`grouping`, e.pac) + ,vForceToPacking + ,@pac := e.pac / @t + ,@pac * e.qty + ,s.company_name + ,e.qty + ,IFNULL(c.Id_Cubo, e.package) + FROM vn2008.buy_edi e + LEFT JOIN vn2008.Compres c ON c.Id_Compra = vBuy + LEFT JOIN vn2008.Articles a ON a.Id_Article = c.Id_Article + LEFT JOIN supplier s ON e.pro = s.supplier_id + JOIN vn2008.config cfg + WHERE e.id = vSelf + LIMIT 1; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10738,154 +7293,154 @@ CREATE DEFINER=`root`@`%` PROCEDURE `exchange_new`( IN `vAuction` SMALLINT, IN `vPackage` INT, IN `vPutOrderFk` INT) -BEGIN +BEGIN /** * Adds a new exchange, generates it's barcode and * inserts/updates the transaction. When the referenced * transaction exists as provisional, updates it with - * the new values. - */ - DECLARE vEkt INT; - DECLARE vRewriteKop INT DEFAULT NULL; - DECLARE vBarcode CHAR(15) DEFAULT NULL; - DECLARE vIsDuplicated BOOL; + * the new values. + */ + DECLARE vEkt INT; + DECLARE vRewriteKop INT DEFAULT NULL; + DECLARE vBarcode CHAR(15) DEFAULT NULL; + DECLARE vIsDuplicated BOOL; DECLARE vUpdateExistent BOOL DEFAULT FALSE; - DECLARE duplicateKey CONDITION FOR 1062; + DECLARE duplicateKey CONDITION FOR 1062; + + DECLARE CONTINUE HANDLER FOR duplicateKey + SET vIsDuplicated = TRUE; + + -- Generates the barcode + + IF vAgj != 0 AND vAgj IS NOT NULL + THEN + SET vBarcode = CONCAT( + LPAD(vAuction, 2, 0), + LPAD(IFNULL(vClock, 99), 2, 0), + LPAD(DAYOFYEAR(vDate), 3, 0), + IF(vClock IS NULL OR vClock = 99, + LPAD(vAgj, 7, 0), + CONCAT(LPAD(vAgj, 5, 0), '01') + ), + '0' + ); + END IF; + + -- Rewrites the kop parameter + + IF vKop IS NULL THEN + SELECT defaultKop INTO vKop FROM exchangeConfig; + END IF; + + SELECT e.kop INTO vRewriteKop + FROM mailSender e + JOIN mail m ON m.senderFk = e.id + WHERE m.id = vMailFk; + + SET vKop = IFNULL(vRewriteKop, vKop); + + -- Inserts the new transaction - DECLARE CONTINUE HANDLER FOR duplicateKey - SET vIsDuplicated = TRUE; - - -- Generates the barcode - - IF vAgj != 0 AND vAgj IS NOT NULL - THEN - SET vBarcode = CONCAT( - LPAD(vAuction, 2, 0), - LPAD(IFNULL(vClock, 99), 2, 0), - LPAD(DAYOFYEAR(vDate), 3, 0), - IF(vClock IS NULL OR vClock = 99, - LPAD(vAgj, 7, 0), - CONCAT(LPAD(vAgj, 5, 0), '01') - ), - '0' - ); - END IF; - - -- Rewrites the kop parameter - - IF vKop IS NULL THEN - SELECT defaultKop INTO vKop FROM exchangeConfig; - END IF; - - SELECT e.kop INTO vRewriteKop - FROM mailSender e - JOIN mail m ON m.senderFk = e.id - WHERE m.id = vMailFk; - - SET vKop = IFNULL(vRewriteKop, vKop); - - -- Inserts the new transaction - - SET vIsDuplicated = FALSE; - INSERT INTO ekt SET - barcode = IFNULL(vBarcode, barcode) - ,deliveryNumber = vDeliveryNumber - ,entryYear = YEAR(vDate) - ,fec = vDate - ,hor = vHour - ,ref = vRef - ,item = vItem - ,agj = vAgj - ,cat = vCat - ,pac = vPac - ,sub = vSub - ,kop = vKop - ,ptd = vPtd - ,pro = vPro - ,ori = vOrigin - ,ptj = vPtj - ,qty = vQuantiy - ,pri = vPrice - ,klo = vClock - ,s1 = vS1 - ,s2 = vS2 - ,s3 = vS3 - ,s4 = vS4 - ,s5 = vS5 - ,s6 = vS6 - ,k1 = vK1 - ,k2 = vK2 - ,k3 = vP1 - ,k4 = vP2 - ,auction = vAuction - ,package = vPackage - ,putOrderFk = vPutOrderFk; - - -- If it exists duplicado updates it - - IF NOT vIsDuplicated - THEN - SET vEkt = LAST_INSERT_ID(); - CALL ekt_load (vEkt); - - ELSEIF vDeliveryNumber != 0 - AND vDeliveryNumber IS NOT NULL - THEN - SELECT id INTO vEkt - FROM ekt - WHERE deliveryNumber = vDeliveryNumber; - - SELECT COUNT(*) = 0 INTO vUpdateExistent - FROM ekt t - JOIN `exchange` b ON b.ektFk = t.id - JOIN exchangeConfig c - WHERE t.deliveryNumber = vDeliveryNumber - AND t.entryYear = YEAR(vDate) - AND b.typeFk != c.presaleFk; - END IF; - - IF vUpdateExistent - THEN - UPDATE ekt SET - barcode = IFNULL(vBarcode, barcode) - ,fec = vDate - ,hor = vHour - ,ref = vRef - ,item = vItem - ,agj = vAgj - ,cat = vCat - ,pac = vPac - ,sub = vSub - ,kop = vKop - ,ptd = vPtd - ,pro = vPro - ,ori = vOrigin - ,ptj = vPtj - ,qty = vQuantiy - ,pri = vPrice - ,klo = vClock - ,s1 = vS1 - ,s2 = vS2 - ,s3 = vS3 - ,s4 = vS4 - ,s5 = vS5 - ,s6 = vS6 - ,k1 = vK1 - ,k2 = vK2 - ,k3 = vP1 - ,k4 = vP2 - ,auction = vAuction - ,package = vPackage - ,putOrderFk = vPutOrderFk - WHERE id = vEkt; - END IF; - - -- Registers the exchange - - INSERT INTO `exchange` SET - mailFk = vMailFk - ,typeFk = vType - ,ektFk = vEkt; + SET vIsDuplicated = FALSE; + INSERT INTO ekt SET + barcode = IFNULL(vBarcode, barcode) + ,deliveryNumber = vDeliveryNumber + ,entryYear = YEAR(vDate) + ,fec = vDate + ,hor = vHour + ,ref = vRef + ,item = vItem + ,agj = vAgj + ,cat = vCat + ,pac = vPac + ,sub = vSub + ,kop = vKop + ,ptd = vPtd + ,pro = vPro + ,ori = vOrigin + ,ptj = vPtj + ,qty = vQuantiy + ,pri = vPrice + ,klo = vClock + ,s1 = vS1 + ,s2 = vS2 + ,s3 = vS3 + ,s4 = vS4 + ,s5 = vS5 + ,s6 = vS6 + ,k1 = vK1 + ,k2 = vK2 + ,k3 = vP1 + ,k4 = vP2 + ,auction = vAuction + ,package = vPackage + ,putOrderFk = vPutOrderFk; + + -- If it exists duplicado updates it + + IF NOT vIsDuplicated + THEN + SET vEkt = LAST_INSERT_ID(); + CALL ekt_load (vEkt); + + ELSEIF vDeliveryNumber != 0 + AND vDeliveryNumber IS NOT NULL + THEN + SELECT id INTO vEkt + FROM ekt + WHERE deliveryNumber = vDeliveryNumber; + + SELECT COUNT(*) = 0 INTO vUpdateExistent + FROM ekt t + JOIN `exchange` b ON b.ektFk = t.id + JOIN exchangeConfig c + WHERE t.deliveryNumber = vDeliveryNumber + AND t.entryYear = YEAR(vDate) + AND b.typeFk != c.presaleFk; + END IF; + + IF vUpdateExistent + THEN + UPDATE ekt SET + barcode = IFNULL(vBarcode, barcode) + ,fec = vDate + ,hor = vHour + ,ref = vRef + ,item = vItem + ,agj = vAgj + ,cat = vCat + ,pac = vPac + ,sub = vSub + ,kop = vKop + ,ptd = vPtd + ,pro = vPro + ,ori = vOrigin + ,ptj = vPtj + ,qty = vQuantiy + ,pri = vPrice + ,klo = vClock + ,s1 = vS1 + ,s2 = vS2 + ,s3 = vS3 + ,s4 = vS4 + ,s5 = vS5 + ,s6 = vS6 + ,k1 = vK1 + ,k2 = vK2 + ,k3 = vP1 + ,k4 = vP2 + ,auction = vAuction + ,package = vPackage + ,putOrderFk = vPutOrderFk + WHERE id = vEkt; + END IF; + + -- Registers the exchange + + INSERT INTO `exchange` SET + mailFk = vMailFk + ,typeFk = vType + ,ektFk = vEkt; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10960,7 +7515,7 @@ USE `hedera`; DROP TABLE IF EXISTS `androidUser`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `androidUser` ( `androidId` varchar(200) CHARACTER SET utf8 NOT NULL, `userFk` int(10) unsigned NOT NULL, @@ -10975,7 +7530,7 @@ CREATE TABLE `androidUser` ( DROP TABLE IF EXISTS `basketOrder`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `basketOrder` ( `clientFk` int(11) NOT NULL, `orderFk` int(10) unsigned NOT NULL, @@ -10993,7 +7548,7 @@ CREATE TABLE `basketOrder` ( DROP TABLE IF EXISTS `browser`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `browser` ( `name` varchar(30) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Browser name in browscap', `version` float NOT NULL COMMENT 'Minimal version', @@ -11007,7 +7562,7 @@ CREATE TABLE `browser` ( DROP TABLE IF EXISTS `config`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `config` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `defaultLang` char(2) CHARACTER SET utf8 NOT NULL COMMENT 'The default language if none is specified', @@ -11023,7 +7578,7 @@ CREATE TABLE `config` ( `pdfsDir` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Directory where PDFs are allocated', `dmsDir` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Directory where documents are allocated', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration parameters'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11032,12 +7587,12 @@ CREATE TABLE `config` ( DROP TABLE IF EXISTS `contact`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `contact` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `recipient` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11046,7 +7601,7 @@ CREATE TABLE `contact` ( DROP TABLE IF EXISTS `image`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `image` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `collectionFk` varchar(50) COLLATE utf8_unicode_ci NOT NULL, @@ -11056,7 +7611,7 @@ CREATE TABLE `image` ( PRIMARY KEY (`id`), UNIQUE KEY `collection` (`collectionFk`,`name`), CONSTRAINT `image_ibfk_1` FOREIGN KEY (`collectionFk`) REFERENCES `imageCollection` (`name`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=176813 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11065,7 +7620,7 @@ CREATE TABLE `image` ( DROP TABLE IF EXISTS `imageCollection`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `imageCollection` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, @@ -11079,7 +7634,7 @@ CREATE TABLE `imageCollection` ( `column` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Deprecated', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11088,7 +7643,7 @@ CREATE TABLE `imageCollection` ( DROP TABLE IF EXISTS `imageCollectionSize`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `imageCollectionSize` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `collectionFk` int(10) unsigned NOT NULL, @@ -11098,7 +7653,7 @@ CREATE TABLE `imageCollectionSize` ( PRIMARY KEY (`id`), KEY `image_schema_id` (`collectionFk`), CONSTRAINT `imageCollectionSize_ibfk_1` FOREIGN KEY (`collectionFk`) REFERENCES `imageCollection` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11107,14 +7662,14 @@ CREATE TABLE `imageCollectionSize` ( DROP TABLE IF EXISTS `imageConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `imageConfig` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identifier', `maxSize` int(10) unsigned NOT NULL COMMENT 'Maximun size for uploaded images in MB', `useXsendfile` tinyint(4) NOT NULL COMMENT 'Whether to use the apache module XSendfile', `url` varchar(255) NOT NULL COMMENT 'Public URL where image are hosted', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='Global image parameters'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COMMENT='Global image parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11123,7 +7678,7 @@ CREATE TABLE `imageConfig` ( DROP TABLE IF EXISTS `language`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `language` ( `code` varchar(10) CHARACTER SET utf8 NOT NULL, `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, @@ -11139,7 +7694,7 @@ CREATE TABLE `language` ( DROP TABLE IF EXISTS `link`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `link` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(30) COLLATE utf8_unicode_ci NOT NULL, @@ -11147,7 +7702,7 @@ CREATE TABLE `link` ( `link` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `image` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11219,7 +7774,7 @@ DELIMITER ; DROP TABLE IF EXISTS `location`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `location` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `lat` varchar(12) COLLATE utf8_unicode_ci NOT NULL, @@ -11232,7 +7787,7 @@ CREATE TABLE `location` ( `phone` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `language` char(2) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11241,7 +7796,7 @@ CREATE TABLE `location` ( DROP TABLE IF EXISTS `mailConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `mailConfig` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identifier', `host` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'localhost' COMMENT 'SMTP host', @@ -11252,7 +7807,7 @@ CREATE TABLE `mailConfig` ( `user` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'SMTP user', `password` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'SMTP password, base64 encoded', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11261,7 +7816,7 @@ CREATE TABLE `mailConfig` ( DROP TABLE IF EXISTS `mainAccount`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `mainAccount` ( `accountFk` mediumint(8) unsigned NOT NULL, PRIMARY KEY (`accountFk`) @@ -11269,13 +7824,13 @@ CREATE TABLE `mainAccount` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `mainAccountBank` +-- Temporary table structure for view `mainAccountBank` -- DROP TABLE IF EXISTS `mainAccountBank`; /*!50001 DROP VIEW IF EXISTS `mainAccountBank`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `mainAccountBank` AS SELECT 1 AS `name`, 1 AS `iban`*/; @@ -11287,7 +7842,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `menu`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `menu` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `description` varchar(30) COLLATE utf8_unicode_ci NOT NULL, @@ -11299,7 +7854,7 @@ CREATE TABLE `menu` ( KEY `group_id` (`roleFk`), KEY `parent` (`parentFk`), CONSTRAINT `menu_ibfk_1` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11308,14 +7863,14 @@ CREATE TABLE `menu` ( DROP TABLE IF EXISTS `message`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `message` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `code` char(35) COLLATE utf8_unicode_ci NOT NULL, `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `code` (`code`) -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11324,7 +7879,7 @@ CREATE TABLE `message` ( DROP TABLE IF EXISTS `metatag`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `metatag` ( `id` int(11) NOT NULL, `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, @@ -11335,13 +7890,13 @@ CREATE TABLE `metatag` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `myAddress` +-- Temporary table structure for view `myAddress` -- DROP TABLE IF EXISTS `myAddress`; /*!50001 DROP VIEW IF EXISTS `myAddress`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `myAddress` AS SELECT 1 AS `id`, 1 AS `clientFk`, @@ -11359,13 +7914,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `myBasket` +-- Temporary table structure for view `myBasket` -- DROP TABLE IF EXISTS `myBasket`; /*!50001 DROP VIEW IF EXISTS `myBasket`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `myBasket` AS SELECT 1 AS `id`, 1 AS `made`, @@ -11379,13 +7934,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `myBasketDefaults` +-- Temporary table structure for view `myBasketDefaults` -- DROP TABLE IF EXISTS `myBasketDefaults`; /*!50001 DROP VIEW IF EXISTS `myBasketDefaults`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `myBasketDefaults` AS SELECT 1 AS `deliveryMethod`, 1 AS `agencyModeFk`, @@ -11394,13 +7949,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `myBasketItem` +-- Temporary table structure for view `myBasketItem` -- DROP TABLE IF EXISTS `myBasketItem`; /*!50001 DROP VIEW IF EXISTS `myBasketItem`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `myBasketItem` AS SELECT 1 AS `id`, 1 AS `orderFk`, @@ -11411,13 +7966,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `myClient` +-- Temporary table structure for view `myClient` -- DROP TABLE IF EXISTS `myClient`; /*!50001 DROP VIEW IF EXISTS `myClient`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `myClient` AS SELECT 1 AS `id`, 1 AS `isToBeMailed`, @@ -11426,13 +7981,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `myInvoice` +-- Temporary table structure for view `myInvoice` -- DROP TABLE IF EXISTS `myInvoice`; /*!50001 DROP VIEW IF EXISTS `myInvoice`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `myInvoice` AS SELECT 1 AS `id`, 1 AS `ref`, @@ -11442,13 +7997,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `myMenu` +-- Temporary table structure for view `myMenu` -- DROP TABLE IF EXISTS `myMenu`; /*!50001 DROP VIEW IF EXISTS `myMenu`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `myMenu` AS SELECT 1 AS `id`, 1 AS `path`, @@ -11457,13 +8012,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `myOrder` +-- Temporary table structure for view `myOrder` -- DROP TABLE IF EXISTS `myOrder`; /*!50001 DROP VIEW IF EXISTS `myOrder`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `myOrder` AS SELECT 1 AS `id`, 1 AS `landed`, @@ -11481,13 +8036,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `myOrderRow` +-- Temporary table structure for view `myOrderRow` -- DROP TABLE IF EXISTS `myOrderRow`; /*!50001 DROP VIEW IF EXISTS `myOrderRow`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `myOrderRow` AS SELECT 1 AS `id`, 1 AS `Fk`, @@ -11502,26 +8057,26 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `myOrderTicket` +-- Temporary table structure for view `myOrderTicket` -- DROP TABLE IF EXISTS `myOrderTicket`; /*!50001 DROP VIEW IF EXISTS `myOrderTicket`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `myOrderTicket` AS SELECT 1 AS `orderFk`, 1 AS `ticketFk`*/; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `myTicket` +-- Temporary table structure for view `myTicket` -- DROP TABLE IF EXISTS `myTicket`; /*!50001 DROP VIEW IF EXISTS `myTicket`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `myTicket` AS SELECT 1 AS `id`, 1 AS `clientFk`, @@ -11537,13 +8092,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `myTicketRow` +-- Temporary table structure for view `myTicketRow` -- DROP TABLE IF EXISTS `myTicketRow`; /*!50001 DROP VIEW IF EXISTS `myTicketRow`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `myTicketRow` AS SELECT 1 AS `id`, 1 AS `itemFk`, @@ -11557,13 +8112,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `myTicketState` +-- Temporary table structure for view `myTicketState` -- DROP TABLE IF EXISTS `myTicketState`; /*!50001 DROP VIEW IF EXISTS `myTicketState`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `myTicketState` AS SELECT 1 AS `id`, 1 AS `clientFk`, @@ -11581,13 +8136,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `myTpvTransaction` +-- Temporary table structure for view `myTpvTransaction` -- DROP TABLE IF EXISTS `myTpvTransaction`; /*!50001 DROP VIEW IF EXISTS `myTpvTransaction`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `myTpvTransaction` AS SELECT 1 AS `id`, 1 AS `merchantFk`, @@ -11605,7 +8160,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `news`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `news` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(150) COLLATE utf8_unicode_ci NOT NULL, @@ -11620,7 +8175,7 @@ CREATE TABLE `news` ( KEY `tag` (`tag`), CONSTRAINT `news_ibfk_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`account` (`id`) ON UPDATE CASCADE, CONSTRAINT `news_ibfk_2` FOREIGN KEY (`tag`) REFERENCES `newsTag` (`name`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=13076 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11692,7 +8247,7 @@ DELIMITER ; DROP TABLE IF EXISTS `newsTag`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `newsTag` ( `name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, `description` varchar(25) COLLATE utf8_unicode_ci NOT NULL, @@ -11706,7 +8261,7 @@ CREATE TABLE `newsTag` ( DROP TABLE IF EXISTS `order`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `order` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `date_send` date NOT NULL DEFAULT '0000-00-00', @@ -11737,7 +8292,7 @@ CREATE TABLE `order` ( CONSTRAINT `order_ibfk_5` FOREIGN KEY (`address_id`) REFERENCES `vn`.`address` (`id`) ON UPDATE CASCADE, CONSTRAINT `order_ibfk_8` FOREIGN KEY (`delivery_method_id`) REFERENCES `vn`.`deliveryMethod` (`id`) ON UPDATE CASCADE, CONSTRAINT `order_ibfk_9` FOREIGN KEY (`agency_id`) REFERENCES `vn`.`agencyMode` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2286868 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11792,7 +8347,7 @@ DELIMITER ; DROP TABLE IF EXISTS `orderConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `orderConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, `employeeFk` int(11) NOT NULL, @@ -11814,7 +8369,7 @@ CREATE TABLE `orderConfig` ( CONSTRAINT `orderConfig_ibfk_3` FOREIGN KEY (`guestAgencyFk`) REFERENCES `vn`.`agencyMode` (`id`) ON UPDATE CASCADE, CONSTRAINT `orderConfig_ibfk_4` FOREIGN KEY (`defaultAgencyFk`) REFERENCES `vn`.`agencyMode` (`id`), CONSTRAINT `orderConfig_ibfk_5` FOREIGN KEY (`guestAddressFk`) REFERENCES `vn`.`address` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11823,7 +8378,7 @@ CREATE TABLE `orderConfig` ( DROP TABLE IF EXISTS `orderRecalc`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `orderRecalc` ( `orderFk` int(10) unsigned NOT NULL, PRIMARY KEY (`orderFk`), @@ -11837,7 +8392,7 @@ CREATE TABLE `orderRecalc` ( DROP TABLE IF EXISTS `orderRow`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `orderRow` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `orderFk` int(10) unsigned NOT NULL DEFAULT '0', @@ -11856,7 +8411,7 @@ CREATE TABLE `orderRow` ( KEY `warehouse_shipment` (`warehouseFk`,`shipment`), CONSTRAINT `orderRow_ibfk_2` FOREIGN KEY (`itemFk`) REFERENCES `vn`.`item` (`id`) ON UPDATE CASCADE, CONSTRAINT `orderRow_ibfk_3` FOREIGN KEY (`orderFk`) REFERENCES `order` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=13685290 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11958,7 +8513,7 @@ DELIMITER ; DROP TABLE IF EXISTS `orderRowComponent`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `orderRowComponent` ( `rowFk` int(10) unsigned NOT NULL, `componentFk` int(11) NOT NULL, @@ -11970,26 +8525,26 @@ CREATE TABLE `orderRowComponent` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `orderTicket` +-- Temporary table structure for view `orderTicket` -- DROP TABLE IF EXISTS `orderTicket`; /*!50001 DROP VIEW IF EXISTS `orderTicket`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `orderTicket` AS SELECT 1 AS `orderFk`, 1 AS `ticketFk`*/; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `order_component` +-- Temporary table structure for view `order_component` -- DROP TABLE IF EXISTS `order_component`; /*!50001 DROP VIEW IF EXISTS `order_component`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `order_component` AS SELECT 1 AS `order_row_id`, 1 AS `component_id`, @@ -11997,13 +8552,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `order_row` +-- Temporary table structure for view `order_row` -- DROP TABLE IF EXISTS `order_row`; /*!50001 DROP VIEW IF EXISTS `order_row`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `order_row` AS SELECT 1 AS `id`, 1 AS `order_id`, @@ -12023,7 +8578,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `restPriv`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `restPriv` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `methodPath` varchar(255) COLLATE utf8_unicode_ci NOT NULL, @@ -12031,7 +8586,7 @@ CREATE TABLE `restPriv` ( PRIMARY KEY (`id`), KEY `role` (`role`), CONSTRAINT `restPriv_ibfk_1` FOREIGN KEY (`role`) REFERENCES `account`.`role` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12040,7 +8595,7 @@ CREATE TABLE `restPriv` ( DROP TABLE IF EXISTS `shelf`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `shelf` ( `id` int(10) unsigned NOT NULL, `name` varchar(30) COLLATE utf8_unicode_ci NOT NULL, @@ -12059,7 +8614,7 @@ CREATE TABLE `shelf` ( DROP TABLE IF EXISTS `shelfConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `shelfConfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(25) COLLATE utf8_unicode_ci NOT NULL, @@ -12077,7 +8632,7 @@ CREATE TABLE `shelfConfig` ( CONSTRAINT `shelfConfig_ibfk_1` FOREIGN KEY (`family`) REFERENCES `vn`.`itemType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `shelfConfig_ibfk_2` FOREIGN KEY (`shelf`) REFERENCES `shelf` (`id`) ON UPDATE CASCADE, CONSTRAINT `shelfConfig_ibfk_3` FOREIGN KEY (`warehouse`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12086,7 +8641,7 @@ CREATE TABLE `shelfConfig` ( DROP TABLE IF EXISTS `social`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `social` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(50) COLLATE utf8_unicode_ci NOT NULL, @@ -12095,7 +8650,7 @@ CREATE TABLE `social` ( `priority` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `priority` (`priority`) -) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12104,12 +8659,12 @@ CREATE TABLE `social` ( DROP TABLE IF EXISTS `survey`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `survey` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `question` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12118,7 +8673,7 @@ CREATE TABLE `survey` ( DROP TABLE IF EXISTS `surveyAnswer`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `surveyAnswer` ( `id` int(10) unsigned NOT NULL, `surveyFk` int(10) unsigned NOT NULL, @@ -12135,7 +8690,7 @@ CREATE TABLE `surveyAnswer` ( DROP TABLE IF EXISTS `surveyVote`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `surveyVote` ( `surveyFk` int(10) unsigned NOT NULL, `userFk` int(10) unsigned NOT NULL, @@ -12152,7 +8707,7 @@ CREATE TABLE `surveyVote` ( DROP TABLE IF EXISTS `tpvConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `tpvConfig` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `currency` smallint(5) unsigned NOT NULL, @@ -12168,7 +8723,7 @@ CREATE TABLE `tpvConfig` ( PRIMARY KEY (`id`), KEY `employee_id` (`employeeFk`), CONSTRAINT `employee_id` FOREIGN KEY (`employeeFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Virtual TPV parameters'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Virtual TPV parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12177,7 +8732,7 @@ CREATE TABLE `tpvConfig` ( DROP TABLE IF EXISTS `tpvError`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `tpvError` ( `code` char(7) COLLATE utf8_unicode_ci NOT NULL, `message` varchar(255) COLLATE utf8_unicode_ci NOT NULL, @@ -12191,7 +8746,7 @@ CREATE TABLE `tpvError` ( DROP TABLE IF EXISTS `tpvImapConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `tpvImapConfig` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `host` varchar(150) COLLATE utf8_unicode_ci NOT NULL, @@ -12201,7 +8756,7 @@ CREATE TABLE `tpvImapConfig` ( `successFolder` varchar(150) CHARACTER SET utf8 DEFAULT NULL, `errorFolder` varchar(150) CHARACTER SET utf8 DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='IMAP configuration parameters for virtual TPV'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='IMAP configuration parameters for virtual TPV'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12210,7 +8765,7 @@ CREATE TABLE `tpvImapConfig` ( DROP TABLE IF EXISTS `tpvMerchant`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `tpvMerchant` ( `id` int(10) unsigned NOT NULL COMMENT 'Merchant identifier', `description` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Small description', @@ -12230,7 +8785,7 @@ CREATE TABLE `tpvMerchant` ( DROP TABLE IF EXISTS `tpvMerchantEnable`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `tpvMerchantEnable` ( `merchantFk` int(10) unsigned NOT NULL DEFAULT '0', `companyFk` smallint(6) unsigned NOT NULL, @@ -12246,7 +8801,7 @@ CREATE TABLE `tpvMerchantEnable` ( DROP TABLE IF EXISTS `tpvResponse`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `tpvResponse` ( `id` smallint(5) unsigned NOT NULL, `message` varchar(255) COLLATE utf8_unicode_ci NOT NULL, @@ -12260,7 +8815,7 @@ CREATE TABLE `tpvResponse` ( DROP TABLE IF EXISTS `tpvTransaction`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `tpvTransaction` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `merchantFk` int(10) unsigned NOT NULL, @@ -12280,7 +8835,7 @@ CREATE TABLE `tpvTransaction` ( CONSTRAINT `receipt_id` FOREIGN KEY (`receiptFk`) REFERENCES `vn`.`receipt` (`Id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `tpvTransaction_ibfk_1` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `tpvTransaction_ibfk_2` FOREIGN KEY (`merchantFk`) REFERENCES `tpvMerchant` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=379747 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Transactions realized through the virtual TPV'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Transactions realized through the virtual TPV'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12289,7 +8844,7 @@ CREATE TABLE `tpvTransaction` ( DROP TABLE IF EXISTS `userSession`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `userSession` ( `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `lastUpdate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, @@ -12308,14 +8863,14 @@ CREATE TABLE `userSession` ( DROP TABLE IF EXISTS `visit`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `visit` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `firstAgentFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `firstAgent` (`firstAgentFk`), CONSTRAINT `visit_ibfk_1` FOREIGN KEY (`firstAgentFk`) REFERENCES `visitAgent` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2035382 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12324,7 +8879,7 @@ CREATE TABLE `visit` ( DROP TABLE IF EXISTS `visitAccess`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `visitAccess` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `agentFk` int(10) unsigned NOT NULL, @@ -12335,7 +8890,7 @@ CREATE TABLE `visitAccess` ( KEY `visit_access_idx_agent` (`agentFk`), KEY `stamp` (`stamp`), CONSTRAINT `visitAccess_ibfk_1` FOREIGN KEY (`agentFk`) REFERENCES `visitAgent` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=4558610 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12344,7 +8899,7 @@ CREATE TABLE `visitAccess` ( DROP TABLE IF EXISTS `visitAgent`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `visitAgent` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `visitFk` int(10) unsigned NOT NULL, @@ -12360,7 +8915,7 @@ CREATE TABLE `visitAgent` ( KEY `firstAccess` (`firstAccessFk`), CONSTRAINT `visitAgent_ibfk_1` FOREIGN KEY (`visitFk`) REFERENCES `visit` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `visitAgent_ibfk_2` FOREIGN KEY (`firstAccessFk`) REFERENCES `visitAccess` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2687431 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12369,7 +8924,7 @@ CREATE TABLE `visitAgent` ( DROP TABLE IF EXISTS `visitUser`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `visitUser` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `accessFk` int(10) unsigned NOT NULL, @@ -12380,7 +8935,7 @@ CREATE TABLE `visitUser` ( KEY `date_time` (`stamp`), KEY `user_id` (`userFk`), CONSTRAINT `visitUser_ibfk_1` FOREIGN KEY (`accessFk`) REFERENCES `visitAccess` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3988167 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12961,30 +9516,30 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `item_listAllocation`(IN `vWh` TINYINT, IN `vDate` DATE, IN `vType` INT, IN `vPrefix` VARCHAR(255), IN `vUseIds` BOOLEAN) -BEGIN -/** - * Lists visible items and it's box sizes of the specified - * type at specified date. - * - * @param vWh The warehouse id - * @param vDate The visible date - * @param vType The type id - * @param vPrefix The article prefix to filter or %NULL for all - * @param vUseIds Whether to order the result by item id - * @select List of visible items with it's box sizes - */ - CALL item_getVisible(vWh, vDate, vType, vPrefix); - - IF vUseIds - THEN - SELECT * FROM tmp.itemVisible - ORDER BY Id_Article; - ELSE - SELECT * FROM tmp.itemVisible - ORDER BY Article, packing; - END IF; - - DROP TEMPORARY TABLE tmp.itemVisible; +BEGIN +/** + * Lists visible items and it's box sizes of the specified + * type at specified date. + * + * @param vWh The warehouse id + * @param vDate The visible date + * @param vType The type id + * @param vPrefix The article prefix to filter or %NULL for all + * @param vUseIds Whether to order the result by item id + * @select List of visible items with it's box sizes + */ + CALL item_getVisible(vWh, vDate, vType, vPrefix); + + IF vUseIds + THEN + SELECT * FROM tmp.itemVisible + ORDER BY Id_Article; + ELSE + SELECT * FROM tmp.itemVisible + ORDER BY Article, packing; + END IF; + + DROP TEMPORARY TABLE tmp.itemVisible; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -15629,7 +12184,7 @@ USE `nst`; DROP TABLE IF EXISTS `balance`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `balance` ( `id` int(11) NOT NULL AUTO_INCREMENT, `lft` int(11) NOT NULL, @@ -15647,7 +12202,7 @@ CREATE TABLE `balance` ( DROP TABLE IF EXISTS `geo`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `geo` ( `id` int(11) NOT NULL, `lft` int(11) DEFAULT NULL, @@ -15668,7 +12223,7 @@ CREATE TABLE `geo` ( DROP TABLE IF EXISTS `labourTree`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `labourTree` ( `id` int(11) NOT NULL AUTO_INCREMENT, `lft` int(11) NOT NULL, @@ -15677,7 +12232,7 @@ CREATE TABLE `labourTree` ( `sons` int(11) NOT NULL DEFAULT '0', `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=92 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -15686,7 +12241,7 @@ CREATE TABLE `labourTree` ( DROP TABLE IF EXISTS `nst`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `nst` ( `id` int(11) NOT NULL AUTO_INCREMENT, `lft` int(11) NOT NULL, @@ -15694,7 +12249,7 @@ CREATE TABLE `nst` ( PRIMARY KEY (`id`), UNIQUE KEY `lft_UNIQUE` (`lft`), UNIQUE KEY `rgt_UNIQUE` (`rgt`) -) ENGINE=InnoDB AUTO_INCREMENT=6681 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -16039,7 +12594,7 @@ USE `pbx`; DROP TABLE IF EXISTS `blacklist`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `blacklist` ( `phone` varchar(20) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`phone`) @@ -16092,7 +12647,7 @@ DELIMITER ; DROP TABLE IF EXISTS `cdr`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `cdr` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `call_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -16118,17 +12673,17 @@ CREATE TABLE `cdr` ( KEY `dstchannel` (`dst_channel`), KEY `disposition` (`disposition`), KEY `src` (`src`) -) ENGINE=InnoDB AUTO_INCREMENT=321003 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `cdrConf` +-- Temporary table structure for view `cdrConf` -- DROP TABLE IF EXISTS `cdrConf`; /*!50001 DROP VIEW IF EXISTS `cdrConf`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `cdrConf` AS SELECT 1 AS `calldate`, 1 AS `clid`, @@ -16154,13 +12709,13 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `config`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `config` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `sundayFestive` tinyint(4) NOT NULL, `countryPrefix` varchar(20) CHARACTER SET utf8 DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -16169,7 +12724,7 @@ CREATE TABLE `config` ( DROP TABLE IF EXISTS `followme`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `followme` ( `extension` varchar(128) CHARACTER SET utf8 NOT NULL, `phone` varchar(20) CHARACTER SET utf8 NOT NULL, @@ -16219,13 +12774,13 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Temporary view structure for view `followmeConf` +-- Temporary table structure for view `followmeConf` -- DROP TABLE IF EXISTS `followmeConf`; /*!50001 DROP VIEW IF EXISTS `followmeConf`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `followmeConf` AS SELECT 1 AS `name`, 1 AS `music`, @@ -16240,7 +12795,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `followmeConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `followmeConfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `music` varchar(50) CHARACTER SET utf8 DEFAULT NULL, @@ -16249,17 +12804,17 @@ CREATE TABLE `followmeConfig` ( `declineCall` char(1) CHARACTER SET utf8 NOT NULL, `timeout` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `followmeNumberConf` +-- Temporary table structure for view `followmeNumberConf` -- DROP TABLE IF EXISTS `followmeNumberConf`; /*!50001 DROP VIEW IF EXISTS `followmeNumberConf`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `followmeNumberConf` AS SELECT 1 AS `name`, 1 AS `ordinal`, @@ -16273,7 +12828,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `queue`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `queue` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `description` varchar(128) CHARACTER SET utf8 NOT NULL, @@ -16284,7 +12839,7 @@ CREATE TABLE `queue` ( UNIQUE KEY `description` (`description`), KEY `config` (`config`), CONSTRAINT `queue_ibfk_1` FOREIGN KEY (`config`) REFERENCES `queueConfig` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Queues'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Queues'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -16328,13 +12883,13 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Temporary view structure for view `queueConf` +-- Temporary table structure for view `queueConf` -- DROP TABLE IF EXISTS `queueConf`; /*!50001 DROP VIEW IF EXISTS `queueConf`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `queueConf` AS SELECT 1 AS `name`, 1 AS `strategy`, @@ -16351,7 +12906,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `queueConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `queueConfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `strategy` varchar(128) CHARACTER SET utf8 NOT NULL, @@ -16361,7 +12916,7 @@ CREATE TABLE `queueConfig` ( `maxLen` int(10) unsigned NOT NULL, `ringInUse` tinyint(4) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Default values for queues configuration'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Default values for queues configuration'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -16370,7 +12925,7 @@ CREATE TABLE `queueConfig` ( DROP TABLE IF EXISTS `queueMember`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `queueMember` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `queue` varchar(128) CHARACTER SET utf8 NOT NULL, @@ -16380,17 +12935,17 @@ CREATE TABLE `queueMember` ( KEY `extension` (`extension`), CONSTRAINT `queueMember_ibfk_1` FOREIGN KEY (`queue`) REFERENCES `queue` (`name`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `queueMember_ibfk_2` FOREIGN KEY (`extension`) REFERENCES `sip` (`extension`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=792 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Queue members'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Queue members'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `queueMemberConf` +-- Temporary table structure for view `queueMemberConf` -- DROP TABLE IF EXISTS `queueMemberConf`; /*!50001 DROP VIEW IF EXISTS `queueMemberConf`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `queueMemberConf` AS SELECT 1 AS `uniqueid`, 1 AS `queue_name`, @@ -16404,7 +12959,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `queuePhone`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `queuePhone` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `queue` varchar(128) CHARACTER SET utf8 NOT NULL, @@ -16412,7 +12967,7 @@ CREATE TABLE `queuePhone` ( PRIMARY KEY (`id`), UNIQUE KEY `queue` (`queue`,`phone`), CONSTRAINT `queuePhone_ibfk_1` FOREIGN KEY (`queue`) REFERENCES `queue` (`name`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1003 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -16461,7 +13016,7 @@ DELIMITER ; DROP TABLE IF EXISTS `schedule`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `schedule` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `weekDay` tinyint(3) unsigned NOT NULL COMMENT '0 = Monday, 6 = Sunday', @@ -16471,7 +13026,7 @@ CREATE TABLE `schedule` ( PRIMARY KEY (`id`), KEY `queue` (`queue`), CONSTRAINT `schedule_ibfk_1` FOREIGN KEY (`queue`) REFERENCES `queue` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -16480,7 +13035,7 @@ CREATE TABLE `schedule` ( DROP TABLE IF EXISTS `sip`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `sip` ( `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'The user id', `extension` varchar(128) CHARACTER SET utf8 NOT NULL COMMENT 'The softphone extension', @@ -16583,13 +13138,13 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Temporary view structure for view `sipConf` +-- Temporary table structure for view `sipConf` -- DROP TABLE IF EXISTS `sipConf`; /*!50001 DROP VIEW IF EXISTS `sipConf`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `sipConf` AS SELECT 1 AS `id`, 1 AS `name`, @@ -16622,7 +13177,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `sipConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `sipConfig` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `host` varchar(40) CHARACTER SET utf8 DEFAULT NULL, @@ -16644,7 +13199,7 @@ CREATE TABLE `sipConfig` ( `dtlsprivatekey` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `dtlssetup` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Default values for SIP accounts'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Default values for SIP accounts'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -16653,7 +13208,7 @@ CREATE TABLE `sipConfig` ( DROP TABLE IF EXISTS `sipReg`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `sipReg` ( `userId` int(10) unsigned NOT NULL, `ipAddr` varchar(45) CHARACTER SET utf8 DEFAULT NULL, @@ -16890,7 +13445,7 @@ USE `postgresql`; DROP TABLE IF EXISTS `address`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `address` ( `address_id` int(11) NOT NULL AUTO_INCREMENT, `town_id` int(11) NOT NULL, @@ -16904,7 +13459,7 @@ CREATE TABLE `address` ( KEY `address_town_id_idx` (`town_id`), CONSTRAINT `address_ibfk_1` FOREIGN KEY (`address_type_id`) REFERENCES `address_type` (`address_type_id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `address_ibfk_2` FOREIGN KEY (`town_id`) REFERENCES `townKk` (`town_id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=846 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -16913,12 +13468,12 @@ CREATE TABLE `address` ( DROP TABLE IF EXISTS `address_type`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `address_type` ( `address_type_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(20) NOT NULL, PRIMARY KEY (`address_type_id`) -) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -16927,7 +13482,7 @@ CREATE TABLE `address_type` ( DROP TABLE IF EXISTS `bank_account`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `bank_account` ( `bank_account_id` int(11) NOT NULL AUTO_INCREMENT, `client_id` int(11) DEFAULT NULL, @@ -16950,7 +13505,7 @@ CREATE TABLE `bank_account` ( CONSTRAINT `bank_account_bank_account_type_id_fkey` FOREIGN KEY (`bank_account_type_id`) REFERENCES `bank_account_type` (`bank_account_type_id`) ON UPDATE CASCADE, CONSTRAINT `bank_account_nation_id_fkey` FOREIGN KEY (`nation_id`) REFERENCES `nation` (`nation_id`) ON UPDATE CASCADE, CONSTRAINT `bank_profile` FOREIGN KEY (`client_id`) REFERENCES `profile` (`profile_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=937 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -16959,12 +13514,12 @@ CREATE TABLE `bank_account` ( DROP TABLE IF EXISTS `bank_account_type`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `bank_account_type` ( `bank_account_type_id` int(11) NOT NULL AUTO_INCREMENT, `name` char(15) DEFAULT NULL, PRIMARY KEY (`bank_account_type_id`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -16973,7 +13528,7 @@ CREATE TABLE `bank_account_type` ( DROP TABLE IF EXISTS `bank_bic`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `bank_bic` ( `nrbe` int(11) NOT NULL, `denominacion` varchar(255) DEFAULT NULL, @@ -16991,7 +13546,7 @@ CREATE TABLE `bank_bic` ( DROP TABLE IF EXISTS `business`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `business` ( `business_id` int(11) NOT NULL AUTO_INCREMENT, `client_id` int(11) DEFAULT NULL, @@ -17005,7 +13560,7 @@ CREATE TABLE `business` ( KEY `bussiness_provider` (`provider_id`), CONSTRAINT `business_client` FOREIGN KEY (`client_id`) REFERENCES `profile` (`profile_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `bussiness_provider` FOREIGN KEY (`provider_id`) REFERENCES `profile` (`profile_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3059 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17014,7 +13569,7 @@ CREATE TABLE `business` ( DROP TABLE IF EXISTS `business_labour`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `business_labour` ( `business_id` int(11) NOT NULL, `notes` longtext, @@ -17044,7 +13599,7 @@ CREATE TABLE `business_labour` ( DROP TABLE IF EXISTS `business_labour_payroll`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `business_labour_payroll` ( `business_id` int(11) NOT NULL, `cod_tarifa` int(11) DEFAULT NULL, @@ -17062,7 +13617,7 @@ CREATE TABLE `business_labour_payroll` ( DROP TABLE IF EXISTS `calendar_employee`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `calendar_employee` ( `business_id` int(11) NOT NULL, `calendar_state_id` int(11) NOT NULL, @@ -17080,13 +13635,13 @@ CREATE TABLE `calendar_employee` ( DROP TABLE IF EXISTS `calendar_free`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `calendar_free` ( `calendar_free_id` int(11) NOT NULL AUTO_INCREMENT, `type` varchar(20) NOT NULL, `rgb` varchar(7) DEFAULT NULL, PRIMARY KEY (`calendar_free_id`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17095,7 +13650,7 @@ CREATE TABLE `calendar_free` ( DROP TABLE IF EXISTS `calendar_labour`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `calendar_labour` ( `calendar_free_id` int(11) NOT NULL, `person_id` int(11) NOT NULL, @@ -17112,7 +13667,7 @@ CREATE TABLE `calendar_labour` ( CONSTRAINT `fk_calendar_labour_calendar_free1` FOREIGN KEY (`calendar_free_id`) REFERENCES `calendar_free` (`calendar_free_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_calendar_labour_legend_id` FOREIGN KEY (`calendar_labour_legend_id`) REFERENCES `calendar_labour_legend` (`calendar_labour_legend_id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `workcenter_calendar` FOREIGN KEY (`workcenter_id`) REFERENCES `workcenter` (`workcenter_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=586 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17121,13 +13676,13 @@ CREATE TABLE `calendar_labour` ( DROP TABLE IF EXISTS `calendar_labour_legend`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `calendar_labour_legend` ( `calendar_labour_legend_id` int(11) NOT NULL AUTO_INCREMENT, `descripcion` longtext, PRIMARY KEY (`calendar_labour_legend_id`), UNIQUE KEY `calendar_labour_legend_calendar_labour_legend_id_key` (`calendar_labour_legend_id`) -) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17136,7 +13691,7 @@ CREATE TABLE `calendar_labour_legend` ( DROP TABLE IF EXISTS `calendar_labour_type`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `calendar_labour_type` ( `calendar_labour_type_id` int(11) NOT NULL AUTO_INCREMENT, `descripcion` varchar(50) DEFAULT NULL, @@ -17145,7 +13700,7 @@ CREATE TABLE `calendar_labour_type` ( `isPartial` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`calendar_labour_type_id`), UNIQUE KEY `hours_labour_hours_labour_id_key` (`calendar_labour_type_id`) -) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17154,7 +13709,7 @@ CREATE TABLE `calendar_labour_type` ( DROP TABLE IF EXISTS `calendar_state`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `calendar_state` ( `calendar_state_id` int(11) NOT NULL AUTO_INCREMENT, `type` varchar(30) NOT NULL, @@ -17164,7 +13719,7 @@ CREATE TABLE `calendar_state` ( `code` varchar(45) DEFAULT NULL, `isAllowedToWork` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`calendar_state_id`) -) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17173,12 +13728,12 @@ CREATE TABLE `calendar_state` ( DROP TABLE IF EXISTS `currency`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `currency` ( `currency_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(15) NOT NULL, PRIMARY KEY (`currency_id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17187,7 +13742,7 @@ CREATE TABLE `currency` ( DROP TABLE IF EXISTS `income_employee`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `income_employee` ( `id` int(11) NOT NULL AUTO_INCREMENT, `debe` decimal(10,2) DEFAULT NULL, @@ -17201,7 +13756,7 @@ CREATE TABLE `income_employee` ( KEY `fperson_id` (`person_id`), CONSTRAINT `fincometype_id` FOREIGN KEY (`id_incomeType`) REFERENCES `incometype_employee` (`id_incometype`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fperson_id` FOREIGN KEY (`person_id`) REFERENCES `person` (`person_id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=76272 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17210,7 +13765,7 @@ CREATE TABLE `income_employee` ( DROP TABLE IF EXISTS `incometype_employee`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `incometype_employee` ( `id_incometype` int(11) NOT NULL, `descripcion` varchar(255) DEFAULT NULL, @@ -17225,7 +13780,7 @@ CREATE TABLE `incometype_employee` ( DROP TABLE IF EXISTS `journey`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `journey` ( `journey_id` int(11) NOT NULL AUTO_INCREMENT, `day_id` smallint(6) NOT NULL DEFAULT '1' COMMENT 'Lunes = 1 \nDomingo = 7', @@ -17235,7 +13790,7 @@ CREATE TABLE `journey` ( PRIMARY KEY (`journey_id`), KEY `fki_business_journey` (`business_id`), CONSTRAINT `business_journey` FOREIGN KEY (`business_id`) REFERENCES `business_labour` (`business_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2716 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17244,7 +13799,7 @@ CREATE TABLE `journey` ( DROP TABLE IF EXISTS `labour_agreement`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `labour_agreement` ( `labour_agreement_id` int(11) NOT NULL AUTO_INCREMENT, `month_hollidays` double DEFAULT NULL, @@ -17253,7 +13808,7 @@ CREATE TABLE `labour_agreement` ( `date_START` date DEFAULT NULL, `date_END` date DEFAULT NULL, PRIMARY KEY (`labour_agreement_id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17262,7 +13817,7 @@ CREATE TABLE `labour_agreement` ( DROP TABLE IF EXISTS `media`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `media` ( `media_id` int(11) NOT NULL AUTO_INCREMENT, `media_type_id` int(11) NOT NULL, @@ -17271,7 +13826,7 @@ CREATE TABLE `media` ( PRIMARY KEY (`media_id`), KEY `media_media_type_id_idx` (`media_type_id`), CONSTRAINT `media_ibfk_1` FOREIGN KEY (`media_type_id`) REFERENCES `media_type` (`media_type_id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1171 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17280,13 +13835,13 @@ CREATE TABLE `media` ( DROP TABLE IF EXISTS `media_type`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `media_type` ( `media_type_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(15) NOT NULL, PRIMARY KEY (`media_type_id`), UNIQUE KEY `media_type_name_key` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17295,7 +13850,7 @@ CREATE TABLE `media_type` ( DROP TABLE IF EXISTS `nation`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `nation` ( `nation_id` int(11) NOT NULL AUTO_INCREMENT, `currency_id` int(11) NOT NULL DEFAULT '1', @@ -17306,7 +13861,7 @@ CREATE TABLE `nation` ( UNIQUE KEY `nation_name_key` (`name`), KEY `nation_currency_id_idx` (`currency_id`), CONSTRAINT `nation_ibfk_1` FOREIGN KEY (`currency_id`) REFERENCES `currency` (`currency_id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17315,7 +13870,7 @@ CREATE TABLE `nation` ( DROP TABLE IF EXISTS `periodos`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `periodos` ( `fecha` date NOT NULL, `periodo` int(11) DEFAULT NULL, @@ -17329,7 +13884,7 @@ CREATE TABLE `periodos` ( DROP TABLE IF EXISTS `person`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `person` ( `person_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(60) NOT NULL, @@ -17352,7 +13907,7 @@ CREATE TABLE `person` ( KEY `index1` (`person_id`,`name`,`nickname`,`firstname`), KEY `person_worker` (`id_trabajador`), CONSTRAINT `Person_ibfk_1` FOREIGN KEY (`id_trabajador`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1166 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17361,7 +13916,7 @@ CREATE TABLE `person` ( DROP TABLE IF EXISTS `professional_category`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `professional_category` ( `professional_category_id` int(11) NOT NULL AUTO_INCREMENT, `category_name` varchar(50) NOT NULL, @@ -17370,7 +13925,7 @@ CREATE TABLE `professional_category` ( `holiday_days` decimal(3,1) DEFAULT NULL, PRIMARY KEY (`professional_category_id`), UNIQUE KEY `professional_category_name_category_key` (`category_name`) -) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17379,13 +13934,13 @@ CREATE TABLE `professional_category` ( DROP TABLE IF EXISTS `professional_levels`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `professional_levels` ( `professional_levels_id` int(11) NOT NULL AUTO_INCREMENT, `level_name` varchar(5) DEFAULT NULL, `price_overtime` double DEFAULT NULL, PRIMARY KEY (`professional_levels_id`) -) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17394,7 +13949,7 @@ CREATE TABLE `professional_levels` ( DROP TABLE IF EXISTS `profile`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `profile` ( `profile_id` int(11) NOT NULL AUTO_INCREMENT, `person_id` int(11) NOT NULL, @@ -17403,7 +13958,7 @@ CREATE TABLE `profile` ( KEY `profile_person_id_idx` (`person_id`), KEY `profile_profile_type_id_idx` (`profile_type_id`), CONSTRAINT `person_fk` FOREIGN KEY (`person_id`) REFERENCES `person` (`person_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1050 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17412,7 +13967,7 @@ CREATE TABLE `profile` ( DROP TABLE IF EXISTS `profile_address`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `profile_address` ( `profile_address_id` int(11) NOT NULL AUTO_INCREMENT, `profile_id` int(11) NOT NULL, @@ -17420,7 +13975,7 @@ CREATE TABLE `profile_address` ( PRIMARY KEY (`profile_address_id`), KEY `profile_address_address_id_idx` (`address_id`), KEY `profile_address_profile_id_idx` (`profile_id`) -) ENGINE=InnoDB AUTO_INCREMENT=182 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17429,7 +13984,7 @@ CREATE TABLE `profile_address` ( DROP TABLE IF EXISTS `profile_media`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `profile_media` ( `profile_media_id` int(11) NOT NULL AUTO_INCREMENT, `profile_id` int(11) NOT NULL, @@ -17439,7 +13994,7 @@ CREATE TABLE `profile_media` ( KEY `profile_media_profile_id_idx` (`profile_id`), CONSTRAINT `fk_profile_media_media1` FOREIGN KEY (`media_id`) REFERENCES `media` (`media_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `media_ibfk_20` FOREIGN KEY (`profile_id`) REFERENCES `profile` (`profile_id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1332 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17448,12 +14003,12 @@ CREATE TABLE `profile_media` ( DROP TABLE IF EXISTS `profile_type`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `profile_type` ( `profile_type_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(15) NOT NULL, PRIMARY KEY (`profile_type_id`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17462,7 +14017,7 @@ CREATE TABLE `profile_type` ( DROP TABLE IF EXISTS `province`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `province` ( `province_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(15) NOT NULL, @@ -17471,7 +14026,7 @@ CREATE TABLE `province` ( UNIQUE KEY `province_name_key` (`name`), KEY `province_nation_id_idx` (`nation_id`), CONSTRAINT `fk_province_nation1` FOREIGN KEY (`nation_id`) REFERENCES `nation` (`nation_id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=162 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17480,7 +14035,7 @@ CREATE TABLE `province` ( DROP TABLE IF EXISTS `townKk`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `townKk` ( `town_id` int(11) NOT NULL AUTO_INCREMENT, `province_id` int(11) NOT NULL, @@ -17489,7 +14044,7 @@ CREATE TABLE `townKk` ( PRIMARY KEY (`town_id`), KEY `town_province_id_idx` (`province_id`), CONSTRAINT `townKk_ibfk_1` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3673 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17498,7 +14053,7 @@ CREATE TABLE `townKk` ( DROP TABLE IF EXISTS `workcenter`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workcenter` ( `workcenter_id` int(11) NOT NULL AUTO_INCREMENT, `name` longtext, @@ -17506,7 +14061,7 @@ CREATE TABLE `workcenter` ( `counter` bigint(20) DEFAULT NULL, `warehouseFk` smallint(6) DEFAULT NULL, PRIMARY KEY (`workcenter_id`) -) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17515,7 +14070,7 @@ CREATE TABLE `workcenter` ( DROP TABLE IF EXISTS `workerTimeControlConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerTimeControlConfig` ( `id` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `warehouseFk` smallint(6) unsigned NOT NULL, @@ -17531,7 +14086,7 @@ CREATE TABLE `workerTimeControlConfig` ( DROP TABLE IF EXISTS `workers20190711_FichadasAbril`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workers20190711_FichadasAbril` ( `id` int(11) NOT NULL AUTO_INCREMENT, `person_id` int(11) NOT NULL DEFAULT '0', @@ -17569,7 +14124,7 @@ USE `salix`; DROP TABLE IF EXISTS `ACL`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ACL` ( `id` int(11) NOT NULL AUTO_INCREMENT, `model` varchar(512) CHARACTER SET utf8 DEFAULT NULL, @@ -17579,7 +14134,7 @@ CREATE TABLE `ACL` ( `principalType` set('ROLE','USER') COLLATE utf8_unicode_ci DEFAULT 'ROLE', `principalId` varchar(512) CHARACTER SET utf8 DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=202 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17588,7 +14143,7 @@ CREATE TABLE `ACL` ( DROP TABLE IF EXISTS `AccessToken`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `AccessToken` ( `id` varchar(255) CHARACTER SET utf8 NOT NULL, `ttl` int(11) DEFAULT NULL, @@ -17600,13 +14155,13 @@ CREATE TABLE `AccessToken` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `Account` +-- Temporary table structure for view `Account` -- DROP TABLE IF EXISTS `Account`; /*!50001 DROP VIEW IF EXISTS `Account`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `Account` AS SELECT 1 AS `id`, 1 AS `name`, @@ -17619,13 +14174,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `Role` +-- Temporary table structure for view `Role` -- DROP TABLE IF EXISTS `Role`; /*!50001 DROP VIEW IF EXISTS `Role`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `Role` AS SELECT 1 AS `id`, 1 AS `name`, @@ -17635,13 +14190,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `RoleMapping` +-- Temporary table structure for view `RoleMapping` -- DROP TABLE IF EXISTS `RoleMapping`; /*!50001 DROP VIEW IF EXISTS `RoleMapping`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `RoleMapping` AS SELECT 1 AS `id`, 1 AS `principalType`, @@ -17655,7 +14210,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `fieldAcl`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `fieldAcl` ( `id` int(11) NOT NULL AUTO_INCREMENT, `model` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -17663,7 +14218,7 @@ CREATE TABLE `fieldAcl` ( `actionType` set('insert','update','*') COLLATE utf8_unicode_ci DEFAULT '*', `role` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=65 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17672,7 +14227,7 @@ CREATE TABLE `fieldAcl` ( DROP TABLE IF EXISTS `user`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `realm` varchar(512) CHARACTER SET utf8 DEFAULT NULL, @@ -17682,7 +14237,7 @@ CREATE TABLE `user` ( `emailVerified` tinyint(1) DEFAULT NULL, `verificationToken` varchar(512) CHARACTER SET utf8 DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=50054 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17691,7 +14246,7 @@ CREATE TABLE `user` ( DROP TABLE IF EXISTS `userConfigView`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `userConfigView` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userFk` int(10) unsigned NOT NULL, @@ -17699,7 +14254,7 @@ CREATE TABLE `userConfigView` ( `configuration` text COLLATE utf8_unicode_ci, PRIMARY KEY (`id`), UNIQUE KEY `uniqueUser_TableCode` (`userFk`,`tableCode`) -) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17779,7 +14334,7 @@ USE `stock`; DROP TABLE IF EXISTS `inbound`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `inbound` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `tableName` set('buy','sale') NOT NULL, @@ -17868,7 +14423,7 @@ DELIMITER ; DROP TABLE IF EXISTS `inboundPick`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `inboundPick` ( `inboundFk` int(10) unsigned DEFAULT NULL, `outboundFk` int(10) unsigned DEFAULT NULL, @@ -17884,7 +14439,7 @@ CREATE TABLE `inboundPick` ( DROP TABLE IF EXISTS `log`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `log` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `operation` set('insert','delete') NOT NULL, @@ -17901,7 +14456,7 @@ CREATE TABLE `log` ( DROP TABLE IF EXISTS `outbound`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `outbound` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `tableName` set('sale','buy','orderRow') NOT NULL, @@ -17993,7 +14548,7 @@ DELIMITER ; DROP TABLE IF EXISTS `visible`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `visible` ( `itemFk` int(10) unsigned NOT NULL, `warehouseFk` int(10) unsigned NOT NULL, @@ -18292,23 +14847,23 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `log_add`(IN `vTableName` VARCHAR(255), IN `vNewId` VARCHAR(255), IN `vOldId` VARCHAR(255)) -proc: BEGIN - -- XXX: Disabled while testing - LEAVE proc; - - IF vOldId IS NOT NULL AND !(vOldId <=> vNewId) THEN - INSERT IGNORE INTO `log` SET - tableName = vTableName, - tableId = vOldId, - operation = 'delete'; - END IF; - - IF vNewId IS NOT NULL THEN - INSERT IGNORE INTO `log` SET - tableName = vTableName, - tableId = vNewId, - operation = 'insert'; - END IF; +proc: BEGIN + -- XXX: Disabled while testing + LEAVE proc; + + IF vOldId IS NOT NULL AND !(vOldId <=> vNewId) THEN + INSERT IGNORE INTO `log` SET + tableName = vTableName, + tableId = vOldId, + operation = 'delete'; + END IF; + + IF vNewId IS NOT NULL THEN + INSERT IGNORE INTO `log` SET + tableName = vTableName, + tableId = vNewId, + operation = 'insert'; + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -18576,29 +15131,29 @@ CREATE DEFINER=`root`@`%` PROCEDURE `log_refreshSale`( BEGIN DROP TEMPORARY TABLE IF EXISTS tValues; CREATE TEMPORARY TABLE tValues - ENGINE = MEMORY - SELECT - m.id saleFk, - m.ticketFk, - m.itemFk, - t.warehouseFk, - t.shipped, + ENGINE = MEMORY + SELECT + m.id saleFk, + m.ticketFk, + m.itemFk, + t.warehouseFk, + t.shipped, ABS(m.quantity) quantity, m.created, TIMESTAMPADD(DAY, tp.life, t.shipped) expired, m.quantity < 0 isIn, - m.isPicked OR s.alertLevel > 1 isPicked - FROM vn.sale m - JOIN vn.ticket t ON t.id = m.ticketFk + m.isPicked OR s.alertLevel > 1 isPicked + FROM vn.sale m + JOIN vn.ticket t ON t.id = m.ticketFk JOIN vn.ticketState s ON s.ticketFk = t.id JOIN vn.item i ON i.id = m.itemFk - JOIN vn.itemType tp ON tp.id = i.typeFk + JOIN vn.itemType tp ON tp.id = i.typeFk WHERE ( - vTableId IS NULL - OR (vTableName = 'ticket' AND t.id = vTableId) - OR (vTableName = 'sale' AND m.id = vTableId) - ) - AND t.shipped >= vn.getInventoryDate() + vTableId IS NULL + OR (vTableName = 'ticket' AND t.id = vTableId) + OR (vTableName = 'sale' AND m.id = vTableId) + ) + AND t.shipped >= vn.getInventoryDate() AND m.quantity != 0; REPLACE INTO inbound ( @@ -18631,7 +15186,7 @@ BEGIN FROM tValues WHERE !isIn; - DROP TEMPORARY TABLE tValues; + DROP TEMPORARY TABLE tValues; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -19018,7 +15573,7 @@ USE `util`; DROP TABLE IF EXISTS `config`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `config` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `dbVersion` char(11) CHARACTER SET utf8 DEFAULT NULL COMMENT 'The current database version', @@ -19026,7 +15581,7 @@ CREATE TABLE `config` ( `environment` varchar(45) CHARACTER SET utf8 DEFAULT NULL COMMENT 'The current Database environment', `lastDump` datetime DEFAULT NULL COMMENT 'Timestamp of the last data dump', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration table'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration table'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19035,7 +15590,7 @@ CREATE TABLE `config` ( DROP TABLE IF EXISTS `debug`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `debug` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, @@ -19045,7 +15600,7 @@ CREATE TABLE `debug` ( `variable` varchar(255) CHARACTER SET utf8 DEFAULT NULL, `value` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=546 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Log de depuración'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Log de depuración'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19930,7 +16485,7 @@ USE `vn`; DROP TABLE IF EXISTS `XDiario`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `XDiario` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ASIEN` double DEFAULT NULL, @@ -20002,7 +16557,7 @@ CREATE TABLE `XDiario` ( PRIMARY KEY (`id`), KEY `empresa_id` (`empresa_id`), CONSTRAINT `XDiario_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=4095537 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20051,13 +16606,13 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Temporary view structure for view `absenceType` +-- Temporary table structure for view `absenceType` -- DROP TABLE IF EXISTS `absenceType`; /*!50001 DROP VIEW IF EXISTS `absenceType`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `absenceType` AS SELECT 1 AS `id`, 1 AS `name`, @@ -20071,7 +16626,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `accountingType`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `accountingType` ( `id` smallint(6) NOT NULL DEFAULT '0', `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, @@ -20085,7 +16640,7 @@ CREATE TABLE `accountingType` ( DROP TABLE IF EXISTS `activeContrat`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `activeContrat` ( `date` date NOT NULL, `business_id` int(11) NOT NULL, @@ -20099,7 +16654,7 @@ CREATE TABLE `activeContrat` ( DROP TABLE IF EXISTS `activityTaxDismissed`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `activityTaxDismissed` ( `clientFk` int(11) NOT NULL, `isNotified` tinyint(1) DEFAULT '0', @@ -20116,7 +16671,7 @@ CREATE TABLE `activityTaxDismissed` ( DROP TABLE IF EXISTS `address`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `address` ( `id` int(11) NOT NULL AUTO_INCREMENT, `clientFk` int(11) NOT NULL DEFAULT '0', @@ -20151,7 +16706,7 @@ CREATE TABLE `address` ( CONSTRAINT `address_ibfk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `address_ibfk_3` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON UPDATE CASCADE, CONSTRAINT `address_ibfk_4` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=29842 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20245,7 +16800,7 @@ DELIMITER ; DROP TABLE IF EXISTS `addressForPackaging`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `addressForPackaging` ( `addressFk` int(11) NOT NULL, `packagingValue` decimal(10,2) NOT NULL DEFAULT '0.04', @@ -20260,7 +16815,7 @@ CREATE TABLE `addressForPackaging` ( DROP TABLE IF EXISTS `addressObservation`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `addressObservation` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `addressFk` int(11) NOT NULL, @@ -20271,7 +16826,7 @@ CREATE TABLE `addressObservation` ( KEY `addressObservationFgn_idx` (`observationTypeFk`), CONSTRAINT `addressFgn` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `addressObservationFgn` FOREIGN KEY (`observationTypeFk`) REFERENCES `observationType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=4245 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de los consignatarios'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de los consignatarios'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -20280,7 +16835,7 @@ CREATE TABLE `addressObservation` ( DROP TABLE IF EXISTS `agency`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `agency` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(25) COLLATE utf8_unicode_ci NOT NULL, @@ -20302,7 +16857,7 @@ CREATE TABLE `agency` ( CONSTRAINT `agency_ibfk_2` FOREIGN KEY (`bankFk`) REFERENCES `bank` (`id`) ON UPDATE CASCADE, CONSTRAINT `agency_ibfk_3` FOREIGN KEY (`workCenterFk`) REFERENCES `workCenter` (`id`) ON UPDATE CASCADE, CONSTRAINT `agency_ibfk_4` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=287 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20329,7 +16884,7 @@ DELIMITER ; DROP TABLE IF EXISTS `agencyMode`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `agencyMode` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -20351,16 +16906,32 @@ CREATE TABLE `agencyMode` ( PRIMARY KEY (`id`), KEY `Agencias` (`name`), KEY `Vista` (`deliveryMethodFk`) -) ENGINE=InnoDB AUTO_INCREMENT=1243 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Temporary table structure for view `agencyProvince__` +-- + +DROP TABLE IF EXISTS `agencyProvince__`; +/*!50001 DROP VIEW IF EXISTS `agencyProvince__`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `agencyProvince__` AS SELECT + 1 AS `provinceFk`, + 1 AS `agencyFk`, + 1 AS `zone`, + 1 AS `warehouseFk`, + 1 AS `isVolumetric`*/; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `alertLevel` -- DROP TABLE IF EXISTS `alertLevel`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `alertLevel` ( `code` varchar(45) CHARACTER SET utf8 NOT NULL, `alertLevel` int(11) NOT NULL, @@ -20370,13 +16941,13 @@ CREATE TABLE `alertLevel` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `annualAverageInvoiced` +-- Temporary table structure for view `annualAverageInvoiced` -- DROP TABLE IF EXISTS `annualAverageInvoiced`; /*!50001 DROP VIEW IF EXISTS `annualAverageInvoiced`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `annualAverageInvoiced` AS SELECT 1 AS `clientFk`, 1 AS `invoiced`*/; @@ -20388,7 +16959,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `assignedTicketToWorker`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `assignedTicketToWorker` ( `id` int(11) NOT NULL AUTO_INCREMENT, `idWorker` int(11) DEFAULT NULL, @@ -20396,7 +16967,7 @@ CREATE TABLE `assignedTicketToWorker` ( PRIMARY KEY (`id`), UNIQUE KEY `idWorker_UNIQUE` (`idWorker`), UNIQUE KEY `idTicket_UNIQUE` (`idTicket`) -) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla para relacionar un ticket con el sacador del altillo '; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla para relacionar un ticket con el sacador del altillo '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -20405,7 +16976,7 @@ CREATE TABLE `assignedTicketToWorker` ( DROP TABLE IF EXISTS `autoRadioConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `autoRadioConfig` ( `id` int(11) NOT NULL, `password` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -20425,7 +16996,7 @@ CREATE TABLE `autoRadioConfig` ( DROP TABLE IF EXISTS `autoRadioLogCall`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `autoRadioLogCall` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ticketFk` int(11) NOT NULL, @@ -20434,7 +17005,7 @@ CREATE TABLE `autoRadioLogCall` ( PRIMARY KEY (`id`), KEY `ticket_idx` (`ticketFk`), CONSTRAINT `ticket` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=1896 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -20443,7 +17014,7 @@ CREATE TABLE `autoRadioLogCall` ( DROP TABLE IF EXISTS `autonomousRegion`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `autonomousRegion` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) CHARACTER SET utf8 NOT NULL, @@ -20452,7 +17023,7 @@ CREATE TABLE `autonomousRegion` ( PRIMARY KEY (`id`), KEY `countryFk` (`countryFk`), CONSTRAINT `countryFk` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -20461,7 +17032,7 @@ CREATE TABLE `autonomousRegion` ( DROP TABLE IF EXISTS `bank`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `bank` ( `id` int(11) NOT NULL DEFAULT '0', `bank` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -20488,7 +17059,7 @@ CREATE TABLE `bank` ( DROP TABLE IF EXISTS `bankEntity`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `bankEntity` ( `countryFk` mediumint(8) unsigned NOT NULL DEFAULT '1', `id` int(10) unsigned NOT NULL AUTO_INCREMENT, @@ -20498,7 +17069,7 @@ CREATE TABLE `bankEntity` ( UNIQUE KEY `bic_UNIQUE` (`bic`), KEY `fg_entity1_idx` (`countryFk`), CONSTRAINT `fg_entity1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=30055 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Entidades bancarias '; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Entidades bancarias '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -20507,7 +17078,7 @@ CREATE TABLE `bankEntity` ( DROP TABLE IF EXISTS `bionicConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `bionicConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, `generalInflationCoeficient` double(10,2) NOT NULL, @@ -20515,7 +17086,7 @@ CREATE TABLE `bionicConfig` ( `verdnaturaVolumeBox` int(11) NOT NULL, `itemCarryBox` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -20524,7 +17095,7 @@ CREATE TABLE `bionicConfig` ( DROP TABLE IF EXISTS `bookingPlanner`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `bookingPlanner` ( `id` int(10) NOT NULL AUTO_INCREMENT, `effectived` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -20542,7 +17113,7 @@ CREATE TABLE `bookingPlanner` ( CONSTRAINT `bookingPlanner_ibfk_1` FOREIGN KEY (`pgcFk`) REFERENCES `pgc` (`code`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `bookingPlanner_ibfk_2` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `bookingPlanner_ibfk_3` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON DELETE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=86 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -20551,7 +17122,7 @@ CREATE TABLE `bookingPlanner` ( DROP TABLE IF EXISTS `botanicExport`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `botanicExport` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `ediGenusFk` mediumint(8) unsigned NOT NULL, @@ -20563,7 +17134,7 @@ CREATE TABLE `botanicExport` ( PRIMARY KEY (`id`), KEY `Id_Paises` (`countryFk`), CONSTRAINT `botanicExport_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=340 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Especifica los generos y especies prohibidos en paises'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Especifica los generos y especies prohibidos en paises'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20592,12 +17163,12 @@ DELIMITER ; DROP TABLE IF EXISTS `businessReasonEnd`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `businessReasonEnd` ( `id` tinyint(3) NOT NULL AUTO_INCREMENT, `reason` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -20606,7 +17177,7 @@ CREATE TABLE `businessReasonEnd` ( DROP TABLE IF EXISTS `buy`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `buy` ( `id` int(11) NOT NULL AUTO_INCREMENT, `entryFk` int(11) NOT NULL DEFAULT '0', @@ -20649,7 +17220,7 @@ CREATE TABLE `buy` ( CONSTRAINT `buy_ibfk_2` FOREIGN KEY (`packageFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE, CONSTRAINT `buy_id` FOREIGN KEY (`entryFk`) REFERENCES `entry` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `buy_itemfk` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=358205565 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20839,7 +17410,7 @@ DELIMITER ; DROP TABLE IF EXISTS `buyMark`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `buyMark` ( `id` int(11) NOT NULL, `comment` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -20856,7 +17427,7 @@ CREATE TABLE `buyMark` ( DROP TABLE IF EXISTS `calendarHolidays`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `calendarHolidays` ( `calendarHolidaysTypeFk` int(11) NOT NULL, `dated` date NOT NULL, @@ -20878,12 +17449,12 @@ CREATE TABLE `calendarHolidays` ( DROP TABLE IF EXISTS `calendarHolidaysName`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `calendarHolidaysName` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(100) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -20892,13 +17463,13 @@ CREATE TABLE `calendarHolidaysName` ( DROP TABLE IF EXISTS `calendarHolidaysType`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `calendarHolidaysType` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, `hexColour` char(7) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -20907,13 +17478,13 @@ CREATE TABLE `calendarHolidaysType` ( DROP TABLE IF EXISTS `category`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `category` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `nick` varchar(3) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -20922,12 +17493,12 @@ CREATE TABLE `category` ( DROP TABLE IF EXISTS `chain`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `chain` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Grupos de clientes'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Grupos de clientes'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -20936,7 +17507,7 @@ CREATE TABLE `chain` ( DROP TABLE IF EXISTS `claim`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `claim` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `ticketCreated` date NOT NULL, @@ -20959,7 +17530,7 @@ CREATE TABLE `claim` ( CONSTRAINT `claim_ibfk_3` FOREIGN KEY (`claimStateFk`) REFERENCES `claimState` (`id`) ON UPDATE CASCADE, CONSTRAINT `claim_ibfk_4` FOREIGN KEY (`claimDepartmentFk`) REFERENCES `vn2008`.`cl_dep` (`id`) ON UPDATE CASCADE, CONSTRAINT `claim_ibfk_5` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=72699 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Reclamaciones, tabla principal'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Reclamaciones, tabla principal'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -20968,7 +17539,7 @@ CREATE TABLE `claim` ( DROP TABLE IF EXISTS `claimBeginning`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `claimBeginning` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `claimFk` int(10) unsigned NOT NULL, @@ -20981,7 +17552,7 @@ CREATE TABLE `claimBeginning` ( KEY `cl_main_id` (`claimFk`), CONSTRAINT `claimBeginning_ibfk_7` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `claimBeginning_ibfk_8` FOREIGN KEY (`claimFk`) REFERENCES `claim` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=159141 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de las reclamaciones'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -21018,7 +17589,7 @@ DELIMITER ; DROP TABLE IF EXISTS `claimDestination`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `claimDestination` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `description` varchar(15) COLLATE utf8_unicode_ci NOT NULL, @@ -21026,7 +17597,7 @@ CREATE TABLE `claimDestination` ( PRIMARY KEY (`id`), KEY `clSolAddressFk_idx` (`addressFk`), CONSTRAINT `clSolAddressFk` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Solucion ofrecida a la reclamación'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Solucion ofrecida a la reclamación'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -21035,7 +17606,7 @@ CREATE TABLE `claimDestination` ( DROP TABLE IF EXISTS `claimDevelopment`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `claimDevelopment` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `claimFk` int(10) unsigned NOT NULL, @@ -21060,7 +17631,7 @@ CREATE TABLE `claimDevelopment` ( CONSTRAINT `claimDevelopment_ibfk_7` FOREIGN KEY (`claimReasonFk`) REFERENCES `claimReason` (`id`) ON UPDATE CASCADE, CONSTRAINT `claimDevelopment_ibfk_8` FOREIGN KEY (`claimResultFk`) REFERENCES `claimResult` (`id`) ON UPDATE CASCADE, CONSTRAINT `claimDevelopment_ibfk_9` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=61996 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Causas de las reclamaciones'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Causas de las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -21069,7 +17640,7 @@ CREATE TABLE `claimDevelopment` ( DROP TABLE IF EXISTS `claimDms`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `claimDms` ( `claimFk` int(10) unsigned NOT NULL, `dmsFk` int(11) NOT NULL, @@ -21086,7 +17657,7 @@ CREATE TABLE `claimDms` ( DROP TABLE IF EXISTS `claimEnd`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `claimEnd` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `saleFk` int(11) DEFAULT NULL, @@ -21102,7 +17673,7 @@ CREATE TABLE `claimEnd` ( CONSTRAINT `claimEnd_ibfk_1` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `claimEnd_ibfk_3` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `claimEnd_ibfk_4` FOREIGN KEY (`claimFk`) REFERENCES `claim` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=121333 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Acciones en respuesta a las reclamaciones'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Acciones en respuesta a las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -21111,7 +17682,7 @@ CREATE TABLE `claimEnd` ( DROP TABLE IF EXISTS `claimLog`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `claimLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `originFk` int(10) unsigned NOT NULL, @@ -21129,17 +17700,17 @@ CREATE TABLE `claimLog` ( KEY `userFk` (`userFk`), CONSTRAINT `claimOriginFk` FOREIGN KEY (`originFk`) REFERENCES `claim` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `claimUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=8585 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `claimRatio` +-- Temporary table structure for view `claimRatio` -- DROP TABLE IF EXISTS `claimRatio`; /*!50001 DROP VIEW IF EXISTS `claimRatio`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `claimRatio` AS SELECT 1 AS `clientFk`, 1 AS `yearSale`, @@ -21155,12 +17726,12 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `claimReason`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `claimReason` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Motivos de las fallos'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Motivos de las fallos'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -21169,12 +17740,12 @@ CREATE TABLE `claimReason` ( DROP TABLE IF EXISTS `claimRedelivery`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `claimRedelivery` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Método por el cual el cliente nos devuelve la mercancía'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Método por el cual el cliente nos devuelve la mercancía'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -21183,13 +17754,13 @@ CREATE TABLE `claimRedelivery` ( DROP TABLE IF EXISTS `claimResponsible`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `claimResponsible` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `responsability` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'if=1 >sensib >culpa', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Responsables de las causas'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Responsables de las causas'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -21198,12 +17769,12 @@ CREATE TABLE `claimResponsible` ( DROP TABLE IF EXISTS `claimResult`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `claimResult` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Consecuencias de los motivos'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Consecuencias de los motivos'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -21212,7 +17783,7 @@ CREATE TABLE `claimResult` ( DROP TABLE IF EXISTS `claimState`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `claimState` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `description` varchar(15) COLLATE utf8_unicode_ci NOT NULL, @@ -21220,7 +17791,7 @@ CREATE TABLE `claimState` ( PRIMARY KEY (`id`), KEY `roleFgn_idx` (`roleFk`), CONSTRAINT `roleFgn` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Estados posibles de las reclamaciones'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Estados posibles de las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -21229,7 +17800,7 @@ CREATE TABLE `claimState` ( DROP TABLE IF EXISTS `client`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `client` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, @@ -21318,7 +17889,7 @@ CREATE TABLE `client` ( CONSTRAINT `client_ibfk_5` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON UPDATE CASCADE, CONSTRAINT `tipos_de_cliente` FOREIGN KEY (`clientTypeFk`) REFERENCES `clientType` (`id`) ON UPDATE CASCADE, CONSTRAINT `typeFk` FOREIGN KEY (`typeFk`) REFERENCES `clientType` (`code`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=17017 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -21441,7 +18012,7 @@ DELIMITER ; DROP TABLE IF EXISTS `clientChain`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `clientChain` ( `id` int(11) NOT NULL AUTO_INCREMENT, `clientFk` int(11) NOT NULL, @@ -21451,7 +18022,7 @@ CREATE TABLE `clientChain` ( KEY `clientChain_fk2_idx` (`chainFk`), CONSTRAINT `clientChain_fk1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `clientChain_fk2` FOREIGN KEY (`chainFk`) REFERENCES `chain` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -21460,14 +18031,14 @@ CREATE TABLE `clientChain` ( DROP TABLE IF EXISTS `clientContact`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `clientContact` ( `id` int(11) NOT NULL AUTO_INCREMENT, `clientFk` int(11) NOT NULL, `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `phone` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4162 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -21476,7 +18047,7 @@ CREATE TABLE `clientContact` ( DROP TABLE IF EXISTS `clientCredit`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `clientCredit` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `clientFk` int(11) NOT NULL, @@ -21488,7 +18059,7 @@ CREATE TABLE `clientCredit` ( KEY `credit_ClienteFk` (`clientFk`), CONSTRAINT `credit_ClienteFk` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `workers_fk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=86085 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -21497,7 +18068,7 @@ CREATE TABLE `clientCredit` ( DROP TABLE IF EXISTS `clientCreditLimit`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `clientCreditLimit` ( `id` int(11) NOT NULL, `maxAmount` int(10) unsigned NOT NULL, @@ -21512,7 +18083,7 @@ CREATE TABLE `clientCreditLimit` ( DROP TABLE IF EXISTS `clientDms`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `clientDms` ( `clientFk` int(11) NOT NULL, `dmsFk` int(11) NOT NULL, @@ -21530,7 +18101,7 @@ CREATE TABLE `clientDms` ( DROP TABLE IF EXISTS `clientLog`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `clientLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `originFk` int(11) NOT NULL, @@ -21548,17 +18119,17 @@ CREATE TABLE `clientLog` ( KEY `userFk` (`userFk`), CONSTRAINT `clientLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `clientLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=243781 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `clientManaCache` +-- Temporary table structure for view `clientManaCache` -- DROP TABLE IF EXISTS `clientManaCache`; /*!50001 DROP VIEW IF EXISTS `clientManaCache`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `clientManaCache` AS SELECT 1 AS `clientFk`, 1 AS `mana`, @@ -21571,7 +18142,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `clientObservation`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `clientObservation` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `clientFk` int(11) NOT NULL, @@ -21583,7 +18154,7 @@ CREATE TABLE `clientObservation` ( KEY `Id_Cliente` (`clientFk`), CONSTRAINT `clientObservation_ibfk_1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `clientObservation_ibfk_2` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=79281 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -21633,7 +18204,7 @@ DELIMITER ; DROP TABLE IF EXISTS `clientProtected`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `clientProtected` ( `clientFk` int(11) NOT NULL, `workerFk` int(11) NOT NULL, @@ -21646,13 +18217,13 @@ CREATE TABLE `clientProtected` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `clientRisk` +-- Temporary table structure for view `clientRisk` -- DROP TABLE IF EXISTS `clientRisk`; /*!50001 DROP VIEW IF EXISTS `clientRisk`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `clientRisk` AS SELECT 1 AS `clientFk`, 1 AS `companyFk`, @@ -21665,7 +18236,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `clientSample`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `clientSample` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `clientFk` int(10) unsigned NOT NULL, @@ -21678,7 +18249,7 @@ CREATE TABLE `clientSample` ( PRIMARY KEY (`id`), KEY `empresa_id` (`companyFk`), CONSTRAINT `clientSample_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=18669 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -21687,7 +18258,7 @@ CREATE TABLE `clientSample` ( DROP TABLE IF EXISTS `clientType`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `clientType` ( `id` int(11) NOT NULL AUTO_INCREMENT, `code` varchar(20) CHARACTER SET utf8 NOT NULL, @@ -21695,7 +18266,7 @@ CREATE TABLE `clientType` ( `isCreatedAsServed` tinyint(1) DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Establece categorias para poder agrupar las ventas'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Establece categorias para poder agrupar las ventas'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -21704,7 +18275,7 @@ CREATE TABLE `clientType` ( DROP TABLE IF EXISTS `cmr`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `cmr` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ticketFk` int(11) NOT NULL, @@ -21717,7 +18288,7 @@ CREATE TABLE `cmr` ( PRIMARY KEY (`id`), KEY `cmr_fk1_idx` (`ticketFk`), CONSTRAINT `cmr_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -21761,13 +18332,13 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Temporary view structure for view `cmr_list` +-- Temporary table structure for view `cmr_list` -- DROP TABLE IF EXISTS `cmr_list`; /*!50001 DROP VIEW IF EXISTS `cmr_list`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `cmr_list` AS SELECT 1 AS `cmrFk`, 1 AS `ticketFk`, @@ -21807,7 +18378,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `collection`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `collection` ( `id` int(11) NOT NULL AUTO_INCREMENT, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -21815,17 +18386,17 @@ CREATE TABLE `collection` ( PRIMARY KEY (`id`), KEY `ticketCollection_idx` (`workerFk`), CONSTRAINT `ticketCollection` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=133 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `collectionReportSource` +-- Temporary table structure for view `collectionReportSource` -- DROP TABLE IF EXISTS `collectionReportSource`; /*!50001 DROP VIEW IF EXISTS `collectionReportSource`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `collectionReportSource` AS SELECT 1 AS `collectionFk`, 1 AS `ticketFk`, @@ -21843,7 +18414,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `company`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `company` ( `id` smallint(5) unsigned NOT NULL, `code` char(3) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -21884,22 +18455,22 @@ CREATE TABLE `company` ( DROP TABLE IF EXISTS `companyGroup`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `companyGroup` ( `id` int(11) NOT NULL AUTO_INCREMENT, `code` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `component` +-- Temporary table structure for view `component` -- DROP TABLE IF EXISTS `component`; /*!50001 DROP VIEW IF EXISTS `component`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `component` AS SELECT 1 AS `id`, 1 AS `name`, @@ -21910,13 +18481,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `componentRate` +-- Temporary table structure for view `componentRate` -- DROP TABLE IF EXISTS `componentRate`; /*!50001 DROP VIEW IF EXISTS `componentRate`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `componentRate` AS SELECT 1 AS `id`, 1 AS `name`, @@ -21928,13 +18499,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `componentType` +-- Temporary table structure for view `componentType` -- DROP TABLE IF EXISTS `componentType`; /*!50001 DROP VIEW IF EXISTS `componentType`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `componentType` AS SELECT 1 AS `id`, 1 AS `type`, @@ -21943,13 +18514,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `componentTypeRate` +-- Temporary table structure for view `componentTypeRate` -- DROP TABLE IF EXISTS `componentTypeRate`; /*!50001 DROP VIEW IF EXISTS `componentTypeRate`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `componentTypeRate` AS SELECT 1 AS `id`, 1 AS `type`, @@ -21962,12 +18533,12 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `confectionType`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `confectionType` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -21976,7 +18547,7 @@ CREATE TABLE `confectionType` ( DROP TABLE IF EXISTS `config`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `config` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ochoa` int(10) unsigned NOT NULL, @@ -22024,7 +18595,7 @@ CREATE TABLE `config` ( `ASIEN` bigint(20) DEFAULT NULL, PRIMARY KEY (`id`), KEY `fechainv_idx` (`inventoried`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -22033,7 +18604,7 @@ CREATE TABLE `config` ( DROP TABLE IF EXISTS `config__`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `config__` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `mdbServer` varchar(255) COLLATE utf8_unicode_ci NOT NULL, @@ -22041,7 +18612,7 @@ CREATE TABLE `config__` ( `defaultersMaxAmount` int(10) DEFAULT '200' COMMENT 'maxima deuda permitida a partir de la cual se bloquea a un usuario', `ASIEN` bigint(20) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -22050,12 +18621,12 @@ CREATE TABLE `config__` ( DROP TABLE IF EXISTS `contactChannel`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `contactChannel` ( `id` smallint(6) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Canal por el que nos ha conocido un cliente y se ha dado de'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Canal por el que nos ha conocido un cliente y se ha dado de'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -22064,7 +18635,7 @@ CREATE TABLE `contactChannel` ( DROP TABLE IF EXISTS `country`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `country` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `country` varchar(25) COLLATE utf8_unicode_ci NOT NULL, @@ -22080,7 +18651,7 @@ CREATE TABLE `country` ( `ibanLength` tinyint(4) DEFAULT NULL, PRIMARY KEY (`id`), KEY `Id_Paisreal` (`politicalCountryFk`) -) ENGINE=InnoDB AUTO_INCREMENT=72 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -22168,12 +18739,12 @@ DELIMITER ; DROP TABLE IF EXISTS `cplusCorrectingType`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `cplusCorrectingType` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -22182,7 +18753,7 @@ CREATE TABLE `cplusCorrectingType` ( DROP TABLE IF EXISTS `cplusInvoiceType472`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `cplusInvoiceType472` ( `id` int(10) unsigned NOT NULL, `description` varchar(255) CHARACTER SET utf8 NOT NULL, @@ -22196,7 +18767,7 @@ CREATE TABLE `cplusInvoiceType472` ( DROP TABLE IF EXISTS `cplusInvoiceType477`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `cplusInvoiceType477` ( `id` int(10) unsigned NOT NULL, `description` varchar(255) CHARACTER SET utf8 NOT NULL, @@ -22210,7 +18781,7 @@ CREATE TABLE `cplusInvoiceType477` ( DROP TABLE IF EXISTS `cplusRectificationType`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `cplusRectificationType` ( `id` int(10) unsigned NOT NULL, `description` varchar(255) CHARACTER SET utf8 NOT NULL, @@ -22224,7 +18795,7 @@ CREATE TABLE `cplusRectificationType` ( DROP TABLE IF EXISTS `cplusSubjectOp`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `cplusSubjectOp` ( `id` int(10) unsigned NOT NULL, `description` varchar(255) CHARACTER SET utf8 NOT NULL, @@ -22238,7 +18809,7 @@ CREATE TABLE `cplusSubjectOp` ( DROP TABLE IF EXISTS `cplusTaxBreak`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `cplusTaxBreak` ( `id` int(10) unsigned NOT NULL, `description` varchar(255) CHARACTER SET utf8 NOT NULL, @@ -22252,7 +18823,7 @@ CREATE TABLE `cplusTaxBreak` ( DROP TABLE IF EXISTS `cplusTerIdNif`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `cplusTerIdNif` ( `id` int(11) NOT NULL, `description` varchar(255) CHARACTER SET utf8 NOT NULL, @@ -22266,7 +18837,7 @@ CREATE TABLE `cplusTerIdNif` ( DROP TABLE IF EXISTS `cplusTrascendency472`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `cplusTrascendency472` ( `id` int(10) unsigned NOT NULL, `description` varchar(255) CHARACTER SET utf8 NOT NULL, @@ -22280,7 +18851,7 @@ CREATE TABLE `cplusTrascendency472` ( DROP TABLE IF EXISTS `cplusTrascendency477`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `cplusTrascendency477` ( `id` int(10) unsigned NOT NULL, `description` varchar(255) CHARACTER SET utf8 NOT NULL, @@ -22294,7 +18865,7 @@ CREATE TABLE `cplusTrascendency477` ( DROP TABLE IF EXISTS `creditClassification`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `creditClassification` ( `id` int(11) NOT NULL AUTO_INCREMENT, `client` int(11) NOT NULL, @@ -22304,7 +18875,7 @@ CREATE TABLE `creditClassification` ( KEY `creditClassifClientFk_idx` (`client`), KEY `creditClassifdateEnd_idx` (`dateEnd`), CONSTRAINT `creditClassifClientFk` FOREIGN KEY (`client`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3277 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -22338,7 +18909,7 @@ DELIMITER ; DROP TABLE IF EXISTS `creditInsurance`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `creditInsurance` ( `id` int(11) NOT NULL AUTO_INCREMENT, `creditClassification` int(11) DEFAULT NULL, @@ -22348,7 +18919,7 @@ CREATE TABLE `creditInsurance` ( PRIMARY KEY (`id`), KEY `CreditInsurance_Fk1_idx` (`creditClassification`), CONSTRAINT `CreditInsurance_Fk1` FOREIGN KEY (`creditClassification`) REFERENCES `creditClassification` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3200 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalla los clientes que tienen seguro de credito'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalla los clientes que tienen seguro de credito'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -22379,7 +18950,7 @@ DELIMITER ; DROP TABLE IF EXISTS `currency`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `currency` ( `id` tinyint(3) unsigned NOT NULL, `code` varchar(3) COLLATE utf8_unicode_ci NOT NULL, @@ -22396,7 +18967,7 @@ CREATE TABLE `currency` ( DROP TABLE IF EXISTS `dayMinute`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `dayMinute` ( `id` int(10) unsigned NOT NULL, `hh` int(10) unsigned NOT NULL, @@ -22408,13 +18979,13 @@ CREATE TABLE `dayMinute` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `defaulter` +-- Temporary table structure for view `defaulter` -- DROP TABLE IF EXISTS `defaulter`; /*!50001 DROP VIEW IF EXISTS `defaulter`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `defaulter` AS SELECT 1 AS `clientFk`, 1 AS `created`, @@ -22429,14 +19000,14 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `deliveryMethod`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `deliveryMethod` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `code` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `code` (`code`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -22445,13 +19016,13 @@ CREATE TABLE `deliveryMethod` ( DROP TABLE IF EXISTS `deliveryPoint`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `deliveryPoint` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `ubication` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -22460,7 +19031,7 @@ CREATE TABLE `deliveryPoint` ( DROP TABLE IF EXISTS `delivery_zip`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `delivery_zip` ( `postal_code` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, `country_code` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -22488,7 +19059,7 @@ CREATE TABLE `delivery_zip` ( DROP TABLE IF EXISTS `department`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `department` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, @@ -22511,7 +19082,7 @@ CREATE TABLE `department` ( KEY `dep_org_ibfk_3_idx` (`companyFk`), KEY `lft_rgt_depth_idx` (`lft`,`rgt`,`depth`), CONSTRAINT `fk_department_Trabajadores1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=95 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -22579,7 +19150,7 @@ DELIMITER ; DROP TABLE IF EXISTS `departmentItemType`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `departmentItemType` ( `id` int(11) NOT NULL AUTO_INCREMENT, `departmentFk` int(11) NOT NULL, @@ -22592,17 +19163,17 @@ CREATE TABLE `departmentItemType` ( CONSTRAINT `departmentItemTypeIdx1` FOREIGN KEY (`departmentFk`) REFERENCES `department` (`id`) ON UPDATE CASCADE, CONSTRAINT `departmentItemTypeIdx2` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON UPDATE CASCADE, CONSTRAINT `departmentItemTypeIdx3` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `departmentTree` +-- Temporary table structure for view `departmentTree` -- DROP TABLE IF EXISTS `departmentTree`; /*!50001 DROP VIEW IF EXISTS `departmentTree`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `departmentTree` AS SELECT 1 AS `id`, 1 AS `dep`*/; @@ -22614,12 +19185,12 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `department_recalc`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `department_recalc` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `isChanged` tinyint(4) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -22628,7 +19199,7 @@ CREATE TABLE `department_recalc` ( DROP TABLE IF EXISTS `device`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `device` ( `id` int(11) NOT NULL AUTO_INCREMENT, `sn` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -22637,7 +19208,7 @@ CREATE TABLE `device` ( PRIMARY KEY (`id`), KEY `device_fk1_idx` (`userFk`), CONSTRAINT `device_fk1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=375 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -22646,7 +19217,7 @@ CREATE TABLE `device` ( DROP TABLE IF EXISTS `deviceProduction`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `deviceProduction` ( `id` int(11) NOT NULL AUTO_INCREMENT, `imei` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -22662,7 +19233,7 @@ CREATE TABLE `deviceProduction` ( KEY `departmentFgn` (`departmentFk`), CONSTRAINT `departmentFgn` FOREIGN KEY (`departmentFk`) REFERENCES `department` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `deviceProductionModelsFgn` FOREIGN KEY (`modelFk`) REFERENCES `deviceProductionModels` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=381 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -22671,7 +19242,7 @@ CREATE TABLE `deviceProduction` ( DROP TABLE IF EXISTS `deviceProductionModels`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `deviceProductionModels` ( `code` varchar(50) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`code`) @@ -22684,7 +19255,7 @@ CREATE TABLE `deviceProductionModels` ( DROP TABLE IF EXISTS `deviceProductionUser`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `deviceProductionUser` ( `deviceProductionFk` int(11) NOT NULL, `userFk` int(10) unsigned NOT NULL, @@ -22701,7 +19272,7 @@ CREATE TABLE `deviceProductionUser` ( DROP TABLE IF EXISTS `dms`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `dms` ( `id` int(11) NOT NULL AUTO_INCREMENT, `dmsTypeFk` int(11) NOT NULL DEFAULT '1', @@ -22719,7 +19290,7 @@ CREATE TABLE `dms` ( UNIQUE KEY `emp_id` (`companyFk`,`hardCopyNumber`,`warehouseFk`), KEY `trabajador_id` (`workerFk`), KEY `warehouse_id` (`warehouseFk`) -) ENGINE=InnoDB AUTO_INCREMENT=1409575 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='document managment system'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='document managment system'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -22797,7 +19368,7 @@ DELIMITER ; DROP TABLE IF EXISTS `dmsType`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `dmsType` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, @@ -22810,7 +19381,7 @@ CREATE TABLE `dmsType` ( KEY `writeRoleFk` (`writeRoleFk`), CONSTRAINT `readRoleFk` FOREIGN KEY (`readRoleFk`) REFERENCES `account`.`role` (`id`), CONSTRAINT `writeRoleFk` FOREIGN KEY (`writeRoleFk`) REFERENCES `account`.`role` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -22819,7 +19390,7 @@ CREATE TABLE `dmsType` ( DROP TABLE IF EXISTS `dua`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `dua` ( `id` int(11) NOT NULL AUTO_INCREMENT, `code` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -22839,7 +19410,7 @@ CREATE TABLE `dua` ( CONSTRAINT `dua_fk1` FOREIGN KEY (`gestdocFk`) REFERENCES `dms` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `dua_fk2` FOREIGN KEY (`awbFk`) REFERENCES `vn2008`.`awb` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `dua_fk4` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=19542 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -22848,7 +19419,7 @@ CREATE TABLE `dua` ( DROP TABLE IF EXISTS `duaEntry`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `duaEntry` ( `duaFk` int(11) NOT NULL, `entryFk` int(11) NOT NULL, @@ -22869,7 +19440,7 @@ CREATE TABLE `duaEntry` ( DROP TABLE IF EXISTS `duaIntrastat`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `duaIntrastat` ( `id` int(11) NOT NULL AUTO_INCREMENT, `duaFk` int(11) NOT NULL, @@ -22880,7 +19451,7 @@ CREATE TABLE `duaIntrastat` ( KEY `duaIntrastat_fk2_idx` (`duaFk`), CONSTRAINT `duaIntrastat_fk1` FOREIGN KEY (`intrastatFk`) REFERENCES `intrastat` (`id`) ON UPDATE CASCADE, CONSTRAINT `duaIntrastat_fk2` FOREIGN KEY (`duaFk`) REFERENCES `dua` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=7324 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -22889,7 +19460,7 @@ CREATE TABLE `duaIntrastat` ( DROP TABLE IF EXISTS `duaInvoiceIn`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `duaInvoiceIn` ( `id` int(11) NOT NULL AUTO_INCREMENT, `duaFk` int(11) NOT NULL, @@ -22900,7 +19471,7 @@ CREATE TABLE `duaInvoiceIn` ( KEY `duaInvoiceIn_fk2_idx` (`invoiceInFk`), CONSTRAINT `duaInvoiceIn_fk1` FOREIGN KEY (`duaFk`) REFERENCES `dua` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `duaInvoiceIn_fk2` FOREIGN KEY (`invoiceInFk`) REFERENCES `vn2008`.`recibida` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=5333 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Facturas asociadas a la declaración aduanera, básicamente la del agente transitario'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Facturas asociadas a la declaración aduanera, básicamente la del agente transitario'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -22909,7 +19480,7 @@ CREATE TABLE `duaInvoiceIn` ( DROP TABLE IF EXISTS `duaTax`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `duaTax` ( `id` int(11) NOT NULL AUTO_INCREMENT, `duaFk` int(11) NOT NULL, @@ -22925,17 +19496,17 @@ CREATE TABLE `duaTax` ( CONSTRAINT `duaTax_fk1` FOREIGN KEY (`duaFk`) REFERENCES `dua` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `duaTax_fk2` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, CONSTRAINT `duaTax_fk3` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=10732 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `ediGenus` +-- Temporary table structure for view `ediGenus` -- DROP TABLE IF EXISTS `ediGenus`; /*!50001 DROP VIEW IF EXISTS `ediGenus`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `ediGenus` AS SELECT 1 AS `id`, 1 AS `latinGenusName`, @@ -22945,13 +19516,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `ediSpecie` +-- Temporary table structure for view `ediSpecie` -- DROP TABLE IF EXISTS `ediSpecie`; /*!50001 DROP VIEW IF EXISTS `ediSpecie`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `ediSpecie` AS SELECT 1 AS `id`, 1 AS `genusFk`, @@ -22967,13 +19538,13 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `emergencyMedia`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `emergencyMedia` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `value` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Table to save all emergency phones', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -22982,7 +19553,7 @@ CREATE TABLE `emergencyMedia` ( DROP TABLE IF EXISTS `energyInput`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `energyInput` ( `input` int(11) NOT NULL COMMENT 'The input number', `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, @@ -22997,7 +19568,7 @@ CREATE TABLE `energyInput` ( DROP TABLE IF EXISTS `energyMeter`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `energyMeter` ( `input` int(11) NOT NULL COMMENT 'The input number', `period` datetime NOT NULL COMMENT 'Consumption period in hours interval', @@ -23013,7 +19584,7 @@ CREATE TABLE `energyMeter` ( DROP TABLE IF EXISTS `entry`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `entry` ( `id` int(11) NOT NULL AUTO_INCREMENT, `supplierFk` int(11) NOT NULL DEFAULT '644', @@ -23046,7 +19617,7 @@ CREATE TABLE `entry` ( CONSTRAINT `entry_ibfk_1` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, CONSTRAINT `entry_ibfk_6` FOREIGN KEY (`travelFk`) REFERENCES `travel` (`id`) ON UPDATE CASCADE, CONSTRAINT `entry_ibfk_7` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=183609 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='InnoDB free: 88064 kB; (`Id_Proveedor`) REFER `vn2008/Provee'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='InnoDB free: 88064 kB; (`Id_Proveedor`) REFER `vn2008/Provee'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -23235,7 +19806,7 @@ DELIMITER ; DROP TABLE IF EXISTS `entryLog`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `entryLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `originFk` int(11) NOT NULL, @@ -23248,7 +19819,7 @@ CREATE TABLE `entryLog` ( KEY `entryLog_ibfk_2` (`userFk`), CONSTRAINT `entryLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `entryLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=181611 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23257,7 +19828,7 @@ CREATE TABLE `entryLog` ( DROP TABLE IF EXISTS `entrySplit`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `entrySplit` ( `receivedFk` int(11) NOT NULL, `delayedFk` int(11) NOT NULL, @@ -23274,7 +19845,7 @@ CREATE TABLE `entrySplit` ( DROP TABLE IF EXISTS `entryVirtual`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `entryVirtual` ( `entryFk` int(11) NOT NULL, PRIMARY KEY (`entryFk`), @@ -23288,7 +19859,7 @@ CREATE TABLE `entryVirtual` ( DROP TABLE IF EXISTS `envialiaAgency`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `envialiaAgency` ( `id` varchar(6) COLLATE utf8_unicode_ci NOT NULL, `route` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -23304,7 +19875,7 @@ CREATE TABLE `envialiaAgency` ( DROP TABLE IF EXISTS `envialiaCity`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `envialiaCity` ( `id` int(11) NOT NULL AUTO_INCREMENT, `city` varchar(255) COLLATE utf8_unicode_ci NOT NULL, @@ -23313,7 +19884,7 @@ CREATE TABLE `envialiaCity` ( PRIMARY KEY (`id`), KEY `agencyFk` (`agencyFk`), KEY `postalCode` (`postalCode`) -) ENGINE=InnoDB AUTO_INCREMENT=1585166 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23322,7 +19893,7 @@ CREATE TABLE `envialiaCity` ( DROP TABLE IF EXISTS `envialiaConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `envialiaConfig` ( `serviceType` varchar(3) COLLATE utf8_unicode_ci NOT NULL DEFAULT '024' COMMENT 'Tipo de servicio en horas. 024 -> servicio las 24h', `numBox` varchar(3) COLLATE utf8_unicode_ci DEFAULT '001' COMMENT 'cajas por envio', @@ -23337,13 +19908,13 @@ CREATE TABLE `envialiaConfig` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `exchangeInsuranceEntry` +-- Temporary table structure for view `exchangeInsuranceEntry` -- DROP TABLE IF EXISTS `exchangeInsuranceEntry`; /*!50001 DROP VIEW IF EXISTS `exchangeInsuranceEntry`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `exchangeInsuranceEntry` AS SELECT 1 AS `dated`, 1 AS `Dolares`, @@ -23351,13 +19922,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `exchangeInsuranceIn` +-- Temporary table structure for view `exchangeInsuranceIn` -- DROP TABLE IF EXISTS `exchangeInsuranceIn`; /*!50001 DROP VIEW IF EXISTS `exchangeInsuranceIn`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `exchangeInsuranceIn` AS SELECT 1 AS `dated`, 1 AS `amount`, @@ -23365,13 +19936,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `exchangeInsuranceOut` +-- Temporary table structure for view `exchangeInsuranceOut` -- DROP TABLE IF EXISTS `exchangeInsuranceOut`; /*!50001 DROP VIEW IF EXISTS `exchangeInsuranceOut`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `exchangeInsuranceOut` AS SELECT 1 AS `received`, 1 AS `divisa`, @@ -23379,13 +19950,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `exchangeReportSourcePrevious` +-- Temporary table structure for view `exchangeReportSourcePrevious` -- DROP TABLE IF EXISTS `exchangeReportSourcePrevious`; /*!50001 DROP VIEW IF EXISTS `exchangeReportSourcePrevious`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `exchangeReportSourcePrevious` AS SELECT 1 AS `dated`, 1 AS `amountIn`, @@ -23402,13 +19973,13 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `excuse`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `excuse` ( `id` int(11) NOT NULL AUTO_INCREMENT, `txt` varchar(255) CHARACTER SET latin1 NOT NULL, `date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23417,7 +19988,7 @@ CREATE TABLE `excuse` ( DROP TABLE IF EXISTS `expedition`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `expedition` ( `id` int(11) NOT NULL AUTO_INCREMENT, `agencyModeFk` int(11) NOT NULL, @@ -23438,7 +20009,7 @@ CREATE TABLE `expedition` ( KEY `index4` (`ticketFk`), CONSTRAINT `Id_Agencia` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON UPDATE CASCADE, CONSTRAINT `ticket_id` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3475031 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -23541,7 +20112,7 @@ DELIMITER ; DROP TABLE IF EXISTS `expeditionBoxVol`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `expeditionBoxVol` ( `boxFk` int(11) NOT NULL, `m3` double NOT NULL, @@ -23556,7 +20127,7 @@ CREATE TABLE `expeditionBoxVol` ( DROP TABLE IF EXISTS `expence`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `expence` ( `id` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `taxTypeFk` tinyint(4) NOT NULL, @@ -23570,26 +20141,26 @@ CREATE TABLE `expence` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `firstTicketShipped` +-- Temporary table structure for view `firstTicketShipped` -- DROP TABLE IF EXISTS `firstTicketShipped`; /*!50001 DROP VIEW IF EXISTS `firstTicketShipped`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `firstTicketShipped` AS SELECT 1 AS `shipped`, 1 AS `clientFk`*/; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `floraHollandBuyedItems` +-- Temporary table structure for view `floraHollandBuyedItems` -- DROP TABLE IF EXISTS `floraHollandBuyedItems`; /*!50001 DROP VIEW IF EXISTS `floraHollandBuyedItems`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `floraHollandBuyedItems` AS SELECT 1 AS `itemFk`, 1 AS `longName`, @@ -23605,14 +20176,14 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `fuelType`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `fuelType` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `code` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23621,13 +20192,13 @@ CREATE TABLE `fuelType` ( DROP TABLE IF EXISTS `gateArea`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `gateArea` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name_UNIQUE` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23636,7 +20207,7 @@ CREATE TABLE `gateArea` ( DROP TABLE IF EXISTS `greuge`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `greuge` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, `clientFk` int(10) unsigned NOT NULL, @@ -23652,7 +20223,7 @@ CREATE TABLE `greuge` ( KEY `Greuges_cliente_idx` (`clientFk`), CONSTRAINT `Id_Ticket_Greuge_Ticket` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `greuges_type_fk` FOREIGN KEY (`greugeTypeFk`) REFERENCES `greugeType` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3850864 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPACT; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPACT; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -23683,23 +20254,23 @@ DELIMITER ; DROP TABLE IF EXISTS `greugeType`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `greugeType` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `code` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `holiday` +-- Temporary table structure for view `holiday` -- DROP TABLE IF EXISTS `holiday`; /*!50001 DROP VIEW IF EXISTS `holiday`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `holiday` AS SELECT 1 AS `holidayDetailFk`, 1 AS `holidayTypeFk`, @@ -23708,39 +20279,39 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `holidayDetail` +-- Temporary table structure for view `holidayDetail` -- DROP TABLE IF EXISTS `holidayDetail`; /*!50001 DROP VIEW IF EXISTS `holidayDetail`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `holidayDetail` AS SELECT 1 AS `id`, 1 AS `description`*/; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `holidayLegend` +-- Temporary table structure for view `holidayLegend` -- DROP TABLE IF EXISTS `holidayLegend`; /*!50001 DROP VIEW IF EXISTS `holidayLegend`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `holidayLegend` AS SELECT 1 AS `id`, 1 AS `description`*/; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `holidayType` +-- Temporary table structure for view `holidayType` -- DROP TABLE IF EXISTS `holidayType`; /*!50001 DROP VIEW IF EXISTS `holidayType`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `holidayType` AS SELECT 1 AS `id`, 1 AS `name`, @@ -23753,7 +20324,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `ink`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ink` ( `id` char(3) COLLATE utf8_unicode_ci NOT NULL, `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -23771,7 +20342,7 @@ CREATE TABLE `ink` ( DROP TABLE IF EXISTS `inkI18n`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `inkI18n` ( `inkFk` char(3) COLLATE utf8_unicode_ci NOT NULL, `lang` char(2) CHARACTER SET utf8 NOT NULL, @@ -23781,13 +20352,13 @@ CREATE TABLE `inkI18n` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `inkL10n` +-- Temporary table structure for view `inkL10n` -- DROP TABLE IF EXISTS `inkL10n`; /*!50001 DROP VIEW IF EXISTS `inkL10n`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `inkL10n` AS SELECT 1 AS `id`, 1 AS `name`*/; @@ -23799,7 +20370,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `intrastat`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `intrastat` ( `id` int(8) unsigned zerofill NOT NULL, `description` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -23818,7 +20389,7 @@ CREATE TABLE `intrastat` ( DROP TABLE IF EXISTS `inventoryFailure`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `inventoryFailure` ( `id` int(11) NOT NULL AUTO_INCREMENT, `dated` date NOT NULL, @@ -23841,7 +20412,7 @@ CREATE TABLE `inventoryFailure` ( CONSTRAINT `inventoryFailure_fk3` FOREIGN KEY (`guiltyFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `inventoryFailure_fk4` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `inventoryFailure_fk5` FOREIGN KEY (`causeFk`) REFERENCES `inventoryFailureCause` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=29968 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23850,12 +20421,12 @@ CREATE TABLE `inventoryFailure` ( DROP TABLE IF EXISTS `inventoryFailureCause`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `inventoryFailureCause` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23864,7 +20435,7 @@ CREATE TABLE `inventoryFailureCause` ( DROP TABLE IF EXISTS `invoiceCorrection`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `invoiceCorrection` ( `correctingFk` int(10) unsigned NOT NULL COMMENT 'Factura rectificativa', `correctedFk` int(10) unsigned NOT NULL COMMENT 'Factura rectificada', @@ -23885,13 +20456,13 @@ CREATE TABLE `invoiceCorrection` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `invoiceCorrectionDataSource` +-- Temporary table structure for view `invoiceCorrectionDataSource` -- DROP TABLE IF EXISTS `invoiceCorrectionDataSource`; /*!50001 DROP VIEW IF EXISTS `invoiceCorrectionDataSource`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `invoiceCorrectionDataSource` AS SELECT 1 AS `itemFk`, 1 AS `quantity`, @@ -23909,13 +20480,13 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `invoiceCorrectionType`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `invoiceCorrectionType` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `description_UNIQUE` (`description`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23924,7 +20495,7 @@ CREATE TABLE `invoiceCorrectionType` ( DROP TABLE IF EXISTS `invoiceInSerial`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `invoiceInSerial` ( `code` varchar(2) COLLATE utf8_unicode_ci NOT NULL, `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -23944,7 +20515,7 @@ CREATE TABLE `invoiceInSerial` ( DROP TABLE IF EXISTS `invoiceInTaxBookingAccount`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `invoiceInTaxBookingAccount` ( `id` int(10) NOT NULL AUTO_INCREMENT, `effectived` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -23961,7 +20532,7 @@ CREATE TABLE `invoiceInTaxBookingAccount` ( CONSTRAINT `invoiceInTaxBookingAccount_fk1` FOREIGN KEY (`taxAreaFk`) REFERENCES `taxArea` (`code`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceInTaxBookingAccount_fk2` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoiceInTaxBookingAccount_fk3` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23970,7 +20541,7 @@ CREATE TABLE `invoiceInTaxBookingAccount` ( DROP TABLE IF EXISTS `invoiceOut`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `invoiceOut` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `ref` varchar(15) COLLATE utf8_unicode_ci NOT NULL, @@ -24017,7 +20588,7 @@ CREATE TABLE `invoiceOut` ( CONSTRAINT `invoiceOut_ibfk_4` FOREIGN KEY (`cplusTaxBreakFk`) REFERENCES `cplusTaxBreak` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoice_bank_id` FOREIGN KEY (`bankFk`) REFERENCES `bank` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoice_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=525260 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -24130,7 +20701,7 @@ DELIMITER ; DROP TABLE IF EXISTS `invoiceOutExpence`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `invoiceOutExpence` ( `id` int(11) NOT NULL AUTO_INCREMENT, `invoiceOutFk` int(10) unsigned NOT NULL, @@ -24143,7 +20714,7 @@ CREATE TABLE `invoiceOutExpence` ( KEY `invoiceOutExpence_FK_2_idx` (`expenceFk`), CONSTRAINT `invoiceOutExpence_FK_1` FOREIGN KEY (`invoiceOutFk`) REFERENCES `invoiceOut` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceOutExpence_FK_2` FOREIGN KEY (`expenceFk`) REFERENCES `expence` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=139712 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Desglosa la base imponible de una factura en funcion del tipo de gasto/venta'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Desglosa la base imponible de una factura en funcion del tipo de gasto/venta'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -24152,7 +20723,7 @@ CREATE TABLE `invoiceOutExpence` ( DROP TABLE IF EXISTS `invoiceOutSerial`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `invoiceOutSerial` ( `code` varchar(2) COLLATE utf8_unicode_ci NOT NULL, `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -24172,7 +20743,7 @@ CREATE TABLE `invoiceOutSerial` ( DROP TABLE IF EXISTS `invoiceOutTax`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `invoiceOutTax` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `invoiceOutFk` int(10) unsigned NOT NULL, @@ -24186,7 +20757,7 @@ CREATE TABLE `invoiceOutTax` ( KEY `pgcFk` (`pgcFk`), CONSTRAINT `invoiceOutFk` FOREIGN KEY (`invoiceOutFk`) REFERENCES `invoiceOut` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceOutTax_ibfk_1` FOREIGN KEY (`pgcFk`) REFERENCES `pgc` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1193218 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -24195,7 +20766,7 @@ CREATE TABLE `invoiceOutTax` ( DROP TABLE IF EXISTS `item`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `item` ( `id` int(11) NOT NULL AUTO_INCREMENT, `equivalent` int(11) unsigned DEFAULT NULL, @@ -24265,7 +20836,7 @@ CREATE TABLE `item` ( CONSTRAINT `item_ibfk_5` FOREIGN KEY (`typeFk`) REFERENCES `itemType` (`id`) ON UPDATE CASCADE, CONSTRAINT `item_ibfk_6` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `producer_id` FOREIGN KEY (`producerFk`) REFERENCES `producer` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=380013 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -24384,7 +20955,7 @@ DELIMITER ; DROP TABLE IF EXISTS `itemBarcode`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemBarcode` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `itemFk` int(11) NOT NULL, @@ -24394,7 +20965,7 @@ CREATE TABLE `itemBarcode` ( UNIQUE KEY `Id_Article_2` (`itemFk`,`code`), KEY `Id_Article` (`itemFk`), CONSTRAINT `itemBarcode_ibfk_1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=43128 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -24403,7 +20974,7 @@ CREATE TABLE `itemBarcode` ( DROP TABLE IF EXISTS `itemBotanical`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemBotanical` ( `itemFk` int(11) NOT NULL, `botanical` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -24458,13 +21029,13 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Temporary view structure for view `itemBotanicalWithGenus` +-- Temporary table structure for view `itemBotanicalWithGenus` -- DROP TABLE IF EXISTS `itemBotanicalWithGenus`; /*!50001 DROP VIEW IF EXISTS `itemBotanicalWithGenus`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `itemBotanicalWithGenus` AS SELECT 1 AS `itemFk`, 1 AS `ediBotanic`*/; @@ -24476,7 +21047,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `itemCategory`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemCategory` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, @@ -24489,7 +21060,7 @@ CREATE TABLE `itemCategory` ( `code` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `reino_UNIQUE` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -24498,7 +21069,7 @@ CREATE TABLE `itemCategory` ( DROP TABLE IF EXISTS `itemCategoryI18n`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemCategoryI18n` ( `categoryFk` int(10) unsigned NOT NULL, `lang` char(2) CHARACTER SET utf8 NOT NULL, @@ -24508,13 +21079,13 @@ CREATE TABLE `itemCategoryI18n` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `itemCategoryL10n` +-- Temporary table structure for view `itemCategoryL10n` -- DROP TABLE IF EXISTS `itemCategoryL10n`; /*!50001 DROP VIEW IF EXISTS `itemCategoryL10n`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `itemCategoryL10n` AS SELECT 1 AS `id`, 1 AS `name`*/; @@ -24526,7 +21097,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `itemConversor`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemConversor` ( `espItemFk` int(11) NOT NULL, `genItemFk` int(11) DEFAULT NULL, @@ -24538,13 +21109,13 @@ CREATE TABLE `itemConversor` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `itemEntryIn` +-- Temporary table structure for view `itemEntryIn` -- DROP TABLE IF EXISTS `itemEntryIn`; /*!50001 DROP VIEW IF EXISTS `itemEntryIn`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `itemEntryIn` AS SELECT 1 AS `warehouseInFk`, 1 AS `landed`, @@ -24556,13 +21127,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `itemEntryOut` +-- Temporary table structure for view `itemEntryOut` -- DROP TABLE IF EXISTS `itemEntryOut`; /*!50001 DROP VIEW IF EXISTS `itemEntryOut`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `itemEntryOut` AS SELECT 1 AS `warehouseOutFk`, 1 AS `shipped`, @@ -24578,7 +21149,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `itemFreeNumber`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemFreeNumber` ( `itemFk` int(11) NOT NULL, PRIMARY KEY (`itemFk`) @@ -24591,7 +21162,7 @@ CREATE TABLE `itemFreeNumber` ( DROP TABLE IF EXISTS `itemLog`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `originFk` int(11) NOT NULL, @@ -24609,7 +21180,7 @@ CREATE TABLE `itemLog` ( KEY `itemLogUserFk_idx` (`userFk`), CONSTRAINT `itemLogItemFk` FOREIGN KEY (`originFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemLogUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=107546 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -24618,7 +21189,7 @@ CREATE TABLE `itemLog` ( DROP TABLE IF EXISTS `itemPlacement`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemPlacement` ( `id` int(11) NOT NULL AUTO_INCREMENT, `itemFk` int(11) NOT NULL, @@ -24636,7 +21207,7 @@ CREATE TABLE `itemPlacement` ( CONSTRAINT `Articles_nicho_wh_fk` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `Articles_nichos_fk` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemPlacement_fk3` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1179115 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -24667,7 +21238,7 @@ DELIMITER ; DROP TABLE IF EXISTS `itemPlacementSupply`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemPlacementSupply` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `itemFk` int(11) NOT NULL, @@ -24686,17 +21257,17 @@ CREATE TABLE `itemPlacementSupply` ( CONSTRAINT `itemPlacementSupply_fk2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemPlacementSupply_fk3` FOREIGN KEY (`repoUserFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemPlacementSupply_fk4` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=86940 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de nichos de picking que hay que reponer'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de nichos de picking que hay que reponer'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `itemPlacementSupplyList` +-- Temporary table structure for view `itemPlacementSupplyList` -- DROP TABLE IF EXISTS `itemPlacementSupplyList`; /*!50001 DROP VIEW IF EXISTS `itemPlacementSupplyList`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `itemPlacementSupplyList` AS SELECT 1 AS `id`, 1 AS `itemFk`, @@ -24716,13 +21287,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `itemPlacementSupplyList__` +-- Temporary table structure for view `itemPlacementSupplyList__` -- DROP TABLE IF EXISTS `itemPlacementSupplyList__`; /*!50001 DROP VIEW IF EXISTS `itemPlacementSupplyList__`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `itemPlacementSupplyList__` AS SELECT 1 AS `id`, 1 AS `itemFk`, @@ -24747,7 +21318,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `itemRepo`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemRepo` ( `itemFk` int(11) NOT NULL, `quantity` int(10) unsigned NOT NULL DEFAULT '0', @@ -24762,7 +21333,7 @@ CREATE TABLE `itemRepo` ( DROP TABLE IF EXISTS `itemShelving`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemShelving` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `itemFk` int(11) NOT NULL, @@ -24787,7 +21358,7 @@ CREATE TABLE `itemShelving` ( CONSTRAINT `itemShelving_fk1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemShelving_fk2` FOREIGN KEY (`shelvingFk`) REFERENCES `shelving` (`code`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemShelving_fk3` FOREIGN KEY (`packagingFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=151395 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla utilizada para localizar los artículos dentro de los carros. Usado para la gestión del almacén en el altillo '; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla utilizada para localizar los artículos dentro de los carros. Usado para la gestión del almacén en el altillo '; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -24831,13 +21402,13 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Temporary view structure for view `itemShelvingAvailable` +-- Temporary table structure for view `itemShelvingAvailable` -- DROP TABLE IF EXISTS `itemShelvingAvailable`; /*!50001 DROP VIEW IF EXISTS `itemShelvingAvailable`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `itemShelvingAvailable` AS SELECT 1 AS `saleFk`, 1 AS `Modificado`, @@ -24864,13 +21435,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `itemShelvingList` +-- Temporary table structure for view `itemShelvingList` -- DROP TABLE IF EXISTS `itemShelvingList`; /*!50001 DROP VIEW IF EXISTS `itemShelvingList`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `itemShelvingList` AS SELECT 1 AS `shelvingFk`, 1 AS `visible`, @@ -24889,7 +21460,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `itemShelvingPlacementSupply`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemShelvingPlacementSupply` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `itemShelvingFk` int(10) unsigned NOT NULL, @@ -24904,17 +21475,17 @@ CREATE TABLE `itemShelvingPlacementSupply` ( KEY `itemShelvingPlacementSupply_fk3_idx` (`userFk`), CONSTRAINT `itemShelvingPlacementSupply_fk1` FOREIGN KEY (`itemShelvingFk`) REFERENCES `itemShelving` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemShelvingPlacementSupply_fk2` FOREIGN KEY (`itemPlacementSupplyFk`) REFERENCES `itemPlacementSupply` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=81650 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de los itemShelving afectados por las ordenes de reposicion de nicho'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de los itemShelving afectados por las ordenes de reposicion de nicho'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `itemShelvingPlacementSupplyStock` +-- Temporary table structure for view `itemShelvingPlacementSupplyStock` -- DROP TABLE IF EXISTS `itemShelvingPlacementSupplyStock`; /*!50001 DROP VIEW IF EXISTS `itemShelvingPlacementSupplyStock`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `itemShelvingPlacementSupplyStock` AS SELECT 1 AS `itemShelvingFk`, 1 AS `itemFk`, @@ -24933,13 +21504,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `itemShelvingPlacementSupplyStock__` +-- Temporary table structure for view `itemShelvingPlacementSupplyStock__` -- DROP TABLE IF EXISTS `itemShelvingPlacementSupplyStock__`; /*!50001 DROP VIEW IF EXISTS `itemShelvingPlacementSupplyStock__`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `itemShelvingPlacementSupplyStock__` AS SELECT 1 AS `itemShelvingFk`, 1 AS `itemFk`, @@ -24961,7 +21532,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `itemShelvingSale`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemShelvingSale` ( `id` int(11) NOT NULL AUTO_INCREMENT, `itemShelvingFk` int(10) unsigned NOT NULL, @@ -24976,7 +21547,7 @@ CREATE TABLE `itemShelvingSale` ( CONSTRAINT `itemShelvingSale_fk1` FOREIGN KEY (`itemShelvingFk`) REFERENCES `itemShelving` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemShelvingSale_fk2` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemShelvingSale_fk3` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=56499 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle del producto que se retira de los carros, relacionando la linea de movimiento correspondiente'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle del producto que se retira de los carros, relacionando la linea de movimiento correspondiente'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -25002,13 +21573,13 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Temporary view structure for view `itemShelvingSaleSum` +-- Temporary table structure for view `itemShelvingSaleSum` -- DROP TABLE IF EXISTS `itemShelvingSaleSum`; /*!50001 DROP VIEW IF EXISTS `itemShelvingSaleSum`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `itemShelvingSaleSum` AS SELECT 1 AS `id`, 1 AS `itemShelvingFk`, @@ -25019,13 +21590,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `itemShelvingStock` +-- Temporary table structure for view `itemShelvingStock` -- DROP TABLE IF EXISTS `itemShelvingStock`; /*!50001 DROP VIEW IF EXISTS `itemShelvingStock`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `itemShelvingStock` AS SELECT 1 AS `itemFk`, 1 AS `visible`, @@ -25044,13 +21615,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `itemShelvingStockFull` +-- Temporary table structure for view `itemShelvingStockFull` -- DROP TABLE IF EXISTS `itemShelvingStockFull`; /*!50001 DROP VIEW IF EXISTS `itemShelvingStockFull`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `itemShelvingStockFull` AS SELECT 1 AS `itemFk`, 1 AS `quantity`, @@ -25068,13 +21639,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `itemShelvingStockRemoved` +-- Temporary table structure for view `itemShelvingStockRemoved` -- DROP TABLE IF EXISTS `itemShelvingStockRemoved`; /*!50001 DROP VIEW IF EXISTS `itemShelvingStockRemoved`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `itemShelvingStockRemoved` AS SELECT 1 AS `itemShelvingFk`, 1 AS `itemFk`, @@ -25087,7 +21658,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `itemTag`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemTag` ( `id` int(11) NOT NULL AUTO_INCREMENT, `itemFk` int(11) NOT NULL, @@ -25103,7 +21674,7 @@ CREATE TABLE `itemTag` ( KEY `itemFk_2` (`itemFk`,`tagFk`,`intValue`), CONSTRAINT `itemTagItemFk` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemTagTagFk` FOREIGN KEY (`tagFk`) REFERENCES `tag` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1428016 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -25216,13 +21787,13 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Temporary view structure for view `itemTagged` +-- Temporary table structure for view `itemTagged` -- DROP TABLE IF EXISTS `itemTagged`; /*!50001 DROP VIEW IF EXISTS `itemTagged`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `itemTagged` AS SELECT 1 AS `itemFk`*/; SET character_set_client = @saved_cs_client; @@ -25233,7 +21804,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `itemTaxCountry`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemTaxCountry` ( `id` int(11) NOT NULL AUTO_INCREMENT, `itemFk` int(11) DEFAULT NULL, @@ -25247,17 +21818,17 @@ CREATE TABLE `itemTaxCountry` ( CONSTRAINT `countryFK_paises` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE, CONSTRAINT `itemFK_Article` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `taxClassFK_Iva_Group` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=911122 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Define la clase de iva por artículo y pais'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Define la clase de iva por artículo y pais'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `itemTicketOut` +-- Temporary table structure for view `itemTicketOut` -- DROP TABLE IF EXISTS `itemTicketOut`; /*!50001 DROP VIEW IF EXISTS `itemTicketOut`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `itemTicketOut` AS SELECT 1 AS `warehouseFk`, 1 AS `shipped`, @@ -25276,7 +21847,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `itemType`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemType` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `code` varchar(3) COLLATE utf8_unicode_ci NOT NULL, @@ -25319,7 +21890,7 @@ CREATE TABLE `itemType` ( CONSTRAINT `itemType_ibfk_1` FOREIGN KEY (`categoryFk`) REFERENCES `itemCategory` (`id`) ON UPDATE CASCADE, CONSTRAINT `itemType_ibfk_2` FOREIGN KEY (`roleCodeFk`) REFERENCES `account`.`role` (`name`) ON UPDATE CASCADE, CONSTRAINT `warehouseFk5` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=286 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Protege la tabla tipos de updates para los 4 parámetros de los compradores, en funcion del valor del campo CodigoRojo de tblContadores.'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Protege la tabla tipos de updates para los 4 parámetros de los compradores, en funcion del valor del campo CodigoRojo de tblContadores.'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -25359,7 +21930,7 @@ DELIMITER ; DROP TABLE IF EXISTS `itemTypeI18n`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemTypeI18n` ( `typeFk` smallint(5) unsigned NOT NULL, `lang` char(2) CHARACTER SET utf8 NOT NULL, @@ -25369,13 +21940,13 @@ CREATE TABLE `itemTypeI18n` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `itemTypeL10n` +-- Temporary table structure for view `itemTypeL10n` -- DROP TABLE IF EXISTS `itemTypeL10n`; /*!50001 DROP VIEW IF EXISTS `itemTypeL10n`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `itemTypeL10n` AS SELECT 1 AS `id`, 1 AS `name`*/; @@ -25387,7 +21958,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `itemTypeTag`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemTypeTag` ( `id` int(11) NOT NULL AUTO_INCREMENT, `itemTypeFk` smallint(5) unsigned NOT NULL, @@ -25399,7 +21970,7 @@ CREATE TABLE `itemTypeTag` ( KEY `itemTypeTagTag_idx` (`tagFk`), CONSTRAINT `itemTypeTagTag` FOREIGN KEY (`tagFk`) REFERENCES `tag` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `itemTypeTagTipos` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25408,7 +21979,7 @@ CREATE TABLE `itemTypeTag` ( DROP TABLE IF EXISTS `itemVerdecora`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemVerdecora` ( `itemFk` int(11) NOT NULL, `codin` int(11) DEFAULT NULL, @@ -25423,7 +21994,7 @@ CREATE TABLE `itemVerdecora` ( DROP TABLE IF EXISTS `labourTree`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `labourTree` ( `id` int(11) NOT NULL DEFAULT '0', `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, @@ -25441,7 +22012,7 @@ CREATE TABLE `labourTree` ( DROP TABLE IF EXISTS `ledgerConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ledgerConfig` ( `lastBookEntry` int(11) NOT NULL, PRIMARY KEY (`lastBookEntry`) @@ -25454,7 +22025,7 @@ CREATE TABLE `ledgerConfig` ( DROP TABLE IF EXISTS `mail`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `mail` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `sender` varchar(255) COLLATE utf8_unicode_ci NOT NULL, @@ -25471,7 +22042,7 @@ CREATE TABLE `mail` ( PRIMARY KEY (`id`), KEY `sent_idx` (`sent`), KEY `creation_idx` (`creationDate`) -) ENGINE=InnoDB AUTO_INCREMENT=1969292 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25480,13 +22051,13 @@ CREATE TABLE `mail` ( DROP TABLE IF EXISTS `mailTemplates`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `mailTemplates` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) CHARACTER SET utf8 NOT NULL, `attachmentPath` text CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25495,7 +22066,7 @@ CREATE TABLE `mailTemplates` ( DROP TABLE IF EXISTS `mandate`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `mandate` ( `id` int(11) NOT NULL AUTO_INCREMENT, `clientFk` int(11) NOT NULL, @@ -25511,7 +22082,7 @@ CREATE TABLE `mandate` ( CONSTRAINT `mandato_fgkey1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `mandato_fgkey2` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `mandato_fgkey3` FOREIGN KEY (`mandateTypeFk`) REFERENCES `mandateType` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=17348 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -25544,12 +22115,12 @@ DELIMITER ; DROP TABLE IF EXISTS `mandateType`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `mandateType` ( `id` smallint(5) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25558,7 +22129,7 @@ CREATE TABLE `mandateType` ( DROP TABLE IF EXISTS `manuscript`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `manuscript` ( `id` int(11) NOT NULL AUTO_INCREMENT, `code` varchar(45) CHARACTER SET utf8 NOT NULL, @@ -25566,7 +22137,7 @@ CREATE TABLE `manuscript` ( `enabled` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25575,12 +22146,12 @@ CREATE TABLE `manuscript` ( DROP TABLE IF EXISTS `medicalCenter`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `medicalCenter` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25589,7 +22160,7 @@ CREATE TABLE `medicalCenter` ( DROP TABLE IF EXISTS `medicalReview`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `medicalReview` ( `id` int(11) NOT NULL AUTO_INCREMENT, `workerFk` int(11) NOT NULL, @@ -25605,7 +22176,7 @@ CREATE TABLE `medicalReview` ( KEY `frgnkWorker_idx` (`workerFk`), CONSTRAINT `frgcenter` FOREIGN KEY (`centerFk`) REFERENCES `medicalCenter` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `frgnkWorker` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=369 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25614,7 +22185,7 @@ CREATE TABLE `medicalReview` ( DROP TABLE IF EXISTS `message`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `message` ( `id` int(11) NOT NULL AUTO_INCREMENT, `uuid` varchar(50) CHARACTER SET utf8 NOT NULL, @@ -25626,7 +22197,7 @@ CREATE TABLE `message` ( KEY `sender` (`sender`), KEY `recipient` (`recipient`), KEY `uuid` (`uuid`(8)) -) ENGINE=InnoDB AUTO_INCREMENT=2077647 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25635,7 +22206,7 @@ CREATE TABLE `message` ( DROP TABLE IF EXISTS `messageInbox`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `messageInbox` ( `id` int(11) NOT NULL AUTO_INCREMENT, `uuid` varchar(50) CHARACTER SET utf8 NOT NULL, @@ -25648,7 +22219,7 @@ CREATE TABLE `messageInbox` ( PRIMARY KEY (`id`), KEY `uuid` (`uuid`(8)), KEY `finalRecipient` (`finalRecipient`) -) ENGINE=InnoDB AUTO_INCREMENT=2254338 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25657,13 +22228,13 @@ CREATE TABLE `messageInbox` ( DROP TABLE IF EXISTS `mobileAppVersionControl`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `mobileAppVersionControl` ( `id` int(11) NOT NULL AUTO_INCREMENT, `appName` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `version` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla para llevar el control de las Versions de las aplicaciones móvil '; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla para llevar el control de las Versions de las aplicaciones móvil '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25672,7 +22243,7 @@ CREATE TABLE `mobileAppVersionControl` ( DROP TABLE IF EXISTS `noticeCategory`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `noticeCategory` ( `id` int(11) NOT NULL AUTO_INCREMENT, `keyName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -25683,7 +22254,7 @@ CREATE TABLE `noticeCategory` ( `requiredRole` int(11) NOT NULL DEFAULT '1', PRIMARY KEY (`id`), UNIQUE KEY `keyName_UNIQUE` (`keyName`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25692,7 +22263,7 @@ CREATE TABLE `noticeCategory` ( DROP TABLE IF EXISTS `noticeSubscription`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `noticeSubscription` ( `noticeCategoryFk` int(11) NOT NULL DEFAULT '0', `userFk` int(10) unsigned NOT NULL DEFAULT '0', @@ -25709,12 +22280,12 @@ CREATE TABLE `noticeSubscription` ( DROP TABLE IF EXISTS `observationType`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `observationType` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `description` varchar(15) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25723,7 +22294,7 @@ CREATE TABLE `observationType` ( DROP TABLE IF EXISTS `orderTicket`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `orderTicket` ( `orderFk` int(10) unsigned NOT NULL, `ticketFk` int(11) NOT NULL DEFAULT '0', @@ -25738,7 +22309,7 @@ CREATE TABLE `orderTicket` ( DROP TABLE IF EXISTS `origin`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `origin` ( `id` tinyint(2) unsigned NOT NULL AUTO_INCREMENT, `code` varchar(3) COLLATE utf8_unicode_ci NOT NULL, @@ -25752,7 +22323,7 @@ CREATE TABLE `origin` ( KEY `warehouse_id` (`warehouseFk`), KEY `Id_Paises` (`countryFk`), CONSTRAINT `origin_ibfk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=60 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25761,7 +22332,7 @@ CREATE TABLE `origin` ( DROP TABLE IF EXISTS `originI18n`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `originI18n` ( `originFk` tinyint(2) unsigned NOT NULL, `lang` char(2) CHARACTER SET utf8 NOT NULL, @@ -25771,13 +22342,13 @@ CREATE TABLE `originI18n` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `originL10n` +-- Temporary table structure for view `originL10n` -- DROP TABLE IF EXISTS `originL10n`; /*!50001 DROP VIEW IF EXISTS `originL10n`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `originL10n` AS SELECT 1 AS `id`, 1 AS `name`*/; @@ -25789,7 +22360,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `outgoingInvoiceVat`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `outgoingInvoiceVat` ( `outgoingInvoice` mediumint(8) NOT NULL, `taxBase` decimal(12,2) DEFAULT NULL, @@ -25805,14 +22376,14 @@ CREATE TABLE `outgoingInvoiceVat` ( DROP TABLE IF EXISTS `packageChecked`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `packageChecked` ( `id` int(11) NOT NULL AUTO_INCREMENT, `itemFk` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `entryFk_UNIQUE` (`itemFk`), KEY `fkItem_idx` (`itemFk`) -) ENGINE=InnoDB AUTO_INCREMENT=3438 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25821,7 +22392,7 @@ CREATE TABLE `packageChecked` ( DROP TABLE IF EXISTS `packageEquivalent`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `packageEquivalent` ( `packageFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `equivalentFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, @@ -25833,13 +22404,13 @@ CREATE TABLE `packageEquivalent` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `packageEquivalentItem` +-- Temporary table structure for view `packageEquivalentItem` -- DROP TABLE IF EXISTS `packageEquivalentItem`; /*!50001 DROP VIEW IF EXISTS `packageEquivalentItem`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `packageEquivalentItem` AS SELECT 1 AS `itemFk`, 1 AS `equivalentFk`*/; @@ -25851,7 +22422,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `packaging`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `packaging` ( `id` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `volume` decimal(10,2) DEFAULT '0.00', @@ -25883,7 +22454,7 @@ CREATE TABLE `packaging` ( DROP TABLE IF EXISTS `parking`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `parking` ( `id` int(11) NOT NULL AUTO_INCREMENT, `column` varchar(5) CHARACTER SET utf8 NOT NULL DEFAULT '--', @@ -25895,7 +22466,7 @@ CREATE TABLE `parking` ( UNIQUE KEY `code_UNIQUE` (`code`), KEY `parking_fk1_idx` (`sectorFk`), CONSTRAINT `parking_fk1` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=27886 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla con los parkings del altillo'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla con los parkings del altillo'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -25944,12 +22515,12 @@ DELIMITER ; DROP TABLE IF EXISTS `payDem`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `payDem` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `payDem` varchar(15) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25958,7 +22529,7 @@ CREATE TABLE `payDem` ( DROP TABLE IF EXISTS `payMethod`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `payMethod` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, @@ -25968,7 +22539,7 @@ CREATE TABLE `payMethod` ( `ibanRequired` tinyint(3) DEFAULT '0', `isNotified` tinyint(3) NOT NULL DEFAULT '1', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25977,13 +22548,13 @@ CREATE TABLE `payMethod` ( DROP TABLE IF EXISTS `pedidosInternos`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `pedidosInternos` ( `id` int(11) NOT NULL AUTO_INCREMENT, `idArticle` int(11) DEFAULT NULL, `quantity` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25992,7 +22563,7 @@ CREATE TABLE `pedidosInternos` ( DROP TABLE IF EXISTS `person`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `person` ( `id` int(11) NOT NULL AUTO_INCREMENT, `firstname` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -26009,17 +22580,17 @@ CREATE TABLE `person` ( KEY `nifIndex` (`fi`), KEY `workerFk_idx` (`workerFk`), CONSTRAINT `Person_ibfk_1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=818 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `personMedia` +-- Temporary table structure for view `personMedia` -- DROP TABLE IF EXISTS `personMedia`; /*!50001 DROP VIEW IF EXISTS `personMedia`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `personMedia` AS SELECT 1 AS `workerFk`, 1 AS `mediaValue`*/; @@ -26031,7 +22602,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `pgc`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `pgc` ( `code` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `rate` decimal(10,2) NOT NULL, @@ -26054,7 +22625,7 @@ CREATE TABLE `pgc` ( DROP TABLE IF EXISTS `pgcEqu`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `pgcEqu` ( `vatFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Cuenta de IVA', `equFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Cuenta de recargo de equivalencia', @@ -26071,7 +22642,7 @@ CREATE TABLE `pgcEqu` ( DROP TABLE IF EXISTS `postCode`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `postCode` ( `code` varchar(30) COLLATE utf8_unicode_ci NOT NULL, `townFk` int(11) NOT NULL, @@ -26175,7 +22746,7 @@ DELIMITER ; DROP TABLE IF EXISTS `postCodeBack__`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `postCodeBack__` ( `code` varchar(30) COLLATE utf8_unicode_ci NOT NULL, `townFk` int(11) NOT NULL, @@ -26191,7 +22762,7 @@ CREATE TABLE `postCodeBack__` ( DROP TABLE IF EXISTS `priceBuilderTag__`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `priceBuilderTag__` ( `id` int(11) NOT NULL AUTO_INCREMENT, `priceBuilderFk` int(11) NOT NULL, @@ -26202,7 +22773,7 @@ CREATE TABLE `priceBuilderTag__` ( KEY `priceBuilderTag_fk2_idx` (`tagFk`), CONSTRAINT `priceBuilderTag_fk1` FOREIGN KEY (`priceBuilderFk`) REFERENCES `priceBuilder__` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `priceBuilderTag_fk2` FOREIGN KEY (`tagFk`) REFERENCES `tag` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26211,7 +22782,7 @@ CREATE TABLE `priceBuilderTag__` ( DROP TABLE IF EXISTS `priceBuilderWarehouse__`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `priceBuilderWarehouse__` ( `id` int(11) NOT NULL AUTO_INCREMENT, `warehouseFk` smallint(6) unsigned NOT NULL, @@ -26221,7 +22792,7 @@ CREATE TABLE `priceBuilderWarehouse__` ( KEY `priceBuilderWarehouse_fk2_idx` (`priceBuilderFk`), CONSTRAINT `priceBuilderWarehouse_fk1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `priceBuilderWarehouse_fk2` FOREIGN KEY (`priceBuilderFk`) REFERENCES `priceBuilder__` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26230,7 +22801,7 @@ CREATE TABLE `priceBuilderWarehouse__` ( DROP TABLE IF EXISTS `priceBuilder__`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `priceBuilder__` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, @@ -26244,7 +22815,7 @@ CREATE TABLE `priceBuilder__` ( KEY `priceBuilder_fk2_idx` (`userFk`), CONSTRAINT `priceBuilder_fk1` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `priceBuilder_fk2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26253,7 +22824,7 @@ CREATE TABLE `priceBuilder__` ( DROP TABLE IF EXISTS `priceFixed`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `priceFixed` ( `itemFk` int(10) NOT NULL, `rate0` double NOT NULL, @@ -26276,7 +22847,7 @@ CREATE TABLE `priceFixed` ( KEY `date_end` (`ended`), KEY `warehouse_id` (`warehouseFk`), CONSTRAINT `priceFixed_ibfk_1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=65157 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -26333,7 +22904,7 @@ DELIMITER ; DROP TABLE IF EXISTS `printServerQueue`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `printServerQueue` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `printerFk` tinyint(3) unsigned DEFAULT NULL, @@ -26356,7 +22927,7 @@ CREATE TABLE `printServerQueue` ( KEY `Id_Trabajador` (`workerFk`), CONSTRAINT `printServerQueue_ibfk_3` FOREIGN KEY (`priorityFk`) REFERENCES `queuePriority` (`id`) ON UPDATE CASCADE, CONSTRAINT `printServerQueue_ibfk_4` FOREIGN KEY (`printerFk`) REFERENCES `vn2008`.`Impresoras` (`Id_Impresora`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=20465 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26365,7 +22936,7 @@ CREATE TABLE `printServerQueue` ( DROP TABLE IF EXISTS `printingQueueCheck`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `printingQueueCheck` ( `lastCount` int(11) unsigned NOT NULL DEFAULT '0', `lastCheckSum` int(11) unsigned NOT NULL DEFAULT '0', @@ -26380,14 +22951,14 @@ CREATE TABLE `printingQueueCheck` ( DROP TABLE IF EXISTS `producer`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `producer` ( `id` mediumint(3) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `isVisible` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`id`), UNIQUE KEY `name_UNIQUE` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=41633 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26396,7 +22967,7 @@ CREATE TABLE `producer` ( DROP TABLE IF EXISTS `professionalCategory`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `professionalCategory` ( `id` int(11) NOT NULL, `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -26412,7 +22983,7 @@ CREATE TABLE `professionalCategory` ( DROP TABLE IF EXISTS `profile`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `profile` ( `id` int(11) NOT NULL AUTO_INCREMENT, `personFk` int(11) DEFAULT NULL, @@ -26422,7 +22993,7 @@ CREATE TABLE `profile` ( KEY `profileTypeFk` (`profileTypeFk`), CONSTRAINT `profile_ibfk_1` FOREIGN KEY (`personFk`) REFERENCES `person` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `profile_ibfk_2` FOREIGN KEY (`profileTypeFk`) REFERENCES `profileType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=697 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26431,12 +23002,12 @@ CREATE TABLE `profile` ( DROP TABLE IF EXISTS `profileType`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `profileType` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26445,7 +23016,7 @@ CREATE TABLE `profileType` ( DROP TABLE IF EXISTS `province`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `province` ( `id` smallint(6) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(30) COLLATE utf8_unicode_ci NOT NULL, @@ -26462,7 +23033,7 @@ CREATE TABLE `province` ( CONSTRAINT `province_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE, CONSTRAINT `province_zone_fk` FOREIGN KEY (`zoneFk`) REFERENCES `vn2008`.`zones` (`zone_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `warehouse_Id` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=217 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -26558,7 +23129,7 @@ DELIMITER ; DROP TABLE IF EXISTS `punchState`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `punchState` ( `workerFk` int(11) NOT NULL, `state` tinyint(4) DEFAULT '0', @@ -26572,7 +23143,7 @@ CREATE TABLE `punchState` ( DROP TABLE IF EXISTS `queuePriority`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `queuePriority` ( `id` tinyint(3) unsigned NOT NULL DEFAULT '0', `priority` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -26586,7 +23157,7 @@ CREATE TABLE `queuePriority` ( DROP TABLE IF EXISTS `rateConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `rateConfig` ( `id` int(11) NOT NULL, `rate0` int(11) DEFAULT NULL, @@ -26603,7 +23174,7 @@ CREATE TABLE `rateConfig` ( DROP TABLE IF EXISTS `receipt`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `receipt` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `invoiceFk` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -26626,7 +23197,7 @@ CREATE TABLE `receipt` ( CONSTRAINT `receipt_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `receipt_ibfk_2` FOREIGN KEY (`bankFk`) REFERENCES `bank` (`id`) ON UPDATE CASCADE, CONSTRAINT `recibo_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=616111 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -26686,7 +23257,7 @@ DELIMITER ; DROP TABLE IF EXISTS `recovery`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `recovery` ( `id` int(11) NOT NULL AUTO_INCREMENT, `clientFk` int(11) NOT NULL DEFAULT '0', @@ -26698,7 +23269,7 @@ CREATE TABLE `recovery` ( KEY `cliente_idx` (`clientFk`), CONSTRAINT `cliente333` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, CONSTRAINT `cliente_cliente` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=318 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla apuntaremos los acuerdos de recobro semanal a '; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla apuntaremos los acuerdos de recobro semanal a '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26707,7 +23278,7 @@ CREATE TABLE `recovery` ( DROP TABLE IF EXISTS `referenceCurrent`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `referenceCurrent` ( `dated` date NOT NULL, `value` decimal(10,4) NOT NULL, @@ -26722,7 +23293,7 @@ CREATE TABLE `referenceCurrent` ( DROP TABLE IF EXISTS `referenceRate`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `referenceRate` ( `currencyFk` tinyint(3) unsigned NOT NULL, `dated` date NOT NULL, @@ -26738,7 +23309,7 @@ CREATE TABLE `referenceRate` ( DROP TABLE IF EXISTS `referenceRateConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `referenceRateConfig` ( `simulatedValue` float unsigned NOT NULL DEFAULT '1.2309', PRIMARY KEY (`simulatedValue`) @@ -26746,13 +23317,13 @@ CREATE TABLE `referenceRateConfig` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `role` +-- Temporary table structure for view `role` -- DROP TABLE IF EXISTS `role`; /*!50001 DROP VIEW IF EXISTS `role`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `role` AS SELECT 1 AS `id`, 1 AS `name`, @@ -26766,7 +23337,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `route`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `route` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `workerFk` int(11) DEFAULT NULL, @@ -26790,7 +23361,7 @@ CREATE TABLE `route` ( KEY `route_ibfk_2_idx` (`workerFk`), CONSTRAINT `route_ibfk_1` FOREIGN KEY (`gestdocFk`) REFERENCES `dms` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `route_ibfk_2` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=61044 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -26854,13 +23425,13 @@ DELIMITER ; DROP TABLE IF EXISTS `routeAction`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `routeAction` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `price` decimal(10,2) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26869,7 +23440,7 @@ CREATE TABLE `routeAction` ( DROP TABLE IF EXISTS `routeComplement`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `routeComplement` ( `id` int(11) NOT NULL AUTO_INCREMENT, `dated` date NOT NULL, @@ -26881,7 +23452,7 @@ CREATE TABLE `routeComplement` ( KEY `fgn_routeActionFk_idx` (`routeActionFk`), CONSTRAINT `fgn_routeActionFk` FOREIGN KEY (`routeActionFk`) REFERENCES `routeAction` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fgn_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1136 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26890,7 +23461,7 @@ CREATE TABLE `routeComplement` ( DROP TABLE IF EXISTS `routeGate`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `routeGate` ( `deviceId` varchar(30) CHARACTER SET utf8 NOT NULL, `displayText` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -26949,7 +23520,7 @@ DELIMITER ; DROP TABLE IF EXISTS `routeLoadWorker`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `routeLoadWorker` ( `routeFk` int(10) unsigned NOT NULL, `workerFk` int(11) NOT NULL, @@ -26966,7 +23537,7 @@ CREATE TABLE `routeLoadWorker` ( DROP TABLE IF EXISTS `routeLog`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `routeLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `originFk` int(10) unsigned NOT NULL, @@ -26984,7 +23555,7 @@ CREATE TABLE `routeLog` ( KEY `userFk` (`userFk`), CONSTRAINT `routeLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `route` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `routeLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=227662 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26993,7 +23564,7 @@ CREATE TABLE `routeLog` ( DROP TABLE IF EXISTS `routeParams`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `routeParams` ( `ID` int(10) unsigned NOT NULL AUTO_INCREMENT, `kmRate` decimal(10,4) DEFAULT NULL, @@ -27006,7 +23577,7 @@ CREATE TABLE `routeParams` ( `load5m3` decimal(10,4) DEFAULT NULL, `load6m3` decimal(10,4) DEFAULT NULL, PRIMARY KEY (`ID`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27015,7 +23586,7 @@ CREATE TABLE `routeParams` ( DROP TABLE IF EXISTS `routeUserPercentage`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `routeUserPercentage` ( `id` int(11) NOT NULL AUTO_INCREMENT, `workerFk` int(11) NOT NULL, @@ -27024,7 +23595,7 @@ CREATE TABLE `routeUserPercentage` ( PRIMARY KEY (`id`), KEY `routeUserPercentageFk_idx` (`workerFk`), CONSTRAINT `routeUserPercentageFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27033,7 +23604,7 @@ CREATE TABLE `routeUserPercentage` ( DROP TABLE IF EXISTS `sale`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `sale` ( `id` int(11) NOT NULL AUTO_INCREMENT, `itemFk` int(11) NOT NULL, @@ -27053,7 +23624,7 @@ CREATE TABLE `sale` ( KEY `itemFk_ticketFk` (`itemFk`,`ticketFk`), CONSTRAINT `movement_ticket_id` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `sale_ibfk_1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=26615111 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -27158,7 +23729,7 @@ DELIMITER ; DROP TABLE IF EXISTS `saleChecked`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `saleChecked` ( `saleFk` int(11) NOT NULL, `isChecked` int(11) NOT NULL DEFAULT '0', @@ -27173,7 +23744,7 @@ CREATE TABLE `saleChecked` ( DROP TABLE IF EXISTS `saleComponent`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `saleComponent` ( `saleFk` int(11) NOT NULL, `componentFk` int(11) NOT NULL, @@ -27188,13 +23759,13 @@ CREATE TABLE `saleComponent` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `saleFreight` +-- Temporary table structure for view `saleFreight` -- DROP TABLE IF EXISTS `saleFreight`; /*!50001 DROP VIEW IF EXISTS `saleFreight`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `saleFreight` AS SELECT 1 AS `ticketFk`, 1 AS `clientFk`, @@ -27214,7 +23785,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `saleItemShelving`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `saleItemShelving` ( `id` int(11) NOT NULL AUTO_INCREMENT, `saleFk` int(11) NOT NULL, @@ -27224,7 +23795,7 @@ CREATE TABLE `saleItemShelving` ( `ubication` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `saleItemShelving_fk1_idx` (`itemShelvingFk`) -) ENGINE=InnoDB AUTO_INCREMENT=26208 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27233,7 +23804,7 @@ CREATE TABLE `saleItemShelving` ( DROP TABLE IF EXISTS `saleState`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `saleState` ( `saleFk` int(11) NOT NULL, `stateFk` tinyint(3) unsigned NOT NULL, @@ -27250,7 +23821,7 @@ CREATE TABLE `saleState` ( DROP TABLE IF EXISTS `saleTracking`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `saleTracking` ( `saleFk` int(11) NOT NULL, `isChecked` tinyint(3) unsigned NOT NULL DEFAULT '0', @@ -27268,7 +23839,7 @@ CREATE TABLE `saleTracking` ( KEY `saleTracking_fk2_idx` (`actionFk`), CONSTRAINT `fgnStateFk` FOREIGN KEY (`stateFk`) REFERENCES `state` (`id`) ON UPDATE CASCADE, CONSTRAINT `saleTracking_fk2` FOREIGN KEY (`actionFk`) REFERENCES `vncontrol`.`accion` (`accion_id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=21545889 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -27296,13 +23867,13 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Temporary view structure for view `saleVolume` +-- Temporary table structure for view `saleVolume` -- DROP TABLE IF EXISTS `saleVolume`; /*!50001 DROP VIEW IF EXISTS `saleVolume`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `saleVolume` AS SELECT 1 AS `ticketFk`, 1 AS `saleFk`, @@ -27321,7 +23892,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `sample`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `sample` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `code` varchar(20) CHARACTER SET utf8 NOT NULL, @@ -27329,7 +23900,7 @@ CREATE TABLE `sample` ( `isVisible` tinyint(4) NOT NULL DEFAULT '1', `hasCompany` varchar(45) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27338,7 +23909,7 @@ CREATE TABLE `sample` ( DROP TABLE IF EXISTS `sector`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `sector` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, @@ -27351,7 +23922,7 @@ CREATE TABLE `sector` ( UNIQUE KEY `code_UNIQUE` (`code`), KEY `sector_fk1_idx` (`warehouseFk`), CONSTRAINT `sector_fk1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27360,7 +23931,7 @@ CREATE TABLE `sector` ( DROP TABLE IF EXISTS `sharingCart`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `sharingCart` ( `id` int(11) NOT NULL AUTO_INCREMENT, `workerFk` int(11) NOT NULL, @@ -27373,7 +23944,7 @@ CREATE TABLE `sharingCart` ( KEY `Suplent` (`workerSubstitute`), CONSTRAINT `Suplent_key` FOREIGN KEY (`workerSubstitute`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `Trabajador_key` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2250 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -27430,7 +24001,7 @@ DELIMITER ; DROP TABLE IF EXISTS `sharingClient`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `sharingClient` ( `id` int(11) NOT NULL AUTO_INCREMENT, `workerFk` int(11) NOT NULL, @@ -27442,7 +24013,7 @@ CREATE TABLE `sharingClient` ( KEY `Client` (`clientFk`), CONSTRAINT `Clients_key` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, CONSTRAINT `Trabajadores_key` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -27489,7 +24060,7 @@ DELIMITER ; DROP TABLE IF EXISTS `shelving`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `shelving` ( `code` varchar(10) CHARACTER SET utf8 NOT NULL, `parkingFk` int(11) DEFAULT NULL, @@ -27537,7 +24108,7 @@ DELIMITER ; DROP TABLE IF EXISTS `sms`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `sms` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `senderFk` int(11) NOT NULL, @@ -27549,7 +24120,7 @@ CREATE TABLE `sms` ( `status` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=158472 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27558,7 +24129,7 @@ CREATE TABLE `sms` ( DROP TABLE IF EXISTS `smsConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `smsConfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `uri` varchar(255) COLLATE utf8_unicode_ci NOT NULL, @@ -27566,7 +24137,7 @@ CREATE TABLE `smsConfig` ( `password` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `title` varchar(50) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='SMS configuration parameters'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='SMS configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27575,7 +24146,7 @@ CREATE TABLE `smsConfig` ( DROP TABLE IF EXISTS `solunionCAP`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `solunionCAP` ( `creditInsurance` int(11) NOT NULL, `dateStart` date NOT NULL, @@ -27669,7 +24240,7 @@ ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; DROP TABLE IF EXISTS `specialPrice`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `specialPrice` ( `id` int(11) NOT NULL AUTO_INCREMENT, `clientFk` int(11) NOT NULL DEFAULT '0', @@ -27683,7 +24254,7 @@ CREATE TABLE `specialPrice` ( CONSTRAINT `sp_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, CONSTRAINT `{01A99AF1-3D3F-4B15-AC0C-C7A834F319A3}` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `{EE4ADEF6-0AC6-401F-B7C4-D797972FC065}` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=713 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27692,7 +24263,7 @@ CREATE TABLE `specialPrice` ( DROP TABLE IF EXISTS `state`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `state` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, @@ -27705,7 +24276,7 @@ CREATE TABLE `state` ( `isPicked` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`) -) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27714,7 +24285,7 @@ CREATE TABLE `state` ( DROP TABLE IF EXISTS `stockBuyed`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `stockBuyed` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user` int(10) unsigned DEFAULT NULL, @@ -27727,7 +24298,7 @@ CREATE TABLE `stockBuyed` ( UNIQUE KEY `date_UNIQUE` (`date`,`user`), KEY `stockBuyed_user_idx` (`user`), CONSTRAINT `stockBuyedUserFk` FOREIGN KEY (`user`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=864507 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27736,7 +24307,7 @@ CREATE TABLE `stockBuyed` ( DROP TABLE IF EXISTS `stowaway`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `stowaway` ( `id` int(11) NOT NULL COMMENT 'ticket pequeño', `shipFk` int(11) NOT NULL COMMENT 'ticket grande', @@ -27751,7 +24322,7 @@ CREATE TABLE `stowaway` ( DROP TABLE IF EXISTS `supplier`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `supplier` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -27790,7 +24361,7 @@ CREATE TABLE `supplier` ( CONSTRAINT `pay_dem_id` FOREIGN KEY (`payDemFk`) REFERENCES `payDem` (`id`) ON UPDATE CASCADE, CONSTRAINT `pay_met_id` FOREIGN KEY (`payMethodFk`) REFERENCES `payMethod` (`id`) ON UPDATE CASCADE, CONSTRAINT `province_id` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2993 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27799,7 +24370,7 @@ CREATE TABLE `supplier` ( DROP TABLE IF EXISTS `supplierAccount`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `supplierAccount` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `supplierFk` int(11) NOT NULL, @@ -27815,7 +24386,7 @@ CREATE TABLE `supplierAccount` ( KEY `fk_proveedores_proveedores_account_idx` (`supplierFk`), KEY `fk_Proveedores_account_entity1_idx` (`bankEntityFk`), KEY `fk_banco_prov_account_idx` (`bankFk`) -) ENGINE=InnoDB AUTO_INCREMENT=894 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27824,7 +24395,7 @@ CREATE TABLE `supplierAccount` ( DROP TABLE IF EXISTS `supplierExpense`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `supplierExpense` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `dated` date NOT NULL, @@ -27848,17 +24419,17 @@ CREATE TABLE `supplierExpense` ( CONSTRAINT `pago_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `pago_moneda` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`id`) ON UPDATE CASCADE, CONSTRAINT `proveedor_pago` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=130 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `supplierPackaging` +-- Temporary table structure for view `supplierPackaging` -- DROP TABLE IF EXISTS `supplierPackaging`; /*!50001 DROP VIEW IF EXISTS `supplierPackaging`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `supplierPackaging` AS SELECT 1 AS `supplierFk`, 1 AS `itemFk`, @@ -27877,7 +24448,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `tablet`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `tablet` ( `uuid` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -27893,7 +24464,7 @@ CREATE TABLE `tablet` ( DROP TABLE IF EXISTS `tabletDepartment`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `tabletDepartment` ( `tabletFk` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `departmentFk` int(11) NOT NULL, @@ -27909,7 +24480,7 @@ CREATE TABLE `tabletDepartment` ( DROP TABLE IF EXISTS `tag`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `tag` ( `id` int(11) NOT NULL AUTO_INCREMENT, `code` varchar(45) CHARACTER SET utf8 NOT NULL, @@ -27922,7 +24493,7 @@ CREATE TABLE `tag` ( PRIMARY KEY (`id`), KEY `tagEdiTypeFkIdx` (`ediTypeFk`), CONSTRAINT `fgnTag` FOREIGN KEY (`ediTypeFk`) REFERENCES `edi`.`type` (`type_id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=111 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Categorias para etiquetar los productos'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Categorias para etiquetar los productos'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27931,7 +24502,7 @@ CREATE TABLE `tag` ( DROP TABLE IF EXISTS `tagAbbreviation`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `tagAbbreviation` ( `value` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `abbreviation` varchar(10) COLLATE utf8_unicode_ci NOT NULL, @@ -27945,7 +24516,7 @@ CREATE TABLE `tagAbbreviation` ( DROP TABLE IF EXISTS `tagI18n`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `tagI18n` ( `tagFk` int(10) unsigned NOT NULL, `lang` char(2) CHARACTER SET utf8 NOT NULL, @@ -27955,13 +24526,13 @@ CREATE TABLE `tagI18n` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `tagL10n` +-- Temporary table structure for view `tagL10n` -- DROP TABLE IF EXISTS `tagL10n`; /*!50001 DROP VIEW IF EXISTS `tagL10n`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `tagL10n` AS SELECT 1 AS `id`, 1 AS `name`*/; @@ -27973,7 +24544,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `taxArea`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `taxArea` ( `code` varchar(15) CHARACTER SET utf8 NOT NULL, `ClaveOperacionFactura` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -27988,13 +24559,13 @@ CREATE TABLE `taxArea` ( DROP TABLE IF EXISTS `taxClass`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `taxClass` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `description` varchar(30) COLLATE utf8_unicode_ci NOT NULL, `code` varchar(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'R', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28003,7 +24574,7 @@ CREATE TABLE `taxClass` ( DROP TABLE IF EXISTS `taxClassCode`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `taxClassCode` ( `taxClassFk` tinyint(3) unsigned NOT NULL, `effectived` date NOT NULL, @@ -28021,7 +24592,7 @@ CREATE TABLE `taxClassCode` ( DROP TABLE IF EXISTS `taxCode`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `taxCode` ( `id` tinyint(2) unsigned NOT NULL AUTO_INCREMENT, `dated` date NOT NULL, @@ -28039,7 +24610,7 @@ CREATE TABLE `taxCode` ( KEY `codigo` (`code`), KEY `tipo_index` (`type`), CONSTRAINT `taxCode_ibfk_1` FOREIGN KEY (`taxTypeFk`) REFERENCES `taxType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=123 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28048,7 +24619,7 @@ CREATE TABLE `taxCode` ( DROP TABLE IF EXISTS `taxType`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `taxType` ( `id` tinyint(2) NOT NULL AUTO_INCREMENT, `nickname` varchar(6) COLLATE utf8_unicode_ci NOT NULL, @@ -28061,7 +24632,7 @@ CREATE TABLE `taxType` ( KEY `serie_id` (`serial`), KEY `Id_Pais` (`countryFk`), CONSTRAINT `taxType_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28070,7 +24641,7 @@ CREATE TABLE `taxType` ( DROP TABLE IF EXISTS `ticket`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticket` ( `id` int(11) NOT NULL AUTO_INCREMENT, `clientFk` int(11) NOT NULL DEFAULT '0', @@ -28125,7 +24696,7 @@ CREATE TABLE `ticket` ( CONSTRAINT `tickets_fk10` FOREIGN KEY (`refFk`) REFERENCES `invoiceOut` (`ref`) ON UPDATE CASCADE, CONSTRAINT `tickets_fk11` FOREIGN KEY (`collectionFk`) REFERENCES `collection` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `tickets_zone_fk` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2513929 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -28262,7 +24833,7 @@ DELIMITER ; DROP TABLE IF EXISTS `ticketCollection`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketCollection` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ticketFk` int(11) NOT NULL, @@ -28274,7 +24845,7 @@ CREATE TABLE `ticketCollection` ( KEY `ticketCollection_fk2_idx` (`ticketFk`), CONSTRAINT `ticketCollection_fk1` FOREIGN KEY (`collectionFk`) REFERENCES `collection` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketCollection_fk2` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1241 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28283,12 +24854,12 @@ CREATE TABLE `ticketCollection` ( DROP TABLE IF EXISTS `ticketConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, `scopeDays` tinyint(3) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28297,7 +24868,7 @@ CREATE TABLE `ticketConfig` ( DROP TABLE IF EXISTS `ticketDms`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketDms` ( `ticketFk` int(11) NOT NULL, `dmsFk` int(11) NOT NULL, @@ -28334,7 +24905,7 @@ DELIMITER ; DROP TABLE IF EXISTS `ticketDown`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketDown` ( `ticketFk` int(11) NOT NULL, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -28352,7 +24923,7 @@ CREATE TABLE `ticketDown` ( DROP TABLE IF EXISTS `ticketDown_SelectionType`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketDown_SelectionType` ( `id` int(11) NOT NULL, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, @@ -28362,13 +24933,13 @@ CREATE TABLE `ticketDown_SelectionType` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `ticketGetVolume__` +-- Temporary table structure for view `ticketGetVolume__` -- DROP TABLE IF EXISTS `ticketGetVolume__`; /*!50001 DROP VIEW IF EXISTS `ticketGetVolume__`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `ticketGetVolume__` AS SELECT 1 AS `ticketFk`, 1 AS `routeFk`, @@ -28383,7 +24954,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `ticketLastState`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketLastState` ( `ticketFk` int(11) NOT NULL DEFAULT '0', `ticketTrackingFk` int(11) NOT NULL, @@ -28401,7 +24972,7 @@ CREATE TABLE `ticketLastState` ( DROP TABLE IF EXISTS `ticketLog`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `originFk` int(11) NOT NULL, @@ -28419,17 +24990,17 @@ CREATE TABLE `ticketLog` ( KEY `logTicketuserFk` (`userFk`), CONSTRAINT `ticketLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketLog_user` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=8412961 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `ticketNotInvoiced` +-- Temporary table structure for view `ticketNotInvoiced` -- DROP TABLE IF EXISTS `ticketNotInvoiced`; /*!50001 DROP VIEW IF EXISTS `ticketNotInvoiced`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `ticketNotInvoiced` AS SELECT 1 AS `companyFk`, 1 AS `companyCode`, @@ -28445,7 +25016,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `ticketObservation`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketObservation` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `ticketFk` int(11) NOT NULL, @@ -28456,7 +25027,7 @@ CREATE TABLE `ticketObservation` ( KEY `observation_type_id` (`observationTypeFk`), CONSTRAINT `ticketObservation_ibfk_1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketObservation_ibfk_2` FOREIGN KEY (`observationTypeFk`) REFERENCES `observationType` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1530942 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28465,7 +25036,7 @@ CREATE TABLE `ticketObservation` ( DROP TABLE IF EXISTS `ticketPackage`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketPackage` ( `ticket` int(11) NOT NULL, `counter` int(10) unsigned NOT NULL DEFAULT '0', @@ -28480,7 +25051,7 @@ CREATE TABLE `ticketPackage` ( DROP TABLE IF EXISTS `ticketPackaging`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketPackaging` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ticketFk` int(11) NOT NULL, @@ -28496,7 +25067,7 @@ CREATE TABLE `ticketPackaging` ( CONSTRAINT `ticketPackaging_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketPackaging_fk2` FOREIGN KEY (`packagingFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE, CONSTRAINT `ticketPackaging_fk3` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=79234 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -28525,7 +25096,7 @@ DELIMITER ; DROP TABLE IF EXISTS `ticketPackagingStartingStock`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketPackagingStartingStock` ( `clientFk` int(11) NOT NULL, `packagingFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, @@ -28548,7 +25119,7 @@ CREATE TABLE `ticketPackagingStartingStock` ( DROP TABLE IF EXISTS `ticketParking`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketParking` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ticketFk` int(11) NOT NULL, @@ -28559,17 +25130,17 @@ CREATE TABLE `ticketParking` ( KEY `ticketParking_fk1_idx` (`parkingFk`), CONSTRAINT `ticketParking_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketParking_fk2` FOREIGN KEY (`parkingFk`) REFERENCES `parking` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=16798 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los distintos lugares donde puede estar aparcado cada uno de los prepedidos'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los distintos lugares donde puede estar aparcado cada uno de los prepedidos'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `ticketPreviousPreparingList` +-- Temporary table structure for view `ticketPreviousPreparingList` -- DROP TABLE IF EXISTS `ticketPreviousPreparingList`; /*!50001 DROP VIEW IF EXISTS `ticketPreviousPreparingList`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `ticketPreviousPreparingList` AS SELECT 1 AS `ticketFk`, 1 AS `code`, @@ -28587,7 +25158,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `ticketRequest`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketRequest` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -28625,7 +25196,7 @@ CREATE TABLE `ticketRequest` ( CONSTRAINT `fgnAtender` FOREIGN KEY (`atenderFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `fgnRequester` FOREIGN KEY (`requesterFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `fgnTicket` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=52600 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -28690,7 +25261,7 @@ DELIMITER ; DROP TABLE IF EXISTS `ticketService`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketService` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -28715,7 +25286,7 @@ CREATE TABLE `ticketService` ( DROP TABLE IF EXISTS `ticketServiceType`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketServiceType` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, @@ -28723,17 +25294,17 @@ CREATE TABLE `ticketServiceType` ( PRIMARY KEY (`id`), KEY `ticketServiceType_expence_idx` (`expenceFk`), CONSTRAINT `ticketServiceType_expence` FOREIGN KEY (`expenceFk`) REFERENCES `expence` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='Lista de los posibles servicios a elegir'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COMMENT='Lista de los posibles servicios a elegir'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `ticketState` +-- Temporary table structure for view `ticketState` -- DROP TABLE IF EXISTS `ticketState`; /*!50001 DROP VIEW IF EXISTS `ticketState`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `ticketState` AS SELECT 1 AS `updated`, 1 AS `stateFk`, @@ -28750,13 +25321,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `ticketStateToday` +-- Temporary table structure for view `ticketStateToday` -- DROP TABLE IF EXISTS `ticketStateToday`; /*!50001 DROP VIEW IF EXISTS `ticketStateToday`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `ticketStateToday` AS SELECT 1 AS `ticket`, 1 AS `state`, @@ -28769,13 +25340,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `ticketTracking` +-- Temporary table structure for view `ticketTracking` -- DROP TABLE IF EXISTS `ticketTracking`; /*!50001 DROP VIEW IF EXISTS `ticketTracking`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `ticketTracking` AS SELECT 1 AS `id`, 1 AS `stateFk`, @@ -28790,7 +25361,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `ticketTrolley`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketTrolley` ( `ticket` int(11) NOT NULL, `labelCount` int(11) NOT NULL DEFAULT '0', @@ -28805,12 +25376,12 @@ CREATE TABLE `ticketTrolley` ( DROP TABLE IF EXISTS `ticketUpdateAction`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketUpdateAction` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla pondremos las distintas opciones que se ofrecen al comecial o al cliente al cambiar alguno de los parametros básicos de un ticket'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla pondremos las distintas opciones que se ofrecen al comecial o al cliente al cambiar alguno de los parametros básicos de un ticket'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28819,13 +25390,13 @@ CREATE TABLE `ticketUpdateAction` ( DROP TABLE IF EXISTS `ticketWeekly`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketWeekly` ( `ticketFk` int(11) NOT NULL AUTO_INCREMENT, `weekDay` tinyint(1) DEFAULT NULL COMMENT 'funcion de mysql Lunes = 0, Domingo = 6', PRIMARY KEY (`ticketFk`), CONSTRAINT `Id_Ticket_fk` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2511082 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28834,7 +25405,7 @@ CREATE TABLE `ticketWeekly` ( DROP TABLE IF EXISTS `till`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `till` ( `id` int(11) NOT NULL AUTO_INCREMENT, `dated` date NOT NULL, @@ -28866,7 +25437,7 @@ CREATE TABLE `till` ( KEY `fk_Cajas_Proveedores_account1_idx` (`supplierAccountFk`), CONSTRAINT `till_ibfk_2` FOREIGN KEY (`bankFk`) REFERENCES `bank` (`id`) ON UPDATE CASCADE, CONSTRAINT `till_ibfk_3` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=750671 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -28895,7 +25466,7 @@ DELIMITER ; DROP TABLE IF EXISTS `tillConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `tillConfig` ( `id` int(11) NOT NULL, `openingBalance` decimal(10,2) NOT NULL, @@ -28910,7 +25481,7 @@ CREATE TABLE `tillConfig` ( DROP TABLE IF EXISTS `town`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `town` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, @@ -28920,7 +25491,7 @@ CREATE TABLE `town` ( KEY `name_idx` (`name`), KEY `townProvinceFk` (`provinceFk`), CONSTRAINT `townProvinceFk` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=241176 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -29016,12 +25587,12 @@ DELIMITER ; DROP TABLE IF EXISTS `trainingCenter`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `trainingCenter` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29030,7 +25601,7 @@ CREATE TABLE `trainingCenter` ( DROP TABLE IF EXISTS `trainingCourse`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `trainingCourse` ( `id` int(11) NOT NULL AUTO_INCREMENT, `workerFk` int(11) NOT NULL, @@ -29049,7 +25620,7 @@ CREATE TABLE `trainingCourse` ( CONSTRAINT `frgnCenter` FOREIGN KEY (`centerFk`) REFERENCES `trainingCenter` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `frgnTrainingCourseType` FOREIGN KEY (`trainingCourseTypeFk`) REFERENCES `trainingCourseType` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `frgnWorker` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=452 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de trabajadores que han realizado una formación'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de trabajadores que han realizado una formación'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29058,12 +25629,12 @@ CREATE TABLE `trainingCourse` ( DROP TABLE IF EXISTS `trainingCourseType`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `trainingCourseType` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de las formaciones'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de las formaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29072,7 +25643,7 @@ CREATE TABLE `trainingCourseType` ( DROP TABLE IF EXISTS `travel`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `travel` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `shipped` date DEFAULT NULL, @@ -29101,7 +25672,7 @@ CREATE TABLE `travel` ( CONSTRAINT `travel_ibfk_2` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `travel_ibfk_3` FOREIGN KEY (`agencyFk`) REFERENCES `agencyMode` (`id`) ON UPDATE CASCADE, CONSTRAINT `travel_ibfk_4` FOREIGN KEY (`cargoSupplierFk`) REFERENCES `vn2008`.`Proveedores_cargueras` (`Id_Proveedor`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=143498 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -29189,7 +25760,7 @@ DELIMITER ; DROP TABLE IF EXISTS `travelObservation`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `travelObservation` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `originFk` int(11) NOT NULL, @@ -29197,7 +25768,7 @@ CREATE TABLE `travelObservation` ( `description` text COLLATE utf8_unicode_ci NOT NULL, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de travel'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de travel'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29206,7 +25777,7 @@ CREATE TABLE `travelObservation` ( DROP TABLE IF EXISTS `travelRecalc`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `travelRecalc` ( `travelFk` int(10) unsigned NOT NULL, PRIMARY KEY (`travelFk`) @@ -29219,7 +25790,7 @@ CREATE TABLE `travelRecalc` ( DROP TABLE IF EXISTS `travelThermograph`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `travelThermograph` ( `thermographFk` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `created` date NOT NULL, @@ -29241,13 +25812,13 @@ CREATE TABLE `travelThermograph` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `user` +-- Temporary table structure for view `user` -- DROP TABLE IF EXISTS `user`; /*!50001 DROP VIEW IF EXISTS `user`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `user` AS SELECT 1 AS `id`, 1 AS `name`, @@ -29264,7 +25835,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `userConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `userConfig` ( `userFk` int(10) unsigned NOT NULL, `warehouseFk` smallint(6) DEFAULT NULL, @@ -29281,7 +25852,7 @@ CREATE TABLE `userConfig` ( DROP TABLE IF EXISTS `vehicle`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `vehicle` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `numberPlate` varchar(10) COLLATE utf8_unicode_ci NOT NULL, @@ -29300,7 +25871,7 @@ CREATE TABLE `vehicle` ( CONSTRAINT `provinceFk` FOREIGN KEY (`warehouseFk`) REFERENCES `province` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `vehicle_deliveryPointFk` FOREIGN KEY (`deliveryPointFk`) REFERENCES `deliveryPoint` (`id`) ON UPDATE CASCADE, CONSTRAINT `vehicle_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=453 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29309,7 +25880,7 @@ CREATE TABLE `vehicle` ( DROP TABLE IF EXISTS `warehouse`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `warehouse` ( `id` smallint(6) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, @@ -29334,7 +25905,7 @@ CREATE TABLE `warehouse` ( KEY `Id_Paises` (`countryFk`), KEY `isComparativeIdx` (`isComparative`), CONSTRAINT `warehouse_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=58 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -29387,12 +25958,12 @@ DELIMITER ; DROP TABLE IF EXISTS `warehouseAlias`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `warehouseAlias` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29401,7 +25972,7 @@ CREATE TABLE `warehouseAlias` ( DROP TABLE IF EXISTS `workCenter`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workCenter` ( `id` int(11) NOT NULL DEFAULT '0', `name` varchar(255) DEFAULT NULL, @@ -29418,7 +25989,7 @@ CREATE TABLE `workCenter` ( DROP TABLE IF EXISTS `workCenterHoliday`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workCenterHoliday` ( `workCenterFk` int(11) NOT NULL, `days` double NOT NULL, @@ -29433,7 +26004,7 @@ CREATE TABLE `workCenterHoliday` ( DROP TABLE IF EXISTS `worker`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `worker` ( `id` int(11) NOT NULL AUTO_INCREMENT, `code` varchar(3) COLLATE utf8_unicode_ci NOT NULL, @@ -29471,7 +26042,7 @@ CREATE TABLE `worker` ( KEY `empresa_id` (`companyFk`), CONSTRAINT `Clientes` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, CONSTRAINT `worker_ibfk_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=101330 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -29524,7 +26095,7 @@ DELIMITER ; DROP TABLE IF EXISTS `workerBosses`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerBosses` ( `id` int(11) NOT NULL AUTO_INCREMENT, `workerFk` int(11) NOT NULL, @@ -29535,17 +26106,17 @@ CREATE TABLE `workerBosses` ( KEY `fg_bossFk_worker_idx` (`bossFk`), CONSTRAINT `fg_bossFk_worker` FOREIGN KEY (`bossFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fg_workerFk_worker` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2515 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `workerCalendar` +-- Temporary table structure for view `workerCalendar` -- DROP TABLE IF EXISTS `workerCalendar`; /*!50001 DROP VIEW IF EXISTS `workerCalendar`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `workerCalendar` AS SELECT 1 AS `businessFk`, 1 AS `workerFk`, @@ -29559,7 +26130,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `workerClockLog`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerClockLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `originFk` int(11) NOT NULL, @@ -29579,24 +26150,24 @@ CREATE TABLE `workerClockLog` ( DROP TABLE IF EXISTS `workerConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerConfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `defaultWorkerFk` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `defaultWorkerFk` (`defaultWorkerFk`), CONSTRAINT `workerConfig_ibfk_1` FOREIGN KEY (`defaultWorkerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `workerDepartment` +-- Temporary table structure for view `workerDepartment` -- DROP TABLE IF EXISTS `workerDepartment`; /*!50001 DROP VIEW IF EXISTS `workerDepartment`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `workerDepartment` AS SELECT 1 AS `workerFk`, 1 AS `departmentFk`*/; @@ -29608,7 +26179,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `workerDocument`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerDocument` ( `id` int(11) NOT NULL AUTO_INCREMENT, `worker` int(10) unsigned DEFAULT NULL, @@ -29618,7 +26189,7 @@ CREATE TABLE `workerDocument` ( KEY `workerDocument_ibfk_2` (`document`), CONSTRAINT `workerDocument_ibfk_1` FOREIGN KEY (`worker`) REFERENCES `worker` (`userFk`) ON UPDATE CASCADE, CONSTRAINT `workerDocument_ibfk_2` FOREIGN KEY (`document`) REFERENCES `dms` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=12993 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29627,13 +26198,13 @@ CREATE TABLE `workerDocument` ( DROP TABLE IF EXISTS `workerEmergencyBoss`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerEmergencyBoss` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `value` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Table to save all responsible people phones', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29642,7 +26213,7 @@ CREATE TABLE `workerEmergencyBoss` ( DROP TABLE IF EXISTS `workerHourPrice`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerHourPrice` ( `id` int(11) NOT NULL AUTO_INCREMENT, `dated` date NOT NULL, @@ -29650,7 +26221,7 @@ CREATE TABLE `workerHourPrice` ( `nightInc` decimal(4,2) DEFAULT NULL, `extraInc` decimal(4,2) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Recoge los acuerdos de los distintos convenios'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Recoge los acuerdos de los distintos convenios'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29659,7 +26230,7 @@ CREATE TABLE `workerHourPrice` ( DROP TABLE IF EXISTS `workerJourney`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerJourney` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userFk` int(10) unsigned NOT NULL, @@ -29683,17 +26254,17 @@ CREATE TABLE `workerJourney` ( UNIQUE KEY `userFk_UNIQUE` (`userFk`,`dated`), KEY `fk_workerJourney_user_idx` (`userFk`), CONSTRAINT `fk_workerJourney_user` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=66128753 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `workerLabour` +-- Temporary table structure for view `workerLabour` -- DROP TABLE IF EXISTS `workerLabour`; /*!50001 DROP VIEW IF EXISTS `workerLabour`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `workerLabour` AS SELECT 1 AS `businessFk`, 1 AS `workerFk`, @@ -29709,7 +26280,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `workerLog`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `originFk` int(11) NOT NULL, @@ -29722,7 +26293,7 @@ CREATE TABLE `workerLog` ( KEY `userFk_idx` (`userFk`), CONSTRAINT `userFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `workerFk` FOREIGN KEY (`originFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=16400 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29731,7 +26302,7 @@ CREATE TABLE `workerLog` ( DROP TABLE IF EXISTS `workerMana`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerMana` ( `workerFk` int(11) NOT NULL, `size` int(11) NOT NULL DEFAULT '300', @@ -29747,13 +26318,13 @@ CREATE TABLE `workerMana` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `workerMana__` +-- Temporary table structure for view `workerMana__` -- DROP TABLE IF EXISTS `workerMana__`; /*!50001 DROP VIEW IF EXISTS `workerMana__`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `workerMana__` AS SELECT 1 AS `workerFk`, 1 AS `size`, @@ -29765,13 +26336,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `workerMedia` +-- Temporary table structure for view `workerMedia` -- DROP TABLE IF EXISTS `workerMedia`; /*!50001 DROP VIEW IF EXISTS `workerMedia`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `workerMedia` AS SELECT 1 AS `workerFk`, 1 AS `mediaValue`*/; @@ -29783,7 +26354,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `workerTeam`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerTeam` ( `id` int(11) NOT NULL AUTO_INCREMENT, `team` int(11) NOT NULL, @@ -29792,17 +26363,17 @@ CREATE TABLE `workerTeam` ( KEY `user_idx` (`workerFk`), KEY `team_idx` (`team`), CONSTRAINT `user_team` FOREIGN KEY (`workerFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=261 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `workerTeamCollegues` +-- Temporary table structure for view `workerTeamCollegues` -- DROP TABLE IF EXISTS `workerTeamCollegues`; /*!50001 DROP VIEW IF EXISTS `workerTeamCollegues`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `workerTeamCollegues` AS SELECT 1 AS `workerFk`, 1 AS `collegueFk`*/; @@ -29814,7 +26385,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `workerTimeControl`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerTimeControl` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userFk` int(10) unsigned NOT NULL, @@ -29828,7 +26399,7 @@ CREATE TABLE `workerTimeControl` ( KEY `warehouseFkfk1_idx` (`warehouseFk`), CONSTRAINT `warehouseFk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `workerTimeControl_fk1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=8313026 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Fichadas'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Fichadas'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29837,7 +26408,7 @@ CREATE TABLE `workerTimeControl` ( DROP TABLE IF EXISTS `workerTimeControlConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerTimeControlConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, `warehouseFk` smallint(6) unsigned NOT NULL, @@ -29845,7 +26416,7 @@ CREATE TABLE `workerTimeControlConfig` ( PRIMARY KEY (`id`), KEY `warehouseFk_1_idx` (`warehouseFk`), CONSTRAINT `warehouseFk_2` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29854,7 +26425,7 @@ CREATE TABLE `workerTimeControlConfig` ( DROP TABLE IF EXISTS `workerTimeControlLog`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerTimeControlLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userFk` int(10) NOT NULL, @@ -29870,7 +26441,7 @@ CREATE TABLE `workerTimeControlLog` ( DROP TABLE IF EXISTS `workerTimeControlParams`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerTimeControlParams` ( `id` int(11) NOT NULL AUTO_INCREMENT, `dayBreak` int(11) NOT NULL, @@ -29879,7 +26450,7 @@ CREATE TABLE `workerTimeControlParams` ( `dayWorkMax` int(11) NOT NULL, `dayStayMax` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='All values in seconds'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='All values in seconds'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29888,7 +26459,7 @@ CREATE TABLE `workerTimeControlParams` ( DROP TABLE IF EXISTS `workerTimeControlPin`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerTimeControlPin` ( `workerFk` int(11) NOT NULL, `pin` varchar(255) COLLATE utf8_unicode_ci NOT NULL, @@ -29903,23 +26474,23 @@ CREATE TABLE `workerTimeControlPin` ( DROP TABLE IF EXISTS `workerTimeControlSchedule`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerTimeControlSchedule` ( `id` int(11) NOT NULL AUTO_INCREMENT, `time` time DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `punique_trhf` (`time`) -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `workerTimeControlUserInfo` +-- Temporary table structure for view `workerTimeControlUserInfo` -- DROP TABLE IF EXISTS `workerTimeControlUserInfo`; /*!50001 DROP VIEW IF EXISTS `workerTimeControlUserInfo`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `workerTimeControlUserInfo` AS SELECT 1 AS `userFk`, 1 AS `name`, @@ -29932,13 +26503,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `workerTimeControlWorking` +-- Temporary table structure for view `workerTimeControlWorking` -- DROP TABLE IF EXISTS `workerTimeControlWorking`; /*!50001 DROP VIEW IF EXISTS `workerTimeControlWorking`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `workerTimeControlWorking` AS SELECT 1 AS `userFk`, 1 AS `timed`, @@ -29952,13 +26523,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `workerTimeControl_Journey` +-- Temporary table structure for view `workerTimeControl_Journey` -- DROP TABLE IF EXISTS `workerTimeControl_Journey`; /*!50001 DROP VIEW IF EXISTS `workerTimeControl_Journey`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `workerTimeControl_Journey` AS SELECT 1 AS `userFk`, 1 AS `dated`, @@ -29969,13 +26540,13 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `workerTimeJourneyNG` +-- Temporary table structure for view `workerTimeJourneyNG` -- DROP TABLE IF EXISTS `workerTimeJourneyNG`; /*!50001 DROP VIEW IF EXISTS `workerTimeJourneyNG`*/; SET @saved_cs_client = @@character_set_client; -/*!50503 SET character_set_client = utf8mb4 */; +SET character_set_client = utf8; /*!50001 CREATE VIEW `workerTimeJourneyNG` AS SELECT 1 AS `userFk`, 1 AS `dated`, @@ -29991,7 +26562,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `workers20190711`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workers20190711` ( `person_id` int(11) NOT NULL DEFAULT '0', `business_id` int(11) NOT NULL DEFAULT '0', @@ -30016,7 +26587,7 @@ CREATE TABLE `workers20190711` ( DROP TABLE IF EXISTS `workers20190711_FichadasAbril`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workers20190711_FichadasAbril` ( `id` int(11) NOT NULL AUTO_INCREMENT, `person_id` int(11) NOT NULL DEFAULT '0', @@ -30029,7 +26600,7 @@ CREATE TABLE `workers20190711_FichadasAbril` ( `sumable` double DEFAULT NULL, `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=8171 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30038,7 +26609,7 @@ CREATE TABLE `workers20190711_FichadasAbril` ( DROP TABLE IF EXISTS `workers20190711_FichadasJulio11`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workers20190711_FichadasJulio11` ( `id` int(11) NOT NULL AUTO_INCREMENT, `person_id` int(11) NOT NULL DEFAULT '0', @@ -30051,7 +26622,7 @@ CREATE TABLE `workers20190711_FichadasJulio11` ( `sumable` double DEFAULT NULL, `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=328 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30060,7 +26631,7 @@ CREATE TABLE `workers20190711_FichadasJulio11` ( DROP TABLE IF EXISTS `workers20190711_FichadasJunio`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workers20190711_FichadasJunio` ( `id` int(11) NOT NULL AUTO_INCREMENT, `person_id` int(11) NOT NULL DEFAULT '0', @@ -30073,7 +26644,7 @@ CREATE TABLE `workers20190711_FichadasJunio` ( `sumable` double DEFAULT NULL, `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=6936 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30082,7 +26653,7 @@ CREATE TABLE `workers20190711_FichadasJunio` ( DROP TABLE IF EXISTS `workers20190711_FichadasMayo`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workers20190711_FichadasMayo` ( `id` int(11) NOT NULL AUTO_INCREMENT, `person_id` int(11) NOT NULL DEFAULT '0', @@ -30095,7 +26666,7 @@ CREATE TABLE `workers20190711_FichadasMayo` ( `sumable` double DEFAULT NULL, `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=7855 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30104,7 +26675,7 @@ CREATE TABLE `workers20190711_FichadasMayo` ( DROP TABLE IF EXISTS `workers20190711_FichadasOctubre`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workers20190711_FichadasOctubre` ( `id` int(11) NOT NULL AUTO_INCREMENT, `person_id` int(11) NOT NULL DEFAULT '0', @@ -30117,7 +26688,7 @@ CREATE TABLE `workers20190711_FichadasOctubre` ( `sumable` double DEFAULT NULL, `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=7419 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30126,7 +26697,7 @@ CREATE TABLE `workers20190711_FichadasOctubre` ( DROP TABLE IF EXISTS `workingHours`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `workingHours` ( `id` int(11) NOT NULL AUTO_INCREMENT, `timeIn` datetime NOT NULL, @@ -30135,7 +26706,7 @@ CREATE TABLE `workingHours` ( PRIMARY KEY (`id`), KEY `user_working_hour_idx` (`userId`), CONSTRAINT `user_working_hour` FOREIGN KEY (`userId`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=23782 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena horas de Entrada y de Salida del personal'; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena horas de Entrada y de Salida del personal'; /*!40101 SET character_set_client = @saved_cs_client */; ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -30166,7 +26737,7 @@ ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; DROP TABLE IF EXISTS `zone`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `zone` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, @@ -30184,7 +26755,7 @@ CREATE TABLE `zone` ( KEY `zone_name_idx` (`name`), CONSTRAINT `fk_zone_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `fk_zone_2` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=491 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30193,7 +26764,7 @@ CREATE TABLE `zone` ( DROP TABLE IF EXISTS `zoneCalendar`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `zoneCalendar` ( `zoneFk` int(11) NOT NULL, `delivered` date NOT NULL, @@ -30210,7 +26781,7 @@ CREATE TABLE `zoneCalendar` ( DROP TABLE IF EXISTS `zoneGeo`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `zoneGeo` ( `id` int(11) NOT NULL AUTO_INCREMENT, `type` set('country','province','town','postCode') CHARACTER SET utf8 NOT NULL, @@ -30226,7 +26797,7 @@ CREATE TABLE `zoneGeo` ( KEY `name_idx` (`name`), KEY `parentFk` (`parentFk`), KEY `path` (`path`) -) ENGINE=InnoDB AUTO_INCREMENT=597479 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -30275,12 +26846,12 @@ DELIMITER ; DROP TABLE IF EXISTS `zoneGeoRecalc`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `zoneGeoRecalc` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `isChanged` tinyint(4) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +) ENGINE=InnoDBDEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30289,7 +26860,7 @@ CREATE TABLE `zoneGeoRecalc` ( DROP TABLE IF EXISTS `zoneIncluded`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `zoneIncluded` ( `zoneFk` int(11) NOT NULL, `geoFk` int(11) NOT NULL, @@ -30361,90 +26932,90 @@ DELIMITER ;; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `printQueue_check` ON SCHEDULE EVERY 10 MINUTE STARTS '2019-11-08 00:00:00' ON COMPLETION PRESERVE ENABLE COMMENT 'Notifica en caso de que el servidor de impresión este parado' DO BEGIN - - DECLARE vCurrentCount INT; - DECLARE vCheckSum INT; - DECLARE vIsAlreadyNotified BOOLEAN; - DECLARE vTableQueue TEXT; - DECLARE vLineQueue TEXT; - DECLARE vDone BOOL DEFAULT FALSE; - DECLARE vCur CURSOR FOR - SELECT CONCAT(' - ', IFNULL(pq.id, ''), ' - ', IFNULL(p.path, ''),' - ', IFNULL(i.Informe, ''),' - ', IFNULL(e.Estado, ''),' - ', IFNULL(w.firstname, ''), " ", IFNULL(w.lastName, ''),' - ', IFNULL(pq.`error`, ''),' - ') - FROM vn.printingQueue pq - LEFT JOIN vn.worker w ON w.id = pq.worker - LEFT JOIN vn.printer p ON p.id = pq.printer - LEFT JOIN vn2008.Informes i ON i.Id_Informe = pq.report - JOIN vn2008.Estados e ON e.Id_Estado = pq.state - LIMIT 30; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - - SELECT COUNT(*), IFNULL(SUM(id),0) INTO vCurrentCount, vCheckSum - FROM vn.printingQueue WHERE state = 1; - - SELECT isAlreadyNotified INTO vIsAlreadyNotified - FROM printingQueueCheck; - - IF (SELECT lastCount FROM printingQueueCheck) = vCurrentCount AND - (SELECT lastCheckSum FROM printingQueueCheck) = vCheckSum AND - vIsAlreadyNotified = FALSE AND vCurrentCount > 0 - THEN - - SELECT ' - - - - - - - - ' INTO vTableQueue; - - OPEN vCur; - - l: LOOP - - SET vDone = FALSE; - - FETCH vCur INTO vLineQueue; - - IF vDone THEN - LEAVE l; - END IF; - - SELECT CONCAT(vTableQueue, vLineQueue) INTO vTableQueue; - - END LOOP; - - CLOSE vCur; - - INSERT INTO vn2008.mail (`to`, subject, text) - VALUES ('cau@verdnatura.es', - 'servidor de impresion parado', - CONCAT('Hay ', vCurrentCount, ' lineas bloqueadas', vTableQueue, '
Id ColaRuta ImpresoraInformeEstadoTrabajadorError
')); - - UPDATE printingQueueCheck SET isAlreadyNotified = TRUE; - END IF; - - IF (SELECT lastCount FROM printingQueueCheck) > vCurrentCount AND - vIsAlreadyNotified = TRUE - THEN - UPDATE printingQueueCheck SET isAlreadyNotified = FALSE; - END IF; - - UPDATE printingQueueCheck - SET lastCount = vCurrentCount, - lastCheckSum = vCheckSum; - +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `printQueue_check` ON SCHEDULE EVERY 10 MINUTE STARTS '2019-11-08 00:00:00' ON COMPLETION PRESERVE ENABLE COMMENT 'Notifica en caso de que el servidor de impresión este parado' DO BEGIN + + DECLARE vCurrentCount INT; + DECLARE vCheckSum INT; + DECLARE vIsAlreadyNotified BOOLEAN; + DECLARE vTableQueue TEXT; + DECLARE vLineQueue TEXT; + DECLARE vDone BOOL DEFAULT FALSE; + DECLARE vCur CURSOR FOR + SELECT CONCAT(' + ', IFNULL(pq.id, ''), ' + ', IFNULL(p.path, ''),' + ', IFNULL(i.Informe, ''),' + ', IFNULL(e.Estado, ''),' + ', IFNULL(w.firstname, ''), " ", IFNULL(w.lastName, ''),' + ', IFNULL(pq.`error`, ''),' + ') + FROM vn.printingQueue pq + LEFT JOIN vn.worker w ON w.id = pq.worker + LEFT JOIN vn.printer p ON p.id = pq.printer + LEFT JOIN vn2008.Informes i ON i.Id_Informe = pq.report + JOIN vn2008.Estados e ON e.Id_Estado = pq.state + LIMIT 30; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + SELECT COUNT(*), IFNULL(SUM(id),0) INTO vCurrentCount, vCheckSum + FROM vn.printingQueue WHERE state = 1; + + SELECT isAlreadyNotified INTO vIsAlreadyNotified + FROM printingQueueCheck; + + IF (SELECT lastCount FROM printingQueueCheck) = vCurrentCount AND + (SELECT lastCheckSum FROM printingQueueCheck) = vCheckSum AND + vIsAlreadyNotified = FALSE AND vCurrentCount > 0 + THEN + + SELECT ' + + + + + + + + ' INTO vTableQueue; + + OPEN vCur; + + l: LOOP + + SET vDone = FALSE; + + FETCH vCur INTO vLineQueue; + + IF vDone THEN + LEAVE l; + END IF; + + SELECT CONCAT(vTableQueue, vLineQueue) INTO vTableQueue; + + END LOOP; + + CLOSE vCur; + + INSERT INTO vn2008.mail (`to`, subject, text) + VALUES ('cau@verdnatura.es', + 'servidor de impresion parado', + CONCAT('Hay ', vCurrentCount, ' lineas bloqueadas', vTableQueue, '
Id ColaRuta ImpresoraInformeEstadoTrabajadorError
')); + + UPDATE printingQueueCheck SET isAlreadyNotified = TRUE; + END IF; + + IF (SELECT lastCount FROM printingQueueCheck) > vCurrentCount AND + vIsAlreadyNotified = TRUE + THEN + UPDATE printingQueueCheck SET isAlreadyNotified = FALSE; + END IF; + + UPDATE printingQueueCheck + SET lastCount = vCurrentCount, + lastCheckSum = vCheckSum; + END */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; @@ -30613,84 +27184,101 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP FUNCTION IF EXISTS `bionicCalcReverse` */; +/*!50003 DROP FUNCTION IF EXISTS `bionicCalcReverse__` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `bionicCalcReverse`(vWarehouse INT, +CREATE DEFINER=`root`@`%` FUNCTION `bionicCalcReverse__`(vWarehouse INT, vMargin DECIMAL(10,3), vRetailedPrice DECIMAL(10,3), vM3 DECIMAL(10,3), - vConsigna INT, - vAgencia INT) RETURNS decimal(10,3) + vAddress INT, + vAgencyMode INT) RETURNS decimal(10,3) DETERMINISTIC BEGIN - -- BERNAT: WORKING IN THIS FILE - DECLARE COEFICIENTE_DE_INFLACION_GENERAL INT DEFAULT 1.3; - DECLARE DENSIDAD_MINIMA_PESO_VOLUMETRICO INT DEFAULT 167; - DECLARE VOLUMEN_CAJA_VERDNATURA BIGINT DEFAULT 138000; - DECLARE vCustomer INT; - DECLARE vComponentRecovery INT DEFAULT 17; - DECLARE vComponentMana INT DEFAULT 39; - DECLARE vComponentPort INT DEFAULT 15; - DECLARE vComponentMargin INT DEFAULT 29; - DECLARE vComponentCost INT DEFAULT 28; - DECLARE vCost DECIMAL(10,2); + DECLARE vGeneralInflationCoeficient INT; + DECLARE vVerdnaturaVolumeBox BIGINT; + DECLARE vClientFk INT; + DECLARE vComponentRecovery VARCHAR(50) DEFAULT 'debtCollection'; + DECLARE vComponentMana VARCHAR(50) DEFAULT 'autoMana'; + DECLARE vComponentPort VARCHAR(50) DEFAULT 'delivery'; + DECLARE vComponentMargin VARCHAR(50) DEFAULT 'margin'; + DECLARE vComponentCost VARCHAR(50) DEFAULT 'purchaseValue'; + DECLARE vComponentCostValue DECIMAL(10,2); DECLARE vItem INT DEFAULT 98; + DECLARE vItemCarryBox INT; + + SELECT generalInflationCoeFicient, verdnaturaVolumeBox, itemCarryBox + INTO vGeneralInflationCoeficient, vVerdnaturaVolumeBox, vItemCarryBox + FROM bionicConfig; - SELECT clientFk INTO vCustomer FROM address WHERE id = vConsigna; + SELECT clientFk INTO vClientFk FROM address WHERE id = vAddress; + + -- Creamos la tabla tmp.bionicComponent + DROP TEMPORARY TABLE IF EXISTS tmp.bionicComponent; + CREATE TEMPORARY TABLE tmp.bionicComponent( + `warehouseFk` smallint(5) unsigned NOT NULL, + `itemFk` int(11) NOT NULL, + `componentFk` int(10) unsigned NOT NULL, + `value` decimal(10,4) NOT NULL, + UNIQUE KEY `itemWarehouseComponent` (`itemFk`,`warehouseFk`,`componentFk`) USING HASH, + KEY `itemWarehouse` (`itemFk`,`warehouseFk`) USING BTREE + ) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + + -- Margin + INSERT INTO tmp.bionicComponent (warehouseFk, itemFk, componentFk, `value`) + SELECT vWarehouse, vItem, id, vMargin + FROM component + WHERE code = vComponentMargin; - -- Creamos la tabla tmp.bionic_component - DROP TEMPORARY TABLE IF EXISTS tmp.bionic_component; - CREATE TEMPORARY TABLE tmp.bionic_component LIKE - vn2008.template_bionic_component; - - -- Margen - INSERT INTO tmp.bionic_component (warehouse_id, item_id, component_id, cost) - SELECT vWarehouse, vItem, vComponentMargin, vMargin; - -- Recobro - INSERT INTO tmp.bionic_component (warehouse_id, item_id, component_id, cost) - SELECT vWarehouse, vItem, vComponentRecovery, ROUND(LEAST(recobro,0.25), 3) - FROM bi.claims_ratio - WHERE Id_Cliente = vCustomer AND recobro > 0.009; + INSERT INTO tmp.bionicComponent (warehouseFk, itemFk, componentFk, `value`) + SELECT vWarehouse, vItem, c.id, ROUND(LEAST(cr.recobro,0.25), 3) + FROM bi.claims_ratio cr + JOIN component c ON c.code = vComponentRecovery + WHERE cr.Id_Cliente = vClientFk AND cr.recobro > 0.009; -- Componente de maná automático, en función del maná acumulado por el comercial. - INSERT INTO tmp.bionic_component (warehouse_id, item_id, component_id, cost) - SELECT vWarehouse, vItem, vComponentMana, ROUND(prices_modifier_rate, 3) + INSERT INTO tmp.bionicComponent (warehouseFk, itemFk, componentFk, `value`) + SELECT vWarehouse, vItem, co.id, ROUND(ms.prices_modifier_rate, 3) FROM client c - JOIN bs.mana_spellers ms ON c.salesPersonFk = ms.Id_Trabajador - WHERE ms.prices_modifier_activated AND c.id = vCustomer LIMIT 1; + JOIN bs.mana_spellers ms ON c.salesPersonFk = ms.Id_Trabajador + JOIN component co ON co.code = vComponentMana + WHERE ms.prices_modifier_activated AND c.id = vClientFk LIMIT 1; -- Reparto - INSERT INTO tmp.bionic_component (warehouse_id, item_id, component_id, cost) - SELECT vWarehouse, vItem, vComponentPort, COEFICIENTE_DE_INFLACION_GENERAL + INSERT INTO tmp.bionicComponent (warehouseFk, itemFk, componentFk, `value`) + SELECT vWarehouse, vItem, co.id, vGeneralInflationCoeficient * ROUND( - vM3 - * az.price - * az.inflation - / VOLUMEN_CAJA_VERDNATURA, 4 + vM3 + * az.price + * az.inflation + / vVerdnaturaVolumeBox, 4 ) FROM agencyMode ag - JOIN address a ON a.id = vConsigna AND ag.id = vAgencia - JOIN agencyProvince ap ON ap.agencyFk = ag.agencyFk AND ap.warehouseFk = vWarehouse AND ap.provinceFk = a.provinceFk - JOIN agencyModeZone az ON az.agencyModeFk = vAgencia AND az.zone = ap.zone AND az.itemFk = 71 AND az.warehouseFk = vWarehouse; + JOIN address a ON a.id = vAddress AND ag.id = vAgencyMode + JOIN agencyProvince ap ON ap.agencyFk = ag.agencyFk + AND ap.warehouseFk = vWarehouse AND ap.provinceFk = a.provinceFk + JOIN agencyModeZone az ON az.agencyModeFk = vAgencyMode + AND az.zone = ap.zone AND az.itemFk = 71 AND az.warehouseFk = vWarehouse + JOIN component co ON co.code = vComponentPort; -- Coste - SELECT vRetailedPrice - SUM(cost) INTO vCost - FROM tmp.bionic_component; + SELECT vRetailedPrice - SUM(`value`) INTO vComponentCostValue + FROM tmp.bionicComponent; - INSERT INTO tmp.bionic_component (warehouse_id, item_id, component_id, cost) - VALUES ( vWarehouse, vItem, vComponentCost,vCost); + INSERT INTO tmp.bionicComponent (warehouseFk, itemFk, componentFk, `value`) + SELECT vWarehouse, vItem, id,vComponentCostValue + FROM component + WHERE code = vComponentCost; - RETURN vCost; - + RETURN vComponentCostValue; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -35269,27 +31857,27 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `clean__`() -BEGIN - DECLARE vDateShort DATETIME; - DECLARE oneYearAgo DATE; - DECLARE twoYearsAgo DATE; - DECLARE fourYearsAgo DATE; - - SET vDateShort = TIMESTAMPADD(MONTH, -2, CURDATE()); - SET oneYearAgo = TIMESTAMPADD(YEAR,-1,CURDATE()); - SET twoYearsAgo = TIMESTAMPADD(YEAR,-2,CURDATE()); - SET fourYearsAgo = TIMESTAMPADD(YEAR,-4,CURDATE()); - - DELETE FROM vn.message WHERE sendDate < vDateShort; - DELETE FROM vn.messageInbox WHERE sendDate < vDateShort; - DELETE FROM vn.messageInbox WHERE sendDate < vDateShort; - DELETE FROM vn.workerTimeControl WHERE timed < fourYearsAgo; - DELETE FROM vn.itemShelving WHERE created < CURDATE() AND visible = 0; - DELETE FROM vn.ticketDown WHERE created < TIMESTAMPADD(DAY,-1,CURDATE()); - CALL shelving_clean; - +BEGIN + DECLARE vDateShort DATETIME; + DECLARE oneYearAgo DATE; + DECLARE twoYearsAgo DATE; + DECLARE fourYearsAgo DATE; + + SET vDateShort = TIMESTAMPADD(MONTH, -2, CURDATE()); + SET oneYearAgo = TIMESTAMPADD(YEAR,-1,CURDATE()); + SET twoYearsAgo = TIMESTAMPADD(YEAR,-2,CURDATE()); + SET fourYearsAgo = TIMESTAMPADD(YEAR,-4,CURDATE()); + + DELETE FROM vn.message WHERE sendDate < vDateShort; + DELETE FROM vn.messageInbox WHERE sendDate < vDateShort; + DELETE FROM vn.messageInbox WHERE sendDate < vDateShort; + DELETE FROM vn.workerTimeControl WHERE timed < fourYearsAgo; + DELETE FROM vn.itemShelving WHERE created < CURDATE() AND visible = 0; + DELETE FROM vn.ticketDown WHERE created < TIMESTAMPADD(DAY,-1,CURDATE()); + CALL shelving_clean; + CALL vn.ticketPackagingRecovery; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -36089,54 +32677,54 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `clientRemoveWorker`() -BEGIN - DECLARE done BOOL DEFAULT FALSE; - DECLARE vClientFk INT; - - DECLARE rs CURSOR FOR - SELECT c.clientFk - FROM tmp.clientGetDebt c - LEFT JOIN tmp.risk r ON r.clientFk = c.clientFk - WHERE IFNULL(r.risk,0) = 0; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt; - CREATE TEMPORARY TABLE tmp.clientGetDebt - SELECT cd.id as clientFk - FROM bs.clientDied cd - LEFT JOIN vn.clientProtected cp ON cp.clientFk = cd.id - JOIN vn.client c ON c.id = cd.id - JOIN vn.province p ON p.id = c.provinceFk - JOIN vn.country co ON co.id = p.countryFk - WHERE cd.Aviso = 'TERCER AVISO' - AND cp.clientFk IS NULL - AND co.country NOT IN ('Portugal','Francia','España exento') - AND c.salesPersonFk IS NOT NULL; - - CALL vn.clientGetDebt(curdate()); - - DROP TEMPORARY TABLE IF EXISTS tmp.contador; - CREATE TEMPORARY TABLE tmp.contador (id INT) - ENGINE = MEMORY; - - OPEN rs; - FETCH rs INTO vClientFk; - - WHILE NOT done DO - INSERT INTO tmp.contador SET id = vClientFk; - CALL vn.clientGreugeSpray(vClientFk, TRUE, '',TRUE); +BEGIN + DECLARE done BOOL DEFAULT FALSE; + DECLARE vClientFk INT; + + DECLARE rs CURSOR FOR + SELECT c.clientFk + FROM tmp.clientGetDebt c + LEFT JOIN tmp.risk r ON r.clientFk = c.clientFk + WHERE IFNULL(r.risk,0) = 0; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt; + CREATE TEMPORARY TABLE tmp.clientGetDebt + SELECT cd.id as clientFk + FROM bs.clientDied cd + LEFT JOIN vn.clientProtected cp ON cp.clientFk = cd.id + JOIN vn.client c ON c.id = cd.id + JOIN vn.province p ON p.id = c.provinceFk + JOIN vn.country co ON co.id = p.countryFk + WHERE cd.Aviso = 'TERCER AVISO' + AND cp.clientFk IS NULL + AND co.country NOT IN ('Portugal','Francia','España exento') + AND c.salesPersonFk IS NOT NULL; + + CALL vn.clientGetDebt(curdate()); + + DROP TEMPORARY TABLE IF EXISTS tmp.contador; + CREATE TEMPORARY TABLE tmp.contador (id INT) + ENGINE = MEMORY; + + OPEN rs; + FETCH rs INTO vClientFk; + + WHILE NOT done DO + INSERT INTO tmp.contador SET id = vClientFk; + CALL vn.clientGreugeSpray(vClientFk, TRUE, '',TRUE); UPDATE vn.client SET salesPersonFk = NULL WHERE id = vClientFk; INSERT INTO vn.clientLog (originFk, userFk, `action`, description) VALUES (vClientFk, account.userGetId(), 'update', CONCAT('Se ha desasignado el cliente por que no ha comprado en 3 meses')); - + REPLACE bs.clientNewBorn(clientFk, shipped) - VALUES(vClientFk, CURDATE()); - FETCH rs INTO vClientFk; - END WHILE; - - CLOSE rs; + VALUES(vClientFk, CURDATE()); + FETCH rs INTO vClientFk; + END WHILE; + + CLOSE rs; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -36154,176 +32742,176 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `clonTravelComplete`(IN `vTravelFk` INT, IN `vDateStart` DATE, IN `vDateEnd` DATE, IN `vRef` VARCHAR(255)) -BEGIN - -- BERNAT: WORKING IN THIS FILE - DECLARE vTravelNew INT; - DECLARE vEntryNew INT; - DECLARE vDone BIT DEFAULT 0; - DECLARE vAuxEntryFk INT; - DECLARE vRsEntry CURSOR FOR - SELECT e.id - FROM vn.entry e - JOIN vn.travel t - ON t.id = e.travelFk - WHERE e.travelFk = vTravelFk; - - DECLARE vRsBuy CURSOR FOR - SELECT b.* - FROM vn.buy b - JOIN vn.entry e - ON b.entryFk = e.id - WHERE e.travelFk = vTravelNew and b.entryFk=entryNew - ORDER BY e.id; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - - START TRANSACTION; - - INSERT INTO vn.travel (shipped,landed, warehouseInFk, warehouseOutFk, agencyFk, ref, isDelivered, isReceived, m3, kg) - SELECT vDateStart, vDateEnd,warehouseInFk, warehouseOutFk, agencyFk, vRef, isDelivered, isReceived, m3, kg - FROM vn.travel - WHERE id = vTravelFk; - - SET vTravelNew = LAST_INSERT_ID(); - SET vDone = 0; - OPEN vRsEntry ; - FETCH vRsEntry INTO vAuxEntryFk; - - WHILE NOT vDone DO - INSERT INTO vn.entry (supplierFk, - ref, - isInventory, - isConfirmed, - isOrdered, - isRaid, - commission, - created, - evaNotes, - travelFk, - currencyFk, - companyFk, - gestDocFk, - invoiceInFk) - SELECT supplierFk, - ref, - isInventory, - isConfirmed, - isOrdered, - isRaid, - commission, - created, - evaNotes, - vTravelNew, - currencyFk, - companyFk, - gestDocFk, - invoiceInFk - FROM vn.entry - WHERE id = vAuxEntryFk; - - SET vEntryNew = LAST_INSERT_ID(); - - /* INSERT INTO vn.buy ( - entryFk, - itemFk, - amount, - buyingValue, - quantity, - packageFk, - stickers, - freightValue, - packageValue, - comissionValue, - packing, - `grouping`, - groupingMode, - location, - price1, - price2, - price3, - minPrice, - producer, - printedStickers, - isCkecked) - SELECT - vEntryNew, - itemFk, - amount, - buyingValue, - quantity, - packageFk, - stickers, - freightValue, - packageValue, - comissionValue, - packing, - `grouping`, - groupingMode, - location, - price1, - price2, - price3, - minPrice, - producer, - printedStickers, - isCkecked - FROM buy - WHERE entryFk = vAuxEntryFk;*/ - - INSERT INTO vn2008.Compres (Id_Entrada, - Id_Article, - Cantidad, - Costefijo, - Id_Cubo, - Etiquetas, - Portefijo, - Embalajefijo, - Comisionfija, - Packing, - `grouping`, - caja, - Nicho, - Tarifa1, - Tarifa2, - Tarifa3, - PVP, - Productor, - Vida, - punteo) - SELECT vEntryNew, - Id_Article, - Cantidad, - Costefijo, - Id_Cubo, - Etiquetas, - Portefijo, - Embalajefijo, - Comisionfija, - Packing, - `grouping`, - caja, - Nicho, - Tarifa1, - Tarifa2, - Tarifa3, - PVP, - Productor, - Vida, - punteo - FROM vn2008.Compres - WHERE Id_Entrada = vAuxEntryFk; - - - FETCH vRsEntry INTO vAuxEntryFk; - END WHILE; - CLOSE vRsEntry; - COMMIT; +BEGIN + -- BERNAT: WORKING IN THIS FILE + DECLARE vTravelNew INT; + DECLARE vEntryNew INT; + DECLARE vDone BIT DEFAULT 0; + DECLARE vAuxEntryFk INT; + DECLARE vRsEntry CURSOR FOR + SELECT e.id + FROM vn.entry e + JOIN vn.travel t + ON t.id = e.travelFk + WHERE e.travelFk = vTravelFk; + + DECLARE vRsBuy CURSOR FOR + SELECT b.* + FROM vn.buy b + JOIN vn.entry e + ON b.entryFk = e.id + WHERE e.travelFk = vTravelNew and b.entryFk=entryNew + ORDER BY e.id; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + START TRANSACTION; + + INSERT INTO vn.travel (shipped,landed, warehouseInFk, warehouseOutFk, agencyFk, ref, isDelivered, isReceived, m3, kg) + SELECT vDateStart, vDateEnd,warehouseInFk, warehouseOutFk, agencyFk, vRef, isDelivered, isReceived, m3, kg + FROM vn.travel + WHERE id = vTravelFk; + + SET vTravelNew = LAST_INSERT_ID(); + SET vDone = 0; + OPEN vRsEntry ; + FETCH vRsEntry INTO vAuxEntryFk; + + WHILE NOT vDone DO + INSERT INTO vn.entry (supplierFk, + ref, + isInventory, + isConfirmed, + isOrdered, + isRaid, + commission, + created, + evaNotes, + travelFk, + currencyFk, + companyFk, + gestDocFk, + invoiceInFk) + SELECT supplierFk, + ref, + isInventory, + isConfirmed, + isOrdered, + isRaid, + commission, + created, + evaNotes, + vTravelNew, + currencyFk, + companyFk, + gestDocFk, + invoiceInFk + FROM vn.entry + WHERE id = vAuxEntryFk; + + SET vEntryNew = LAST_INSERT_ID(); + + /* INSERT INTO vn.buy ( + entryFk, + itemFk, + amount, + buyingValue, + quantity, + packageFk, + stickers, + freightValue, + packageValue, + comissionValue, + packing, + `grouping`, + groupingMode, + location, + price1, + price2, + price3, + minPrice, + producer, + printedStickers, + isCkecked) + SELECT + vEntryNew, + itemFk, + amount, + buyingValue, + quantity, + packageFk, + stickers, + freightValue, + packageValue, + comissionValue, + packing, + `grouping`, + groupingMode, + location, + price1, + price2, + price3, + minPrice, + producer, + printedStickers, + isCkecked + FROM buy + WHERE entryFk = vAuxEntryFk;*/ + + INSERT INTO vn2008.Compres (Id_Entrada, + Id_Article, + Cantidad, + Costefijo, + Id_Cubo, + Etiquetas, + Portefijo, + Embalajefijo, + Comisionfija, + Packing, + `grouping`, + caja, + Nicho, + Tarifa1, + Tarifa2, + Tarifa3, + PVP, + Productor, + Vida, + punteo) + SELECT vEntryNew, + Id_Article, + Cantidad, + Costefijo, + Id_Cubo, + Etiquetas, + Portefijo, + Embalajefijo, + Comisionfija, + Packing, + `grouping`, + caja, + Nicho, + Tarifa1, + Tarifa2, + Tarifa3, + PVP, + Productor, + Vida, + punteo + FROM vn2008.Compres + WHERE Id_Entrada = vAuxEntryFk; + + + FETCH vRsEntry INTO vAuxEntryFk; + END WHILE; + CLOSE vRsEntry; + COMMIT; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -37498,216 +34086,216 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `entryConverter`(IN `vEntry` INT) -BEGIN - - DECLARE vWarehouseIn INT; - DECLARE vWarehouseOut INT; - DECLARE vTravel INT; - - DECLARE done BOOL DEFAULT FALSE; - - DECLARE vId_Entrada INT; - DECLARE vId_Article INT; - DECLARE vEtiquetas INT; - DECLARE vId_Cubo VARCHAR(10); - DECLARE vPacking INT; - DECLARE vGrouping INT; - DECLARE vCantidad INT; - DECLARE vCostefijo DECIMAL(10,3); - DECLARE vPortefijo DECIMAL(10,3); - DECLARE vEmbalajefijo DECIMAL(10); - DECLARE vComisionfija DECIMAL(10,3); - DECLARE vCaja INT; - DECLARE vNicho VARCHAR(5); - DECLARE vTarifa1 DECIMAL(10,2); - DECLARE vTarifa2 DECIMAL(10,2); - DECLARE vTarifa3 DECIMAL(10,2); - DECLARE vPVP DECIMAL(10,2); - DECLARE vCompra INT; - - DECLARE rs CURSOR FOR - SELECT - b.Id_Entrada, - b.Id_Article, - b.Etiquetas, - b.Id_Cubo, - b.Packing, - b.`grouping`, - b.Cantidad, - b.Costefijo, - b.Portefijo, - b.Embalajefijo, - b.Comisionfija, - b.caja, - b.Nicho, - b.Tarifa1, - b.Tarifa2, - b.Tarifa3, - b.PVP - FROM vn2008.Compres b - JOIN vn.itemConversor ic ON ic.espItemFk = b.Id_Article - WHERE Id_Entrada = vEntry; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - SELECT warehouseInFk, warehouseOutFk, tr.id - INTO vWarehouseIn, vWarehouseOut, vTravel - FROM travel tr - JOIN entry e ON e.travelFk = tr.id - WHERE e.id = vEntry; - - UPDATE travel - SET warehouseInFk = vWarehouseOut, - warehouseOutFk = vWarehouseIn - WHERE id = vTravel; - - UPDATE vn2008.Compres c - LEFT JOIN vn.itemConversor ic ON ic.espItemFk = c.Id_Article - SET Etiquetas = 0, Cantidad = 0 - WHERE c.Id_Entrada = vEntry - AND ic.espItemFk IS NULL; - - OPEN rs; - - DELETE FROM vn2008.Compres WHERE Id_Entrada = vEntry; - - FETCH rs INTO - vId_Entrada, - vId_Article, - vEtiquetas, - vId_Cubo, - vPacking, - vGrouping, - vCantidad, - vCostefijo, - vPortefijo, - vEmbalajefijo, - vComisionfija, - vCaja, - vNicho, - vTarifa1, - vTarifa2, - vTarifa3, - vPVP; - - WHILE NOT done DO - - -- Primero la linea original con las cantidades invertidas - INSERT INTO vn2008.Compres - ( - Id_Entrada, - Id_Article, - Etiquetas, - Id_Cubo, - Packing, - `grouping`, - Cantidad, - Costefijo, - Portefijo, - Embalajefijo, - Comisionfija, - caja, - Nicho, - Tarifa1, - Tarifa2, - Tarifa3, - PVP - ) - VALUES - ( - vId_Entrada, - vId_Article, - - vEtiquetas, - vId_Cubo, - vPacking, - vGrouping, - - vCantidad, - vCostefijo, - vPortefijo, - vEmbalajefijo, - vComisionfija, - vCaja, - vNicho, - vTarifa1, - vTarifa2, - vTarifa3, - vPVP); - - -- Ahora la linea nueva, con el item genérico - INSERT INTO vn2008.Compres - ( - Id_Entrada, - Id_Article, - Etiquetas, - Id_Cubo, - Packing, - `grouping`, - Cantidad, - Costefijo, - Portefijo, - Embalajefijo, - Comisionfija, - caja, - Nicho, - Tarifa1, - Tarifa2, - Tarifa3, - PVP - ) - SELECT - vId_Entrada, - genItemFk as Id_Article, - vEtiquetas, - vId_Cubo, - vPacking, - vGrouping, - vCantidad, - vCostefijo, - vPortefijo, - vEmbalajefijo, - vComisionfija, - vCaja, - vNicho, - vTarifa1, - vTarifa2, - vTarifa3, - vPVP - FROM itemConversor - WHERE espItemFk = vId_Article; - - SELECT LAST_INSERT_ID() - INTO vCompra; - - REPLACE vn2008.Compres_mark(Id_Compra,`comment`) - SELECT vCompra, vId_Article; - - - FETCH rs INTO - vId_Entrada, - vId_Article, - vEtiquetas, - vId_Cubo, - vPacking, - vGrouping, - vCantidad, - vCostefijo, - vPortefijo, - vEmbalajefijo, - vComisionfija, - vCaja, - vNicho, - vTarifa1, - vTarifa2, - vTarifa3, - vPVP; - - END WHILE; - - - CLOSE rs; - - - +BEGIN + + DECLARE vWarehouseIn INT; + DECLARE vWarehouseOut INT; + DECLARE vTravel INT; + + DECLARE done BOOL DEFAULT FALSE; + + DECLARE vId_Entrada INT; + DECLARE vId_Article INT; + DECLARE vEtiquetas INT; + DECLARE vId_Cubo VARCHAR(10); + DECLARE vPacking INT; + DECLARE vGrouping INT; + DECLARE vCantidad INT; + DECLARE vCostefijo DECIMAL(10,3); + DECLARE vPortefijo DECIMAL(10,3); + DECLARE vEmbalajefijo DECIMAL(10); + DECLARE vComisionfija DECIMAL(10,3); + DECLARE vCaja INT; + DECLARE vNicho VARCHAR(5); + DECLARE vTarifa1 DECIMAL(10,2); + DECLARE vTarifa2 DECIMAL(10,2); + DECLARE vTarifa3 DECIMAL(10,2); + DECLARE vPVP DECIMAL(10,2); + DECLARE vCompra INT; + + DECLARE rs CURSOR FOR + SELECT + b.Id_Entrada, + b.Id_Article, + b.Etiquetas, + b.Id_Cubo, + b.Packing, + b.`grouping`, + b.Cantidad, + b.Costefijo, + b.Portefijo, + b.Embalajefijo, + b.Comisionfija, + b.caja, + b.Nicho, + b.Tarifa1, + b.Tarifa2, + b.Tarifa3, + b.PVP + FROM vn2008.Compres b + JOIN vn.itemConversor ic ON ic.espItemFk = b.Id_Article + WHERE Id_Entrada = vEntry; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + SELECT warehouseInFk, warehouseOutFk, tr.id + INTO vWarehouseIn, vWarehouseOut, vTravel + FROM travel tr + JOIN entry e ON e.travelFk = tr.id + WHERE e.id = vEntry; + + UPDATE travel + SET warehouseInFk = vWarehouseOut, + warehouseOutFk = vWarehouseIn + WHERE id = vTravel; + + UPDATE vn2008.Compres c + LEFT JOIN vn.itemConversor ic ON ic.espItemFk = c.Id_Article + SET Etiquetas = 0, Cantidad = 0 + WHERE c.Id_Entrada = vEntry + AND ic.espItemFk IS NULL; + + OPEN rs; + + DELETE FROM vn2008.Compres WHERE Id_Entrada = vEntry; + + FETCH rs INTO + vId_Entrada, + vId_Article, + vEtiquetas, + vId_Cubo, + vPacking, + vGrouping, + vCantidad, + vCostefijo, + vPortefijo, + vEmbalajefijo, + vComisionfija, + vCaja, + vNicho, + vTarifa1, + vTarifa2, + vTarifa3, + vPVP; + + WHILE NOT done DO + + -- Primero la linea original con las cantidades invertidas + INSERT INTO vn2008.Compres + ( + Id_Entrada, + Id_Article, + Etiquetas, + Id_Cubo, + Packing, + `grouping`, + Cantidad, + Costefijo, + Portefijo, + Embalajefijo, + Comisionfija, + caja, + Nicho, + Tarifa1, + Tarifa2, + Tarifa3, + PVP + ) + VALUES + ( + vId_Entrada, + vId_Article, + - vEtiquetas, + vId_Cubo, + vPacking, + vGrouping, + - vCantidad, + vCostefijo, + vPortefijo, + vEmbalajefijo, + vComisionfija, + vCaja, + vNicho, + vTarifa1, + vTarifa2, + vTarifa3, + vPVP); + + -- Ahora la linea nueva, con el item genérico + INSERT INTO vn2008.Compres + ( + Id_Entrada, + Id_Article, + Etiquetas, + Id_Cubo, + Packing, + `grouping`, + Cantidad, + Costefijo, + Portefijo, + Embalajefijo, + Comisionfija, + caja, + Nicho, + Tarifa1, + Tarifa2, + Tarifa3, + PVP + ) + SELECT + vId_Entrada, + genItemFk as Id_Article, + vEtiquetas, + vId_Cubo, + vPacking, + vGrouping, + vCantidad, + vCostefijo, + vPortefijo, + vEmbalajefijo, + vComisionfija, + vCaja, + vNicho, + vTarifa1, + vTarifa2, + vTarifa3, + vPVP + FROM itemConversor + WHERE espItemFk = vId_Article; + + SELECT LAST_INSERT_ID() + INTO vCompra; + + REPLACE vn2008.Compres_mark(Id_Compra,`comment`) + SELECT vCompra, vId_Article; + + + FETCH rs INTO + vId_Entrada, + vId_Article, + vEtiquetas, + vId_Cubo, + vPacking, + vGrouping, + vCantidad, + vCostefijo, + vPortefijo, + vEmbalajefijo, + vComisionfija, + vCaja, + vNicho, + vTarifa1, + vTarifa2, + vTarifa3, + vPVP; + + END WHILE; + + + CLOSE rs; + + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -37769,62 +34357,62 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `entryPrepare`(IN `idE` BIGINT) -BEGIN - SELECT - b.quantity / b.packing AS Paquetes, - b.packing AS `Grouping`, - barcode, - 'ASEGURADO' AS asegurado, - ic.name, - ic.order, - s.name AS Consignatario, - e.supplierFk AS Id_Cliente, - e.isOrdered, - e.isConfirmed, - 10 AS Calidad, - LPAD(IFNULL(cpd.id, ip.code), - 5, - '0') AS path, - b.entryFk AS Id_Ticket, - t.landed AS Fecha, - b.itemFk, - b.quantity, - i.name AS Concepte, - i.size, - i.inkFk, - i.category, - o.code AS Origen, - 0 AS Bultos, - wIn.`name` AS Tipo, - 0 AS OK, - 0 AS Reservado, - i.stems, - b.id AS Id_Movimiento, - ip.code, - 'PEDIDO ASEGURADO' AS MSG, - 0 AS Seguro, - i.image, - pr.name AS producer - FROM vn.buy b - JOIN vn.entry e ON b.entryFk = e.id - JOIN vn.travel t ON t.id = e.travelFk - JOIN vn.warehouse wIn ON wIn.id = t.warehouseInFk - JOIN vn.warehouse wOut ON wOut.id = t.warehouseOutFk - JOIN vn.item i ON i.id = b.itemFk - JOIN vn.itemType it ON it.id =i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - JOIN vn.packaging pkg ON pkg.id = b.packageFk - LEFT JOIN vn.itemPlacement ip ON i.id = ip.itemFk AND ip.warehouseFk = wIn.id AND ip.warehouseFk = t.warehouseOutFk - LEFT JOIN (SELECT itemFk, code AS barcode FROM vn.itemBarcode GROUP BY itemFk) ib ON ib.itemFk = b.itemFk - LEFT JOIN vn.origin o ON o.id = i.originFk - LEFT JOIN vn.supplier s ON s.id = e.supplierFk - LEFT JOIN vn.producer pr on pr.id = i.producerFk - LEFT JOIN vn.coolerPathDetail cpd ON LEFT(ip.code, 3) = cpd.hallway - WHERE - NOT wIn.isFeedStock AND NOT e.isInventory AND NOT e.isRaid - AND e.id = 158772 - AND i.typeFk IS NOT NULL - AND ic.merchandise IS NOT FALSE; +BEGIN + SELECT + b.quantity / b.packing AS Paquetes, + b.packing AS `Grouping`, + barcode, + 'ASEGURADO' AS asegurado, + ic.name, + ic.order, + s.name AS Consignatario, + e.supplierFk AS Id_Cliente, + e.isOrdered, + e.isConfirmed, + 10 AS Calidad, + LPAD(IFNULL(cpd.id, ip.code), + 5, + '0') AS path, + b.entryFk AS Id_Ticket, + t.landed AS Fecha, + b.itemFk, + b.quantity, + i.name AS Concepte, + i.size, + i.inkFk, + i.category, + o.code AS Origen, + 0 AS Bultos, + wIn.`name` AS Tipo, + 0 AS OK, + 0 AS Reservado, + i.stems, + b.id AS Id_Movimiento, + ip.code, + 'PEDIDO ASEGURADO' AS MSG, + 0 AS Seguro, + i.image, + pr.name AS producer + FROM vn.buy b + JOIN vn.entry e ON b.entryFk = e.id + JOIN vn.travel t ON t.id = e.travelFk + JOIN vn.warehouse wIn ON wIn.id = t.warehouseInFk + JOIN vn.warehouse wOut ON wOut.id = t.warehouseOutFk + JOIN vn.item i ON i.id = b.itemFk + JOIN vn.itemType it ON it.id =i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.packaging pkg ON pkg.id = b.packageFk + LEFT JOIN vn.itemPlacement ip ON i.id = ip.itemFk AND ip.warehouseFk = wIn.id AND ip.warehouseFk = t.warehouseOutFk + LEFT JOIN (SELECT itemFk, code AS barcode FROM vn.itemBarcode GROUP BY itemFk) ib ON ib.itemFk = b.itemFk + LEFT JOIN vn.origin o ON o.id = i.originFk + LEFT JOIN vn.supplier s ON s.id = e.supplierFk + LEFT JOIN vn.producer pr on pr.id = i.producerFk + LEFT JOIN vn.coolerPathDetail cpd ON LEFT(ip.code, 3) = cpd.hallway + WHERE + NOT wIn.isFeedStock AND NOT e.isInventory AND NOT e.isRaid + AND e.id = 158772 + AND i.typeFk IS NOT NULL + AND ic.merchandise IS NOT FALSE; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -41502,38 +38090,38 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `itemLastEntries`(IN `vItem` INT, IN `vDays` DATE) -BEGIN - SELECT - w.id AS warehouseFk, - w.name AS warehouse, - tr.landed, - b.entryFk, - b.isIgnored, - b.price2, - b.price3, - b.stickers, - b.packing, - b.`grouping`, - b.groupingMode, - i.stems, - b.quantity, - b.buyingValue, - b.packageFk , - s.id AS supplierFk, - s.name AS supplier - FROM itemType it - RIGHT JOIN (entry e - LEFT JOIN supplier s ON s.id = e.supplierFk - RIGHT JOIN buy b ON b.entryFk = e.id - LEFT JOIN item i ON i.id = b.itemFk - LEFT JOIN ink ON ink.id = i.inkFk - LEFT JOIN travel tr ON tr.id = e.travelFk - LEFT JOIN warehouse w ON w.id = tr.warehouseInFk - LEFT JOIN origin o ON o.id = i.originFk - ) ON it.id = i.typeFk - LEFT JOIN edi.ekt ek ON b.ektFk = ek.id - WHERE b.itemFk = vItem And tr.shipped BETWEEN vDays AND CURDATE() - ORDER BY tr.landed DESC , b.id DESC; +BEGIN + SELECT + w.id AS warehouseFk, + w.name AS warehouse, + tr.landed, + b.entryFk, + b.isIgnored, + b.price2, + b.price3, + b.stickers, + b.packing, + b.`grouping`, + b.groupingMode, + i.stems, + b.quantity, + b.buyingValue, + b.packageFk , + s.id AS supplierFk, + s.name AS supplier + FROM itemType it + RIGHT JOIN (entry e + LEFT JOIN supplier s ON s.id = e.supplierFk + RIGHT JOIN buy b ON b.entryFk = e.id + LEFT JOIN item i ON i.id = b.itemFk + LEFT JOIN ink ON ink.id = i.inkFk + LEFT JOIN travel tr ON tr.id = e.travelFk + LEFT JOIN warehouse w ON w.id = tr.warehouseInFk + LEFT JOIN origin o ON o.id = i.originFk + ) ON it.id = i.typeFk + LEFT JOIN edi.ekt ek ON b.ektFk = ek.id + WHERE b.itemFk = vItem And tr.shipped BETWEEN vDays AND CURDATE() + ORDER BY tr.landed DESC , b.id DESC; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -45271,77 +41859,77 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `saleItemShelvingMake`(IN `vTicketFk` INT, IN `vSectorFk` INT) -BEGIN - - SET @rest:= CAST(0 AS DECIMAL(10,0)); - SET @saleFk := CAST(0 AS DECIMAL(10,0)); - SET @reserved := CAST(0 AS DECIMAL(10,0)); - - UPDATE vn.itemShelving ish - JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id - JOIN sale s ON s.id = sis.saleFk - SET ish.visible = sis.quantity + ish.visible, - ish.available = sis.quantity + ish.visible - WHERE s.ticketFk = vTicketFk; - - DELETE sis.* - FROM saleItemShelving sis - JOIN sale s ON s.id = sis.saleFk - WHERE s.ticketFk = vTicketFk; - - INSERT INTO saleItemShelving( saleFk, - itemShelvingFk, - quantity, - ubication) - SELECT saleFk, - itemShelvingFk, - CAST(Reserved as DECIMAL(10,0)) as Reserved, - ubication - FROM - (SELECT saleFk, - itemShelvingFk, - ubication, - @rest := IF(@saleFk = saleFk, @rest, quantity) as Falta, - @reserved := IF(available < @rest, available, IF(@rest < packing,0,@rest)) as Reserved, - @rest := @rest - @reserved, - @saleFk := saleFk - FROM - ( SELECT s.id as saleFk, - ish.created, - ish.id as itemShelvingFk, - ish.available, - s.quantity, - ish.packing, - CONCAT(p.`column`, '-',p.`row`,': ', sh.code ) as ubication - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.sector sc ON sc.warehouseFk = t.warehouseFk - JOIN vn.parking p ON p.sectorFk = sc.id - JOIN vn.shelving sh ON sh.parkingFk = p.id - JOIN vn.itemShelving ish ON ish.shelvingFk = sh.code AND ish.itemFk = s.itemFk - WHERE t.id = vTicketFk - AND sc.id = vSectorFk - AND s.quantity MOD ish.packing = 0 - AND s.quantity >= ish.packing - ORDER BY s.id, - sh.priority DESC, - ish.packing DESC, - ish.created - ) sub - ) sub2 - WHERE Reserved > 0; - - UPDATE vn.itemShelving ish - JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id - JOIN vn.sale s ON s.id = sis.saleFk - SET ish.available = ish.visible - sis.quantity, - ish.visible = ish.visible - sis.quantity - WHERE s.ticketFk = vTicketFk - AND s.isPicked = FALSE; - - CALL vn.saleItemShelvingIsPicked(vTicketFk, TRUE); - - +BEGIN + + SET @rest:= CAST(0 AS DECIMAL(10,0)); + SET @saleFk := CAST(0 AS DECIMAL(10,0)); + SET @reserved := CAST(0 AS DECIMAL(10,0)); + + UPDATE vn.itemShelving ish + JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id + JOIN sale s ON s.id = sis.saleFk + SET ish.visible = sis.quantity + ish.visible, + ish.available = sis.quantity + ish.visible + WHERE s.ticketFk = vTicketFk; + + DELETE sis.* + FROM saleItemShelving sis + JOIN sale s ON s.id = sis.saleFk + WHERE s.ticketFk = vTicketFk; + + INSERT INTO saleItemShelving( saleFk, + itemShelvingFk, + quantity, + ubication) + SELECT saleFk, + itemShelvingFk, + CAST(Reserved as DECIMAL(10,0)) as Reserved, + ubication + FROM + (SELECT saleFk, + itemShelvingFk, + ubication, + @rest := IF(@saleFk = saleFk, @rest, quantity) as Falta, + @reserved := IF(available < @rest, available, IF(@rest < packing,0,@rest)) as Reserved, + @rest := @rest - @reserved, + @saleFk := saleFk + FROM + ( SELECT s.id as saleFk, + ish.created, + ish.id as itemShelvingFk, + ish.available, + s.quantity, + ish.packing, + CONCAT(p.`column`, '-',p.`row`,': ', sh.code ) as ubication + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.sector sc ON sc.warehouseFk = t.warehouseFk + JOIN vn.parking p ON p.sectorFk = sc.id + JOIN vn.shelving sh ON sh.parkingFk = p.id + JOIN vn.itemShelving ish ON ish.shelvingFk = sh.code AND ish.itemFk = s.itemFk + WHERE t.id = vTicketFk + AND sc.id = vSectorFk + AND s.quantity MOD ish.packing = 0 + AND s.quantity >= ish.packing + ORDER BY s.id, + sh.priority DESC, + ish.packing DESC, + ish.created + ) sub + ) sub2 + WHERE Reserved > 0; + + UPDATE vn.itemShelving ish + JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id + JOIN vn.sale s ON s.id = sis.saleFk + SET ish.available = ish.visible - sis.quantity, + ish.visible = ish.visible - sis.quantity + WHERE s.ticketFk = vTicketFk + AND s.isPicked = FALSE; + + CALL vn.saleItemShelvingIsPicked(vTicketFk, TRUE); + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -45833,33 +42421,33 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `scanTreeCreate`() -BEGIN - CALL nestTree( - 'vn2008', - 'scan', - 'vn2008', - 'scanTree' - ); - - UPDATE vn2008.scanTree st - JOIN ( - SELECT sl.scan_id, - MAX(sl.odbc_date) lastScanned, - COUNT(DISTINCT t.routeFk) routeCount, - MIN(t.routeFk) mod 1000 as minRoute, - MAX(t.routeFk) mod 1000 as maxRoute, - COUNT(sl.scan_line_id) as scanned - FROM vn2008.scan_line sl - JOIN expedition e ON e.id = sl.`code` - JOIN ticket t ON t.id = e.ticketFk - WHERE t.routeFk - GROUP BY sl.scan_id - ) rs ON rs.scan_id = st.id - SET st.lastScanned = rs.lastScanned, - st.routeCount = rs.routeCount, - st.minRoute = rs.minRoute, - st.maxRoute = IF(rs.minRoute != rs.maxRoute, rs.maxRoute,NULL), - st.scanned = rs.scanned; +BEGIN + CALL nestTree( + 'vn2008', + 'scan', + 'vn2008', + 'scanTree' + ); + + UPDATE vn2008.scanTree st + JOIN ( + SELECT sl.scan_id, + MAX(sl.odbc_date) lastScanned, + COUNT(DISTINCT t.routeFk) routeCount, + MIN(t.routeFk) mod 1000 as minRoute, + MAX(t.routeFk) mod 1000 as maxRoute, + COUNT(sl.scan_line_id) as scanned + FROM vn2008.scan_line sl + JOIN expedition e ON e.id = sl.`code` + JOIN ticket t ON t.id = e.ticketFk + WHERE t.routeFk + GROUP BY sl.scan_id + ) rs ON rs.scan_id = st.id + SET st.lastScanned = rs.lastScanned, + st.routeCount = rs.routeCount, + st.minRoute = rs.minRoute, + st.maxRoute = IF(rs.minRoute != rs.maxRoute, rs.maxRoute,NULL), + st.scanned = rs.scanned; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -51555,8 +48143,11 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerDisable`(vUserId int) -BEGIN +mainLabel:BEGIN + IF vUserId = 14255 THEN + LEAVE mainLabel; + END IF; DELETE FROM account.account WHERE id = vUserId; @@ -51570,8 +48161,7 @@ BEGIN UPDATE `client` c JOIN payMethod p ON p.name = 'CONTADO' SET c.credit = 0, c.payMethodFk = p.id, hasCoreVnl = FALSE - WHERE c.id = vUserId; - + WHERE c.id = vUserId; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -53908,12 +50498,12 @@ USE `vncontrol`; DROP TABLE IF EXISTS `accion`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `accion` ( `accion_id` int(11) NOT NULL AUTO_INCREMENT, `accion` varchar(15) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`accion_id`) -) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -53922,7 +50512,7 @@ CREATE TABLE `accion` ( DROP TABLE IF EXISTS `fallo__`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `fallo__` ( `queja_id` int(10) unsigned NOT NULL, `accion_id` int(11) NOT NULL, @@ -53939,7 +50529,7 @@ CREATE TABLE `fallo__` ( DROP TABLE IF EXISTS `inter`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `inter` ( `inter_id` int(11) NOT NULL AUTO_INCREMENT, `state_id` tinyint(3) unsigned NOT NULL, @@ -53959,7 +50549,7 @@ CREATE TABLE `inter` ( CONSTRAINT `inter_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `vn`.`ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `inter_state` FOREIGN KEY (`state_id`) REFERENCES `vn`.`state` (`id`) ON UPDATE CASCADE, CONSTRAINT `responsable` FOREIGN KEY (`Id_Supervisor`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=22162842 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -54321,156 +50911,6 @@ USE `bi`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Current Database: `bs` --- - -USE `bs`; - --- --- Final view structure for view `bajasLaborales` --- - -/*!50001 DROP VIEW IF EXISTS `bajasLaborales`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `bajasLaborales` AS select `p`.`firstname` AS `firstname`,`p`.`name` AS `name`,`b`.`business_id` AS `business_id`,max(`ce`.`date`) AS `lastDate`,max(ifnull(`b`.`date_end`,curdate())) AS `endContract`,`cs`.`type` AS `type`,cast(count(0) as decimal(10,0)) AS `dias`,`w`.`userFk` AS `userFk` from (((((`postgresql`.`calendar_employee` `ce` join `postgresql`.`business` `b` on((`b`.`business_id` = `ce`.`business_id`))) join `postgresql`.`profile` `pr` on((`pr`.`profile_id` = `b`.`client_id`))) join `postgresql`.`person` `p` on((`p`.`person_id` = `pr`.`person_id`))) join `postgresql`.`calendar_state` `cs` on((`cs`.`calendar_state_id` = `ce`.`calendar_state_id`))) join `vn`.`worker` `w` on((`w`.`id` = `p`.`id_trabajador`))) where ((`ce`.`date` >= (curdate() + interval -(1) year)) and (`cs`.`type` not in ('Vacaciones','Vacaciones 1/2 día','Compensar','Festivo'))) group by `p`.`firstname`,`p`.`name`,`cs`.`type` having (`endContract` >= curdate()) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `lastIndicators` --- - -/*!50001 DROP VIEW IF EXISTS `lastIndicators`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `lastIndicators` AS select `i`.`updated` AS `updated`,`i`.`lastYearSales` AS `lastYearSales`,(`i`.`lastYearSales` - `yi`.`lastYearSales`) AS `incLastYearSales`,`i`.`totalGreuge` AS `totalGreuge`,(`i`.`totalGreuge` - `yi`.`totalGreuge`) AS `incTotalGreuge`,`i`.`latePaymentRate` AS `latePaymentRate`,(`i`.`latePaymentRate` - `yi`.`latePaymentRate`) AS `incLatePaymentRate`,`i`.`countEmployee` AS `countEmployee`,(`i`.`countEmployee` - `yi`.`countEmployee`) AS `incCountEmployee`,`i`.`averageMana` AS `averageMana`,(`i`.`averageMana` - `yi`.`averageMana`) AS `incAverageMana`,`i`.`bankingPool` AS `bankingPool`,(`i`.`bankingPool` - `yi`.`bankingPool`) AS `incbankingPool`,`i`.`lastMonthActiveClients` AS `lastMonthActiveClients`,(`i`.`lastMonthActiveClients` - `yi`.`lastMonthActiveClients`) AS `incLastMonthActiveClients`,`i`.`lastMonthLostClients` AS `lastMonthLostClients`,(`i`.`lastMonthLostClients` - `yi`.`lastMonthLostClients`) AS `incLastMonthLostClients`,`i`.`lastMonthNewClients` AS `lastMonthNewClients`,(`i`.`lastMonthNewClients` - `yi`.`lastMonthNewClients`) AS `incLastMonthNewClients`,`i`.`lastMonthWebBuyingRate` AS `lastMonthWebBuyingRate`,(`i`.`lastMonthWebBuyingRate` - `yi`.`lastMonthWebBuyingRate`) AS `incLastMonthWebBuyingRate`,`i`.`productionHours` AS `productionHours`,`i`.`dailyWorkersCost` AS `dailyWorkersCost`,`i`.`volumeM3` AS `volumeM3`,`i`.`salesValue` AS `salesValue`,`i`.`valueM3` AS `valueM3`,`i`.`hoursM3` AS `hoursM3`,`i`.`workerCostM3` AS `workerCostM3`,`i`.`salesWorkersCostRate` AS `salesWorkersCostRate`,`i`.`thisWeekSales` AS `thisWeekSales`,`i`.`lastYearWeekSales` AS `lastYearWeekSales` from (`indicators` `i` join `indicators` `yi` on((`yi`.`updated` = (select (max(`indicators`.`updated`) + interval -(1) day) from `indicators`)))) where (`i`.`updated` = (select max(`indicators`.`updated`) from `indicators`)) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `m3Silla` --- - -/*!50001 DROP VIEW IF EXISTS `m3Silla`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `m3Silla` AS select `m3`.`fecha` AS `fecha`,`m3`.`year` AS `year`,`m3`.`month` AS `month`,`m3`.`week` AS `week`,`m3`.`day` AS `day`,`m3`.`dayName` AS `dayName`,cast(sum(`m3`.`m3`) as decimal(10,0)) AS `Volumen`,cast(sum(`m3`.`euros`) as decimal(10,0)) AS `Euros` from `m3` where (`m3`.`warehouseFk` in (1,44)) group by `m3`.`fecha` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `m3analisis` --- - -/*!50001 DROP VIEW IF EXISTS `m3analisis`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `m3analisis` AS select `m`.`fecha` AS `fecha`,`m`.`year` AS `year`,`m`.`month` AS `month`,`m`.`week` AS `week`,`m`.`day` AS `day`,`m`.`dayName` AS `dayName`,`m`.`Volumen` AS `Volumen`,`m`.`Euros` AS `Euros`,`h`.`Departamento` AS `Departamento`,`h`.`Horas` AS `Horas`,`h`.`Salarios` AS `Salarios`,(`h`.`Horas` / `m`.`Volumen`) AS `tiempoM3`,(`m`.`Euros` / `m`.`Volumen`) AS `valorM3`,(`h`.`Salarios` / `m`.`Volumen`) AS `costeLaboralM3`,(`h`.`Salarios` / `m`.`Euros`) AS `costeEuros`,(`h`.`Salarios` / `h`.`Horas`) AS `precioHora` from (`bs`.`m3Silla` `m` join `bs`.`horasSilla` `h` on((`h`.`Fecha` = `m`.`fecha`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `manaSpellersExcluded` --- - -/*!50001 DROP VIEW IF EXISTS `manaSpellersExcluded`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `manaSpellersExcluded` AS select `m`.`Id_Trabajador` AS `workerFk` from `mana_spellers_excluded` `m` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `mana_spellers` --- - -/*!50001 DROP VIEW IF EXISTS `mana_spellers`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `mana_spellers` AS select `wm`.`workerFk` AS `Id_Trabajador`,`wm`.`size` AS `size`,`wm`.`amount` AS `used`,`wm`.`pricesModifierRate` AS `prices_modifier_rate`,`wm`.`isPricesModifierActivated` AS `prices_modifier_activated`,`wm`.`minRate` AS `minRate`,`wm`.`maxRate` AS `maxRate` from `vn`.`workerMana` `wm` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `mermas` --- - -/*!50001 DROP VIEW IF EXISTS `mermas`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `mermas` AS select `w`.`code` AS `Comprador`,`it`.`name` AS `Familia`,`i`.`id` AS `Referencia`,`i`.`name` AS `Item`,`s`.`quantity` AS `Cantidad`,(((`b`.`buyingValue` + `b`.`freightValue`) + `b`.`comissionValue`) + `b`.`packageValue`) AS `Coste_Unitario`,(`s`.`quantity` * (((`b`.`buyingValue` + `b`.`freightValue`) + `b`.`comissionValue`) + `b`.`packageValue`)) AS `Importe`,`c`.`name` AS `Cliente`,`s`.`ticketFk` AS `ticketFk`,`t`.`shipped` AS `Fecha` from (((((((`vn`.`worker` `w` join `vn`.`itemType` `it` on((`it`.`workerFk` = `w`.`id`))) join `vn`.`item` `i` on((`i`.`typeFk` = `it`.`id`))) join `vn`.`sale` `s` on((`s`.`itemFk` = `i`.`id`))) join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `vn`.`client` `c` on((`c`.`id` = `t`.`clientFk`))) left join `bi`.`Last_buy_id` `lb` on(((`lb`.`Id_Article` = `s`.`itemFk`) and (`lb`.`warehouse_id` = `t`.`warehouseFk`)))) left join `vn`.`buy` `b` on((`b`.`id` = `lb`.`Id_Compra`))) where ((`t`.`shipped` > '2018-01-01') and (`c`.`isRelevant` or (`c`.`id` in (200,400)))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `workerMana` --- - -/*!50001 DROP VIEW IF EXISTS `workerMana`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerMana` AS select `m`.`Id_Trabajador` AS `workerFk`,`m`.`used` AS `amount` from `bs`.`mana_spellers` `m` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Current Database: `cache` -- @@ -55041,6 +51481,24 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `agencyProvince__` +-- + +/*!50001 DROP VIEW IF EXISTS `agencyProvince__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `agencyProvince__` AS select `a`.`province_id` AS `provinceFk`,`a`.`agency_id` AS `agencyFk`,`a`.`zona` AS `zone`,`a`.`warehouse_id` AS `warehouseFk`,`a`.`isVolumetric` AS `isVolumetric` from `vn2008`.`Agencias_province` `a` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `annualAverageInvoiced` -- @@ -56280,4 +52738,4 @@ USE `vncontrol`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-12-13 8:42:46 +-- Dump completed on 2019-12-16 8:42:22 diff --git a/db/export-data.sh b/db/export-data.sh index fd690854a..4dc57db41 100755 --- a/db/export-data.sh +++ b/db/export-data.sh @@ -52,8 +52,6 @@ TABLES=( ) dump_tables ${TABLES[@]} - - TABLES=( bi tarifa_componentes diff --git a/db/export-structure.sh b/db/export-structure.sh index da1d23daf..d780d849c 100755 --- a/db/export-structure.sh +++ b/db/export-structure.sh @@ -97,10 +97,10 @@ IGNORETABLES=( mysqldump \ --defaults-file=config.production.ini \ --default-character-set=utf8 \ - --column-statistics=0 \ --no-data --comments \ --triggers --routines --events \ --databases \ ${SCHEMAS[@]} \ ${IGNORETABLES[@]} \ + | sed 's/ AUTO_INCREMENT=[0-9]* //g' \ > dump/structure.sql diff --git a/modules/client/back/methods/client/specs/activeWorkersWithRole.spec.js b/modules/client/back/methods/client/specs/activeWorkersWithRole.spec.js index 0004b2156..7cc49cd90 100644 --- a/modules/client/back/methods/client/specs/activeWorkersWithRole.spec.js +++ b/modules/client/back/methods/client/specs/activeWorkersWithRole.spec.js @@ -7,7 +7,7 @@ describe('Client activeWorkersWithRole', () => { let isSalesPerson = await app.models.Account.hasRole(result[0].id, 'salesPerson'); - expect(result.length).toEqual(14); + expect(result.length).toEqual(13); expect(isSalesPerson).toBeTruthy(); }); @@ -17,7 +17,7 @@ describe('Client activeWorkersWithRole', () => { let isBuyer = await app.models.Account.hasRole(result[0].id, 'buyer'); - expect(result.length).toEqual(11); + expect(result.length).toEqual(10); expect(isBuyer).toBeTruthy(); }); }); diff --git a/modules/client/back/methods/client/specs/listWorkers.spec.js b/modules/client/back/methods/client/specs/listWorkers.spec.js index 728268457..5f3836ba1 100644 --- a/modules/client/back/methods/client/specs/listWorkers.spec.js +++ b/modules/client/back/methods/client/specs/listWorkers.spec.js @@ -6,7 +6,7 @@ describe('Client listWorkers', () => { .then(result => { let amountOfEmployees = Object.keys(result).length; - expect(amountOfEmployees).toEqual(49); + expect(amountOfEmployees).toEqual(48); done(); }) .catch(done.fail);