From 1c81fa55abd202026bb100e34d31e3e11e069603 Mon Sep 17 00:00:00 2001 From: Bernat Date: Thu, 25 Oct 2018 09:41:58 +0200 Subject: [PATCH] export structure and data from production --- services/db/export-data.cmd | 28 +- services/db/export-data.sh | 28 +- services/db/export-structure.cmd | 2 +- services/db/export-structure.sh | 2 +- .../changes/1.0-OnlyLocal/06-entity.sql | 3 - .../install/changes/1.2-CHECK/02-clentLog.sql | 13 - .../1.2-CHECK/03-clientLogBeforeInsert.sql | 11 - .../changes/1.2-CHECK/05-clientLog.sql | 10 - .../db/install/changes/1.2-CHECK/06.ACL.sql | 17 - .../changes/1.2-CHECK/07.userConfig.sql | 8 - .../changes/1.2-CHECK/08-itemDiary.sql | 119 - .../changes/1.2-CHECK/09.defaulters.sql | 14 - .../changes/1.2-CHECK/10.clientRisk.sql | 12 - services/db/install/dump/dumpedFixtures.sql | 20 +- services/db/install/dump/structure.sql | 2091 +++++++++++++---- 15 files changed, 1719 insertions(+), 659 deletions(-) delete mode 100644 services/db/install/changes/1.2-CHECK/02-clentLog.sql delete mode 100644 services/db/install/changes/1.2-CHECK/03-clientLogBeforeInsert.sql delete mode 100644 services/db/install/changes/1.2-CHECK/05-clientLog.sql delete mode 100644 services/db/install/changes/1.2-CHECK/06.ACL.sql delete mode 100644 services/db/install/changes/1.2-CHECK/07.userConfig.sql delete mode 100644 services/db/install/changes/1.2-CHECK/08-itemDiary.sql delete mode 100644 services/db/install/changes/1.2-CHECK/09.defaulters.sql delete mode 100644 services/db/install/changes/1.2-CHECK/10.clientRisk.sql diff --git a/services/db/export-data.cmd b/services/db/export-data.cmd index ca7fd23f0..d12d8c287 100755 --- a/services/db/export-data.cmd +++ b/services/db/export-data.cmd @@ -1,18 +1,18 @@ ::IMPORTANT Any changes in this file are to applyed to mirror file export-data.sh -echo USE `account`; > install/dump/03-dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info account role roleRole roleInherit >> install/dump/03-dumpedFixtures.sql -echo USE `salix`; >> install/dump/03-dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info salix ACL >> install/dump/03-dumpedFixtures.sql -echo USE `vn`; >> install/dump/03-dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak bookingPlanner pgc tag alertLevel>> install/dump/03-dumpedFixtures.sql -echo USE `vn2008`; >> install/dump/03-dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos Monedas container iva_group_codigo escritos cl_est cl_con cl_res cl_dev cl_mot >> install/dump/03-dumpedFixtures.sql -echo USE `bi`; >> install/dump/03-dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info bi tarifa_componentes tarifa_componentes_series >> install/dump/03-dumpedFixtures.sql -echo USE `cache`; >> install/dump/03-dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info cache cache >> install/dump/03-dumpedFixtures.sql -echo USE `hedera`; >> install/dump/03-dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info hedera tpvError tpvResponse tpvConfig >> install/dump/03-dumpedFixtures.sql +echo USE `account`; > install/dump/dumpedFixtures.sql +mysqldump --defaults-file=connect.ini --no-create-info account role roleRole roleInherit >> install/dump/dumpedFixtures.sql +echo USE `salix`; >> install/dump/dumpedFixtures.sql +mysqldump --defaults-file=connect.ini --no-create-info salix ACL >> install/dump/dumpedFixtures.sql +echo USE `vn`; >> install/dump/dumpedFixtures.sql +mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak bookingPlanner pgc tag alertLevel>> install/dump/dumpedFixtures.sql +echo USE `vn2008`; >> install/dump/dumpedFixtures.sql +mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos Monedas container iva_group_codigo escritos cl_est cl_con cl_res cl_dev cl_mot >> install/dump/dumpedFixtures.sql +echo USE `bi`; >> install/dump/dumpedFixtures.sql +mysqldump --defaults-file=connect.ini --no-create-info bi tarifa_componentes tarifa_componentes_series >> install/dump/dumpedFixtures.sql +echo USE `cache`; >> install/dump/dumpedFixtures.sql +mysqldump --defaults-file=connect.ini --no-create-info cache cache >> install/dump/dumpedFixtures.sql +echo USE `hedera`; >> install/dump/dumpedFixtures.sql +mysqldump --defaults-file=connect.ini --no-create-info hedera tpvError tpvResponse tpvConfig >> install/dump/dumpedFixtures.sql diff --git a/services/db/export-data.sh b/services/db/export-data.sh index 41aabf81e..6c630f3cf 100755 --- a/services/db/export-data.sh +++ b/services/db/export-data.sh @@ -1,16 +1,16 @@ #!/bin/bash #IMPORTANT Any changes in this file are to applyed to mirror file export-data.cmd -echo "USE \`account\`;" > install/dump/03-dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info account role roleRole roleInherit >> install/dump/03-dumpedFixtures.sql -echo "USE \`salix\`;" >> install/dump/03-dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info salix ACL >> install/dump/03-dumpedFixtures.sql -echo "USE \`vn\`;" >> install/dump/03-dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak bookingPlanner pgc tag alertLevel >> install/dump/03-dumpedFixtures.sql -echo "USE \`vn2008\`;" >> install/dump/03-dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos Monedas container iva_group_codigo escritos cl_est cl_con cl_res cl_dev cl_mot >> install/dump/03-dumpedFixtures.sql -echo "USE \`bi\`;" >> install/dump/03-dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info bi tarifa_componentes tarifa_componentes_series >> install/dump/03-dumpedFixtures.sql -echo "USE \`cache\`;" >> install/dump/03-dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info cache cache >> install/dump/03-dumpedFixtures.sql -echo "USE \`hedera\`;" >> install/dump/03-dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info hedera tpvError tpvResponse tpvConfig >> install/dump/03-dumpedFixtures.sql +echo "USE \`account\`;" > install/dump/dumpedFixtures.sql +mysqldump --defaults-file=connect.ini --no-create-info account role roleRole roleInherit >> install/dump/dumpedFixtures.sql +echo "USE \`salix\`;" >> install/dump/dumpedFixtures.sql +mysqldump --defaults-file=connect.ini --no-create-info salix ACL >> install/dump/dumpedFixtures.sql +echo "USE \`vn\`;" >> install/dump/dumpedFixtures.sql +mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak bookingPlanner pgc tag alertLevel >> install/dump/dumpedFixtures.sql +echo "USE \`vn2008\`;" >> install/dump/dumpedFixtures.sql +mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos Monedas container iva_group_codigo escritos cl_est cl_con cl_res cl_dev cl_mot >> install/dump/dumpedFixtures.sql +echo "USE \`bi\`;" >> install/dump/dumpedFixtures.sql +mysqldump --defaults-file=connect.ini --no-create-info bi tarifa_componentes tarifa_componentes_series >> install/dump/dumpedFixtures.sql +echo "USE \`cache\`;" >> install/dump/dumpedFixtures.sql +mysqldump --defaults-file=connect.ini --no-create-info cache cache >> install/dump/dumpedFixtures.sql +echo "USE \`hedera\`;" >> install/dump/dumpedFixtures.sql +mysqldump --defaults-file=connect.ini --no-create-info hedera tpvError tpvResponse tpvConfig >> install/dump/dumpedFixtures.sql diff --git a/services/db/export-structure.cmd b/services/db/export-structure.cmd index 0f2203dcb..59e924034 100755 --- a/services/db/export-structure.cmd +++ b/services/db/export-structure.cmd @@ -1,2 +1,2 @@ ::IMPORTANT Any changes in this file are to applyed to mirror file export-structure.sh -mysqldump --defaults-file=connect.ini --default-character-set=utf8 --no-data --comments --triggers --routines --events --databases account util vn2008 vn edi bs bi pbx cache salix vncontrol hedera stock > install/dump/01-structure.sql +mysqldump --defaults-file=connect.ini --default-character-set=utf8 --no-data --comments --triggers --routines --events --databases account util vn2008 vn edi bs bi pbx cache salix vncontrol hedera stock > install/dump/structure.sql diff --git a/services/db/export-structure.sh b/services/db/export-structure.sh index 402174e61..2c88932b4 100755 --- a/services/db/export-structure.sh +++ b/services/db/export-structure.sh @@ -1,3 +1,3 @@ #!/bin/bash #IMPORTANT Any changes in this file are to applyed to mirror file export-structure.cmd -mysqldump --defaults-file=connect.ini --default-character-set=utf8 --no-data --comments --triggers --routines --events --databases account util vn2008 vn edi bs bi pbx cache salix vncontrol hedera stock > install/dump/01-structure.sql +mysqldump --defaults-file=connect.ini --default-character-set=utf8 --no-data --comments --triggers --routines --events --databases account util vn2008 vn edi bs bi pbx cache salix vncontrol hedera stock > install/dump/structure.sql diff --git a/services/db/install/changes/1.0-OnlyLocal/06-entity.sql b/services/db/install/changes/1.0-OnlyLocal/06-entity.sql index 08d83a6b0..6f8369743 100644 --- a/services/db/install/changes/1.0-OnlyLocal/06-entity.sql +++ b/services/db/install/changes/1.0-OnlyLocal/06-entity.sql @@ -3,9 +3,6 @@ * Ya está en producción **/ -ALTER TABLE `vn2008`.`Clientes` -ADD COLUMN `bankEntityFk` INT(10) UNSIGNED NULL AFTER `hasLcr`; - USE `vn`; CREATE OR REPLACE ALGORITHM = UNDEFINED diff --git a/services/db/install/changes/1.2-CHECK/02-clentLog.sql b/services/db/install/changes/1.2-CHECK/02-clentLog.sql deleted file mode 100644 index 24cc39711..000000000 --- a/services/db/install/changes/1.2-CHECK/02-clentLog.sql +++ /dev/null @@ -1,13 +0,0 @@ -ALTER TABLE `vn`.`clientLog` -CHANGE COLUMN `newInstance` `newInstance` TEXT NULL DEFAULT NULL ; - - - -ALTER TABLE `vn`.`clientLog` -CHANGE COLUMN `model` `changedModel` TEXT CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL , -ADD COLUMN `changedModelId` INT(11) NULL DEFAULT NULL AFTER `newInstance`, -ADD COLUMN `changedModelValue` VARCHAR(45) NULL DEFAULT NULL AFTER `changedModelId`; - - -ALTER TABLE `vn`.`clientLog` -CHANGE COLUMN `changedModel` `changedModel` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL ; diff --git a/services/db/install/changes/1.2-CHECK/03-clientLogBeforeInsert.sql b/services/db/install/changes/1.2-CHECK/03-clientLogBeforeInsert.sql deleted file mode 100644 index 357f2a80d..000000000 --- a/services/db/install/changes/1.2-CHECK/03-clientLogBeforeInsert.sql +++ /dev/null @@ -1,11 +0,0 @@ -DROP TRIGGER IF EXISTS `vn`.`clientLog_BEFORE_INSERT`; - -DELIMITER $$ -USE `vn`$$ -CREATE DEFINER=`root`@`%` TRIGGER `vn`.`clientLog_BEFORE_INSERT` BEFORE INSERT ON `clientLog` FOR EACH ROW -BEGIN - IF NEW.newInstance is NULL THEN - SET NEW.newInstance = NEW.description; - END IF; -END$$ -DELIMITER ; diff --git a/services/db/install/changes/1.2-CHECK/05-clientLog.sql b/services/db/install/changes/1.2-CHECK/05-clientLog.sql deleted file mode 100644 index 18b17c036..000000000 --- a/services/db/install/changes/1.2-CHECK/05-clientLog.sql +++ /dev/null @@ -1,10 +0,0 @@ -ALTER TABLE `vn`.`clientLog` -DROP FOREIGN KEY `clientLog_ibfk_2`; -ALTER TABLE `vn`.`clientLog` -CHANGE COLUMN `userFk` `userFk` INT(10) UNSIGNED NULL DEFAULT NULL ; -ALTER TABLE `vn`.`clientLog` -ADD CONSTRAINT `clientLog_ibfk_2` - FOREIGN KEY (`userFk`) - REFERENCES `account`.`user` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE; diff --git a/services/db/install/changes/1.2-CHECK/06.ACL.sql b/services/db/install/changes/1.2-CHECK/06.ACL.sql deleted file mode 100644 index 5c2ebe817..000000000 --- a/services/db/install/changes/1.2-CHECK/06.ACL.sql +++ /dev/null @@ -1,17 +0,0 @@ -INSERT INTO salix.ACL(id, model, property, accessType, permission, principalType, principalId) -VALUES -(104, 'Item', '*', 'WRITE', 'ALLOW', 'ROLE', 'marketingBoss'), -(105, 'ItemBarcode', '*', 'WRITE', 'ALLOW', 'ROLE', 'marketingBoss'), -(106, 'ItemBotanical', '*', 'WRITE', 'ALLOW', 'ROLE', 'marketingBoss'), -(107, 'ItemNiche', '*', 'WRITE', 'ALLOW', 'ROLE', 'marketingBoss'), -(108, 'ItemPlacement', '*', 'WRITE', 'ALLOW', 'ROLE', 'marketingBoss'), -(109, 'UserConfig', '*', '*', 'ALLOW', 'ROLE', 'employee'), -(110, 'Bank', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), -(111, 'ClientLog', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), -(112, 'Defaulter', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), -(113, 'ClientRisk', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), -(114, 'Receipt', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), -(115, 'Receipt', '*', 'WRITE', 'ALLOW', 'ROLE', 'administrative'); -UPDATE salix.ACL -SET model='ItemTag', property='*', accessType='WRITE', permission='ALLOW', principalType='ROLE', principalId='marketingBoss' -WHERE id=52; \ No newline at end of file diff --git a/services/db/install/changes/1.2-CHECK/07.userConfig.sql b/services/db/install/changes/1.2-CHECK/07.userConfig.sql deleted file mode 100644 index 8032a048f..000000000 --- a/services/db/install/changes/1.2-CHECK/07.userConfig.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE `vn`.`userConfig` ( - `userFk` int(10) unsigned NOT NULL, - `warehouseFk` smallint(6) DEFAULT NULL, - `companyFk` smallint(5) unsigned DEFAULT NULL, - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (`userFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuración de usuario en Salix'; diff --git a/services/db/install/changes/1.2-CHECK/08-itemDiary.sql b/services/db/install/changes/1.2-CHECK/08-itemDiary.sql deleted file mode 100644 index 3994672fb..000000000 --- a/services/db/install/changes/1.2-CHECK/08-itemDiary.sql +++ /dev/null @@ -1,119 +0,0 @@ -USE `vn`; -DROP procedure IF EXISTS `itemDiary`; - -DELIMITER $$ -USE `vn`$$ -CREATE DEFINER=`root`@`%` PROCEDURE `itemDiary`(IN vItemId INT, IN vWarehouse INT) -BEGIN - DECLARE vDateInventory DATETIME; - DECLARE vCurdate DATE DEFAULT CURDATE(); - DECLARE vDayEnd DATETIME DEFAULT util.dayEnd(vCurdate); - -- traduccion: date, alertLevel, origin, reference, name, In, Out, Balance - SELECT Fechainventario INTO vDateInventory FROM vn2008.tblContadores; - SET @a = 0; - SELECT sql_no_cache DATE(date) AS date, - alertLevel, - stateName, - origin, - reference, - clientFk, - name, - `in`, - `out`, - @a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance, - isPicked, - isTicket - FROM - ( SELECT tr.landed as date, - b.quantity as `in`, - NULL as `out`, - IF(tr.isReceived != FALSE,3, IF(tr.isDelivered,1,0)) as alertLevel, - st.name AS stateName, - s.name as name, - e.ref as reference, - e.id as origin, - s.id as clientFk, - TRUE isPicked, - FALSE AS isTicket - FROM vn.buy b - JOIN vn.entry e ON e.id = b.entryFk - JOIN vn.travel tr ON tr.id = e.travelFk - JOIN vn.supplier s ON s.id = e.supplierFk - JOIN vn.alertLevel al ON al.alertLevel = - CASE - WHEN tr.isReceived != FALSE THEN 3 - WHEN tr.isDelivered THEN 1 - ELSE 0 - END - JOIN vn.state st ON st.code = al.code - WHERE tr.landed >= vDateInventory - AND vWarehouse = tr.warehouseInFk - AND b.itemFk = vItemId - AND e.isInventory = 0 - - UNION ALL - - SELECT tr.shipped as date, - NULL as `in`, - b.quantity as `out`, - IF(tr.isReceived != FALSE,3, IF(tr.isDelivered,1,0)) as alertLevel, - st.name AS stateName, - s.name as name, - e.ref as reference, - e.id as origin, - s.id as clientFk, - TRUE isPicked, - FALSE AS isTicket - FROM vn.buy b - JOIN vn.entry e ON e.id = b.entryFk - JOIN vn.travel tr ON tr.id = e.travelFk - JOIN vn.warehouse w ON w.id = tr.warehouseOutFk - JOIN vn.supplier s ON s.id = e.supplierFk - JOIN vn.alertLevel al ON al.alertLevel = - CASE - WHEN tr.isReceived != FALSE THEN 3 - WHEN tr.isDelivered THEN 1 - ELSE 0 - END - JOIN vn.state st ON st.code = al.code - WHERE tr.shipped >= vDateInventory - AND vWarehouse =tr.warehouseOutFk - AND s.id <> 4 - AND b.itemFk = vItemId - AND e.isInventory = 0 - AND w.isFeedStock = 0 - - UNION ALL - - SELECT t.shipped as date, - NULL as `in`, - s.quantity as `out`, - al.alertLevel as alertLevel, - st.name AS stateName, - t.nickname as name, - t.refFk as reference, - t.id as origin, - t.clientFk, - TRUE as isPicked, -- stk.id as isPicked - TRUE as isTicket - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - LEFT JOIN vn.ticketState ts ON ts.ticket = t.id - JOIN vn.client c ON c.id = t.clientFk - JOIN vn.alertLevel al ON al.alertLevel = - CASE - WHEN t.shipped < vCurdate THEN 3 - WHEN t.shipped > vDayEnd THEN 0 - ELSE IFNULL(ts.alertLevel, 0) - END - JOIN vn.state st ON st.code = al.code - -- LEFT JOIN vn.saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = 14 - WHERE t.shipped >= vDateInventory - AND s.itemFk = vItemId - AND vWarehouse =t.warehouseFk - ) AS itemDiary - ORDER BY date DESC, alertLevel DESC, isPicked DESC, `in` DESC, `out` DESC; -END$$ - -DELIMITER ; - diff --git a/services/db/install/changes/1.2-CHECK/09.defaulters.sql b/services/db/install/changes/1.2-CHECK/09.defaulters.sql deleted file mode 100644 index ce38e8c71..000000000 --- a/services/db/install/changes/1.2-CHECK/09.defaulters.sql +++ /dev/null @@ -1,14 +0,0 @@ -USE `vn`; -CREATE - OR REPLACE ALGORITHM = UNDEFINED - DEFINER = `root`@`%` - SQL SECURITY DEFINER -VIEW `vn`.`defaulter` AS - SELECT - `d`.`client` AS `clientFk`, - `d`.`date` AS `created`, - `d`.`amount` AS `amount`, - `d`.`defaulterSince` AS `defaulterSinced`, - `d`.`hasChanged` AS `hasChanged` - FROM - `bi`.`defaulters` `d`; diff --git a/services/db/install/changes/1.2-CHECK/10.clientRisk.sql b/services/db/install/changes/1.2-CHECK/10.clientRisk.sql deleted file mode 100644 index 582d9ccce..000000000 --- a/services/db/install/changes/1.2-CHECK/10.clientRisk.sql +++ /dev/null @@ -1,12 +0,0 @@ -USE `vn`; -CREATE - OR REPLACE ALGORITHM = UNDEFINED - DEFINER = `root`@`%` - SQL SECURITY DEFINER -VIEW `clientRisk` AS - SELECT - `c`.`customer_id` AS `clientFk`, - `c`.`company_id` AS `companyFk`, - `c`.`amount` AS `amount` - FROM - `bi`.`customer_risk` `c`; diff --git a/services/db/install/dump/dumpedFixtures.sql b/services/db/install/dump/dumpedFixtures.sql index 5f176901f..e5a24ee43 100644 --- a/services/db/install/dump/dumpedFixtures.sql +++ b/services/db/install/dump/dumpedFixtures.sql @@ -55,7 +55,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-10-04 9:08:07 +-- Dump completed on 2018-10-25 9:12:10 USE `salix`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- @@ -80,7 +80,7 @@ USE `salix`; LOCK TABLES `ACL` WRITE; /*!40000 ALTER TABLE `ACL` DISABLE KEYS */; -INSERT INTO `ACL` VALUES (1,'Account','*','*','ALLOW','ROLE','employee'),(3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(7,'Client','*','*','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','employee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','employee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','employee'),(18,'State','*','READ','ALLOW','ROLE','employee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','employee'),(28,'ClientObservation','*','READ','ALLOW','ROLE','employee'),(30,'GreugeType','*','READ','ALLOW','ROLE','employee'),(31,'Mandate','*','READ','ALLOW','ROLE','employee'),(32,'MandateType','*','READ','ALLOW','ROLE','employee'),(33,'Company','*','READ','ALLOW','ROLE','employee'),(34,'Greuge','*','READ','ALLOW','ROLE','employee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(48,'ItemNiche','*','READ','ALLOW','ROLE','employee'),(49,'ItemNiche','*','WRITE','ALLOW','ROLE','buyer'),(50,'ItemNiche','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(52,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','employee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(57,'CreditClassification','*','READ','ALLOW','ROLE','employee'),(58,'CreditClassification','*','*','ALLOW','ROLE','creditInsurance'),(59,'CreditInsurance','*','READ','ALLOW','ROLE','employee'),(60,'CreditInsurance','*','*','ALLOW','ROLE','creditInsurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(62,'Ticket','*','*','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(67,'TicketState','*','*','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(71,'SaleChecked','*','READ','ALLOW','ROLE','employee'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','READ','ALLOW','ROLE','employee'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','removes','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','*','ALLOW','ROLE','employee'),(92,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(93,'Sale','reserve','*','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(95,'ClientSample','*','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','salesAssistant'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','salesPerson'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','salesAssistant'),(101,'Claim','*','*','ALLOW','ROLE','employee'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(103,'ClaimEnd','importTicketSales','WRITE','ALLOW','ROLE','salesAssistant'); +INSERT INTO `ACL` VALUES (1,'Account','*','*','ALLOW','ROLE','employee'),(3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(7,'Client','*','*','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','employee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','employee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','employee'),(18,'State','*','READ','ALLOW','ROLE','employee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','employee'),(28,'ClientObservation','*','READ','ALLOW','ROLE','employee'),(30,'GreugeType','*','READ','ALLOW','ROLE','employee'),(31,'Mandate','*','READ','ALLOW','ROLE','employee'),(32,'MandateType','*','READ','ALLOW','ROLE','employee'),(33,'Company','*','READ','ALLOW','ROLE','employee'),(34,'Greuge','*','READ','ALLOW','ROLE','employee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(48,'ItemNiche','*','READ','ALLOW','ROLE','employee'),(49,'ItemNiche','*','WRITE','ALLOW','ROLE','buyer'),(50,'ItemNiche','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(52,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','employee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(57,'CreditClassification','*','READ','ALLOW','ROLE','employee'),(58,'CreditClassification','*','*','ALLOW','ROLE','creditInsurance'),(59,'CreditInsurance','*','READ','ALLOW','ROLE','employee'),(60,'CreditInsurance','*','*','ALLOW','ROLE','creditInsurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(62,'Ticket','*','*','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(67,'TicketState','*','*','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(71,'SaleChecked','*','READ','ALLOW','ROLE','employee'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','READ','ALLOW','ROLE','employee'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','removes','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','*','ALLOW','ROLE','employee'),(92,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(93,'Sale','reserve','*','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(95,'ClientSample','*','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','salesAssistant'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','salesPerson'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','salesAssistant'),(101,'Claim','*','*','ALLOW','ROLE','employee'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(103,'ClaimEnd','importTicketSales','WRITE','ALLOW','ROLE','salesAssistant'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(107,'ItemNiche','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','employee'),(111,'ClientLog','*','READ','ALLOW','ROLE','employee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','employee'),(114,'Receipt','*','READ','ALLOW','ROLE','employee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'); /*!40000 ALTER TABLE `ACL` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -93,7 +93,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-10-04 9:08:07 +-- Dump completed on 2018-10-25 9:12:10 USE `vn`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- @@ -191,7 +191,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-10-04 9:08:07 +-- Dump completed on 2018-10-25 9:12:10 USE `vn2008`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- @@ -226,7 +226,7 @@ UNLOCK TABLES; LOCK TABLES `Gastos` WRITE; /*!40000 ALTER TABLE `Gastos` DISABLE KEYS */; -INSERT INTO `Gastos` VALUES ('2000000000',1,'Inmovilizado pendiente',1,0,0),('2000000000',3,'Compra de bienes de inmovilizado',1,0,0),('2600000000',1,'Fianzas',0,0,0),('4600000000',1,'Anticipos de remuneraciones',1,0,0),('4600000001',1,'Anticpos de remuneración',1,0,0),('4751000000',0,'Retenciones',0,1,0),('4751000000',1,'Retenciones',0,1,0),('4751000000',6,'Retencion',0,0,0),('4759000000',1,'Embargos salariales',1,0,0),('5200000006',1,'Deudas a c/p CRA',1,0,0),('5200000008',0,'Prestamo CP Transolver IVECO 269',1,0,0),('5200000008',1,'Prestamo Transolver 201600269',1,0,0),('5200000009',0,'Prestamo CP Transolver IVECO 270',1,0,0),('5200000009',1,'Prestamo Transolver 201600270',1,0,0),('5200000010',0,'Prestamo CP Transolver IVECO 271',1,0,0),('5200000010',1,'Prestamo Transolver 201600271',1,0,0),('5200000011',1,'Prestamo Transolver 339',0,0,0),('5200000012',1,'Prestamo Transolver 340',1,0,0),('5200000013',1,'Prestamo Transolver 341',1,0,0),('5200000014',1,'Prestamo a c/p BBVA 600.000€',1,0,0),('5200000022',1,'Linea comercio exterior',1,0,0),('5240000001',1,'Leasing BBVA',1,0,0),('5240002032',1,'Leasing Iveco',1,0,0),('5240002066',1,'Leasing c/p Man',1,0,0),('5240002104',1,'Leasing c/p La caixa 3 vehículos',1,0,0),('5325000003',6,'Prestamo a partes vinculadas',0,0,0),('5420000001',1,'Prestamo concedido',1,0,0),('5650000001',1,'Fianza c/p vehiculo',0,0,0),('5660000001',1,'Suplidos',0,0,0),('5660000001',20,'Suplidos',1,0,0),('5660000002',0,'Suplidos',0,0,0),('5660000002',1,'Suplidos Transitarios nacionales',1,0,0),('5660000003',1,'Deposito c/p Ebury',1,0,0),('5660000003',4,'Deposito Ebury',0,0,0),('5660000004',4,'Deposito Global Reach',0,0,0),('6001000000',1,'Compras a terceros nacional',1,0,0),('6001000000',18,'Compras a terceros nacional',1,0,0),('6001000000',19,'Compras a terceros nacional',1,0,0),('6001000001',1,'Adquisiones en Europa',0,0,0),('6001000001',3,'Adquisición en Europa',1,0,0),('6002000000',1,'Transportes de compras',1,0,0),('6002000001',1,'Tranportes de compra Europa',1,0,0),('6002000001',4,'Transportes de compras Europa',1,0,0),('6002000567',0,'Transporte de compras VNH',1,0,0),('6003000000',1,'Adquisición mercancia Extracomunitaria',1,0,0),('6003000000',5,'Adquisición mercancia Extracomunitaria',1,0,0),('6003000000',6,'Adquisición mercancia Extracomunitaria',1,0,0),('6003000567',0,'Compra de mercancia extracomunitaria VNH',1,0,0),('6004000000',1,'Transporte compras Sudamérica',1,0,0),('6004000000',4,'Transporte compras Sudamérica',1,0,0),('6004000000',6,'Transporte compras Sudamérica',1,0,0),('6010000000',1,'Materias primas',1,0,0),('6020000000',1,'Otros aprovisionamientos',1,0,0),('6020000001',1,'Embalajes',1,0,0),('6020000002',1,'Otros aprov. Taller artíficial',1,0,0),('6070000000',1,'Trabajos de produccion encargados a terceros',1,0,0),('6090000000',6,'Rappels por compras',1,0,0),('6100000000',0,'Variacion existencias',1,0,0),('6210000000',1,'Arrendamientos',1,0,0),('6210000001',1,'Arrendamiento vehículo',1,0,0),('6210000001',4,'Gastos de arrendamiento vehículos',1,0,0),('6210000002',1,'Arrendamiento nave',1,0,0),('6210000003',1,'Arrendamiento espacio virtual-informatic',1,0,0),('6210000004',1,'Arrendamiento elementos para el proceso de informa',1,0,0),('6210000005',1,'Arrendamiento CC y banddejas',1,0,0),('6210000567',0,'Alquiler VNH',1,0,0),('6220000000',1,'Reparaciones y conservacion',1,0,0),('6220000001',1,'Reparación-Informatica',1,0,0),('6220000001',4,'Reparacion y mantenimiento informatica',1,0,0),('6220000003',1,'Reparación-Vehiculos',1,0,0),('6220000004',1,'Reparación-Instalaciones',1,0,0),('6220000005',1,'Reparación y mantenimineto CCs',1,0,0),('6220000006',1,'Repracion y conser maquinaria',1,0,0),('6230000000',1,'Servicios de profesionales independientes',1,0,0),('6230000000',4,'Servicio de profesionales',0,0,0),('6230000000',6,'Servicios de profesionales',1,0,0),('6230000001',1,'Servicios por gestión de ventas',1,0,0),('6230000001',4,'Servicios por gestión de ventas',1,0,0),('6240000000',1,'Transportes',1,0,0),('6240000000',4,'Transportes de ventas',1,0,0),('6240000001',1,'Transporte ventas troncal',1,0,0),('6240000567',0,'Transporte ventas VNH',1,0,0),('6250000000',1,'Primas de seguros',1,0,0),('6250000000',4,'Prima de Seguros',1,0,0),('6250000001',1,'Primas de seguros-Personales',1,0,0),('6250000002',1,'Primas de seguros-Colectivos',1,0,0),('6250000003',1,'Primas de seguros-Vehiculos',1,0,0),('6250000004',1,'Primas de seguros-Inmuebles',1,0,0),('6250000567',0,'Seguros VNH',1,0,0),('6260000000',1,'Gastos bancarios',1,0,0),('6260000000',4,'Gastos bancarios',0,0,0),('6260000000',6,'Gastos bancarios',1,0,0),('6260000001',1,'Gastos bancarios datafono',1,0,0),('6260000002',1,'Gastos bancarios transferencia nacional',1,0,0),('6260000003',1,'Gastos bancarios transferencia Europa',1,0,0),('6260000004',1,'Gastos bancarios transferencia divisas',1,0,0),('6260000567',0,'Gastos bancarios VNH',1,0,0),('6270000000',1,'Publicidad y RRPP',1,0,0),('6270000000',3,'Publicidad, propaganda y RR PP',1,0,0),('6270000000',6,'Publicidad',1,0,0),('6270000000',14,'Publicidad, propaganda RRPP',1,0,0),('6270000001',1,'Patrocinio',0,0,0),('6280000000',1,'Suministros',1,0,0),('6280000001',1,'Telefonos',1,0,0),('6280000002',1,'Gasoil',1,0,0),('6280000003',1,'Suministros-Electricidad',1,0,0),('6280000004',1,'Internet',1,0,0),('6280000567',0,'Suministros VNH',1,0,0),('6280001567',0,'Suministros telefono VNH',1,0,0),('6280003567',0,'Suministro luz VNH',1,0,0),('6290000000',1,'Otros servicios',1,0,0),('6290000001',1,'Material de oficina',1,0,0),('6290000002',1,'Gastos en formacion',1,0,0),('6290000003',1,'Asesoria juridica',1,0,0),('6290000004',4,'Otros servicios UE',1,0,0),('6290000005',1,'Gastos varios-Correos',1,0,0),('6290000006',6,'Otros servicios extranjero',1,0,0),('6290000007',1,'Gastos pequeño material',1,0,0),('6290000007',3,'Compras pequeño material',1,0,0),('6290000007',6,'Pequeño material',1,0,0),('6290000008',1,'Gastos varios-uniformes personal',1,0,0),('6290000008',3,'Compra uniformes',1,0,0),('6290000009',1,'Gastos-CC Container',1,0,0),('6290000010',1,'Gastos formación clientes',1,0,0),('6290000012',1,'Gastos gestión contra-reembolsos',1,0,0),('6290000013',1,'Arrendamiento Vilassar',1,0,0),('6290000014',1,'Gasto laboral espresas ETT',1,0,0),('6290000015',1,'Gasto compra terminales moviles y similares',1,0,0),('6290000015',3,'Gasto compra terminales moviles y similares',1,0,0),('6290000015',6,'Gasto compra terminales moviles y similares',1,0,0),('6290000016',1,'Gasto gestión cobro ventas',1,0,0),('6290000553',1,'Gastos viaje administrador',1,0,0),('6290000553',4,'Gastos viaje administrador-gerente',1,0,0),('6290000553',6,'Gastos viaje administrador',1,0,0),('6290001000',1,'Gastos de viaje',1,0,0),('6290001000',4,'Gastos viajes otros departamentos',1,0,0),('6290001000',6,'Gastos viaje personal otros departamentos',1,0,0),('6290001001',1,'Gastos R.R.P.P. Gerente',1,0,0),('6290001002',1,'Gastos R.R.P.P. Comerciales',1,0,0),('6290001567',0,'Gastos material oficina',1,0,0),('6300000000',1,'Impuesto de sociedades',1,0,0),('6310000000',1,'Otros tributos',1,0,0),('6380000000',1,'Ajustes positivos s/b Bº',1,0,0),('6400000000',0,'Sueldos y salarios',1,0,0),('6400000000',1,'Salarios',0,0,0),('6400000001',0,'Productividad',1,0,0),('6400000567',0,'Salarios VNH',1,0,0),('6410000001',1,'Indemnizaciones',1,0,0),('6420000000',0,'Seguridad Social a cargo de la empresa',1,0,0),('6420000000',1,'Seguridad Social',0,0,0),('6490000000',1,'Otros gastos sociales',1,0,0),('6500000000',1,'Impagados definitivos',1,0,0),('6620000000',0,'Intereses Bancarios',1,0,0),('6620000001',1,'Intereses deudas a l/p',1,0,0),('6620000006',1,'Intereses deuda prestamo CRA',1,0,0),('6620000007',1,'Intereses La Caixa linea comercio exterior',1,0,0),('6620000007',16,'Intereses La Caixa Linea Comercio Exterior',0,0,0),('6620000008',1,'Intereses Prestamos Transolver 2016',1,0,0),('6620000011',1,'Intereses BBVA linea comercio exterior',1,0,0),('6620000014',1,'Intereses Prestamo BBVA',1,0,0),('6620000015',1,'Interés Póliza Deutsche Bank Comercio Exterior',0,0,0),('6620000023',1,'Intereses Bankinter Póliza Comercio Exterior',0,0,0),('6620002032',1,'Intereses Leaing Iveco',1,0,0),('6620002066',1,'Leasing Intereses Man',1,0,0),('6620002104',1,'Intereses Leasing La caixa 3 vehículos',1,0,0),('6681000000',1,'Diferencia negativa tipo de cambio',1,0,0),('6681000000',4,'Diferencia negativa tipo de cambio',0,0,0),('6681000000',6,'Diferencia negativa tipo de cambio',1,0,0),('6681000567',0,'Diferencias de cambio VNH',1,0,0),('6690000000',1,'Otros gastos financieros',1,0,0),('6690000000',6,'Gastos financieros',1,0,0),('6720000000',16,'Perdidas procedentes de inversiones',0,0,0),('6780000000',1,'Gastos extraordinarios',1,0,0),('6780000001',1,'Gastos no deducibles',1,0,0),('6780000001',16,'Gasto no deducible',0,0,0),('6800000000',1,'Amortización inmovilizado intangible',1,0,0),('6800000001',0,'Amortizacion inmovilizado material',1,0,0),('6800000001',1,'Amortización del inmovilizado material',1,0,0),('6810000000',0,'Amortizaciones inmovilizado',1,0,0),('6810000000',1,'Amortizacion inmovilizado material',1,0,0),('7000000000',0,'Ventas',1,0,0),('7000000001',1,'Venta entre empresas',1,0,0),('7000010000',0,'Terceros Flor',1,0,0),('7000020000',0,'Terceros Planta',1,0,0),('7000030000',0,'Terceros Complementos',1,0,0),('7000040000',0,'Terceros Artificial',1,0,0),('7000050000',0,'Terceros Verdes',1,0,0),('7000060000',0,'Terceros Otros',1,0,0),('7000070000',0,'Terceros Confección',1,0,0),('7000080000',1,'Terceros Logística',1,0,0),('7001000000',1,'Mercaderia',1,0,1),('7001010000',0,'Grupo Flor',1,0,0),('7001020000',0,'Grupo Planta',1,0,0),('7001030000',0,'Grupo Complementos',1,0,0),('7001040000',0,'Grupo Artificial',1,0,0),('7001050000',0,'Grupo Verdes',1,0,0),('7001060000',0,'Grupo Otros',1,0,0),('7001070000',0,'Grupo Confección',1,0,0),('7001080000',1,'Grupo Logística',1,0,0),('7002010000',0,'Asociados Flor',1,0,0),('7002020000',0,'Asociados Planta',1,0,0),('7002030000',0,'Asociados Complementos',1,0,0),('7002040000',0,'Asociados Artificial',1,0,0),('7002050000',0,'Asociados Verdes',1,0,0),('7002060000',0,'Asociados Otros',1,0,0),('7002070000',0,'Asociados Confección',1,0,0),('7002080000',1,'Asociados Logística',1,0,0),('7040000000',1,'Embalajes',1,0,1),('7050000000',1,'Prestacion de servicios',1,0,1),('7400000000',1,'Subvenciones, donaciones a la explotacion',1,0,0),('7550000000',0,'Ingresos por serivicios al personal',1,0,0),('768,0',0,NULL,1,0,0),('7680000000',0,'Diferencias positivas de cambio',1,0,0),('7680000000',1,'Diferenica positiva tipo de cambio',1,0,0),('7680000000',4,'Diferenica positiva tipo de cambio',0,0,0),('7680000000',6,'Diferenica positiva tipo de cambio',1,0,0),('7690000000',1,'Otros ingresos financieros',1,0,0),('7780000000',1,'Ingresos excepcionales',1,0,0),('7780000000',16,'Ingreso extraordinario',0,0,0),('7780000001',1,'Indemnizaciones transporte',1,0,0),('7780000001',4,'Indemnizaciones agencias transporte',1,0,0),('7780000001',5,'Indemnizaciones agencias transporte',1,0,0),('7780000001',6,'Indemnizaciones transporte',1,0,0),('7940000000',16,'Reversión impagos',0,0,0); +INSERT INTO `Gastos` VALUES ('2000000000',1,'Inmovilizado pendiente',1,0,0),('2000000000',3,'Compra de bienes de inmovilizado',1,0,0),('2600000000',1,'Fianzas',0,0,0),('4600000000',1,'Anticipos de remuneraciones',1,0,0),('4600000001',1,'Anticpos de remuneración',1,0,0),('4751000000',0,'Retenciones',0,1,0),('4751000000',1,'Retenciones',0,1,0),('4751000000',6,'Retencion',0,0,0),('4759000000',1,'Embargos salariales',1,0,0),('5200000006',1,'Deudas a c/p CRA',1,0,0),('5200000008',0,'Prestamo CP Transolver IVECO 269',1,0,0),('5200000008',1,'Prestamo Transolver 201600269',1,0,0),('5200000009',0,'Prestamo CP Transolver IVECO 270',1,0,0),('5200000009',1,'Prestamo Transolver 201600270',1,0,0),('5200000010',0,'Prestamo CP Transolver IVECO 271',1,0,0),('5200000010',1,'Prestamo Transolver 201600271',1,0,0),('5200000011',1,'Prestamo Transolver 339',0,0,0),('5200000012',1,'Prestamo Transolver 340',1,0,0),('5200000013',1,'Prestamo Transolver 341',1,0,0),('5200000014',1,'Prestamo a c/p BBVA 600.000€',1,0,0),('5200000022',1,'Linea comercio exterior',1,0,0),('5240000001',1,'Leasing BBVA',1,0,0),('5240002032',1,'Leasing Iveco',1,0,0),('5240002066',1,'Leasing c/p Man',1,0,0),('5240002104',1,'Leasing c/p La caixa 3 vehículos',1,0,0),('5325000003',6,'Prestamo a partes vinculadas',0,0,0),('5420000001',1,'Prestamo concedido',1,0,0),('5650000001',1,'Fianza c/p vehiculo',0,0,0),('5660000001',1,'Suplidos',0,0,0),('5660000001',20,'Suplidos',1,0,0),('5660000002',0,'Suplidos',0,0,0),('5660000002',1,'Suplidos Transitarios nacionales',1,0,0),('5660000003',1,'Deposito c/p Ebury',1,0,0),('5660000003',4,'Deposito Ebury',0,0,0),('5660000004',4,'Deposito Global Reach',0,0,0),('6001000000',1,'Compras a terceros nacional',1,0,0),('6001000000',18,'Compras a terceros nacional',1,0,0),('6001000000',19,'Compras a terceros nacional',1,0,0),('6001000001',1,'Adquisiones en Europa',0,0,0),('6001000001',3,'Adquisición en Europa',1,0,0),('6002000000',1,'Transportes de compras',1,0,0),('6002000001',1,'Tranportes de compra Europa',1,0,0),('6002000001',4,'Transportes de compras Europa',1,0,0),('6002000567',0,'Transporte de compras VNH',1,0,0),('6003000000',1,'Adquisición mercancia Extracomunitaria',1,0,0),('6003000000',5,'Adquisición mercancia Extracomunitaria',1,0,0),('6003000000',6,'Adquisición mercancia Extracomunitaria',1,0,0),('6003000567',0,'Compra de mercancia extracomunitaria VNH',1,0,0),('6004000000',1,'Transporte compras Sudamérica',1,0,0),('6004000000',4,'Transporte compras Sudamérica',1,0,0),('6004000000',6,'Transporte compras Sudamérica',1,0,0),('6010000000',1,'Materias primas',1,0,0),('6020000000',1,'Otros aprovisionamientos',1,0,0),('6020000001',1,'Embalajes',1,0,0),('6020000002',1,'Otros aprov. Taller artíficial',1,0,0),('6070000000',1,'Trabajos de produccion encargados a terceros',1,0,0),('6090000000',6,'Rappels por compras',1,0,0),('6100000000',0,'Variacion existencias',1,0,0),('6210000000',1,'Arrendamientos',1,0,0),('6210000001',1,'Arrendamiento vehículo',1,0,0),('6210000001',4,'Gastos de arrendamiento vehículos',1,0,0),('6210000002',1,'Arrendamiento nave',1,0,0),('6210000003',1,'Arrendamiento espacio virtual-informatic',1,0,0),('6210000004',1,'Arrendamiento elementos para el proceso de informa',1,0,0),('6210000005',1,'Arrendamiento CC y banddejas',1,0,0),('6210000567',0,'Alquiler VNH',1,0,0),('6220000000',1,'Reparaciones y conservacion',1,0,0),('6220000001',1,'Reparación-Informatica',1,0,0),('6220000001',4,'Reparacion y mantenimiento informatica',1,0,0),('6220000003',1,'Reparación-Vehiculos',1,0,0),('6220000004',1,'Reparación-Instalaciones',1,0,0),('6220000005',1,'Reparación y mantenimineto CCs',1,0,0),('6220000006',1,'Repracion y conser maquinaria',1,0,0),('6230000000',1,'Servicios de profesionales independientes',1,0,0),('6230000000',4,'Servicio de profesionales',0,0,0),('6230000000',6,'Servicios de profesionales',1,0,0),('6230000001',1,'Servicios por gestión de ventas',1,0,0),('6230000001',4,'Servicios por gestión de ventas',1,0,0),('6240000000',1,'Transportes',1,0,0),('6240000000',4,'Transportes de ventas',1,0,0),('6240000001',1,'Transporte ventas troncal',1,0,0),('6240000567',0,'Transporte ventas VNH',1,0,0),('6250000000',1,'Primas de seguros',1,0,0),('6250000000',4,'Prima de Seguros',1,0,0),('6250000001',1,'Primas de seguros-Personales',1,0,0),('6250000002',1,'Primas de seguros-Colectivos',1,0,0),('6250000003',1,'Primas de seguros-Vehiculos',1,0,0),('6250000004',1,'Primas de seguros-Inmuebles',1,0,0),('6250000567',0,'Seguros VNH',1,0,0),('6260000000',1,'Gastos bancarios',1,0,0),('6260000000',4,'Gastos bancarios',0,0,0),('6260000000',6,'Gastos bancarios',1,0,0),('6260000001',1,'Gastos bancarios datafono',1,0,0),('6260000002',1,'Gastos bancarios transferencia nacional',1,0,0),('6260000003',1,'Gastos bancarios transferencia Europa',1,0,0),('6260000004',1,'Gastos bancarios transferencia divisas',1,0,0),('6260000567',0,'Gastos bancarios VNH',1,0,0),('6270000000',1,'Publicidad y RRPP',1,0,0),('6270000000',3,'Publicidad, propaganda y RR PP',1,0,0),('6270000000',6,'Publicidad',1,0,0),('6270000000',14,'Publicidad, propaganda RRPP',1,0,0),('6270000001',1,'Patrocinio',0,0,0),('6280000000',1,'Suministros',1,0,0),('6280000001',1,'Telefonos',1,0,0),('6280000002',1,'Gasoil',1,0,0),('6280000003',1,'Suministros-Electricidad',1,0,0),('6280000004',1,'Internet',1,0,0),('6280000567',0,'Suministros VNH',1,0,0),('6280001567',0,'Suministros telefono VNH',1,0,0),('6280003567',0,'Suministro luz VNH',1,0,0),('6290000000',1,'Otros servicios',1,0,0),('6290000000',6,'Otros gastos varios',1,0,0),('6290000001',1,'Material de oficina',1,0,0),('6290000002',1,'Gastos en formacion',1,0,0),('6290000003',1,'Asesoria juridica',1,0,0),('6290000004',4,'Otros servicios UE',1,0,0),('6290000005',1,'Gastos varios-Correos',1,0,0),('6290000006',6,'Otros servicios extranjero',1,0,0),('6290000007',1,'Gastos pequeño material',1,0,0),('6290000007',3,'Compras pequeño material',1,0,0),('6290000007',6,'Pequeño material',1,0,0),('6290000008',1,'Gastos varios-uniformes personal',1,0,0),('6290000008',3,'Compra uniformes',1,0,0),('6290000009',1,'Gastos-CC Container',1,0,0),('6290000010',1,'Gastos formación clientes',1,0,0),('6290000012',1,'Gastos gestión contra-reembolsos',1,0,0),('6290000013',1,'Arrendamiento Vilassar',1,0,0),('6290000014',1,'Gasto laboral espresas ETT',1,0,0),('6290000015',1,'Gasto compra terminales moviles y similares',1,0,0),('6290000015',3,'Gasto compra terminales moviles y similares',1,0,0),('6290000015',6,'Gasto compra terminales moviles y similares',1,0,0),('6290000016',1,'Gasto gestión cobro ventas',1,0,0),('6290000553',1,'Gastos viaje administrador',1,0,0),('6290000553',4,'Gastos viaje administrador-gerente',1,0,0),('6290000553',6,'Gastos viaje administrador',1,0,0),('6290001000',1,'Gastos de viaje',1,0,0),('6290001000',4,'Gastos viajes otros departamentos',1,0,0),('6290001000',6,'Gastos viaje personal otros departamentos',1,0,0),('6290001001',1,'Gastos R.R.P.P. Gerente',1,0,0),('6290001002',1,'Gastos R.R.P.P. Comerciales',1,0,0),('6290001567',0,'Gastos material oficina',1,0,0),('6300000000',1,'Impuesto de sociedades',1,0,0),('6310000000',1,'Otros tributos',1,0,0),('6380000000',1,'Ajustes positivos s/b Bº',1,0,0),('6400000000',0,'Sueldos y salarios',1,0,0),('6400000000',1,'Salarios',0,0,0),('6400000001',0,'Productividad',1,0,0),('6400000567',0,'Salarios VNH',1,0,0),('6410000001',1,'Indemnizaciones',1,0,0),('6420000000',0,'Seguridad Social a cargo de la empresa',1,0,0),('6420000000',1,'Seguridad Social',0,0,0),('6490000000',1,'Otros gastos sociales',1,0,0),('6500000000',1,'Impagados definitivos',1,0,0),('6620000000',0,'Intereses Bancarios',1,0,0),('6620000001',1,'Intereses deudas a l/p',1,0,0),('6620000006',1,'Intereses deuda prestamo CRA',1,0,0),('6620000007',1,'Intereses La Caixa linea comercio exterior',1,0,0),('6620000007',16,'Intereses La Caixa Linea Comercio Exterior',0,0,0),('6620000008',1,'Intereses Prestamos Transolver 2016',1,0,0),('6620000011',1,'Intereses BBVA linea comercio exterior',1,0,0),('6620000014',1,'Intereses Prestamo BBVA',1,0,0),('6620000015',1,'Interés Póliza Deutsche Bank Comercio Exterior',0,0,0),('6620000023',1,'Intereses Bankinter Póliza Comercio Exterior',0,0,0),('6620002032',1,'Intereses Leaing Iveco',1,0,0),('6620002066',1,'Leasing Intereses Man',1,0,0),('6620002104',1,'Intereses Leasing La caixa 3 vehículos',1,0,0),('6681000000',1,'Diferencia negativa tipo de cambio',1,0,0),('6681000000',4,'Diferencia negativa tipo de cambio',0,0,0),('6681000000',6,'Diferencia negativa tipo de cambio',1,0,0),('6681000567',0,'Diferencias de cambio VNH',1,0,0),('6690000000',1,'Otros gastos financieros',1,0,0),('6690000000',6,'Gastos financieros',1,0,0),('6720000000',16,'Perdidas procedentes de inversiones',0,0,0),('6780000000',1,'Gastos extraordinarios',1,0,0),('6780000001',1,'Gastos no deducibles',1,0,0),('6780000001',16,'Gasto no deducible',0,0,0),('6800000000',1,'Amortización inmovilizado intangible',1,0,0),('6800000001',0,'Amortizacion inmovilizado material',1,0,0),('6800000001',1,'Amortización del inmovilizado material',1,0,0),('6810000000',0,'Amortizaciones inmovilizado',1,0,0),('6810000000',1,'Amortizacion inmovilizado material',1,0,0),('7000000000',0,'Ventas',1,0,0),('7000000001',1,'Venta entre empresas',1,0,0),('7000010000',0,'Terceros Flor',1,0,0),('7000020000',0,'Terceros Planta',1,0,0),('7000030000',0,'Terceros Complementos',1,0,0),('7000040000',0,'Terceros Artificial',1,0,0),('7000050000',0,'Terceros Verdes',1,0,0),('7000060000',0,'Terceros Otros',1,0,0),('7000070000',0,'Terceros Confección',1,0,0),('7000080000',1,'Terceros Logística',1,0,0),('7001000000',1,'Mercaderia',1,0,1),('7001010000',0,'Grupo Flor',1,0,0),('7001020000',0,'Grupo Planta',1,0,0),('7001030000',0,'Grupo Complementos',1,0,0),('7001040000',0,'Grupo Artificial',1,0,0),('7001050000',0,'Grupo Verdes',1,0,0),('7001060000',0,'Grupo Otros',1,0,0),('7001070000',0,'Grupo Confección',1,0,0),('7001080000',1,'Grupo Logística',1,0,0),('7002010000',0,'Asociados Flor',1,0,0),('7002020000',0,'Asociados Planta',1,0,0),('7002030000',0,'Asociados Complementos',1,0,0),('7002040000',0,'Asociados Artificial',1,0,0),('7002050000',0,'Asociados Verdes',1,0,0),('7002060000',0,'Asociados Otros',1,0,0),('7002070000',0,'Asociados Confección',1,0,0),('7002080000',1,'Asociados Logística',1,0,0),('7040000000',1,'Embalajes',1,0,1),('7050000000',1,'Prestacion de servicios',1,0,1),('7400000000',1,'Subvenciones, donaciones a la explotacion',1,0,0),('7550000000',0,'Ingresos por serivicios al personal',1,0,0),('768,0',0,NULL,1,0,0),('7680000000',0,'Diferencias positivas de cambio',1,0,0),('7680000000',1,'Diferenica positiva tipo de cambio',1,0,0),('7680000000',4,'Diferenica positiva tipo de cambio',0,0,0),('7680000000',6,'Diferenica positiva tipo de cambio',1,0,0),('7690000000',1,'Otros ingresos financieros',1,0,0),('7780000000',1,'Ingresos excepcionales',1,0,0),('7780000000',16,'Ingreso extraordinario',0,0,0),('7780000001',1,'Indemnizaciones transporte',1,0,0),('7780000001',4,'Indemnizaciones agencias transporte',1,0,0),('7780000001',5,'Indemnizaciones agencias transporte',1,0,0),('7780000001',6,'Indemnizaciones transporte',1,0,0),('7940000000',1,'Reversión impagos',1,0,0),('7940000000',16,'Reversión impagos',0,0,0); /*!40000 ALTER TABLE `Gastos` ENABLE KEYS */; UNLOCK TABLES; @@ -369,7 +369,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-10-04 9:08:07 +-- Dump completed on 2018-10-25 9:12:10 USE `bi`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- @@ -417,7 +417,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-10-04 9:08:08 +-- Dump completed on 2018-10-25 9:12:10 USE `cache`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- @@ -442,7 +442,7 @@ USE `cache`; LOCK TABLES `cache` WRITE; /*!40000 ALTER TABLE `cache` DISABLE KEYS */; -INSERT INTO `cache` VALUES (1,'equalizator','00:15:00'),(2,'available','00:05:00'),(3,'stock','00:10:00'),(4,'last_buy','08:30:00'),(5,'weekly_sales','12:00:00'),(6,'bionic','00:05:00'),(7,'sales','00:03:00'),(8,'visible','00:06:00'),(9,'item_range','00:03:00'),(10,'barcodes','01:00:00'),(11,'prod_graphic','00:15:00'),(12,'ticketShipping','00:01:00'); +INSERT INTO `cache` VALUES (1,'equalizator','00:15:00'),(2,'available','00:05:00'),(3,'stock','00:20:00'),(4,'last_buy','08:30:00'),(5,'weekly_sales','12:00:00'),(6,'bionic','00:05:00'),(7,'sales','00:03:00'),(8,'visible','00:06:00'),(9,'item_range','00:03:00'),(10,'barcodes','01:00:00'),(11,'prod_graphic','00:15:00'),(12,'ticketShipping','00:01:00'); /*!40000 ALTER TABLE `cache` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -455,7 +455,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-10-04 9:08:08 +-- Dump completed on 2018-10-25 9:12:10 USE `hedera`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- @@ -513,4 +513,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-10-04 9:08:08 +-- Dump completed on 2018-10-25 9:12:10 diff --git a/services/db/install/dump/structure.sql b/services/db/install/dump/structure.sql index e3270325c..a8a82a444 100644 --- a/services/db/install/dump/structure.sql +++ b/services/db/install/dump/structure.sql @@ -363,7 +363,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=14676 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global users'; +) ENGINE=InnoDB AUTO_INCREMENT=14796 DEFAULT 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 */ ; @@ -2392,7 +2392,7 @@ ALTER DATABASE `util` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `warn`(vCode CHAR(35)) +CREATE DEFINER=`z-developer`@`%` PROCEDURE `warn`(vCode CHAR(35)) BEGIN DECLARE w VARCHAR(1) DEFAULT '__'; SET @warn = vCode; @@ -2440,7 +2440,7 @@ CREATE TABLE `Agencias` ( PRIMARY KEY (`Id_Agencia`), KEY `Agencias` (`Agencia`), KEY `Vista` (`Vista`) -) ENGINE=InnoDB AUTO_INCREMENT=1216 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1217 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2459,7 +2459,7 @@ CREATE TABLE `Agencias_dits` ( `value_old` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `value_new` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`idAgencia_dits`) -) ENGINE=InnoDB AUTO_INCREMENT=24324 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=27869 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2577,7 +2577,7 @@ CREATE TABLE `Articles` ( CONSTRAINT `Articles_ibfk_5` FOREIGN KEY (`tipo_id`) REFERENCES `Tipos` (`tipo_id`) ON UPDATE CASCADE, CONSTRAINT `expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `Gastos` (`Id_Gasto`) ON UPDATE CASCADE, CONSTRAINT `producer_id` FOREIGN KEY (`producer_id`) REFERENCES `producer` (`producer_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=323313 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=325895 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 */ ; @@ -2812,7 +2812,7 @@ CREATE TABLE `Articles_dits` ( KEY `fgkey1_idx` (`idaccion_dits`), KEY `fgkey2_idx` (`Id_Ticket`), KEY `fgkey3_idx` (`Id_Trabajador`) -) ENGINE=InnoDB AUTO_INCREMENT=20624 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=20666 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2835,7 +2835,7 @@ CREATE TABLE `Articles_nicho` ( KEY `Articles_nicho_wh_fk` (`warehouse_id`), CONSTRAINT `Articles_nicho_wh_fk` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `Articles_nichos_fk` FOREIGN KEY (`Id_Article`) REFERENCES `Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=559982 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=588212 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2961,7 +2961,7 @@ CREATE TABLE `Cajas` ( KEY `warehouse_id` (`warehouse_id`), KEY `fk_Cajas_Proveedores_account1_idx` (`Proveedores_account_Id`), CONSTRAINT `Cajas_ibfk_2` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=621102 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=629321 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 */ ; @@ -3089,6 +3089,7 @@ CREATE TABLE `Clientes` ( `hasInvoiceSimplified` tinyint(1) NOT NULL DEFAULT '0', `iban` varchar(45) CHARACTER SET utf8 DEFAULT NULL, `hasLcr` tinyint(1) NOT NULL DEFAULT '0', + `bankEntityFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id_cliente`), UNIQUE KEY `IF` (`if`), KEY `Id_Trabajador` (`Id_Trabajador`), @@ -3102,14 +3103,16 @@ CREATE TABLE `Clientes` ( KEY `movil` (`movil`), KEY `tipos_de_cliente_idx` (`clientes_tipo_id`), KEY `codpos` (`codpos`,`codPostal`), + KEY `fk_Clientes_entity_idx` (`bankEntityFk`), CONSTRAINT `Clientes_ibfk_1` FOREIGN KEY (`Id_Pais`) REFERENCES `Paises` (`Id`) ON UPDATE CASCADE, CONSTRAINT `Clientes_ibfk_2` FOREIGN KEY (`pay_met_id`) REFERENCES `pay_met` (`id`) ON UPDATE CASCADE, CONSTRAINT `Clientes_ibfk_3` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `Clientes_ibfk_4` FOREIGN KEY (`default_address`) REFERENCES `Consignatarios` (`id_consigna`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `Clientes_ibfk_5` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON UPDATE CASCADE, CONSTRAINT `canal_nuevo_cliente` FOREIGN KEY (`chanel_id`) REFERENCES `chanel` (`chanel_id`) ON UPDATE CASCADE, + CONSTRAINT `fk_Clientes_entity` FOREIGN KEY (`bankEntityFk`) REFERENCES `entity` (`entity_id`) ON UPDATE CASCADE, CONSTRAINT `tipos_de_cliente` FOREIGN KEY (`clientes_tipo_id`) REFERENCES `clientes_tipo` (`clientes_tipo_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=14676 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=14796 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 */ ; @@ -3271,7 +3274,7 @@ CREATE TABLE `Clientes_cedidos` ( CONSTRAINT `cliente_cedido_fk` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `new_trabajador_fk` FOREIGN KEY (`Id_Trabajador_new`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `trabajador_fk` FOREIGN KEY (`Id_Trabajador_old`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Clientes que se han cambiado de comercial, pero durante un tiempo comisionan a los dos, al anterior y al actual'; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Clientes que se han cambiado de comercial, pero durante un tiempo comisionan a los dos, al anterior y al actual'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3392,7 +3395,7 @@ CREATE TABLE `Colas` ( CONSTRAINT `Colas_ibfk_3` FOREIGN KEY (`Id_Prioridad`) REFERENCES `Prioridades` (`Id_Prioridad`) ON UPDATE CASCADE, CONSTRAINT `Colas_ibfk_4` FOREIGN KEY (`Id_Impresora`) REFERENCES `Impresoras` (`Id_Impresora`) ON UPDATE CASCADE, CONSTRAINT `Colas_ibfk_5` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=16777 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=38518 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3474,7 +3477,7 @@ CREATE TABLE `Compres` ( CONSTRAINT `Compres_ibfk_2` FOREIGN KEY (`Id_Cubo`) REFERENCES `Cubos` (`Id_Cubo`) ON UPDATE CASCADE, CONSTRAINT `Compres_ibfk_3` FOREIGN KEY (`container_id`) REFERENCES `container` (`container_id`) ON UPDATE CASCADE, CONSTRAINT `buy_id` FOREIGN KEY (`Id_Entrada`) REFERENCES `Entradas` (`Id_Entrada`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=273682181 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB AUTO_INCREMENT=273886610 DEFAULT 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 */ ; @@ -3705,7 +3708,7 @@ CREATE TABLE `Compres_ok` ( KEY `Id_Movimiento` (`Id_Compra`), KEY `Id_Accion` (`Id_Accion`), CONSTRAINT `Compres_ok_ibfk_1` FOREIGN KEY (`Id_Compra`) REFERENCES `Compres` (`Id_Compra`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=23133 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=24122 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3749,7 +3752,7 @@ CREATE TABLE `Consignatarios` ( CONSTRAINT `Consignatarios_ibfk_3` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON UPDATE CASCADE, CONSTRAINT `Consignatarios_ibfk_4` FOREIGN KEY (`Id_Agencia`) REFERENCES `Agencias` (`Id_Agencia`) ON UPDATE CASCADE, CONSTRAINT `address_customer_id` FOREIGN KEY (`Id_cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=25926 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=26141 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 */ ; @@ -3933,7 +3936,7 @@ CREATE TABLE `Contactos` ( PRIMARY KEY (`Id_Contacto`), KEY `Telefono` (`Telefono`), KEY `Movil` (`Movil`) -) ENGINE=InnoDB AUTO_INCREMENT=2651 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2653 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 */ ; @@ -4130,7 +4133,7 @@ CREATE TABLE `Entradas` ( CONSTRAINT `Entradas_ibfk_1` FOREIGN KEY (`Id_Proveedor`) REFERENCES `Proveedores` (`Id_Proveedor`) ON UPDATE CASCADE, CONSTRAINT `Entradas_ibfk_6` FOREIGN KEY (`travel_id`) REFERENCES `travel` (`id`) ON UPDATE CASCADE, CONSTRAINT `Entradas_ibfk_7` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=151644 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='InnoDB free: 88064 kB; (`Id_Proveedor`) REFER `vn2008/Provee'; +) ENGINE=InnoDB AUTO_INCREMENT=153509 DEFAULT 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 */ ; @@ -4147,12 +4150,7 @@ BEGIN IF (SELECT cuenta LIKE '___4______' FROM Proveedores WHERE Id_Proveedor = NEW.Id_Proveedor) THEN SET NEW.Id_Moneda = 2; END IF; - -- Actualizar travel.totalEntries - - /*UPDATE vn.travel SET totalEntries = totalEntries + 1 - WHERE id = NEW.travel_id;*/ - END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -4215,15 +4213,6 @@ BEGIN IF NEW.Id_Moneda = 2 THEN SET NEW.comision = getComision(NEW.Id_Entrada, NEW.Id_Moneda); END IF; - - /* IF NEW.travel_id <> OLD.travel_id THEN - UPDATE vn.travel SET totalEntries = totalEntries -1 - WHERE id = OLD.travel_id; - - UPDATE vn.travel SET totalEntries = totalEntries +1 - WHERE id = NEW.travel_id; - END IF;*/ - END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -4242,10 +4231,7 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn2008`.`EntradasAfterUpdate` AFTER UPDATE ON `Entradas` FOR EACH ROW BEGIN - CALL stock.queueAdd ('entry', NEW.Id_Entrada, OLD.Id_Entrada); - - - + CALL stock.queueAdd ('entry', NEW.Id_Entrada, OLD.Id_Entrada); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -4265,10 +4251,6 @@ DELIMITER ;; AFTER DELETE ON `Entradas` FOR EACH ROW BEGIN CALL stock.queueAdd ('entry', NULL, OLD.Id_Entrada); - - /*UPDATE vn.travel SET totalEntries = totalEntries -1 - WHERE id = OLD.travel_id;*/ - END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -4312,7 +4294,7 @@ CREATE TABLE `Entradas_dits` ( CONSTRAINT `Entradas_dits_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `Entradas` (`Id_Entrada`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fgkey_entradas_1` FOREIGN KEY (`idaccion_dits`) REFERENCES `accion_dits` (`idaccion_dits`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `fgkey_entradas_3` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3063041 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3136753 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4330,7 +4312,7 @@ CREATE TABLE `Entradas_kop` ( PRIMARY KEY (`Id_Entradas_kop`), KEY `entradas_entradas_kop_idx` (`Id_Entrada`), CONSTRAINT `entradas_entradas_kop` FOREIGN KEY (`Id_Entrada`) REFERENCES `Entradas` (`Id_Entrada`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1292 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona las entradas con los origenes de compra'; +) ENGINE=InnoDB AUTO_INCREMENT=58 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona las entradas con los origenes de compra'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4418,7 +4400,7 @@ CREATE TABLE `Equipos` ( PRIMARY KEY (`id`), KEY `trabajador_id` (`trabajador_id`), CONSTRAINT `Equipos_ibfk_1` FOREIGN KEY (`trabajador_id`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=165 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=174 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4573,7 +4555,7 @@ CREATE TABLE `Facturas` ( CONSTRAINT `Facturas_ibfk_4` FOREIGN KEY (`cplusTaxBreakFk`) REFERENCES `vn`.`cplusTaxBreak` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoice_bank_id` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE, CONSTRAINT `invoice_customer_id` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=470969 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=471497 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 */ ; @@ -4791,7 +4773,7 @@ CREATE TABLE `Greuges` ( KEY `Id_Ticket_Greuge_Ticket_idx` (`Id_Ticket`), CONSTRAINT `Id_Ticket_Greuge_Ticket` FOREIGN KEY (`Id_Ticket`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `greuges_type_fk` FOREIGN KEY (`Greuges_type_id`) REFERENCES `Greuges_type` (`Greuges_type_id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2517557 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=FIXED; +) ENGINE=InnoDB AUTO_INCREMENT=2569607 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=FIXED; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4992,7 +4974,7 @@ CREATE TABLE `Movimientos` ( KEY `itemFk_ticketFk` (`Id_Article`,`Id_Ticket`), CONSTRAINT `Movimientos_ibfk_1` FOREIGN KEY (`Id_Article`) REFERENCES `Articles` (`Id_Article`) ON UPDATE CASCADE, CONSTRAINT `movement_ticket_id` FOREIGN KEY (`Id_Ticket`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=22202973 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=22589438 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 */ ; @@ -5028,12 +5010,6 @@ BEGIN IF NEW.Descuento > 100 THEN SET NEW.Descuento = 0; END IF; - - IF NEW.OK = FALSE AND OLD.OK != FALSE THEN - - CALL vn.saleItemShelvingDelete(new.Id_Movimiento); - - END IF; END */;; @@ -5155,7 +5131,7 @@ CREATE TABLE `Movimientos_mark` ( KEY `Id_Movimiento` (`Id_Movimiento`), KEY `fgnStateFk_idx` (`stateFk`), CONSTRAINT `fgnStateFk` FOREIGN KEY (`stateFk`) REFERENCES `state` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=12283586 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=12775622 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 */ ; @@ -5249,7 +5225,7 @@ CREATE TABLE `Ordenes` ( KEY `Id_Comprador` (`CodCOMPRADOR`), KEY `Id_Movimiento` (`Id_Movimiento`), KEY `Id_Vendedor` (`CodVENDEDOR`) -) ENGINE=InnoDB AUTO_INCREMENT=35611 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=36782 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5295,7 +5271,7 @@ CREATE TABLE `Pagares` ( KEY `empresa_id` (`kk_empresa_id`), KEY `pago_id` (`pago_id`), CONSTRAINT `Pagares_ibfk_2` FOREIGN KEY (`pago_id`) REFERENCES `pago` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2846 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2847 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5421,7 +5397,7 @@ CREATE TABLE `Proveedores` ( CONSTRAINT `pay_dem_id` FOREIGN KEY (`pay_dem_id`) REFERENCES `pay_dem` (`id`) ON UPDATE CASCADE, CONSTRAINT `pay_met_id` FOREIGN KEY (`pay_met_id`) REFERENCES `pay_met` (`id`) ON UPDATE CASCADE, CONSTRAINT `province_id` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2609 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2622 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5447,7 +5423,7 @@ CREATE TABLE `Proveedores_account` ( KEY `fk_Proveedores_account_entity1_idx` (`entity_id`), KEY `fk_banco_prov_account_idx` (`Id_Banco`), CONSTRAINT `fk_banco_prov_account` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=681 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=687 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5538,7 +5514,7 @@ CREATE TABLE `Recibos` ( CONSTRAINT `Recibos_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE, CONSTRAINT `Recibos_ibfk_2` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE, CONSTRAINT `recibo_customer_id` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=490419 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=497387 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 */ ; @@ -5629,7 +5605,7 @@ CREATE TABLE `Relaciones` ( KEY `Id_Contacto` (`Id_Contacto`), KEY `Id_Proveedor` (`Id_Proveedor`), KEY `Id_Cliente` (`Id_Cliente`) -) ENGINE=InnoDB AUTO_INCREMENT=2650 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2652 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5649,7 +5625,7 @@ CREATE TABLE `Remesas` ( KEY `empresa_id` (`empresa_id`), CONSTRAINT `Remesas_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE, CONSTRAINT `Remesas_ibfk_2` FOREIGN KEY (`Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1142 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1156 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5674,7 +5650,7 @@ CREATE TABLE `Reservas` ( PRIMARY KEY (`Id_Reserva`), KEY `Id_1` (`Id_Ticket`), KEY `Id_Article` (`Id_Article`) -) ENGINE=InnoDB AUTO_INCREMENT=275 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5705,7 +5681,7 @@ CREATE TABLE `Rutas` ( KEY `Fecha` (`Fecha`), KEY `gestdoc_id` (`gestdoc_id`), CONSTRAINT `Rutas_ibfk_1` FOREIGN KEY (`gestdoc_id`) REFERENCES `gestdoc` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=42993 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=44277 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 */ ; @@ -5767,7 +5743,7 @@ CREATE TABLE `Rutas_Master` ( PRIMARY KEY (`id`), KEY `fk_rutas_warehouse_id_idx` (`warehouse_id`), CONSTRAINT `fk_rutas_warehouse_id` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=76 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5858,7 +5834,7 @@ CREATE TABLE `Saldos_Prevision` ( KEY `empresa_prevision_idx` (`empresa_id`), CONSTRAINT `banco_prevision` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE, CONSTRAINT `empresa_prevision` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=109 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Aqui ponemos los gastos e ingresos pendientes de introducir '; +) ENGINE=InnoDB AUTO_INCREMENT=111 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Aqui ponemos los gastos e ingresos pendientes de introducir '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5893,7 +5869,7 @@ CREATE TABLE `Split_lines` ( KEY `Id_Compra` (`Id_Compra`), CONSTRAINT `Id_Compra` FOREIGN KEY (`Id_Compra`) REFERENCES `Compres` (`Id_Compra`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `Split_lines_ibfk_1` FOREIGN KEY (`Id_Split`) REFERENCES `Splits` (`Id_Split`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=336249 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=339910 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5911,7 +5887,7 @@ CREATE TABLE `Splits` ( `Notas` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`Id_Split`), KEY `Id_Entrada` (`Id_Entrada`) -) ENGINE=InnoDB AUTO_INCREMENT=36393 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=36426 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5939,7 +5915,7 @@ CREATE TABLE `Stockcontrol` ( CONSTRAINT `Stockcontrol_ibfk_1` FOREIGN KEY (`Id_Article`) REFERENCES `Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `Stockcontrol_ibfk_2` FOREIGN KEY (`Id_Remitente`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `Stockcontrol_ibfk_3` FOREIGN KEY (`Id_Solver`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=23766 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=23819 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5997,7 +5973,7 @@ CREATE TABLE `Tickets` ( CONSTRAINT `Tickets_ibfk_9` FOREIGN KEY (`Id_Ruta`) REFERENCES `Rutas` (`Id_Ruta`) ON UPDATE CASCADE, CONSTRAINT `ticket_customer_id` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE, CONSTRAINT `tickets_fk10` FOREIGN KEY (`Factura`) REFERENCES `Facturas` (`Id_Factura`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2004445 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2040053 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 */ ; @@ -6193,7 +6169,7 @@ CREATE TABLE `Tickets_dits` ( CONSTRAINT `Tickets_dits_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fgkey1` FOREIGN KEY (`idaccion_dits`) REFERENCES `accion_dits` (`idaccion_dits`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `fgkey3` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=61925397 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=63065673 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6399,7 +6375,7 @@ CREATE TABLE `Trabajadores` ( KEY `sub` (`sub`), CONSTRAINT `Clientes` FOREIGN KEY (`Id_Cliente_Interno`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE, CONSTRAINT `Trabajadores_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1203 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1218 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 */ ; @@ -6526,7 +6502,7 @@ CREATE TABLE `Vehiculos` ( KEY `provinceFk_idx` (`warehouseFk`), CONSTRAINT `Vehiculos_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE, CONSTRAINT `provinceFk` FOREIGN KEY (`warehouseFk`) REFERENCES `province` (`province_id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=394 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=405 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6552,7 +6528,7 @@ CREATE TABLE `Vehiculos_consumo` ( PRIMARY KEY (`Vehiculos_consumo_id`,`Id_Vehiculo`), KEY `fk_Vehiculos_consumo_Vehiculos_idx` (`Id_Vehiculo`), CONSTRAINT `fk_Vehiculos_consumo_Vehiculos` FOREIGN KEY (`Id_Vehiculo`) REFERENCES `Vehiculos` (`Id_Vehiculo`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=9282 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla apuntan el importe de los tickets de la gasolinera solred, con quien tenemos un contrato y nos facturan mensualmente'; +) ENGINE=InnoDB AUTO_INCREMENT=9499 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla apuntan el importe de los tickets de la gasolinera solred, con quien tenemos un contrato y nos facturan mensualmente'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6666,7 +6642,7 @@ CREATE TABLE `XDiario` ( PRIMARY KEY (`id`), KEY `empresa_id` (`empresa_id`), CONSTRAINT `XDiario_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3495844 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3514690 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 */ ; @@ -6749,7 +6725,7 @@ CREATE TABLE `accion_dits` ( `accion` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`idaccion_dits`), UNIQUE KEY `accion_UNIQUE` (`accion`) -) ENGINE=InnoDB AUTO_INCREMENT=167 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=169 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6774,7 +6750,7 @@ CREATE TABLE `account_conciliacion` ( KEY `fg_accconciliacion_key1_idx` (`Id_Proveedores_account`), KEY `index_id_calculated` (`id_calculated`), CONSTRAINT `fg_key1_accountconc` FOREIGN KEY (`Id_Proveedores_account`) REFERENCES `Proveedores_account` (`Id_Proveedores_account`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=9900 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=11603 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 */ ; @@ -6941,7 +6917,7 @@ CREATE TABLE `agency_hour` ( CONSTRAINT `agency_hour_ibfk_1` FOREIGN KEY (`agency_id`) REFERENCES `agency` (`agency_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `agency_hour_ibfk_2` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `agency_hour_ibfk_3` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=4794 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4975 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 */ ; @@ -7037,7 +7013,7 @@ CREATE TABLE `agency_weekday_bonus` ( `bonus` decimal(10,2) NOT NULL DEFAULT '0.00', PRIMARY KEY (`id`), UNIQUE KEY `warehouse_id` (`warehouse_id`,`agency_id`,`weekDay`,`zona`) -) ENGINE=InnoDB AUTO_INCREMENT=140 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=147 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7051,7 +7027,7 @@ CREATE TABLE `airline` ( `airline_id` smallint(2) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`airline_id`) -) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7107,7 +7083,7 @@ CREATE TABLE `albaran` ( CONSTRAINT `fk_albaran_empresa1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE, CONSTRAINT `fk_albaran_recibida` FOREIGN KEY (`recibida_id`) REFERENCES `recibida` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `fk_albaran_warehouse1` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2672 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2757 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7184,7 +7160,7 @@ CREATE TABLE `awb` ( CONSTRAINT `awbInvoiceIn` FOREIGN KEY (`invoiceInFk`) REFERENCES `recibida` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `awbTransitoryFk` FOREIGN KEY (`transitario_id`) REFERENCES `Proveedores` (`Id_Proveedor`) ON UPDATE CASCADE, CONSTRAINT `awb_ibfk_1` FOREIGN KEY (`iva_id`) REFERENCES `iva_codigo` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2751 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2832 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 */ ; @@ -7361,7 +7337,7 @@ CREATE TABLE `awb_component_template` ( CONSTRAINT `Id_Moneda` FOREIGN KEY (`Id_Moneda`) REFERENCES `Monedas` (`Id_Moneda`) ON UPDATE CASCADE, CONSTRAINT `awb_unit_fk1` FOREIGN KEY (`awb_unit_id`) REFERENCES `awb_unit` (`awb_unit_id`) ON UPDATE CASCADE, CONSTRAINT `role_fk` FOREIGN KEY (`awb_role_id`) REFERENCES `awb_role` (`awb_role_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=640 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=688 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7442,7 +7418,7 @@ CREATE TABLE `awb_gestdoc` ( KEY `awb_gestdoc_gestdoc_fk` (`gestdoc_id`), CONSTRAINT `awb_gestdoc_awb_fk` FOREIGN KEY (`awb_id`) REFERENCES `awb` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `awb_gestdoc_gestdoc_fk` FOREIGN KEY (`gestdoc_id`) REFERENCES `gestdoc` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2405 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2480 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7560,7 +7536,7 @@ CREATE TABLE `barcodes` ( UNIQUE KEY `Id_Article_2` (`Id_Article`,`code`), KEY `Id_Article` (`Id_Article`), CONSTRAINT `barcodes_ibfk_1` FOREIGN KEY (`Id_Article`) REFERENCES `Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=36789 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=37077 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7628,7 +7604,7 @@ 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=14 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7701,7 +7677,7 @@ CREATE TABLE `buy_edi` ( KEY `kop` (`kop`), KEY `barcode` (`barcode`), KEY `fec` (`fec`) -) ENGINE=InnoDB AUTO_INCREMENT=768179 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=783299 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7934,7 +7910,7 @@ CREATE TABLE `cl_act` ( CONSTRAINT `cl_act_ibfk_1` FOREIGN KEY (`Id_Movimiento`) REFERENCES `Movimientos` (`Id_Movimiento`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `cl_act_ibfk_3` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, CONSTRAINT `cl_act_ibfk_4` FOREIGN KEY (`cl_main_id`) REFERENCES `cl_main` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=91971 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Acciones en respuesta a las reclamaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=93660 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Acciones en respuesta a las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7968,7 +7944,7 @@ CREATE TABLE `cl_cau` ( CONSTRAINT `cl_cau_ibfk_7` FOREIGN KEY (`cl_mot_id`) REFERENCES `cl_mot` (`id`) ON UPDATE CASCADE, CONSTRAINT `cl_cau_ibfk_8` FOREIGN KEY (`cl_con_id`) REFERENCES `cl_con` (`id`) ON UPDATE CASCADE, CONSTRAINT `cl_cau_ibfk_9` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=48552 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Causas de las reclamaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=49323 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Causas de las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8018,7 +7994,7 @@ CREATE TABLE `cl_det` ( KEY `cl_main_id` (`cl_main_id`), CONSTRAINT `cl_det_ibfk_7` FOREIGN KEY (`Id_Movimiento`) REFERENCES `Movimientos` (`Id_Movimiento`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `cl_det_ibfk_8` FOREIGN KEY (`cl_main_id`) REFERENCES `cl_main` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=125434 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de las reclamaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=128063 DEFAULT 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 */ ; @@ -8106,7 +8082,7 @@ CREATE TABLE `cl_main` ( CONSTRAINT `cl_main_ibfk_4` FOREIGN KEY (`cl_dep_id`) REFERENCES `cl_dep` (`id`) ON UPDATE CASCADE, CONSTRAINT `cl_main_ibfk_5` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `cl_main_ticketFk` FOREIGN KEY (`ticketFk`) REFERENCES `Tickets` (`Id_Ticket`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=54468 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Reclamaciones, tabla principal'; +) ENGINE=InnoDB AUTO_INCREMENT=55515 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Reclamaciones, tabla principal'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8176,7 +8152,7 @@ DROP TABLE IF EXISTS `cl_sol`; CREATE TABLE `cl_sol` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `solucion` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - `addressFk` int(10) DEFAULT NULL, + `addressFk` int(10) DEFAULT NULL COMMENT 'Indica el consignatario para el ticket que regulariza el inventario', PRIMARY KEY (`id`), KEY `clSolAddressFk_idx` (`addressFk`), CONSTRAINT `clSolAddressFk` FOREIGN KEY (`addressFk`) REFERENCES `Consignatarios` (`id_consigna`) ON DELETE SET NULL ON UPDATE CASCADE @@ -8222,7 +8198,7 @@ CREATE TABLE `client_observation` ( KEY `Id_Cliente` (`Id_Cliente`), CONSTRAINT `client_observation_ibfk_1` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `client_observation_ibfk_2` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=67870 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; +) ENGINE=InnoDB AUTO_INCREMENT=68510 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8389,7 +8365,7 @@ CREATE TABLE `consignatarios_observation` ( `text` text COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`consignatarios_observation_id`), UNIQUE KEY `Id_Consigna` (`Id_Consigna`,`observation_type_id`) -) ENGINE=InnoDB AUTO_INCREMENT=3425 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de los consignatarios'; +) ENGINE=InnoDB AUTO_INCREMENT=3468 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de los consignatarios'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8471,7 +8447,7 @@ CREATE TABLE `credit` ( KEY `credit_ClienteFk` (`Id_Cliente`), CONSTRAINT `credit_ClienteFk` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `workers_fk` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=67270 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=68826 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8596,7 +8572,7 @@ CREATE TABLE `device` ( PRIMARY KEY (`device_id`), UNIQUE KEY `device_id_UNIQUE` (`device_id`), UNIQUE KEY `sn_UNIQUE` (`sn`) -) ENGINE=InnoDB AUTO_INCREMENT=263 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=279 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8986,7 +8962,7 @@ CREATE TABLE `escritos_det` ( PRIMARY KEY (`id`), KEY `empresa_id` (`empresa_id`), CONSTRAINT `escritos_det_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=16115 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=16307 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9015,7 +8991,7 @@ CREATE TABLE `expeditions` ( KEY `index4` (`ticket_id`), CONSTRAINT `Id_Agencia` FOREIGN KEY (`agency_id`) REFERENCES `Agencias` (`Id_Agencia`) ON UPDATE CASCADE, CONSTRAINT `ticket_id` FOREIGN KEY (`ticket_id`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2622538 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2681275 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 */ ; @@ -9153,19 +9129,6 @@ CREATE TABLE `expeditions_pictures` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Table structure for table `facturasIncorrectasMarzo2018` --- - -DROP TABLE IF EXISTS `facturasIncorrectasMarzo2018`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `facturasIncorrectasMarzo2018` ( - `id` int(10) unsigned NOT 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 `filtros` -- @@ -9275,7 +9238,7 @@ CREATE TABLE `gestdoc` ( UNIQUE KEY `emp_id` (`emp_id`,`orden`,`warehouse_id`), KEY `trabajador_id` (`trabajador_id`), KEY `warehouse_id` (`warehouse_id`) -) ENGINE=InnoDB AUTO_INCREMENT=1079576 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='document managment system'; +) ENGINE=InnoDB AUTO_INCREMENT=1098606 DEFAULT 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 */ ; @@ -9474,7 +9437,7 @@ CREATE TABLE `intrastat_data` ( KEY `recibida` (`recibida_id`), CONSTRAINT `intrastat_data_ibfk_1` FOREIGN KEY (`intrastat_id`) REFERENCES `Intrastat` (`Codintrastat`) ON UPDATE CASCADE, CONSTRAINT `intrastat_data_ibfk_2` FOREIGN KEY (`recibida_id`) REFERENCES `recibida` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=69231 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=69935 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9628,9 +9591,9 @@ SET character_set_client = utf8; 1 AS `amount`, 1 AS `ok`, 1 AS `Reservado`, - 1 AS `ready`, 1 AS `invoice`, - 1 AS `alertLevel`*/; + 1 AS `saleFk`, + 1 AS `ticketFk`*/; SET character_set_client = @saved_cs_client; -- @@ -9812,7 +9775,7 @@ CREATE TABLE `mail` ( `recipientFk` int(11) DEFAULT NULL, `plainTextBody` text COLLATE utf8_unicode_ci, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=1464193 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=MyISAM AUTO_INCREMENT=1493895 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9870,7 +9833,7 @@ CREATE TABLE `mandato` ( CONSTRAINT `mandato_fgkey1` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `mandato_fgkey2` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `mandato_fgkey3` FOREIGN KEY (`idmandato_tipo`) REFERENCES `mandato_tipo` (`idmandato_tipo`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=15633 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=15788 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 */ ; @@ -10079,7 +10042,7 @@ CREATE TABLE `pago` ( CONSTRAINT `pago_moneda` FOREIGN KEY (`id_moneda`) REFERENCES `Monedas` (`Id_Moneda`) ON UPDATE CASCADE, CONSTRAINT `pago_pay_met` FOREIGN KEY (`pay_met_id`) REFERENCES `pay_met` (`id`) ON UPDATE CASCADE, CONSTRAINT `proveedor_pago` FOREIGN KEY (`id_proveedor`) REFERENCES `Proveedores` (`Id_Proveedor`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=44208 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=44621 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 */ ; @@ -10574,7 +10537,7 @@ CREATE TABLE `price_fixed` ( KEY `date_end` (`date_end`), KEY `warehouse_id` (`warehouse_id`), CONSTRAINT `price_fixed_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=56527 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=57214 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 */ ; @@ -10636,7 +10599,7 @@ CREATE TABLE `producer` ( `visible` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`producer_id`), UNIQUE KEY `name_UNIQUE` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=5348 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=5431 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -10805,7 +10768,7 @@ CREATE TABLE `recibida` ( CONSTRAINT `recibida_ibfk_5` FOREIGN KEY (`cplusInvoiceType472Fk`) REFERENCES `vn`.`cplusInvoiceType472` (`id`) ON UPDATE CASCADE, CONSTRAINT `recibida_ibfk_6` FOREIGN KEY (`cplusRectificationTypeFk`) REFERENCES `vn`.`cplusRectificationType` (`id`) ON UPDATE CASCADE, CONSTRAINT `recibida_ibfk_7` FOREIGN KEY (`cplusTrascendency472Fk`) REFERENCES `vn`.`cplusTrascendency472` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=72621 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=73719 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 */ ; @@ -11394,7 +11357,7 @@ CREATE TABLE `recibida_iva` ( CONSTRAINT `recibida_iva_ibfk_2` FOREIGN KEY (`iva_id`) REFERENCES `iva_codigo` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `recibida_iva_ibfk_5` FOREIGN KEY (`recibida_id`) REFERENCES `recibida` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `recibida_iva_ibfk_6` FOREIGN KEY (`gastos_id`) REFERENCES `Gastos` (`Id_Gasto`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=103998 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=107568 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11417,7 +11380,7 @@ CREATE TABLE `recibida_vencimiento` ( KEY `banco_id` (`banco_id`), CONSTRAINT `recibida_vencimiento_ibfk_6` FOREIGN KEY (`banco_id`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE, CONSTRAINT `recibida_vencimiento_ibfk_7` FOREIGN KEY (`recibida_id`) REFERENCES `recibida` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=101372 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=104884 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 */ ; @@ -11641,7 +11604,7 @@ CREATE TABLE `scan` ( `name` varchar(45) CHARACTER SET utf8 DEFAULT NULL, `odbc_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=69262 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Se borra automaticamente 8 dias en el pasado desde vn2008.clean'; +) ENGINE=InnoDB AUTO_INCREMENT=72639 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Se borra automaticamente 8 dias en el pasado desde vn2008.clean'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11681,7 +11644,7 @@ CREATE TABLE `scan_line` ( PRIMARY KEY (`scan_line_id`), KEY `id_scan_id_idx` (`scan_id`), CONSTRAINT `id_scan_id` FOREIGN KEY (`scan_id`) REFERENCES `scan` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=864101 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=904668 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11703,7 +11666,7 @@ CREATE TABLE `sharingcart` ( KEY `Suplent` (`Id_Suplente`), CONSTRAINT `Suplent_key` FOREIGN KEY (`Id_Suplente`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, CONSTRAINT `Trabajador_key` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1896 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1907 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 */ ; @@ -11877,22 +11840,7 @@ CREATE TABLE `state` ( `sectorProdPriority` tinyint(3) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`) -) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `subordinate` --- - -DROP TABLE IF EXISTS `subordinate`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `subordinate` ( - `Id_Trabajador` bigint(11) DEFAULT NULL, - `visited` int(1) NOT NULL DEFAULT '0', - `boss` int(1) NOT NULL DEFAULT '0', - KEY `Id_Trabajador` (`Id_Trabajador`) -) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12174,7 +12122,7 @@ CREATE TABLE `ticket_observation` ( KEY `observation_type_id` (`observation_type_id`), CONSTRAINT `ticket_observation_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticket_observation_ibfk_2` FOREIGN KEY (`observation_type_id`) REFERENCES `observation_type` (`observation_type_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1169599 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; +) ENGINE=InnoDB AUTO_INCREMENT=1194757 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12298,7 +12246,7 @@ CREATE TABLE `travel` ( CONSTRAINT `travel_ibfk_2` FOREIGN KEY (`warehouse_id_out`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `travel_ibfk_3` FOREIGN KEY (`agency_id`) REFERENCES `Agencias` (`Id_Agencia`) ON UPDATE CASCADE, CONSTRAINT `travel_ibfk_4` FOREIGN KEY (`cargoSupplierFk`) REFERENCES `Proveedores` (`Id_Proveedor`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=115339 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB AUTO_INCREMENT=116036 DEFAULT 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 */ ; @@ -12435,7 +12383,7 @@ CREATE TABLE `travel_dits` ( KEY `fgkey2_idx` (`Id_Ticket`), KEY `fgkey3_idx` (`Id_Trabajador`), CONSTRAINT `travel_dits_ibfk_1` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=185619 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=190632 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13925,7 +13873,7 @@ 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 `nightlyTaskChecker` ON SCHEDULE EVERY 1 DAY STARTS '2018-09-26 04:00:00' ON COMPLETION PRESERVE ENABLE DO BEGIN +/*!50106 CREATE*/ /*!50117 DEFINER=`z-developer`@`%`*/ /*!50106 EVENT `nightlyTaskChecker` ON SCHEDULE EVERY 1 DAY STARTS '2018-09-26 04:00:00' ON COMPLETION PRESERVE ENABLE DO BEGIN DECLARE procedureIncorrect VARCHAR(50); SELECT CONCAT(`schema`,`procedure`) INTO procedureIncorrect FROM bs.nightTask WHERE date(finished) <> date(started); IF procedureIncorrect > '' THEN INSERT INTO vn2008.mail (`to`, subject, text) VALUES ('cau@verdnatura.es', 'error proceso nocturno', @@ -16976,7 +16924,7 @@ BEGIN DECLARE datINV DATE; SELECT FechaInventario INTO datINV FROM tblContadores; - ALTER TABLE `article_inventory` + ALTER TABLE `article_inventory` ADD `buy_date` datetime NOT NULL; UPDATE article_inventory INNER JOIN @@ -17003,7 +16951,7 @@ BEGIN GROUP BY article_id ) AS buy ON article_inventory.article_id = buy.article_id - SET article_inventory.buy_date = buy.bdate; + SET article_inventory.buy_date = buy.bdate; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -21752,6 +21700,8 @@ BEGIN sepavnl as SEPA, corevnl as RecibidoCORE, hasLcr + -- JGF descomentar cuando en salix este el bankEntityFk -- bic + -- JGF descomentar cuando en salix este el bankEntityFk -- description FROM Clientes cli JOIN (SELECT risk.company_id, @@ -21785,7 +21735,9 @@ BEGIN HAVING Recibo > 10 ) c on c.Id_Cliente = cli.Id_Cliente JOIN Proveedores p on p.Id_Proveedor = c.company_id - JOIN empresa e on e.id = c.company_id; + JOIN empresa e on e.id = c.company_id + -- JGF descomentar cuando en salix este el bankEntityFk -- LEFT JOIN vn.bankEntity be ON be.id = c.bankEntityFk + ; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -21804,8 +21756,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `calling`() BEGIN - -DROP TEMPORARY TABLE IF EXISTS Agenda, Agenda2; + DROP TEMPORARY TABLE IF EXISTS Agenda, Agenda2; CREATE TEMPORARY TABLE IF NOT EXISTS Agenda (Telefono varchar(15) PRIMARY KEY, Cliente VARCHAR(45)); @@ -23909,8 +23860,7 @@ BEGIN -- Insertamos los tickets que ya tienen expediciones, que fallaran si se repite la clave primaria. - INSERT INTO zeleVOL(Provincia, Id_Ticket, Bultos) - SELECT p.name, e.ticket_id, COUNT(e.ticket_id) + INSERT INTO zeleVOL(Provincia, Id_Ticket, Bultos) SELECT p.name, e.ticket_id, COUNT(e.ticket_id) FROM expeditions e JOIN Tickets t ON ticket_id = Id_Ticket JOIN Consignatarios c USING(Id_Consigna) @@ -23944,8 +23894,7 @@ BEGIN GROUP BY p.name, Id_Ticket ) sub GROUP BY province ON DUPLICATE KEY UPDATE Faltan = Faltan; - - -- Mostramos el resultado + -- Mostramos el resultado SELECT Provincia, COUNT(Id_Ticket) expediciones, SUM(Bultos) Bultos, SUM(Faltan) Prevision FROM zeleVOL @@ -25461,53 +25410,6 @@ WHERE AND v.reino_id <> 8 ; -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 `facturacionMarzo2018` */; -/*!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 `facturacionMarzo2018`() -BEGIN - -DECLARE done BOOL DEFAULT FALSE; -DECLARE vRefFk VARCHAR(15); - -DECLARE rs CURSOR FOR - SELECT io.ref - FROM vn.invoiceOut io - JOIN vn2008.facturasIncorrectasMarzo2018 f ON f.id = io.id; - -DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - -OPEN rs; - -FETCH rs INTO vRefFk; - -WHILE NOT done DO - - CALL vn.invoiceOutAgain(vRefFk); - - FETCH rs INTO vRefFk; - -END WHILE; - - -CLOSE rs; - - - - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -28281,7 +28183,7 @@ BEGIN INSERT INTO daily_task_log SET consulta = 'inventory_refresh-end'; - */ +*/ END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -28813,8 +28715,100 @@ BEGIN DECLARE v_tomorrow DATETIME DEFAULT TIMESTAMPADD(HOUR, 24, CURDATE()); INSERT INTO tmp_item (item_id, visible) - SELECT item_id, SUM(amount) amount FROM ( - SELECT item_id, amount FROM item_out + SELECT item_id, SUM(amount) amount + FROM ( + SELECT item_id, amount + FROM item_out i + LEFT JOIN vn.ticketState ts ON ts.ticketFk = i.ticketFk + LEFT JOIN `vn`.`saleTracking` `stPrevious` + ON `stPrevious`.`saleFk` = i.saleFk + AND `stPrevious`.`stateFk` = 26 + LEFT JOIN `vn`.`saleTracking` `stPrepared` + ON `stPrepared`.`saleFk` = i.saleFk + AND `stPrepared`.`stateFk` = 14 + LEFT JOIN `vn`.`saleTracking` `stControled` + ON `stControled`.`saleFk` = i.saleFk + AND `stControled`.`stateFk` = 8 + WHERE warehouse_id = v_wh + AND i.dat >= v_curdate + AND ( + (( + stPrevious.isChecked + OR stPrepared.isChecked + OR stControled.isChecked + OR ts.alertLevel > 1 + OR i.invoice IS NOT NULL + ) + AND dat < v_tomorrow) + OR i.Reservado) + UNION ALL + SELECT item_id, amount FROM item_entry_in + WHERE received != FALSE + AND dat >= v_curdate AND dat < v_tomorrow + AND warehouse_id = v_wh + AND (v_item IS NULL OR item_id = v_item) + UNION ALL + SELECT item_id, amount FROM item_entry_out + WHERE delivered != FALSE + AND dat >= v_curdate AND dat < v_tomorrow + AND warehouse_id = v_wh + AND (v_item IS NULL OR item_id = v_item) + ) t + GROUP BY item_id + ON DUPLICATE KEY UPDATE + visible = IFNULL(stock,0) + VALUES(visible); +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 `item_stock_visibleKk` */; +/*!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 `item_stock_visibleKk`(v_wh SMALLINT, v_item INT) +BEGIN + DECLARE v_curdate DATETIME DEFAULT TIMESTAMP(CURDATE(), '00:00:00'); + DECLARE v_tomorrow DATETIME DEFAULT TIMESTAMPADD(HOUR, 24, CURDATE()); + + INSERT INTO tmp_item (item_id, visible) + SELECT item_id, SUM(amount) amount + FROM ( + SELECT item_id, amount + FROM item_out i + LEFT JOIN `vn`.`saleTracking` `stPrevious` + ON `stPrevious`.`saleFk` = i.saleFk + AND `stPrevious`.`stateFk` = 26 + LEFT JOIN `vn`.`saleTracking` `stPrepared` + ON `stPrepared`.`saleFk` = i.saleFk + AND `stPrepared`.`stateFk` = 14 + LEFT JOIN `vn`.`saleTracking` `stControled` + ON `stControled`.`saleFk` = i.saleFk + AND `stControled`.`stateFk` = 8 + WHERE warehouse_id = v_wh + AND i.dat >= v_curdate + AND ( + (( + stPrevious.isChecked + OR stPrepared.isChecked + OR stControled.isChecked + OR i.alertLevel > 1 + OR i.invoice IS NOT NULL + ) + AND dat < v_tomorrow) + OR i.Reservado) + + /* LEFT JOIN + (SELECT isChecked + FROM vn.saleTracking + WHERE WHERE dat >= v_curdate AND warehouse_id = v_wh AND (alertLevel > 1 @@ -28822,8 +28816,8 @@ BEGIN ok != FALSE AND (((ok != FALSE OR ready != FALSE OR invoice IS NOT NULL) AND dat < v_tomorrow) - */ - OR Reservado != FALSE ) + + OR Reservado != FALSE )*/ UNION ALL SELECT item_id, amount FROM item_entry_in WHERE received != FALSE @@ -29209,6 +29203,63 @@ 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 PROCEDURE IF EXISTS `kkk` */; +/*!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 `kkk`() +BEGIN + +/* Crea los tags para articulos que no los tengan. + * Quitar los triggers de las tablas itemTag insert + * y Articles update +*/ + + DROP TEMPORARY TABLE IF EXISTS upda; + create temporary table upda + SELECT i.id + FROM vn.item i + WHERE i.typeFk = 182 or i.typeFk = 169; + + -- Parte dos en la que se actualiza el articulo + + UPDATE itemTag i + JOIN upda u ON i.itemFk = u.id + SET priority = 1 + WHERE tagFk = 4; + + UPDATE itemTag i + JOIN upda u ON i.itemFk = u.id + SET priority = 2 + WHERE tagFk = 1; + + UPDATE itemTag i + JOIN upda u ON i.itemFk = u.id + SET priority = 3 + WHERE tagFk = 35; + + UPDATE itemTag i + JOIN upda u ON i.itemFk = u.id + SET priority = 4 + WHERE tagFk = 37; + + UPDATE itemTag i + JOIN upda u ON i.itemFk = u.id + SET priority = 5 + WHERE tagFk = 67; + +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 `ListaTicketsEncajados` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -29794,8 +29845,7 @@ BEGIN INSERT INTO Mensajes(Mensaje,Fecha,Remitente,Destinatario) VALUES(memTXT, NOW(),idREM, idDES); - - SELECT LAST_INSERT_ID() INTO last_ID; + SELECT LAST_INSERT_ID() INTO last_ID; INSERT INTO Incidencias(Incidencia,Id_Trabajador,Destino,Fecha,Fecha_Mod) @@ -31066,7 +31116,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `productionState`(vWarehouse INT , vDate DATE) +CREATE DEFINER=`z-developer`@`%` PROCEDURE `productionState`(vWarehouse INT , vDate DATE) BEGIN @@ -34840,6 +34890,60 @@ update bi.saldos_bancos_pordia s join empresa e on e.id = s.empresa_id set s.Empresa = abbreviation; +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 `salePreparingList` */; +/*!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 `salePreparingList`(IN idT BIGINT) +BEGIN + + SELECT t.clientFk, + t.shipped, + a.nickname, + s.ticketFk, + s.itemFk, + s.quantity, + s.concept, + s.reserved, + s.id saleFk, + i.size, + i.inkFk, + i.stems, + i.image, + i.subName, + b.grouping, + ip.code as placement, + lpad(ifnull(cooler_path_detail_id, ip.code),5,'0') as path, + stPrevious.isChecked as isPrevious, + stPrepared.isChecked as isPrepared, + stControled.isChecked as isControled + + FROM vn.ticket t + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN vn.itemPlacement ip ON i.id = ip.itemFk AND i.warehouseFk = t.warehouseFk + LEFT JOIN vn2008.cooler_path_detail cpd on left(ip.code,3) = cpd.pasillo + LEFT JOIN bi.Last_buy_id lb ON lb.Id_Article = i.id AND lb.warehouse_id = t.warehouseFk + LEFT JOIN vn.buy b ON b.id = lb.Id_Compra + LEFT JOIN vn.saleTracking stPrepared ON stPrepared.saleFk = s.id AND stPrepared.stateFk = 8 + LEFT JOIN vn.saleTracking stControled ON stControled.saleFk = s.id AND stControled.stateFk = 14 + LEFT JOIN vn.saleTracking stPrevious ON stPrevious.saleFk = s.id AND stPrevious.stateFk = 26 + + WHERE t.id = idT + GROUP BY s.id; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -34983,6 +35087,105 @@ FETCH rs INTO vMyTicket; +WHILE NOT done DO + + + INSERT INTO Tickets(Id_Cliente + , warehouse_id + , Fecha + , Alias + , Id_Consigna + , Id_Trabajador + , Id_Ruta + , empresa_id + , Id_Agencia + , landing) + SELECT Id_Cliente + , SILLA_PCA as warehouse_id + , Fecha + , Alias + , Id_Consigna + , Id_Trabajador + , Id_Ruta + , empresa_id + , Id_Agencia + , landing + FROM Tickets + WHERE Id_Ticket = vMyTicket; + + SELECT LAST_INSERT_ID() INTO vNewTicket; + + -- SELECT vMyTicket, vNewTicket; SET done = 1; + UPDATE Movimientos m + JOIN Articles a using(Id_Article) + JOIN Tipos tp using(tipo_id) + SET Id_Ticket = vNewTicket + WHERE Id_Ticket = vMyTicket + AND ( + Id_Tipo = 'ANT' + OR + ( m.Id_Article = 100 + AND + Concepte LIKE 'ANT%') + ); + + FETCH rs INTO vMyTicket; + +END WHILE; + +CLOSE rs; + +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 `splitAnthuriums2018` */; +/*!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 `splitAnthuriums2018`() +BEGIN + +DECLARE vStartingDate DATETIME DEFAULT '2018-10-16'; +DECLARE vEndingDate DATETIME DEFAULT '2018-10-31 23:59:00'; +DECLARE vMyTicket INT; +DECLARE vNewTicket INT; +DECLARE SILLA_PCA INT DEFAULT 44; +DECLARE done INT DEFAULT 0; + +DECLARE rs CURSOR FOR +SELECT DISTINCT Id_Ticket +FROM Movimientos m +JOIN Tickets t using(Id_Ticket) +JOIN Articles a using(Id_Article) +JOIN Tipos tp using(tipo_id) +WHERE t.Fecha between vStartingDate and vEndingDate +AND warehouse_id = 1 +AND + ( + Id_Tipo = 'ANT' + OR + ( Id_Article = 100 + AND + Concepte LIKE 'ANT%') + ); + +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; + +OPEN rs; + +FETCH rs INTO vMyTicket; + + + WHILE NOT done DO @@ -35114,6 +35317,90 @@ END WHILE; CLOSE rs; +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 `splitHeliconias2018` */; +/*!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 `splitHeliconias2018`() +BEGIN + +DECLARE vStartingDate DATETIME DEFAULT '2018-10-16'; +DECLARE vEndingDate DATETIME DEFAULT '2018-10-31 23:59:00'; +DECLARE vMyTicket INT; +DECLARE vNewTicket INT; +DECLARE SILLA_PCA INT DEFAULT 44; +DECLARE done INT DEFAULT 0; + +DECLARE rs CURSOR FOR +SELECT DISTINCT Id_Ticket +FROM Movimientos m +JOIN Compres c ON Id_Entrada IN (152622) AND c.Id_Article = m.Id_Article +JOIN Tickets t using(Id_Ticket) +LEFT JOIN vn.ticketStateToday tst ON t.Id_Ticket = tst.ticket +WHERE (IFNULL(tst.productionOrder,9) < 5 OR t.Fecha between vStartingDate and vEndingDate) +AND warehouse_id = 1; + +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; + +OPEN rs; + +FETCH rs INTO vMyTicket; + + + +WHILE NOT done DO + + + INSERT INTO Tickets(Id_Cliente + , warehouse_id + , Fecha + , Alias + , Id_Consigna + , Id_Trabajador + , Id_Ruta + , empresa_id + , Id_Agencia + , landing) + SELECT Id_Cliente + , SILLA_PCA as warehouse_id + , Fecha + , Alias + , Id_Consigna + , Id_Trabajador + , Id_Ruta + , empresa_id + , Id_Agencia + , landing + FROM Tickets + WHERE Id_Ticket = vMyTicket; + + SELECT LAST_INSERT_ID() INTO vNewTicket; + + -- SELECT vMyTicket, vNewTicket; SET done = 1; + UPDATE Movimientos m + JOIN Compres c ON Id_Entrada IN (152622) AND c.Id_Article = m.Id_Article + SET Id_Ticket = vNewTicket + WHERE Id_Ticket = vMyTicket + ; + + FETCH rs INTO vMyTicket; + +END WHILE; + +CLOSE rs; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -35167,6 +35454,109 @@ FETCH rs INTO vMyTicket; +WHILE NOT done DO + + + INSERT INTO Tickets(Id_Cliente + , warehouse_id + , Fecha + , Alias + , Id_Consigna + , Id_Trabajador + , Id_Ruta + , empresa_id + , Id_Agencia + , landing) + SELECT Id_Cliente + , SILLA_PCA as warehouse_id + , Fecha + , Alias + , Id_Consigna + , Id_Trabajador + , Id_Ruta + , empresa_id + , Id_Agencia + , landing + FROM Tickets + WHERE Id_Ticket = vMyTicket; + + SELECT LAST_INSERT_ID() INTO vNewTicket; + + -- SELECT vMyTicket, vNewTicket; SET done = 1; + UPDATE Movimientos m + JOIN Articles a using(Id_Article) + JOIN Tipos tp using(tipo_id) + SET Id_Ticket = vNewTicket + WHERE Id_Ticket = vMyTicket + AND ( + Id_Tipo = 'CYM' + OR + Id_Tipo = 'ORQ' + OR + ( Id_Article = 100 + AND + Concepte LIKE 'CYM%') + ); + + FETCH rs INTO vMyTicket; + +END WHILE; + +CLOSE rs; + +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 `splitOrquideas2018` */; +/*!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 `splitOrquideas2018`() +BEGIN + +DECLARE vStartingDate DATETIME DEFAULT '2018-10-16'; +DECLARE vEndingDate DATETIME DEFAULT '2018-10-31 23:59:00'; +DECLARE vMyTicket INT; +DECLARE vNewTicket INT; +DECLARE SILLA_PCA INT DEFAULT 44; +DECLARE done INT DEFAULT 0; + +DECLARE rs CURSOR FOR +SELECT DISTINCT Id_Ticket +FROM Movimientos m +JOIN Tickets t using(Id_Ticket) +JOIN Articles a using(Id_Article) +JOIN Tipos tp using(tipo_id) +WHERE t.Fecha between vStartingDate and vEndingDate +AND warehouse_id = 1 +AND + ( + Id_Tipo = 'CYM' + OR + Id_Tipo = 'ORQ' + OR + ( Id_Article = 100 + AND + Concepte LIKE 'CYM%') + ); + +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; + +OPEN rs; + +FETCH rs INTO vMyTicket; + + + WHILE NOT done DO @@ -37454,7 +37844,7 @@ BEGIN WHERE tr.landing >= vDateFrom GROUP BY e.Id_Entrada ) sub - ORDER BY landing,shipment, travel, IsTravel DESC, (loadPriority > 0) DESC,loadPriority, Agencia, Notas_Eva ; + ORDER BY shipment, landing, travel, IsTravel DESC, (loadPriority > 0) DESC,loadPriority, Agencia, Notas_Eva ; END ;; DELIMITER ; @@ -40025,6 +40415,51 @@ SET character_set_client = utf8; 1 AS `claimDestinationFk`*/; SET character_set_client = @saved_cs_client; +-- +-- Table structure for table `claimLog` +-- + +DROP TABLE IF EXISTS `claimLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `claimLog` ( + `id` int(11) NOT NULL, + `originFk` int(10) unsigned NOT NULL, + `userFk` int(10) unsigned DEFAULT NULL, + `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, + `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `description` text COLLATE utf8_unicode_ci NOT NULL, + `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `oldInstance` text COLLATE utf8_unicode_ci, + `newInstance` text COLLATE utf8_unicode_ci, + `changedModelId` int(11) DEFAULT NULL, + `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `originFk` (`originFk`), + KEY `userFk` (`userFk`), + CONSTRAINT `claimOriginFk` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`cl_main` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `claimUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB 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 `vn`.`claimLog_BEFORE_INSERT` BEFORE INSERT ON `claimLog` FOR EACH ROW +BEGIN + SET NEW.newInstance = NEW.description; +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 */ ; + -- -- Temporary table structure for view `claimRatio` -- @@ -40162,7 +40597,8 @@ SET character_set_client = utf8; 1 AS `hasInvoiceSimplified`, 1 AS `salesPersonFk`, 1 AS `isVies`, - 1 AS `eypbc`*/; + 1 AS `eypbc`, + 1 AS `bankEntityFk`*/; SET character_set_client = @saved_cs_client; -- @@ -40178,7 +40614,7 @@ CREATE TABLE `clientContact` ( `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=4097 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4101 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40238,19 +40674,21 @@ DROP TABLE IF EXISTS `clientLog`; CREATE TABLE `clientLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `originFk` int(11) NOT NULL, - `userFk` int(10) unsigned NOT NULL, + `userFk` int(10) unsigned DEFAULT NULL, `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `description` text COLLATE utf8_unicode_ci NOT NULL, - `model` text COLLATE utf8_unicode_ci, + `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci NOT NULL, + `newInstance` text COLLATE utf8_unicode_ci, + `changedModelId` int(11) DEFAULT NULL, + `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `originFk` (`originFk`), KEY `userFk` (`userFk`), CONSTRAINT `clientLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) 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=174948 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=178516 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 */ ; @@ -40263,6 +40701,7 @@ CREATE TABLE `clientLog` ( DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`clientLog_BEFORE_INSERT` BEFORE INSERT ON `clientLog` FOR EACH ROW BEGIN + SET NEW.newInstance = NEW.description; END */;; DELIMITER ; @@ -40319,6 +40758,20 @@ CREATE TABLE `clientProtected` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de clientes y comerciales que no se van a ver afectados por las desagsignaciones mensuales automaticas'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Temporary table structure for view `clientRisk` +-- + +DROP TABLE IF EXISTS `clientRisk`; +/*!50001 DROP VIEW IF EXISTS `clientRisk`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `clientRisk` AS SELECT + 1 AS `clientFk`, + 1 AS `companyFk`, + 1 AS `amount`*/; +SET character_set_client = @saved_cs_client; + -- -- Temporary table structure for view `clientSample` -- @@ -40691,7 +41144,7 @@ CREATE TABLE `creditClassification` ( KEY `creditClassifClientFk_idx` (`client`), KEY `creditClassifdateEnd_idx` (`dateEnd`), CONSTRAINT `creditClassifClientFk` FOREIGN KEY (`client`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2888 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2963 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!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 */ ; @@ -40736,7 +41189,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=2184 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalla los clientes que tienen seguro de credito'; +) ENGINE=InnoDB AUTO_INCREMENT=2317 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalla los clientes que tienen seguro de credito'; /*!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 */ ; @@ -40789,6 +41242,22 @@ CREATE TABLE `dailyTaskLog` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Temporary table structure for view `defaulter` +-- + +DROP TABLE IF EXISTS `defaulter`; +/*!50001 DROP VIEW IF EXISTS `defaulter`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `defaulter` AS SELECT + 1 AS `clientFk`, + 1 AS `created`, + 1 AS `amount`, + 1 AS `defaulterSinced`, + 1 AS `hasChanged`*/; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `deliveryError` -- @@ -40891,7 +41360,7 @@ CREATE TABLE `dua` ( CONSTRAINT `dua_fk1` FOREIGN KEY (`gestdocFk`) REFERENCES `vn2008`.`gestdoc` (`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 `vn2008`.`empresa` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3378 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3469 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40932,7 +41401,7 @@ CREATE TABLE `duaIntrastat` ( KEY `duaIntrastat_fk2_idx` (`duaFk`), CONSTRAINT `duaIntrastat_fk1` FOREIGN KEY (`intrastatFk`) REFERENCES `vn2008`.`Intrastat` (`Codintrastat`) ON UPDATE CASCADE, CONSTRAINT `duaIntrastat_fk2` FOREIGN KEY (`duaFk`) REFERENCES `dua` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=4903 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=5077 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40952,7 +41421,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=4309 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Facturas asociadas a la declaración aduanera, básicamente la del agente transitario'; +) ENGINE=InnoDB AUTO_INCREMENT=4358 DEFAULT 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 */; -- @@ -40977,7 +41446,7 @@ 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 `vn2008`.`Proveedores` (`Id_Proveedor`) ON UPDATE CASCADE, CONSTRAINT `duaTax_fk3` FOREIGN KEY (`taxClassFk`) REFERENCES `vn2008`.`iva_group` (`iva_group_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2439 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2802 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41073,7 +41542,7 @@ CREATE TABLE `entryLog` ( KEY `entryLog_ibfk_2` (`userFk`), CONSTRAINT `entryLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Entradas` (`Id_Entrada`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `entryLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=72628 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=90236 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41657,7 +42126,7 @@ CREATE TABLE `invoiceOutExpence` ( KEY `invoiceOutExpence_FK_2_idx` (`expenceFk`), CONSTRAINT `invoiceOutExpence_FK_1` FOREIGN KEY (`invoiceOutFk`) REFERENCES `vn2008`.`Facturas` (`factura_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceOutExpence_FK_2` FOREIGN KEY (`expenceFk`) REFERENCES `vn2008`.`Gastos` (`Id_Gasto`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=81333 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Desglosa la base imponible de una factura en funcion del tipo de gasto/venta'; +) ENGINE=InnoDB AUTO_INCREMENT=81939 DEFAULT 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 */; -- @@ -41700,7 +42169,7 @@ CREATE TABLE `invoiceOutTax` ( KEY `pgcFk` (`pgcFk`), CONSTRAINT `invoiceOutFk` FOREIGN KEY (`invoiceOutFk`) REFERENCES `vn2008`.`Facturas` (`factura_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceOutTax_ibfk_1` FOREIGN KEY (`pgcFk`) REFERENCES `pgc` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=979044 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=979863 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41809,7 +42278,8 @@ SET character_set_client = utf8; 1 AS `name`, 1 AS `display`, 1 AS `color`, - 1 AS `icon`*/; + 1 AS `icon`, + 1 AS `merchandise`*/; SET character_set_client = @saved_cs_client; -- @@ -41884,12 +42354,35 @@ CREATE TABLE `itemLog` ( `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `description` text COLLATE utf8_unicode_ci NOT NULL, + `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `oldInstance` text COLLATE utf8_unicode_ci, + `newInstance` text COLLATE utf8_unicode_ci, + `changedModelId` int(11) DEFAULT NULL, + `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, KEY `itemLogItemFk_idx` (`originFk`), KEY `itemLogUserFk_idx` (`userFk`), CONSTRAINT `itemLogItemFk` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `itemLogUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE ) ENGINE=InnoDB 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 `vn`.`itemLog_BEFORE_INSERT` BEFORE INSERT ON `itemLog` FOR EACH ROW +BEGIN + SET NEW.newInstance = NEW.description; +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 */ ; -- -- Temporary table structure for view `itemPlacement` @@ -41971,7 +42464,7 @@ CREATE TABLE `itemShelving` ( CONSTRAINT `itemShelving_fk1` FOREIGN KEY (`itemFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) 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 `vn2008`.`Cubos` (`Id_Cubo`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=11587 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=23427 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42000,7 +42493,8 @@ SET character_set_client = utf8; 1 AS `itemShelving`, 1 AS `Agency`, 1 AS `shipped`, - 1 AS `grouping`*/; + 1 AS `grouping`, + 1 AS `packing`*/; SET character_set_client = @saved_cs_client; -- @@ -42035,7 +42529,7 @@ CREATE TABLE `itemTag` ( KEY `priorityItem` (`itemFk`,`priority`), KEY `tagFk` (`tagFk`,`value`), CONSTRAINT `itemFK` FOREIGN KEY (`itemFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=530751 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=534239 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 */ ; @@ -42050,6 +42544,8 @@ DELIMITER ;; BEGIN DECLARE vInkId VARCHAR(3) DEFAULT NULL; + DECLARE vOriginId INT DEFAULT NULL; + IF NEW.priority = 1 AND NEW.value IS NOT NULL THEN UPDATE item i JOIN tag t ON t.id = NEW.tagFk @@ -42097,6 +42593,12 @@ BEGIN SELECT id INTO vInkId FROM ink WHERE name = NEW.value; UPDATE item SET inkFk = vInkId WHERE id = NEW.itemFk; END IF; + + -- Al insertar el tag origen se modifica también en la tabla item + IF NEW.tagFk = 35 THEN + SELECT id INTO vOriginId FROM origin WHERE name = NEW.value; + UPDATE item SET originFk = vOriginId WHERE id = NEW.itemFk; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -42174,14 +42676,23 @@ DELIMITER ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`itemTag_AFTER_UPDATE` AFTER UPDATE ON `itemTag` FOR EACH ROW BEGIN - -- Al modificar el tag color se modifica también el antiguo campo color + DECLARE vInkId VARCHAR(3) DEFAULT NULL; + DECLARE vOriginId INT DEFAULT NULL; + + -- Al modificar el tag color se modifica también el antiguo campo color IF (NEW.tagFk = 1) THEN SELECT id INTO vInkId FROM ink WHERE `name` = NEW.`value`; IF vInkId > '' THEN UPDATE item SET inkFk = vInkId WHERE id = NEW.itemFk; END IF; END IF; + + -- Al insertar el tag origen se modifica también en la tabla item + IF NEW.tagFk = 35 THEN + SELECT id INTO vOriginId FROM origin WHERE name = NEW.value; + UPDATE item SET originFk = vOriginId WHERE id = NEW.itemFk; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -42301,7 +42812,7 @@ CREATE TABLE `itemTaxCountry` ( CONSTRAINT `countryFK_paises` FOREIGN KEY (`countryFk`) REFERENCES `vn2008`.`Paises` (`Id`) ON UPDATE CASCADE, CONSTRAINT `itemFK_Article` FOREIGN KEY (`itemFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `taxClassFK_Iva_Group` FOREIGN KEY (`taxClassFk`) REFERENCES `vn2008`.`iva_group` (`iva_group_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=535481 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Define la clase de iva por artículo y pais'; +) ENGINE=InnoDB AUTO_INCREMENT=546314 DEFAULT 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 */; -- @@ -42571,7 +43082,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 `vn2008`.`Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=92 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=109 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42592,7 +43103,7 @@ CREATE TABLE `message` ( KEY `sender` (`sender`), KEY `recipient` (`recipient`), KEY `uuid` (`uuid`(8)) -) ENGINE=InnoDB AUTO_INCREMENT=1607245 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1650820 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42614,7 +43125,7 @@ CREATE TABLE `messageInbox` ( PRIMARY KEY (`id`), KEY `uuid` (`uuid`(8)), KEY `finalRecipient` (`finalRecipient`) -) ENGINE=InnoDB AUTO_INCREMENT=1757942 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1810659 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42856,7 +43367,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=23277 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=23770 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 */ ; @@ -42887,7 +43398,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`parking_BEFORE_UPDATE` BEFORE UPDATE ON `parking` FOR EACH ROW +/*!50003 CREATE*/ /*!50017 DEFINER=`z-developer`@`%`*/ /*!50003 TRIGGER `vn`.`parking_BEFORE_UPDATE` BEFORE UPDATE ON `parking` FOR EACH ROW BEGIN -- SET new.`code` = CONCAT(new.`column`,' - ',new.`row`) ; @@ -43566,6 +44077,23 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Table structure for table `routeLoadWorker` +-- + +DROP TABLE IF EXISTS `routeLoadWorker`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `routeLoadWorker` ( + `routeFk` int(10) unsigned NOT NULL, + `workerFk` int(11) NOT NULL, + PRIMARY KEY (`routeFk`,`workerFk`), + KEY `frmWorker_idx` (`workerFk`), + CONSTRAINT `frmRutas` FOREIGN KEY (`routeFk`) REFERENCES `vn2008`.`Rutas` (`Id_Ruta`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `frmWorker` FOREIGN KEY (`workerFk`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `routeLog` -- @@ -43581,7 +44109,7 @@ CREATE TABLE `routeLog` ( `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `description` text COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=608749 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=651323 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43666,7 +44194,24 @@ CREATE TABLE `saleItemShelving` ( `ubication` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `saleItemShelving_fk1_idx` (`itemShelvingFk`) -) ENGINE=InnoDB AUTO_INCREMENT=9448 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=16450 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `saleState` +-- + +DROP TABLE IF EXISTS `saleState`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `saleState` ( + `saleFk` int(11) NOT NULL, + `stateFk` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`saleFk`), + KEY `saleState_fk2_idx` (`stateFk`), + CONSTRAINT `saleState_fk1` FOREIGN KEY (`saleFk`) REFERENCES `vn2008`.`Movimientos` (`Id_Movimiento`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `saleState_fk2` FOREIGN KEY (`stateFk`) REFERENCES `vn2008`.`state` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='cahce para el estado de la linea'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43757,7 +44302,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=107497 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=110831 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43922,7 +44467,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=412959 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=440339 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44141,6 +44686,37 @@ SET character_set_client = utf8; 1 AS `created`*/; SET character_set_client = @saved_cs_client; +-- +-- Table structure for table `ticketDown` +-- + +DROP TABLE IF EXISTS `ticketDown`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketDown` ( + `ticketFk` int(11) NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `selected` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`ticketFk`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Cola de impresion para los tickets que se van a solicitar al altillo'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `ticketDownBuffer` +-- + +DROP TABLE IF EXISTS `ticketDownBuffer`; +/*!50001 DROP VIEW IF EXISTS `ticketDownBuffer`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `ticketDownBuffer` AS SELECT + 1 AS `ticketFk`, + 1 AS `created`, + 1 AS `selected`, + 1 AS `sacador`, + 1 AS `parking`*/; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `ticketLog` -- @@ -44155,12 +44731,17 @@ CREATE TABLE `ticketLog` ( `action` set('insert','update','delete','select') COLLATE utf8_unicode_ci NOT NULL, `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `description` text COLLATE utf8_unicode_ci NOT NULL, + `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `oldInstance` text COLLATE utf8_unicode_ci, + `newInstance` text COLLATE utf8_unicode_ci, + `changedModelId` int(11) DEFAULT NULL, + `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `logTicketoriginFk` (`originFk`), KEY `logTicketuserFk` (`userFk`), CONSTRAINT `ticketLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2295135 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2928944 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 */ ; @@ -44171,6 +44752,24 @@ CREATE TABLE `ticketLog` ( /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`ticketLog_BEFORE_INSERT` BEFORE INSERT ON `ticketLog` FOR EACH ROW +BEGIN + SET NEW.newInstance = NEW.description; +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 `vn`.`ticketLog_AFTER_INSERT` AFTER INSERT ON `ticketLog` FOR EACH ROW BEGIN DECLARE vActionId INT DEFAULT 84; @@ -44260,7 +44859,7 @@ CREATE TABLE `ticketPackaging` ( KEY `ticketPackaging_fk2_idx` (`packagingFk`), CONSTRAINT `ticketPackaging_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketPackaging_fk2` FOREIGN KEY (`packagingFk`) REFERENCES `vn2008`.`Cubos` (`Id_Cubo`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=41676 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=44007 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44492,7 +45091,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 `vn2008`.`Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=217 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de trabajadores que han realizado una formación'; +) ENGINE=InnoDB AUTO_INCREMENT=229 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de trabajadores que han realizado una formación'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44506,7 +45105,7 @@ 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=14 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de las formaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de las formaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44639,6 +45238,23 @@ SET character_set_client = utf8; 1 AS `lastPassChange`*/; SET character_set_client = @saved_cs_client; +-- +-- Table structure for table `userConfig` +-- + +DROP TABLE IF EXISTS `userConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `userConfig` ( + `userFk` int(10) unsigned NOT NULL, + `warehouseFk` smallint(6) DEFAULT NULL, + `companyFk` smallint(5) unsigned DEFAULT NULL, + `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`userFk`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuración de usuario en Salix'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Temporary table structure for view `vehicle` -- @@ -44784,7 +45400,7 @@ CREATE TABLE `workerDocument` ( KEY `workerDocument_ibfk_2` (`document`), CONSTRAINT `workerDocument_ibfk_1` FOREIGN KEY (`worker`) REFERENCES `vn2008`.`Trabajadores` (`user_id`) ON UPDATE CASCADE, CONSTRAINT `workerDocument_ibfk_2` FOREIGN KEY (`document`) REFERENCES `vn2008`.`gestdoc` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=7113 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=7527 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44801,7 +45417,7 @@ CREATE TABLE `workerHourPrice` ( `nightInc` decimal(4,2) DEFAULT NULL, `extraInc` decimal(4,2) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Recoge los acuerdos de los distintos convenios'; +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Recoge los acuerdos de los distintos convenios'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44834,7 +45450,7 @@ 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=7549265 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=10185174 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44856,7 +45472,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 `vn2008`.`Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=5875 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=6718 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44893,7 +45509,7 @@ CREATE TABLE `workerTimeControl` ( KEY `warehouseFkfk1_idx` (`warehouseFk`), CONSTRAINT `warehouseFk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `vn2008`.`warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `workerTimeControl_fk1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1419504 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Fichadas'; +) ENGINE=InnoDB AUTO_INCREMENT=1432916 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Fichadas'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45021,8 +45637,12 @@ CREATE TABLE `zone` ( PRIMARY KEY (`id`,`name`), UNIQUE KEY `name_UNIQUE` (`name`), KEY `fk_zone_1_idx` (`warehouseFk`), - KEY `fk_zone_2_idx` (`agencyModeFk`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; + KEY `fk_zone_2_idx` (`agencyModeFk`), + KEY `fk_zone1_idx` (`warehouseFk`), + KEY `fk_zone2_idx` (`agencyModeFk`), + CONSTRAINT `fk_zone_1` FOREIGN KEY (`warehouseFk`) REFERENCES `vn2008`.`warehouse` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `fk_zone_2` FOREIGN KEY (`agencyModeFk`) REFERENCES `vn2008`.`Agencias` (`Id_Agencia`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45107,38 +45727,38 @@ 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 `printingQueueChecker` ON SCHEDULE EVERY 10 MINUTE STARTS '2018-05-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN - - DECLARE vCurrentCount INT; - DECLARE vCheckSum INT; - DECLARE vIsAlreadyNotified BOOLEAN; - - SELECT COUNT(*), SUM(id) INTO vCurrentCount, vCheckSum - FROM 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 - THEN - INSERT INTO vn2008.mail (`to`, subject, text) - VALUES ('cau@verdnatura.es', - 'servidor de impresion parado', - CONCAT('Hay ', vCurrentCount, ' lineas bloqueadas')); - 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=`z-developer`@`%`*/ /*!50106 EVENT `printingQueueChecker` ON SCHEDULE EVERY 10 MINUTE STARTS '2018-05-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN + + DECLARE vCurrentCount INT; + DECLARE vCheckSum INT; + DECLARE vIsAlreadyNotified BOOLEAN; + + SELECT COUNT(*), SUM(id) INTO vCurrentCount, vCheckSum + FROM 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 + THEN + INSERT INTO vn2008.mail (`to`, subject, text) + VALUES ('cau@verdnatura.es', + 'servidor de impresion parado', + CONCAT('Hay ', vCurrentCount, ' lineas bloqueadas')); + 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 */ ;; @@ -45936,6 +46556,9 @@ BEGIN DECLARE vYesterday DATETIME; DECLARE vTodayvMidniight DATETIME DEFAULT midnight(vToday); DECLARE vTicket INT DEFAULT NULL; + -- PAK 22/10/18 + DECLARE PREVIOUS_PREPARATION INT DEFAULT 26; + DECLARE vHasBeenPreviouslyPrepared INT DEFAULT 0; SET vYesterday = TIMESTAMPADD(DAY,-1,vToday); @@ -45984,6 +46607,19 @@ BEGIN ORDER BY (code = 'PICKER_DESIGNED') DESC, Hora, Minuto, (code = 'PRINTED_BACK') DESC , loadingOrder LIMIT 1; + -- Aviso de ticket para bajar + SELECT COUNT(*) INTO vHasBeenPreviouslyPrepared + FROM vncontrol.inter + WHERE Id_Ticket = vTicket + AND state_id = PREVIOUS_PREPARATION; + + IF vHasBeenPreviouslyPrepared THEN + + INSERT IGNORE INTO vn.ticketDown(ticketFk) VALUES(vTicket); + + END IF; + + RETURN vTicket; END ;; @@ -47564,6 +48200,11 @@ BEGIN DELETE FROM vn.workerTimeControl WHERE timed < twoYearsAgo; DELETE FROM vn.itemShelving WHERE created < CURDATE() AND visible = 0; + UPDATE vn.shelving s + LEFT JOIN vn.itemShelving it ON it.shelvingFk = s.code + SET it.visible = 0 + WHERE it.shelvingFk IS NULL; + INSERT INTO vn.dailyTaskLog(state) VALUES('clean END'); END ;; DELIMITER ; @@ -47571,6 +48212,29 @@ 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 PROCEDURE IF EXISTS `clearShelvingList` */; +/*!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 `clearShelvingList`(vShelvingFk VARCHAR(8)) +BEGIN + + UPDATE vn.itemShelving + SET visible = 0, available = 0 + WHERE shelvingFk COLLATE utf8_unicode_ci =vShelvingFk COLLATE utf8_unicode_ci; + +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 `clientCreate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48004,8 +48668,8 @@ BEGIN START TRANSACTION; - INSERT INTO vn.travel (shipped,landed, warehouseInFk, warehouseOutFk, agencyFk, ref, isDelivered, isReceived, m3) - SELECT vDateStart, vDateEnd,warehouseInFk, warehouseOutFk, agencyFk, vRef, isDelivered, isReceived, m3 + 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; @@ -48218,6 +48882,103 @@ 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 PROCEDURE IF EXISTS `cristalBall` */; +/*!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 `cristalBall`() +BEGIN + + + +SELECT date(sub2.dat) dat, + sub2.longName, + sub2.size, + sub2.subName, + cast(sub2.entra as decimal(10,1)) as entra, + cast(sub2.sale as decimal(10,1)) as sale, + sub2.itemFk, + @saldo := entra + sale + ifnull(fue.pal,0) + IF(sub2.itemFk = @item, @saldo, 0) as saldo, + @item := sub2.itemFk as kk, + cast(fue.pal as decimal(10,1)) as pal +FROM +( + SELECT * FROM + ( + SELECT e.dat, + e.item_id as itemFk, + i.longName, + i.size, + i.subName, + sum(e.amount * r.cm3) / 2000000 as entra, + 0 as sale + FROM vn2008.item_entry_in e + JOIN vn.item i ON i.id = e.item_id + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.kingdom k ON k.id = it.kingdomFk + JOIN bi.rotacion r ON r.Id_Article = e.item_id AND r.warehouse_id = e.warehouse_id + WHERE e.dat BETWEEN CURDATE() AND '2018-10-30' + AND e.warehouse_id = 1 + AND k.merchandise + GROUP BY e.dat, e.item_id + + UNION ALL + + SELECT s.dat, + s.item_id as itemFk, + i.longName, + i.size, + i.subName, + 0 as entra, + sum(s.amount * r.cm3) / 2000000 as sale + FROM vn2008.item_out s + JOIN vn.item i ON i.id = s.item_id + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.kingdom k ON k.id = it.kingdomFk + JOIN bi.rotacion r ON r.Id_Article = s.item_id AND r.warehouse_id = s.warehouse_id + WHERE s.dat BETWEEN CURDATE() AND '2018-10-30 23:59' + AND s.warehouse_id = 1 + AND k.merchandise + GROUP BY date(s.dat), s.item_id + + UNION ALL + + SELECT util.yesterday(), + @item := st.item_id as itemFk, + i.longName, + i.size, + i.subName, + st.amount * r.cm3 / 2000000 , + @saldo := 0 + FROM cache.stock st + JOIN vn.item i ON i.id = st.item_id + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.kingdom k ON k.id = it.kingdomFk + JOIN bi.rotacion r ON r.Id_Article = st.item_id AND r.warehouse_id = st.warehouse_id + WHERE st.warehouse_id = 1 + AND k.merchandise + + ) sub + ORDER BY itemFk, dat, entra DESC) sub2 + LEFT JOIN + ( + SELECT itemFk, + - sum(visible / packing) as pal + FROM vn.itemShelving WHERE shelvingFk = 'FUE' + GROUP BY itemFk) fue ON fue.itemFk = sub2.itemFk AND sub2.dat = util.yesterday() + ; +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 `duaEntryValueUpdate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -50692,6 +51453,7 @@ BEGIN WHERE ish.itemFk = vItemFk AND s.warehouseFk = vWarehouseFk; + CALL vn2008.item_last_buy_(vWarehouseFk,vItemFk); SELECT i.id, i.longName, @@ -50702,6 +51464,8 @@ BEGIN i.size, i.stems, i.category, + i.minimum as min, + i.upToDown as repo, p.name as producer, o.code as origin, ip.code as nicho, @@ -50710,18 +51474,23 @@ BEGIN a.available, vVisibleAltillo as enAltillo, v.visible as total, - i.upToDown as repo - + c.grouping as grouping FROM vn.item i LEFT JOIN vn.producer p ON p.id = i.producerFk LEFT JOIN vn.origin o ON o.id = i.originFk LEFT JOIN vn.itemPlacement ip ON ip.itemFk = i.id LEFT JOIN cache.visible v ON v.calc_id = vCacheVisibleFk AND v.item_id = i.id LEFT JOIN cache.available a ON a.calc_id = vCacheAvailableFk AND a.item_id = i.id - - + LEFT JOIN + (SELECT b.item_id,c.grouping + FROM vn2008.t_item_last_buy b + INNER JOIN vn2008.Compres c ON c.Id_Compra = b.buy_id + where b.warehouse_id = vWarehouseFk) c + ON i.id= c.item_id WHERE i.id = vItemFk AND IFNULL(ip.warehouseFk, vWarehouseFk) = vWarehouseFk; + + DROP TEMPORARY TABLE t_item_last_buy; END ;; @@ -50748,7 +51517,7 @@ BEGIN -- traduccion: date, alertLevel, origin, reference, name, In, Out, Balance SELECT Fechainventario INTO vDateInventory FROM vn2008.tblContadores; SET @a = 0; - SELECT sql_no_cache DATE(date) AS date, + SELECT DATE(date) AS date, alertLevel, stateName, origin, @@ -50856,6 +51625,68 @@ 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 PROCEDURE IF EXISTS `itemFuentesBalance` */; +/*!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 `itemFuentesBalance`(vDaysInFuture INT) +BEGIN + + CALL cache.stock_refresh(FALSE); + + SELECT alt.itemFk, + i.longName, + i.size, + i.subName, + v.amount as visible, + alt.reserva, + sale.venta, + IFNULL(buy.compra,0) + IFNULL(mov.traslado,0) as compra, + IFNULL(v.amount,0) - reserva + IFNULL(sale.venta,0) + IFNULL(buy.compra,0) + IFNULL(mov.traslado,0) as saldo + FROM cache.stock v + JOIN ( + SELECT itemFk, CAST(SUM(visible) AS DECIMAL(10,0)) AS reserva + FROM vn.itemShelving + WHERE shelvingFk = 'FUE' + GROUP BY itemFk + ) alt ON alt.itemFk = v.item_id + JOIN vn.item i ON i.id = alt.itemFk + LEFT JOIN ( + SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as venta + FROM vn2008.item_out + WHERE dat BETWEEN CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(curdate())) + AND warehouse_id = 1 + GROUP BY item_id + ) sale ON sale.item_id = alt.itemFk + LEFT JOIN ( + SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as compra + FROM vn2008.item_entry_in + WHERE dat BETWEEN CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(curdate())) + AND warehouse_id = 1 + GROUP BY item_id + ) buy ON buy.item_id = alt.itemFk + LEFT JOIN ( + SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as traslado + FROM vn2008.item_entry_out + WHERE dat BETWEEN CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(curdate())) + AND warehouse_id = 1 + GROUP BY item_id + ) mov ON mov.item_id = alt.itemFk + + WHERE v.warehouse_id = 1; + +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 `itemGetVisibleAvailable` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -51233,6 +52064,32 @@ BEGIN SET tag10 = t.name, value10 = t.name WHERE it.priority = 10 AND (vItem IS NULL OR vItem = it.itemFk); +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 `itemSaveMin` */; +/*!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 `itemSaveMin`(min INT,vBarcode VARCHAR(22)) +BEGIN + + DECLARE vItemFk INT; + SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; + + UPDATE vn.item SET minimum = min WHERE id = vItemFk; + + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -51275,36 +52132,19 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `itemSetNicho`(vNicho VARCHAR(30),vReserva VARCHAR(30),vBarcode INT,vWarehouse INT) +CREATE DEFINER=`root`@`%` PROCEDURE `itemSetNicho`(IN `vPlacement` VARCHAR(30), IN `vReserve` VARCHAR(30), IN `vBarcode` INT, IN `vWarehouse` INT) BEGIN + DECLARE vItemFk INT DEFAULT barcodeToItem(vBarcode); + +INSERT INTO itemPlacement + SET itemFk = vItemFk, + warehouseFk = vWarehouse, + reserve = vReserve , + code = vPlacement + ON DUPLICATE KEY UPDATE + reserve = IFNULL(vReserve,reserve), + code = IFNULL(vPlacement,code); - DECLARE vItemFk INT; - DECLARE numItems INT; - DECLARE maxId INT; - - SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; - SELECT itemFk INTO vItemFk - FROM vn.buy b - WHERE b.id = vItemFk; - - - SELECT COUNT(id) INTO numItems - FROM vn2008.Articles_nicho - WHERE Id_Article = vItemFk; - - IF numItems > 0 THEN - IF vReserva <> '-1' THEN - UPDATE vn2008.Articles_nicho SET nicho = vNicho,reserve =vReserva WHERE Id_Article = vItemFk AND warehouse_id = vWarehouse; - ELSE - UPDATE vn2008.Articles_nicho SET nicho = vNicho WHERE Id_Article = vItemFk AND warehouse_id = vWarehouse; - END IF; - ELSE - IF vReserva <> '-1' THEN - INSERT INTO vn2008.Articles_nicho(Id_Article,warehouse_id,nicho,reserve) VALUES (vItemFk,vWarehouse,vNicho,vReserva); - ELSE - INSERT INTO vn2008.Articles_nicho(Id_Article,warehouse_id,nicho) VALUES (vItemFk,vWarehouse,vNicho); - END IF; - END IF; END ;; DELIMITER ; @@ -51494,8 +52334,11 @@ BEGIN ) b ON b.itemFk = i.id LEFT JOIN ( SELECT itemFk, sum(cast(quantity / packing AS DECIMAL(10,0))) AS etiquetas - FROM itemShelving + FROM itemShelving ish + JOIN shelving sh ON sh.code = ish.shelvingFk + LEFT JOIN parking pk ON pk.id = sh.parkingFk WHERE created > CURDATE() + AND IFNULL(pk.`column`,0) < 700 GROUP BY itemFk ) ish ON ish.itemFk = id WHERE b.stickers OR ish.etiquetas; @@ -51573,7 +52416,7 @@ BEGIN DECLARE vCalcAvailableFk INT; CALL cache.ticketShippingRefresh(vCalcTicketShippingFk, FALSE, 1); - CALL cache.visible_refresh(vCalcVisibleFk, FALSE, 1); + CALL cache.visible_refresh(vCalcVisibleFk, TRUE, 1); CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, CURDATE()); DROP TEMPORARY TABLE IF EXISTS tmp.ticketState; @@ -51612,7 +52455,7 @@ BEGIN JOIN cache.visible v ON v.calc_id = vCalcVisibleFk AND v.item_id = s.itemFk JOIN cache.ticketShipping tsh ON tsh.calc_id = vCalcTicketShippingFk AND tsh.ticketFk = tst.ticketFk JOIN vn.itemShelvingStock iss ON iss.itemFk = s.itemFk - WHERE s.isPicked = FALSE + WHERE tst.productionOrder < 5 UNION ALL @@ -51690,6 +52533,121 @@ BEGIN HAVING saldo <= 0 OR saldoFinal ; +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 `itemShelvingRadar_Entry` */; +/*!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 `itemShelvingRadar_Entry`(vEntryFk INT) +BEGIN + + DECLARE vWarehouseFk INT DEFAULT 1; + DECLARE vCalcVisibleFk INT; + DECLARE vCalcAvailableFk INT; + DECLARE vTodayDayEnd DATETIME DEFAULT util.dayEnd(CURDATE()); + + CALL cache.visible_refresh(vCalcVisibleFk, FALSE, 1); + CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, CURDATE()); + + DROP TEMPORARY TABLE IF EXISTS tmp.item; + CREATE TEMPORARY TABLE tmp.item + ENGINE = MEMORY + SELECT DISTINCT itemFk + FROM vn.buy + WHERE entryFk = vEntryFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.item2; + CREATE TEMPORARY TABLE tmp.item2 + ENGINE = MEMORY + SELECT * + FROM tmp.item; + + SELECT i.id as itemFk, + i.minimum, + CAST(IFNULL(v.visible,0) - IFNULL(iss.visible,0) AS DECIMAL(10,0)) as enNicho, + CAST(IFNULL(a.available,0) AS DECIMAL(10,0)) as disponible, + CAST(IFNULL(v.visible,0) - IFNULL(iss.visible,0) - ts.todaySold AS DECIMAL(10,0)) as finalDia + FROM vn.item i + JOIN tmp.item ti ON ti.itemFk = i.id + LEFT JOIN cache.visible v ON v.calc_id = vCalcVisibleFk AND v.item_id = i.id + LEFT JOIN cache.available a ON i.id = a.item_id AND a.calc_id = vCalcAvailableFk + LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = i.id + LEFT JOIN ( SELECT s.itemFk, sum(s.quantity) as todaySold + FROM vn.sale s + JOIN tmp.item2 ti ON ti.itemFk = s.itemFk + JOIN vn.ticket t ON t.id = s.ticketFk + LEFT JOIN vn.ticketState tst ON tst.ticketFk = t.id + WHERE t.shipped BETWEEN CURDATE() AND vTodayDayEnd + AND t.warehouseFk = vWarehouseFk + AND IFNULL(tst.productionOrder,0) < 5 + GROUP BY s.itemFK + ) ts ON ts.itemFk = i.id; + + + DROP TEMPORARY TABLE tmp.item; + DROP TEMPORARY TABLE tmp.item2; + +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 `itemShelvingTicketSource` */; +/*!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=`z-developer`@`%` PROCEDURE `itemShelvingTicketSource`(vTicketFk INT) +BEGIN + + DECLARE vCalcFk INT; + DECLARE vWarehouseFk INT; + + SELECT warehouseFk INTO vWarehouseFk + FROM vn.ticket + WHERE id = vTicketFk; + + SET vCalcFk = cache.ticketShippingCalcIdGet(vWarehouseFk); + + SELECT + s.id, + ubication, + s.quantity, + sis.quantity as Reserved, + s.itemFk, + s.concept, + s.ticketFk, + s.isPicked, + ish.packing, + FLOOR(sis.quantity / ish.packing) as stickers, + sis.quantity MOD ish.packing as rest, + ts.shippingHour, + ts.shippingMinute + FROM vn.saleItemShelving sis + JOIN vn.itemShelving ish ON ish.id = sis.itemShelvingFk + JOIN vn.sale s ON s.id = sis.saleFk + JOIN cache.ticketShipping ts ON ts.calc_id = vCalcFk AND ts.ticketFk = vTicketFk + WHERE s.ticketFk = vTicketFk + ; + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -52028,7 +52986,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `kk`() +CREATE DEFINER=`z-developer`@`%` PROCEDURE `kk`() BEGIN DECLARE vWarehouseFk INT DEFAULT 1; @@ -53194,11 +54152,17 @@ BEGIN CALL cache.ticketShippingRefresh(vCalcFk, FALSE, 1); - SELECT isa.*, sum(isa.available) as totalAvailable, tsh.shippingHour Hora, tsh.shippingMinute Minuto, i.subName + SELECT isa.*, + cast(max(isa.quantity mod isa.packing) as DECIMAL(10,0)) as picos, + sum(isa.available) as totalAvailable, + tsh.shippingHour Hora, + tsh.shippingMinute Minuto, + i.subName FROM vn.itemShelvingAvailable isa JOIN vn.item i ON i.id = isa.itemFk LEFT JOIN cache.ticketShipping tsh ON tsh.ticketFk = isa.ticketFk WHERE tsh.calc_id = vCalcFk + AND isa.sectorProdPriority <= 3 GROUP BY saleFk HAVING isa.quantity <= totalAvailable; @@ -53245,6 +54209,79 @@ 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 PROCEDURE IF EXISTS `replaceMovimientosMark` */; +/*!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 `replaceMovimientosMark`( + idMovimiento INT, + detalle INT, + originalQuantity INT, + idTrabajador INT, + stateFk INT, + originFk INT, + userFk INT, + actionString VARCHAR(50), + description VARCHAR(100)) +BEGIN + REPLACE INTO vn2008.Movimientos_mark(Id_Movimiento, valor, original_quantity, Id_Trabajador, stateFk) + VALUES(idMovimiento,detalle,originalQuantity,idTrabajador,stateFk); + INSERT INTO vn.ticketLog (originFk, userFk, action , description) VALUES(originFk, userFk, actionString, description); + +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 `riskAllClients` */; +/*!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 `riskAllClients`(maxRiskDate DATE) +BEGIN + + DROP TEMPORARY TABLE IF EXISTS tmp.client_list; + CREATE TEMPORARY TABLE tmp.client_list + (PRIMARY KEY (Id_Cliente)) + ENGINE = MEMORY + SELECT id Id_Cliente, null grade FROM vn.client; + + CALL vn2008.risk_vs_client_list(maxRiskDate); + + SELECT + c.RazonSocial, + c.Id_Cliente, + c.Credito, + CAST(r.risk as DECIMAL (10,2)) risk, + CAST(c.Credito - r.risk as DECIMAL (10,2)) Diferencia, + c.Id_Pais + FROM + vn2008.Clientes c + JOIN tmp.risk r ON r.Id_Cliente = c.Id_Cliente + JOIN tmp.client_list ci ON c.Id_Cliente = ci.Id_Cliente + GROUP BY c.Id_cliente; + + DROP TEMPORARY TABLE IF EXISTS tmp.risk; + DROP TEMPORARY TABLE IF EXISTS tmp.client_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 `routeGateAsign` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53405,6 +54442,13 @@ BEGIN 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 @@ -53494,6 +54538,8 @@ BEGIN DECLARE vDateStart DATETIME; DECLARE vDateEnd DATETIME; DECLARE vAuxId INT; + DECLARE vNumLine INT; + DECLARE vItemFk INT; SELECT clientFk,shipped,warehouseFk,companyFk,addressFk,agencyModeFk,landed,t.id INTO vclientFk,vShipped,vWarehouseFk,vCompanyFk,vAddressFk,vAgencyModeFk,vLanded,vAuxId @@ -53528,19 +54574,92 @@ IF vNewTicket IS NULL SELECT vNewTicket, getWorker(), s.id FROM state s WHERE s.code = 'FIXING'; - - INSERT INTO sale(ticketFk, itemFk, concept, quantity, price, discount) - SELECT vNewTicket, itemFk, concept, vQuantity, price, discount + + + /*parche para campapña, eliminar y modificar el front*/ +SELECT COUNT(id) INTO vNumLine FROM sale s - WHERE s.id = vSaleFk; + WHERE s.ticketFk = vNewTicket AND s.itemFk = (SELECT itemFk FROM sale WHERE id = vSaleFk); - SELECT LAST_INSERT_ID() INTO vNewSale; + IF vNumLine = 0 THEN - INSERT INTO saleComponent(saleFk, componentFk, `value`) - SELECT vNewSale, componentFk, `value` - FROM saleComponent - WHERE saleFk = vSaleFk; + INSERT INTO sale(ticketFk, itemFk, concept, quantity, price, discount) + SELECT vNewTicket, itemFk, concept, vQuantity, price, discount + FROM sale s + WHERE s.id = vSaleFk; + + SELECT LAST_INSERT_ID() INTO vNewSale; + + INSERT INTO saleComponent(saleFk, componentFk, `value`) + SELECT vNewSale, componentFk, `value` + FROM saleComponent + WHERE saleFk = vSaleFk; +ELSE IF vQuantity <> 0 THEN + + SELECT itemFk INTO vItemFk FROM sale WHERE id = vSaleFk; + UPDATE sale SET quantity = vQuantity + WHERE ticketFk = vNewTicket AND itemFk = vItemFk; + +END IF; +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 `salePreparingList` */; +/*!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 `salePreparingList`(IN idT BIGINT) +BEGIN + + SELECT t.clientFk, + t.shipped, + a.nickname, + s.ticketFk, + s.itemFk, + s.quantity, + s.concept, + s.reserved, + s.id saleFk, + i.size, + i.inkFk, + i.stems, + i.image, + i.subName, + b.grouping, + ip.code as placement, + lpad(ifnull(cooler_path_detail_id, ip.code),5,'0') as path, + stPrevious.isChecked as isPrevious, + stPrepared.isChecked as isPrepared, + stControled.isChecked as isControled, + ib.code as barcode + + FROM vn.ticket t + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN vn.itemPlacement ip ON i.id = ip.itemFk AND ip.warehouseFk = t.warehouseFk + LEFT JOIN vn2008.cooler_path_detail cpd on left(ip.code,3) = cpd.pasillo + LEFT JOIN bi.Last_buy_id lb ON lb.Id_Article = i.id AND lb.warehouse_id = t.warehouseFk + LEFT JOIN vn.buy b ON b.id = lb.Id_Compra + LEFT JOIN vn.saleTracking stPrepared ON stPrepared.saleFk = s.id AND stPrepared.stateFk = 14 + LEFT JOIN vn.saleTracking stControled ON stControled.saleFk = s.id AND stControled.stateFk = 8 + LEFT JOIN vn.saleTracking stPrevious ON stPrevious.saleFk = s.id AND stPrevious.stateFk = 26 + LEFT JOIN vn.itemBarcode ib ON ib.itemFk = i.id + + WHERE t.id = idT + GROUP BY s.id; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -53767,39 +54886,36 @@ BEGIN /*ELIMINAR ESPACIOS*/ SET vParkingCode = replace(vParkingCode,' ','') ; + + /*SINO EXISTE EL PARKING LO CREAMOS*/ + SELECT id INTO idParking + FROM vn.parking + WHERE code = vParkingCode COLLATE utf8_unicode_ci; + + IF idParking IS NULL THEN + IF LOCATE('-',vParkingCode) = 4 THEN + SELECT SUBSTRING_INDEX(vParkingCode,'-',1) INTO vColumn; + SELECT SUBSTRING_INDEX(vParkingCode,'-',-1) INTO vRow; + INSERT INTO vn.parking(`column`,row,code,sectorFk) + VALUES(vColumn,vRow,vParkingCode,2); + END IF; + END IF; + /*FIN INSERTAR PARKING*/ + + + SELECT id INTO vParkingFk + FROM vn.parking + WHERE `code` = vParkingCode COLLATE utf8_unicode_ci; + + IF length(vShelvingFk) > 6 THEN - IF vShelvingFk = "OK" THEN - - IF (SELECT `code` FROM vn.ticketStateToday WHERE ticket = vParkingCode) != 'ON_PREPARATION' THEN - - CALL vn.ticketStateUpdate(vParkingCode,'PRINTED_BACK'); + REPLACE vn.shelving(code, parkingFk, isPrinted) + VALUES(vShelvingFk, vParkingFk, TRUE); - END IF; - - SELECT TRUE FROM vn2008.tblContadores; - + SELECT TRUE; + ELSE - /*SINO EXISTE EL PARKING LO CREAMOS*/ - SELECT id INTO idParking - FROM vn.parking - WHERE code = vParkingCode COLLATE utf8_unicode_ci; - - IF idParking IS NULL THEN - IF LOCATE('-',vParkingCode) = 4 THEN - SELECT SUBSTRING_INDEX(vParkingCode,'-',1) INTO vColumn; - SELECT SUBSTRING_INDEX(vParkingCode,'-',-1) INTO vRow; - INSERT INTO vn.parking(`column`,row,code,sectorFk) - VALUES(vColumn,vRow,vParkingCode,2); - END IF; - END IF; - /*FIN INSERTAR PARKING*/ - - - SELECT id INTO vParkingFk - FROM vn.parking - WHERE `code` = vParkingCode COLLATE utf8_unicode_ci; - UPDATE vn.shelving SET parkingFk = vParkingFk WHERE `code` = vShelvingFk COLLATE utf8_unicode_ci; @@ -53808,10 +54924,8 @@ BEGIN FROM vn.shelving WHERE parkingFk = vParkingFk AND `code` = vShelvingFk COLLATE utf8_unicode_ci; - - - END IF; - + + END IF; END ;; DELIMITER ; @@ -54087,18 +55201,17 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `stowawayBoarding`(IN vShipFk INT, IN vStowawayFk INT) BEGIN - REPLACE stowaway(shipFk, id) VALUES (vShipFk, vStowawayFk); - -- Polizón + -- Polizón FIXME mostrar en encajado y movil a tiempo real INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) SELECT vStowawayFk, id, 'POLIZÓN!' FROM observationType ot WHERE ot.description IN ('Sacador','Encajador') ON DUPLICATE KEY UPDATE description = CONCAT('POLIZÓN! ',ticketObservation.description); - -- Nave + -- Nave FIXME mostrar en encajado y movil a tiempo real INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) SELECT vShipFk, id, CONCAT('POLIZÓN: ', vStowawayFk) FROM observationType @@ -54110,11 +55223,35 @@ BEGIN FROM state WHERE code = 'BOARDING'; + -- FIXME No crear ticket 98 INSERT INTO sale(ticketFk, itemFk, quantity, concept) VALUES(vShipFk, 98,1, CONCAT('POLIZÓN! ',vStowawayFk)); - - +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 `stowawayUnBoarding` */; +/*!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 `stowawayUnBoarding`(vShipFk INT, vStowawayFk INT) +BEGIN + DELETE FROM stowaway + WHERE shipFk = vShipFk AND id = vStowawayFk; + + DELETE tt FROM ticketTracking tt + JOIN state s ON s.id = tt.stateFk + WHERE code = 'BOARDING' AND ticketFk = vShipFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -56452,7 +57589,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ticketStatePrevious`(vTicketFk INT) +CREATE DEFINER=`root`@`%` PROCEDURE `ticketStatePrevious`(vTicketFk INT ) BEGIN DECLARE vControlFk INT; @@ -56468,16 +57605,24 @@ BEGIN = 'PREVIOUS_PREPARATION' THEN SELECT MAX(inter_id) INTO vControlFk - FROM vncontrol.inter + FROM vncontrol.inter i + JOIN vn.state s ON i.state_id = s.id WHERE Id_Ticket = vTicketFk - AND inter_id < vControlFk; + AND inter_id < vControlFk + AND s.code != 'PREVIOUS_PREPARATION'; INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador, Id_Supervisor) - SELECT state_id, Id_Ticket, Id_Trabajador, Id_Supervisor + SELECT state_id , Id_Ticket, vn.getWorker(), vn.getWorker() FROM vncontrol.inter WHERE inter_id = vControlFk; END IF; + SELECT name + FROM vn.state + WHERE id = (SELECT state_id + FROM vncontrol.inter + WHERE inter_id = vControlFk); + END ;; DELIMITER ; @@ -56784,6 +57929,74 @@ BEGIN UPDATE vn.item SET upToDown = 0 WHERE item.id = vItemFk; +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 `warehouseFitting` */; +/*!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 `warehouseFitting`(IN vWhOrigin INT , IN vWhDestiny INT) +BEGIN + + DECLARE vCacheVisibleOriginFk INT; + DECLARE vCacheVisibleDestinyFk INT; + + CALL cache.visible_refresh(vCacheVisibleOriginFk, TRUE, vWhOrigin); + CALL cache.visible_refresh(vCacheVisibleDestinyFk, TRUE, vWhDestiny); + + SELECT i.id itemFk, + i.longName, + i.size, + i.subName, + vOrigin.visible AS Origen, + vDestiny.visible Destino + + FROM vn.item i + JOIN vn.itemType it ON it.id = i.typeFk + LEFT JOIN cache.visible vOrigin ON vOrigin.calc_id = vCacheVisibleOriginFk AND vOrigin.item_id = i.id + LEFT JOIN cache.visible vDestiny ON vDestiny.calc_id = vCacheVisibleDestinyFk AND vDestiny.item_id = i.id + WHERE (vOrigin.visible OR vDestiny.visible) + AND it.kingdomFk < 6 + ORDER BY IF(vOrigin.visible,0,1), longName, size, subName; + +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 `warehouseFitting_byTravel` */; +/*!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 `warehouseFitting_byTravel`(IN vTravelFk INT) +BEGIN + + DECLARE vWhOrigin INT; + DECLARE vWhDestiny INT; + + SELECT warehouseInFk, warehouseOutFk INTO vWhDestiny, vWhOrigin + FROM vn.travel + WHERE id = vTravelFk; + + CALL vn.warehouseFitting(vWhOrigin, vWhDestiny); + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -56952,7 +58165,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `workerDisableAll`() +CREATE DEFINER=`z-developer`@`%` PROCEDURE `workerDisableAll`() BEGIN DECLARE done BOOL DEFAULT FALSE; DECLARE vUserFk INT; @@ -57800,7 +59013,7 @@ CREATE TABLE `batch` ( KEY `buy_edi_id` (`buy_edi_id`), CONSTRAINT `batch_ibfk_1` FOREIGN KEY (`message_id`) REFERENCES `message` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `batch_ibfk_2` FOREIGN KEY (`buy_edi_id`) REFERENCES `vn2008`.`buy_edi` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=374112 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=384779 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -58187,7 +59400,7 @@ CREATE TABLE `message` ( UNIQUE KEY `mail_id` (`mail_id`), KEY `sender_id` (`sender_id`), CONSTRAINT `message_ibfk_2` FOREIGN KEY (`sender_id`) REFERENCES `mail` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=395765 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=407022 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -59448,12 +60661,12 @@ 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 `nightlyTaskChecker` ON SCHEDULE EVERY 1 DAY STARTS '2018-09-26 05:00:00' ON COMPLETION PRESERVE ENABLE DO BEGIN -DECLARE procedureIncorrect VARCHAR(50); -SELECT CONCAT(`schema`,`procedure`) INTO procedureIncorrect FROM bs.nightTask WHERE date(finished) <> date(started); -IF procedureIncorrect > '' THEN INSERT INTO vn2008.mail (`to`, subject, text) VALUES ('cau@verdnatura.es', 'error proceso nocturno', -CONCAT('Ha fallado el procedimiento ', procedureIncorrect)); - +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `nightlyTaskChecker` ON SCHEDULE EVERY 1 DAY STARTS '2018-09-26 05:00:00' ON COMPLETION PRESERVE ENABLE DO BEGIN +DECLARE procedureIncorrect VARCHAR(50); +SELECT CONCAT(`schema`,`procedure`) INTO procedureIncorrect FROM bs.nightTask WHERE date(finished) <> date(started); +IF procedureIncorrect > '' THEN INSERT INTO vn2008.mail (`to`, subject, text) VALUES ('cau@verdnatura.es', 'error proceso nocturno', +CONCAT('Ha fallado el procedimiento ', procedureIncorrect)); + END IF; END */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; @@ -61451,13 +62664,13 @@ CREATE TABLE `Last_buy_id` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Last_buy_idBackUpkk` +-- Table structure for table `Last_buy_idBackUp` -- -DROP TABLE IF EXISTS `Last_buy_idBackUpkk`; +DROP TABLE IF EXISTS `Last_buy_idBackUp`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Last_buy_idBackUpkk` ( +CREATE TABLE `Last_buy_idBackUp` ( `Id_Article` int(11) NOT NULL DEFAULT '90', `Id_Compra` int(11) NOT NULL DEFAULT '0', `warehouse_id` smallint(6) unsigned NOT NULL, @@ -64678,7 +65891,7 @@ CREATE TABLE `cdr` ( KEY `dstchannel` (`dst_channel`), KEY `disposition` (`disposition`), KEY `src` (`src`) -) ENGINE=MyISAM AUTO_INCREMENT=222335 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=MyISAM AUTO_INCREMENT=229180 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -65473,7 +66686,7 @@ CREATE TABLE `cache_calc` ( KEY `cache_id` (`cache_id`), KEY `cacheName` (`cacheName`), KEY `expires` (`expires`) -) ENGINE=InnoDB AUTO_INCREMENT=194565 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=211307 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -67108,7 +68321,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=103 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=116 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -67350,7 +68563,7 @@ CREATE TABLE `inter` ( CONSTRAINT `inter_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `inter_state` FOREIGN KEY (`state_id`) REFERENCES `vn2008`.`state` (`id`) ON UPDATE CASCADE, CONSTRAINT `responsable` FOREIGN KEY (`Id_Supervisor`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=12859946 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=13448696 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 */ ; @@ -68089,7 +69302,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=13024 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=13027 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -68140,7 +69353,7 @@ CREATE TABLE `order` ( CONSTRAINT `order_ibfk_5` FOREIGN KEY (`address_id`) REFERENCES `vn2008`.`Consignatarios` (`id_consigna`) ON UPDATE CASCADE, CONSTRAINT `order_ibfk_8` FOREIGN KEY (`delivery_method_id`) REFERENCES `vn2008`.`Vistas` (`vista_id`) ON UPDATE CASCADE, CONSTRAINT `order_ibfk_9` FOREIGN KEY (`agency_id`) REFERENCES `vn2008`.`Agencias` (`Id_Agencia`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1578843 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1627613 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -68242,7 +69455,7 @@ CREATE TABLE `orderRow` ( KEY `warehouse_shipment` (`warehouseFk`,`shipment`), CONSTRAINT `orderRow_ibfk_2` FOREIGN KEY (`itemFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON UPDATE CASCADE, CONSTRAINT `orderRow_ibfk_3` FOREIGN KEY (`orderFk`) REFERENCES `order` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=9669013 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=9931230 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 */ ; @@ -68589,7 +69802,7 @@ CREATE TABLE `tpvTransaction` ( CONSTRAINT `receipt_id` FOREIGN KEY (`receiptFk`) REFERENCES `vn2008`.`Recibos` (`Id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `tpvTransaction_ibfk_1` FOREIGN KEY (`clientFk`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) 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=250798 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Transactions realized through the virtual TPV'; +) ENGINE=InnoDB AUTO_INCREMENT=259173 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Transactions realized through the virtual TPV'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -68624,7 +69837,7 @@ CREATE TABLE `visit` ( PRIMARY KEY (`id`), KEY `firstAgent` (`firstAgent`), CONSTRAINT `visit_ibfk_1` FOREIGN KEY (`firstAgent`) REFERENCES `visitAgent` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1401660 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1430848 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -68644,7 +69857,7 @@ CREATE TABLE `visitAccess` ( KEY `visit_access_idx_agent` (`agent`), KEY `stamp` (`stamp`), CONSTRAINT `visitAccess_ibfk_1` FOREIGN KEY (`agent`) REFERENCES `visitAgent` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3090643 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3171448 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -68669,7 +69882,7 @@ CREATE TABLE `visitAgent` ( KEY `firstAccess` (`firstAccess`), CONSTRAINT `visitAgent_ibfk_1` FOREIGN KEY (`visit`) REFERENCES `visit` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `visitAgent_ibfk_2` FOREIGN KEY (`firstAccess`) REFERENCES `visitAccess` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1959831 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1991833 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -68689,7 +69902,7 @@ CREATE TABLE `visitUser` ( KEY `date_time` (`stamp`), KEY `user_id` (`user`), CONSTRAINT `visitUser_ibfk_1` FOREIGN KEY (`access`) REFERENCES `visitAccess` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2899754 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2969076 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -69651,15 +70864,15 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `myTicketGetRows`(`vTicket` INT) -BEGIN - - SELECT r.itemFk, r.quantity, r.concept, r.price, r.discount, - i.image, i.category, i.size, i.stems, i.inkFk, - i.tag5, i.value5, i.tag6, i.value6, i.tag7, i.value7 - FROM myTicketRow r - JOIN vn.item i ON i.id = r.itemFk - WHERE r.ticketFk = vTicket - ORDER BY r.concept; +BEGIN + + SELECT r.itemFk, r.quantity, r.concept, r.price, r.discount, + i.image, i.category, i.size, i.stems, i.inkFk, + i.tag5, i.value5, i.tag6, i.value6, i.tag7, i.value7 + FROM myTicketRow r + JOIN vn.item i ON i.id = r.itemFk + WHERE r.ticketFk = vTicket + ORDER BY r.concept; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -72160,7 +73373,7 @@ USE `vn2008`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `item_entry_in` AS select `t`.`warehouse_id` AS `warehouse_id`,`t`.`landing` AS `dat`,`m`.`Id_Article` AS `item_id`,`m`.`Cantidad` AS `amount`,`t`.`received` AS `received` from ((`Compres` `m` join `Entradas` `e` on((`m`.`Id_Entrada` = `e`.`Id_Entrada`))) join `travel` `t` on((`e`.`travel_id` = `t`.`id`))) where ((`e`.`Inventario` = 0) and (`m`.`Cantidad` <> 0)) */; +/*!50001 VIEW `item_entry_in` AS select `t`.`warehouse_id` AS `warehouse_id`,`t`.`landing` AS `dat`,`m`.`Id_Article` AS `item_id`,`m`.`Cantidad` AS `amount`,`t`.`received` AS `received` from ((`Compres` `m` join `Entradas` `e` on((`m`.`Id_Entrada` = `e`.`Id_Entrada`))) join `travel` `t` on((`e`.`travel_id` = `t`.`id`))) where ((`e`.`Inventario` = 0) and (`e`.`Redada` = 0) and (`m`.`Cantidad` <> 0)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -72196,7 +73409,7 @@ USE `vn2008`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `item_out` AS select `t`.`warehouse_id` AS `warehouse_id`,`t`.`Fecha` AS `dat`,`m`.`Id_Article` AS `item_id`,-(`m`.`Cantidad`) AS `amount`,`m`.`OK` AS `ok`,`m`.`Reservado` AS `Reservado`,(`ts`.`alertLevel` = 3) AS `ready`,`t`.`Factura` AS `invoice`,ifnull(`ts`.`alertLevel`,0) AS `alertLevel` from ((`vn2008`.`Movimientos` `m` join `vn2008`.`Tickets` `t` on((`m`.`Id_Ticket` = `t`.`Id_Ticket`))) left join `vn`.`ticketState` `ts` on((`t`.`Id_Ticket` = `ts`.`ticket`))) where (`m`.`Cantidad` <> 0) */; +/*!50001 VIEW `item_out` AS select `t`.`warehouse_id` AS `warehouse_id`,`t`.`Fecha` AS `dat`,`m`.`Id_Article` AS `item_id`,-(`m`.`Cantidad`) AS `amount`,`m`.`OK` AS `ok`,`m`.`Reservado` AS `Reservado`,`t`.`Factura` AS `invoice`,`m`.`Id_Movimiento` AS `saleFk`,`m`.`Id_Ticket` AS `ticketFk` from (`Movimientos` `m` join `Tickets` `t` on((`m`.`Id_Ticket` = `t`.`Id_Ticket`))) where (`m`.`Cantidad` <> 0) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -73840,7 +75053,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `client` AS select `c`.`id_cliente` AS `id`,`c`.`cliente` AS `name`,`c`.`if` AS `fi`,`c`.`razonSocial` AS `socialName`,`c`.`contacto` AS `contact`,`c`.`domicilio` AS `street`,`c`.`poblacion` AS `city`,`c`.`codPostal` AS `postcode`,`c`.`telefono` AS `phone`,`c`.`movil` AS `mobile`,`c`.`fax` AS `fax`,`c`.`real` AS `isRelevant`,`c`.`e-mail` AS `email`,`c`.`iban` AS `iban`,`c`.`vencimiento` AS `dueDay`,`c`.`Cuenta` AS `accountingAccount`,`c`.`RE` AS `isEqualizated`,`c`.`province_id` AS `provinceFk`,`c`.`invoice` AS `hasToInvoice`,`c`.`credito` AS `credit`,`c`.`Id_Pais` AS `countryFk`,`c`.`activo` AS `isActive`,`c`.`gestdoc_id` AS `gestdocFk`,`c`.`calidad` AS `quality`,`c`.`pay_met_id` AS `payMethodFk`,`c`.`created` AS `created`,`c`.`mail` AS `isToBeMailed`,`c`.`chanel_id` AS `contactChannelFk`,`c`.`sepaVnl` AS `hasSepaVnl`,`c`.`coreVnl` AS `hasCoreVnl`,`c`.`coreVnh` AS `hasCoreVnh`,`c`.`hasLcr` AS `hasLcr`,`c`.`default_address` AS `defaultAddressFk`,`c`.`risk_calculated` AS `riskCalculated`,`c`.`clientes_tipo_id` AS `clientTypeFk`,`c`.`mail_address` AS `mailAddress`,`c`.`cplusTerIdNifFk` AS `cplusTerIdNifFk`,`c`.`invoiceByAddress` AS `hasToInvoiceByAddress`,`c`.`contabilizado` AS `isTaxDataChecked`,`c`.`congelado` AS `isFreezed`,`c`.`creditInsurance` AS `creditInsurance`,`c`.`isCreatedAsServed` AS `isCreatedAsServed`,`c`.`hasInvoiceSimplified` AS `hasInvoiceSimplified`,`c`.`Id_Trabajador` AS `salesPersonFk`,`c`.`vies` AS `isVies`,`c`.`EYPBC` AS `eypbc` from `vn2008`.`Clientes` `c` */; +/*!50001 VIEW `client` AS select `c`.`id_cliente` AS `id`,`c`.`cliente` AS `name`,`c`.`if` AS `fi`,`c`.`razonSocial` AS `socialName`,`c`.`contacto` AS `contact`,`c`.`domicilio` AS `street`,`c`.`poblacion` AS `city`,`c`.`codPostal` AS `postcode`,`c`.`telefono` AS `phone`,`c`.`movil` AS `mobile`,`c`.`fax` AS `fax`,`c`.`real` AS `isRelevant`,`c`.`e-mail` AS `email`,`c`.`iban` AS `iban`,`c`.`vencimiento` AS `dueDay`,`c`.`Cuenta` AS `accountingAccount`,`c`.`RE` AS `isEqualizated`,`c`.`province_id` AS `provinceFk`,`c`.`invoice` AS `hasToInvoice`,`c`.`credito` AS `credit`,`c`.`Id_Pais` AS `countryFk`,`c`.`activo` AS `isActive`,`c`.`gestdoc_id` AS `gestdocFk`,`c`.`calidad` AS `quality`,`c`.`pay_met_id` AS `payMethodFk`,`c`.`created` AS `created`,`c`.`mail` AS `isToBeMailed`,`c`.`chanel_id` AS `contactChannelFk`,`c`.`sepaVnl` AS `hasSepaVnl`,`c`.`coreVnl` AS `hasCoreVnl`,`c`.`coreVnh` AS `hasCoreVnh`,`c`.`hasLcr` AS `hasLcr`,`c`.`default_address` AS `defaultAddressFk`,`c`.`risk_calculated` AS `riskCalculated`,`c`.`clientes_tipo_id` AS `clientTypeFk`,`c`.`mail_address` AS `mailAddress`,`c`.`cplusTerIdNifFk` AS `cplusTerIdNifFk`,`c`.`invoiceByAddress` AS `hasToInvoiceByAddress`,`c`.`contabilizado` AS `isTaxDataChecked`,`c`.`congelado` AS `isFreezed`,`c`.`creditInsurance` AS `creditInsurance`,`c`.`isCreatedAsServed` AS `isCreatedAsServed`,`c`.`hasInvoiceSimplified` AS `hasInvoiceSimplified`,`c`.`Id_Trabajador` AS `salesPersonFk`,`c`.`vies` AS `isVies`,`c`.`EYPBC` AS `eypbc`,`c`.`bankEntityFk` AS `bankEntityFk` from `vn2008`.`Clientes` `c` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -73917,6 +75130,24 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `clientRisk` +-- + +/*!50001 DROP VIEW IF EXISTS `clientRisk`*/; +/*!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 `clientRisk` AS select `c`.`customer_id` AS `clientFk`,`c`.`company_id` AS `companyFk`,`c`.`amount` AS `amount` from `bi`.`customer_risk` `c` */; +/*!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 `clientSample` -- @@ -74169,6 +75400,24 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `defaulter` +-- + +/*!50001 DROP VIEW IF EXISTS `defaulter`*/; +/*!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 `defaulter` AS select `d`.`client` AS `clientFk`,`d`.`date` AS `created`,`d`.`amount` AS `amount`,`d`.`defaulterSince` AS `defaulterSinced`,`d`.`hasChanged` AS `hasChanged` from `bi`.`defaulters` `d` */; +/*!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 `deliveryMethod` -- @@ -74884,7 +76133,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemCategory` AS select `r`.`id` AS `id`,`r`.`reino` AS `name`,`r`.`display` AS `display`,`r`.`color` AS `color`,`r`.`icon` AS `icon` from `vn2008`.`reinos` `r` */; +/*!50001 VIEW `itemCategory` AS select `r`.`id` AS `id`,`r`.`reino` AS `name`,`r`.`display` AS `display`,`r`.`color` AS `color`,`r`.`icon` AS `icon`,`r`.`mercancia` AS `merchandise` from `vn2008`.`reinos` `r` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -74938,7 +76187,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingAvailable` AS select `s`.`id` AS `saleFk`,`tst`.`updated` AS `Modificado`,`s`.`ticketFk` AS `ticketFk`,`s`.`isPicked` AS `isPicked`,`s`.`itemFk` AS `itemFk`,`s`.`quantity` AS `quantity`,`s`.`concept` AS `concept`,`i`.`size` AS `size`,`st`.`name` AS `Estado`,`st`.`sectorProdPriority` AS `sectorProdPriority`,`its`.`available` AS `available`,`pk`.`sectorFk` AS `sectorFk`,`sh`.`code` AS `matricula`,`pk`.`id` AS `parking`,`its`.`id` AS `itemShelving`,`am`.`name` AS `Agency`,`t`.`shipped` AS `shipped`,`its`.`grouping` AS `grouping` from (((((((((`vn`.`sale` `s` join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `vn`.`agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) join `vn`.`ticketStateToday` `tst` on((`tst`.`ticket` = `t`.`id`))) join `vn`.`state` `st` on((`st`.`id` = `tst`.`state`))) join `vn`.`item` `i` on((`i`.`id` = `s`.`itemFk`))) join `vn`.`itemShelving` `its` on((`its`.`itemFk` = `s`.`itemFk`))) join `vn`.`shelving` `sh` on((`sh`.`code` = `its`.`shelvingFk`))) join `vn`.`parking` `pk` on((`pk`.`id` = `sh`.`parkingFk`))) join `vn`.`sector` `sc` on(((`sc`.`id` = `pk`.`sectorFk`) and (`sc`.`warehouseFk` = `t`.`warehouseFk`)))) where ((`t`.`shipped` between `util`.`yesterday`() and `util`.`dayend`(curdate())) and (`its`.`available` > 0) and (`its`.`grouping` <= `s`.`quantity`) and `st`.`sectorProdPriority`) */; +/*!50001 VIEW `itemShelvingAvailable` AS select `s`.`id` AS `saleFk`,`tst`.`updated` AS `Modificado`,`s`.`ticketFk` AS `ticketFk`,`s`.`isPicked` AS `isPicked`,`s`.`itemFk` AS `itemFk`,`s`.`quantity` AS `quantity`,`s`.`concept` AS `concept`,`i`.`size` AS `size`,`st`.`name` AS `Estado`,`st`.`sectorProdPriority` AS `sectorProdPriority`,`its`.`available` AS `available`,`pk`.`sectorFk` AS `sectorFk`,`sh`.`code` AS `matricula`,`pk`.`id` AS `parking`,`its`.`id` AS `itemShelving`,`am`.`name` AS `Agency`,`t`.`shipped` AS `shipped`,`its`.`grouping` AS `grouping`,`its`.`packing` AS `packing` from (((((((((`vn`.`sale` `s` join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `vn`.`agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) join `vn`.`ticketStateToday` `tst` on((`tst`.`ticket` = `t`.`id`))) join `vn`.`state` `st` on((`st`.`id` = `tst`.`state`))) join `vn`.`item` `i` on((`i`.`id` = `s`.`itemFk`))) join `vn`.`itemShelving` `its` on((`its`.`itemFk` = `s`.`itemFk`))) join `vn`.`shelving` `sh` on((`sh`.`code` = `its`.`shelvingFk`))) join `vn`.`parking` `pk` on((`pk`.`id` = `sh`.`parkingFk`))) join `vn`.`sector` `sc` on(((`sc`.`id` = `pk`.`sectorFk`) and (`sc`.`warehouseFk` = `t`.`warehouseFk`)))) where ((`t`.`shipped` between `util`.`yesterday`() and `util`.`dayend`(curdate())) and (`its`.`available` > 0) and (`sh`.`code` <> 'FUE') and (`its`.`grouping` <= `s`.`quantity`) and `st`.`sectorProdPriority`) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -74956,7 +76205,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingStock` AS select `ish`.`itemFk` AS `itemFk`,sum(`ish`.`visible`) AS `visible`,`ish`.`packing` AS `packing` from (((`itemShelving` `ish` join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) join `sector` `s` on((`s`.`id` = `p`.`sectorFk`))) where (`s`.`warehouseFk` = 1) group by `ish`.`itemFk` */; +/*!50001 VIEW `itemShelvingStock` AS select `ish`.`itemFk` AS `itemFk`,sum(`ish`.`visible`) AS `visible`,min(`ish`.`packing`) AS `packing` from (((`itemShelving` `ish` join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) join `sector` `s` on((`s`.`id` = `p`.`sectorFk`))) where (`s`.`warehouseFk` = 1) group by `ish`.`itemFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -75045,7 +76294,7 @@ USE `vn`; /*!50001 SET character_set_results = utf8 */; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50013 DEFINER=`z-developer`@`%` SQL SECURITY DEFINER */ /*!50001 VIEW `kingdom` AS select `vn2008`.`reinos`.`id` AS `id`,`vn2008`.`reinos`.`reino` AS `kingdom`,`vn2008`.`reinos`.`orden` AS `order`,`vn2008`.`reinos`.`display` AS `display`,`vn2008`.`reinos`.`color` AS `color`,`vn2008`.`reinos`.`efimero` AS `shortLife`,`vn2008`.`reinos`.`mercancia` AS `merchandise`,`vn2008`.`reinos`.`icon` AS `icon` from `vn2008`.`reinos` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -75951,6 +77200,24 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `ticketDownBuffer` +-- + +/*!50001 DROP VIEW IF EXISTS `ticketDownBuffer`*/; +/*!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 `ticketDownBuffer` AS select `td`.`ticketFk` AS `ticketFk`,`td`.`created` AS `created`,`td`.`selected` AS `selected`,concat(`tr`.`Nombre`,' ',`tr`.`Apellidos`) AS `sacador`,`pk`.`code` AS `parking` from ((((`vn`.`ticketDown` `td` left join `vn`.`shelving` `s` on((`s`.`code` = `td`.`ticketFk`))) left join `vn`.`parking` `pk` on((`s`.`parkingFk` = `pk`.`id`))) join `vn`.`ticketStateToday` `tst` on((`tst`.`ticket` = `td`.`ticketFk`))) join `vn2008`.`Trabajadores` `tr` on((`tr`.`Id_Trabajador` = `tst`.`worker`))) where (`td`.`selected` = 2) */; +/*!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 `ticketNotInvoiced` -- @@ -77117,4 +78384,4 @@ USE `stock`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-10-01 12:33:43 +-- Dump completed on 2018-10-25 9:08:02