diff --git a/back/methods/message/send.js b/back/methods/message/send.js index 3b2ab1f16..dfdf1e8dc 100644 --- a/back/methods/message/send.js +++ b/back/methods/message/send.js @@ -26,7 +26,7 @@ module.exports = Self => { }); Self.send = async(ctx, data, transaction) => { - const userId = ctx.req.accessToken.userId; + const userId = ctx.options && ctx.options.accessToken.userId || ctx.req && ctx.req.accessToken.userId; const models = Self.app.models; const sender = await models.Account.findById(userId, transaction); const recipient = await models.Account.findById(data.recipientFk, transaction); diff --git a/back/models/account.json b/back/models/account.json index 89b1f42c5..c3b8c38d7 100644 --- a/back/models/account.json +++ b/back/models/account.json @@ -1,72 +1,74 @@ { - "name": "Account", - "base": "VnModel", - "options": { - "mysql": { - "table": "account.user" - } - }, - "properties": { - "id": { - "type": "number", - "required": true - }, - "name": { - "type": "string", - "required": true - }, - "roleFk": { - "type": "number", - "mysql": { - "columnName": "role" - } - }, - "nickname": { - "type": "string" - }, - "password": { - "type": "string", - "required": true - }, - "active": { - "type": "boolean" - }, - "email": { - "type": "string" - }, - "created": { - "type": "date" - }, - "updated": { - "type": "date" - } - }, - "relations": { - "role": { - "type": "belongsTo", - "model": "Role", - "foreignKey": "roleFk" - } - }, - "acls": [ - { - "property": "login", - "accessType": "EXECUTE", - "principalType": "ROLE", - "principalId": "$everyone", - "permission": "ALLOW" - }, { - "property": "logout", - "accessType": "EXECUTE", - "principalType": "ROLE", - "principalId": "$authenticated", - "permission": "ALLOW" - }, { - "property": "validateToken", - "accessType": "EXECUTE", - "principalType": "ROLE", - "principalId": "$authenticated", - "permission": "ALLOW" - } - ] + "name": "Account", + "base": "VnModel", + "options": { + "mysql": { + "table": "account.user" + } + }, + "properties": { + "id": { + "type": "number", + "required": true + }, + "name": { + "type": "string", + "required": true + }, + "roleFk": { + "type": "number", + "mysql": { + "columnName": "role" + } + }, + "nickname": { + "type": "string" + }, + "password": { + "type": "string", + "required": true + }, + "active": { + "type": "boolean" + }, + "email": { + "type": "string" + }, + "created": { + "type": "date" + }, + "updated": { + "type": "date" + } + }, + "relations": { + "role": { + "type": "belongsTo", + "model": "Role", + "foreignKey": "roleFk" + } + }, + "acls": [ + { + "property": "login", + "accessType": "EXECUTE", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + }, + { + "property": "logout", + "accessType": "EXECUTE", + "principalType": "ROLE", + "principalId": "$authenticated", + "permission": "ALLOW" + }, + { + "property": "validateToken", + "accessType": "EXECUTE", + "principalType": "ROLE", + "principalId": "$authenticated", + "permission": "ALLOW" + } + ] } diff --git a/services/db/.gitignore b/db/.gitignore similarity index 100% rename from services/db/.gitignore rename to db/.gitignore diff --git a/services/db/Dockerfile b/db/Dockerfile similarity index 100% rename from services/db/Dockerfile rename to db/Dockerfile diff --git a/db/connect.tpl.ini b/db/connect.tpl.ini new file mode 100644 index 000000000..2db13e969 --- /dev/null +++ b/db/connect.tpl.ini @@ -0,0 +1,7 @@ +[client] +enable_cleartext_plugin = ON +host = localhost +port = 3306 +user = root +password = password +ssl-mode = DISABLED diff --git a/services/db/docker-start.sh b/db/docker-start.sh similarity index 100% rename from services/db/docker-start.sh rename to db/docker-start.sh diff --git a/services/db/export-data.sh b/db/export-data.sh similarity index 95% rename from services/db/export-data.sh rename to db/export-data.sh index 4e1f049d5..aa3000d9d 100755 --- a/services/db/export-data.sh +++ b/db/export-data.sh @@ -1,5 +1,4 @@ #!/bin/bash -#IMPORTANT Any changes in this file are to applyed to mirror file export-data.cmd 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 diff --git a/services/db/export-structure.sh b/db/export-structure.sh similarity index 100% rename from services/db/export-structure.sh rename to db/export-structure.sh diff --git a/services/db/import-changes.js b/db/import-changes.js similarity index 100% rename from services/db/import-changes.js rename to db/import-changes.js diff --git a/services/db/import-fixtures.js b/db/import-fixtures.js similarity index 100% rename from services/db/import-fixtures.js rename to db/import-fixtures.js diff --git a/services/db/install/boot.sh b/db/install/boot.sh similarity index 95% rename from services/db/install/boot.sh rename to db/install/boot.sh index 70704c48e..02727e089 100755 --- a/services/db/install/boot.sh +++ b/db/install/boot.sh @@ -10,7 +10,7 @@ echo "[INFO] -> Imported ./dump/mysqlPlugins.sql" mysql -u root -f < ./dump/mysqlPlugins.sql # Import changes -for file in changes/*/*.sql; do +for file in changes/*.sql; do echo "[INFO] -> Imported ./$file" mysql -u root -fc < $file done diff --git a/db/install/changes/1-orderGetTotal.sql b/db/install/changes/1-orderGetTotal.sql new file mode 100644 index 000000000..dbbc990f2 --- /dev/null +++ b/db/install/changes/1-orderGetTotal.sql @@ -0,0 +1,29 @@ +USE `hedera`; +DROP procedure IF EXISTS `orderGetTotal`; + +DELIMITER $$ +USE `hedera`$$ + +CREATE DEFINER=`root`@`%` PROCEDURE `orderGetTotal`() +BEGIN +/** +* Calcula el total con IVA para un conjunto de orders. +* +* @table tmp.order(orderFk) Identificadores de las ordenes a calcular +* @return tmp.orderTotal Total para cada order +*/ +CALL orderGetTax; + +DROP TEMPORARY TABLE IF EXISTS tmp.orderTotal; +CREATE TEMPORARY TABLE tmp.orderTotal +(INDEX (orderFk)) +ENGINE = MEMORY +SELECT o.orderFk, IFNULL(SUM(ot.taxableBase + ot.tax), 0.0) AS total +FROM tmp.order o +LEFT JOIN tmp.orderAmount ot ON o.orderFk = ot.orderFk +GROUP BY orderFk; + +DROP TEMPORARY TABLE IF EXISTS tmp.orderTax; +END$$ + +DELIMITER ; diff --git a/db/install/changes/10-ticketGetVisibleAvailable.sql b/db/install/changes/10-ticketGetVisibleAvailable.sql new file mode 100644 index 000000000..3d49d98d4 --- /dev/null +++ b/db/install/changes/10-ticketGetVisibleAvailable.sql @@ -0,0 +1,36 @@ +DROP PROCEDURE IF EXISTS vn.ticketGetVisibleAvailable; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`ticketGetVisibleAvailable`( + vTicket INT) +BEGIN + DECLARE vVisibleCalc INT; + DECLARE vAvailableCalc INT; + DECLARE vShipped DATE; + DECLARE vWarehouse TINYINT; + DECLARE vAlertLevel INT; + + SELECT t.warehouseFk, t.shipped, ts.alertLevel INTO vWarehouse, vShipped, vAlertLevel + FROM ticket t + LEFT JOIN ticketState ts ON ts.ticketFk = vTicket + WHERE t.id = vTicket; + + IF vAlertLevel IS NULL OR vAlertLevel = 0 THEN + IF vShipped >= CURDATE() THEN + CALL cache.available_refresh(vAvailableCalc, FALSE, vWarehouse, vShipped); + END IF; + IF vShipped = CURDATE() THEN + CALL cache.visible_refresh(vVisibleCalc, FALSE, vWarehouse); + END IF; + END IF; + + SELECT s.id, s.itemFk, s.quantity, s.concept, s.price, s.reserved, s.discount, v.visible, av.available, it.image + FROM sale s + LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCalc + LEFT JOIN cache.available av ON av.item_id = s.itemFk AND av.calc_id = vAvailableCalc + LEFT JOIN item it ON it.id = s.itemFk + WHERE s.ticketFk = vTicket + ORDER BY s.concept; +END$$ +DELIMITER ; diff --git a/db/install/changes/2-orderGetTotal.sql b/db/install/changes/2-orderGetTotal.sql new file mode 100644 index 000000000..dac65bbca --- /dev/null +++ b/db/install/changes/2-orderGetTotal.sql @@ -0,0 +1,36 @@ +USE `hedera`; +DROP FUNCTION IF EXISTS `orderGetTotal`; + +DELIMITER $$ +USE `hedera`$$ + +CREATE DEFINER=`root`@`%` FUNCTION `orderGetTotal`(vOrder INT) RETURNS decimal(10,2) +READS SQL DATA +DETERMINISTIC +BEGIN +/** +* Obtiene el total de un pedido con el IVA y el recargo de +* equivalencia incluidos. +* +* @param vOrder El identificador del pedido +* @return El total del pedido +*/ +DECLARE vTotal DECIMAL(10,2); + +DROP TEMPORARY TABLE IF EXISTS tmp.order; +CREATE TEMPORARY TABLE tmp.order +ENGINE = MEMORY +SELECT vOrder orderFk; + +CALL orderGetTotal; + +SELECT total INTO vTotal FROM tmp.orderTotal; + +DROP TEMPORARY TABLE +tmp.order, +tmp.orderTotal; + +RETURN vTotal; +END$$ + +DELIMITER ; diff --git a/db/install/changes/3-orderGetTax.sql b/db/install/changes/3-orderGetTax.sql new file mode 100644 index 000000000..e9ed5a339 --- /dev/null +++ b/db/install/changes/3-orderGetTax.sql @@ -0,0 +1,65 @@ +USE `hedera`; +DROP procedure IF EXISTS `orderGetTax`; + +DELIMITER $$ +USE `hedera`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `orderGetTax`() + READS SQL DATA +BEGIN +/** + * Calcula el IVA, y el recargo de equivalencia de un pedido + * desglosados por tipos. + * + * @param vOrder El identificador del pedido + * @treturn tmp.orderTax Bases imponibles, IVA y recargo de equivalencia + */ + DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; + CREATE TEMPORARY TABLE tmp.addressCompany + (INDEX (addressFk, companyFk)) + ENGINE = MEMORY + SELECT DISTINCT o.address_id addressFk, o.company_id companyFk + FROM tmp.order tmpOrder + JOIN hedera.order o ON o.id = tmpOrder.orderFk; + + CALL vn.addressTaxArea (); + + -- Calcula el IVA y el recargo desglosado. + DROP TEMPORARY TABLE IF EXISTS tmp.orderTax; + CREATE TEMPORARY TABLE tmp.orderTax + (INDEX (orderFk)) + ENGINE = MEMORY + SELECT o.id orderFk, + tc.code, + SUM(m.amount * m.price) taxableBase, + pgc.rate + FROM tmp.order tmpOrder + JOIN `order` o ON o.id = tmpOrder.orderFk + JOIN orderRow m ON m.orderFk = o.id + JOIN vn.item i ON i.id = m.itemFk + JOIN vn.client c ON c.id = o.customer_id + JOIN vn.supplier s ON s.id = o.company_id + JOIN tmp.addressTaxArea ata + ON ata.addressFk = o.address_id AND ata.companyFk = o.company_id + JOIN vn.itemTaxCountry itc + ON itc.itemFk = i.id AND itc.countryFk = s.countryFk + JOIN vn.bookingPlanner bp + ON bp.countryFk = s.countryFk + AND bp.taxAreaFk = ata.areaFk + AND bp.taxClassFk = itc.taxClassFk + JOIN vn.pgc ON pgc.code = bp.pgcFk + JOIN vn.taxClass tc ON tc.id = bp.taxClassFk + GROUP BY tmpOrder.orderFk, pgc.code,pgc.rate + HAVING taxableBase != 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.orderAmount; + CREATE TEMPORARY TABLE tmp.orderAmount + (INDEX (orderFk)) + ENGINE = MEMORY + SELECT orderFk, taxableBase, SUM(CAST(taxableBase * rate / 100 AS DECIMAL(10, 2))) tax,code + FROM tmp.orderTax + GROUP BY orderFk, code; + +END$$ + +DELIMITER ; + diff --git a/db/install/changes/4-addressAfterUpdate.sql b/db/install/changes/4-addressAfterUpdate.sql new file mode 100644 index 000000000..721dda28f --- /dev/null +++ b/db/install/changes/4-addressAfterUpdate.sql @@ -0,0 +1,34 @@ +/* Añadir a producción cuando se suba salix */ + +DROP TRIGGER IF EXISTS vn2008.ConsignatariosAfterUpdate; +USE vn2008; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`ConsignatariosAfterUpdate` AFTER UPDATE ON `Consignatarios` FOR EACH ROW +BEGIN + + -- Recargos de equivalencia distintos implican facturacion por consignatario + IF NEW.isEqualizated != OLD.isEqualizated THEN + + IF + (SELECT COUNT(*) FROM + ( + SELECT DISTINCT (isEqualizated = FALSE) as Equ + FROM Consignatarios + WHERE Id_Cliente = NEW.Id_Cliente + ) t1 + ) > 1 + + THEN + + UPDATE Clientes + SET invoiceByAddress = TRUE + WHERE Id_Cliente = NEW.Id_Cliente; + + END IF; + + END IF; +END$$ +DELIMITER ; +USE vn; diff --git a/db/install/changes/5-addressBeforeInsert.sql b/db/install/changes/5-addressBeforeInsert.sql new file mode 100644 index 000000000..4a3b3afb2 --- /dev/null +++ b/db/install/changes/5-addressBeforeInsert.sql @@ -0,0 +1,27 @@ +/* Añadir a producción cuando se suba salix */ + +DROP TRIGGER IF EXISTS vn2008.ConsignatariosBeforeInsert; +USE vn2008; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`ConsignatariosBeforeInsert` +BEFORE INSERT ON `vn2008`.`Consignatarios` +FOR EACH ROW +BEGIN + DECLARE vIsEqualizated BOOLEAN; + + CALL pbx.phoneIsValid (NEW.telefono); + CALL pbx.phoneIsValid (NEW.movil); + + IF NEW.isEqualizated IS NULL THEN + SELECT RE + INTO vIsEqualizated + FROM Clientes + WHERE Id_Cliente = NEW.Id_Cliente; + + SET NEW.isEqualizated = vIsEqualizated; + END IF; +END$$ +DELIMITER ; +USE vn; diff --git a/db/install/changes/6-addressBeforeUpdate.sql b/db/install/changes/6-addressBeforeUpdate.sql new file mode 100644 index 000000000..2e44dbd77 --- /dev/null +++ b/db/install/changes/6-addressBeforeUpdate.sql @@ -0,0 +1,16 @@ +/* Añadir a producción cuando se suba salix */ + +DROP TRIGGER IF EXISTS vn2008.ConsignatariosBeforeUpdate; +USE vn2008; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`ConsignatariosBeforeUpdate` +BEFORE UPDATE ON `vn2008`.`Consignatarios` +FOR EACH ROW +BEGIN + CALL pbx.phoneIsValid (NEW.telefono); + CALL pbx.phoneIsValid (NEW.movil); +END$$ +DELIMITER ; +USE vn; diff --git a/db/install/changes/7-clientAfterInsert.sql b/db/install/changes/7-clientAfterInsert.sql new file mode 100644 index 000000000..2c9033b31 --- /dev/null +++ b/db/install/changes/7-clientAfterInsert.sql @@ -0,0 +1,3 @@ +/* Añadir a producción cuando se suba salix */ + +DROP TRIGGER vn2008.ClientesAfterInsert; diff --git a/db/install/changes/8-clientAfterUpdate.sql b/db/install/changes/8-clientAfterUpdate.sql new file mode 100644 index 000000000..cfbd145da --- /dev/null +++ b/db/install/changes/8-clientAfterUpdate.sql @@ -0,0 +1,19 @@ +/* Añadir a producción cuando se suba salix */ +DROP TRIGGER IF EXISTS vn2008.ClientesAfterUpdate; +USE vn2008; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`ClientesAfterUpdate` +AFTER UPDATE ON `Clientes` +FOR EACH ROW +BEGIN + IF NEW.default_address AND (NEW.default_address != OLD.default_address) THEN + UPDATE Consignatarios SET predeterminada = FALSE + WHERE Id_cliente = NEW.Id_cliente; + + + END IF; +END$$ +DELIMITER ; +USE vn; diff --git a/db/install/changes/9-migrateDefaultAddress.sql b/db/install/changes/9-migrateDefaultAddress.sql new file mode 100644 index 000000000..019c1067f --- /dev/null +++ b/db/install/changes/9-migrateDefaultAddress.sql @@ -0,0 +1,9 @@ +/* Script de migración consignatarios. + Añadir a producción cuando se suba salix */ + +/* USE vn; + +UPDATE vn.client c + JOIN vn.address a ON a.clientFk = c.id AND a.isDefaultAddress +SET c.defaultAddressFk = a.id +WHERE c.defaultAddressFk IS NULL */ \ No newline at end of file diff --git a/services/db/install/dump/dumpedFixtures.sql b/db/install/dump/dumpedFixtures.sql similarity index 98% rename from services/db/install/dump/dumpedFixtures.sql rename to db/install/dump/dumpedFixtures.sql index ca4e18e4e..9eb199ce7 100644 --- a/services/db/install/dump/dumpedFixtures.sql +++ b/db/install/dump/dumpedFixtures.sql @@ -1,7 +1,7 @@ USE `account`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- --- Host: db.verdnatura.es Database: account +-- Host: test-db.verdnatura.es Database: account -- ------------------------------------------------------ -- Server version 5.6.25-4-log @@ -55,11 +55,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-02-11 7:09:43 +-- Dump completed on 2019-03-01 13:31:23 USE `salix`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- --- Host: db.verdnatura.es Database: salix +-- Host: test-db.verdnatura.es Database: salix -- ------------------------------------------------------ -- Server version 5.6.25-4-log @@ -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'),(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'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','employee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(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'),(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','*','WRITE','ALLOW','ROLE','deliveryBoss'),(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'),(94,'Agency','landsThatDay','*','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'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','salesPerson'),(123,'Worker','*','READ','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','employee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','employee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(134,'Zone','*','READ','ALLOW','ROLE','employee'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','WRITE','ALLOW','ROLE','deliveryBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','WRITE','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'); +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'),(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'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','employee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(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'),(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','*','WRITE','ALLOW','ROLE','deliveryBoss'),(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'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','salesAssistant'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','employee'),(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'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','salesPerson'),(123,'Worker','*','READ','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','employee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','employee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','WRITE','ALLOW','ROLE','deliveryBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','*','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'),(147,'UserConfigView','*','*','ALLOW','ROLE','employee'),(148,'UserConfigView','*','*','ALLOW','ROLE','employee'); /*!40000 ALTER TABLE `ACL` ENABLE KEYS */; UNLOCK TABLES; @@ -103,11 +103,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-02-11 7:09:43 +-- Dump completed on 2019-03-01 13:31:23 USE `vn`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- --- Host: db.verdnatura.es Database: vn +-- Host: test-db.verdnatura.es Database: vn -- ------------------------------------------------------ -- Server version 5.6.25-4-log @@ -178,7 +178,7 @@ UNLOCK TABLES; LOCK TABLES `tag` WRITE; /*!40000 ALTER TABLE `tag` DISABLE KEYS */; -INSERT INTO `tag` VALUES (1,'Color',0,0,'ink',NULL),(2,'Forma',1,0,NULL,NULL),(3,'Material',1,0,NULL,NULL),(4,'Longitud',1,1,NULL,NULL),(5,'Diámetro',1,1,NULL,'mm'),(6,'Perímetro',1,1,NULL,'mm'),(7,'Ancho de la base',1,1,NULL,'mm'),(8,'Altura',1,1,NULL,'mm'),(9,'Volumen',1,1,NULL,'ml'),(10,'Densidad',1,1,NULL,NULL),(11,'Calidad',1,0,NULL,NULL),(12,'Textura',1,0,NULL,NULL),(13,'Material del mango',1,0,NULL,NULL),(14,'Compra mínima',1,1,NULL,NULL),(15,'Nº pétalos',1,1,NULL,NULL),(16,'Ancho',1,1,NULL,'mm'),(17,'Alto',1,1,NULL,'mm'),(18,'Profundidad',1,1,NULL,'mm'),(19,'Largo',1,1,NULL,'mm'),(20,'Ancho superior',1,1,NULL,'mm'),(21,'Ancho inferior',1,1,NULL,'mm'),(22,'Gramaje',1,0,NULL,'g'),(23,'Tallos',1,1,NULL,NULL),(24,'Estado',0,0,NULL,NULL),(25,'Color principal',0,0,NULL,NULL),(26,'Color secundario',0,0,NULL,NULL),(27,'Longitud(cm)',1,1,NULL,'cm'),(28,'Diámetro base',1,1,NULL,NULL),(29,'Colección',1,0,NULL,NULL),(30,'Uds / caja',1,1,NULL,NULL),(31,'Contenido',1,0,NULL,NULL),(32,'Peso',1,1,NULL,'g'),(33,'Grosor',1,1,NULL,'mm'),(34,'Marca',1,0,NULL,NULL),(35,'Origen',0,0,'origin',NULL),(36,'Proveedor',1,0,NULL,NULL),(37,'Productor',1,0,'producer',NULL),(38,'Duración',1,1,NULL,'s'),(39,'Flor',1,0,NULL,NULL),(40,'Soporte',1,0,NULL,NULL),(41,'Tamaño flor',1,1,NULL,NULL),(42,'Apertura',1,1,NULL,NULL),(43,'Tallo',0,1,NULL,NULL),(44,'Numero hojas',1,1,NULL,NULL),(45,'Dimensiones',1,1,NULL,NULL),(46,'Diámetro boca',1,1,NULL,NULL),(47,'Nº flores',1,1,NULL,NULL),(48,'Uds / paquete',1,1,NULL,NULL),(49,'Maceta',1,1,NULL,NULL),(50,'Textura flor',1,1,NULL,NULL),(51,'Textura hoja',1,1,NULL,NULL),(52,'Tipo de iva',1,1,NULL,NULL),(53,'Tronco',1,1,NULL,NULL),(54,'Hoja',1,1,NULL,NULL),(55,'Formato',1,1,NULL,NULL),(56,'Genero',1,1,NULL,NULL),(57,'Especie',1,1,NULL,NULL),(58,'Variedad',1,1,NULL,NULL),(59,'Medida grande',1,0,NULL,NULL),(60,'Medida mediano',1,0,NULL,NULL),(61,'Medida pequeño',1,0,NULL,NULL),(62,'Medida pequeño',1,0,NULL,NULL),(63,'Recipiente interior',1,1,NULL,NULL),(64,'Material secundario',1,1,NULL,NULL),(65,'Colores',1,1,NULL,NULL),(66,'Referencia',1,1,NULL,NULL),(67,'Categoria',1,0,NULL,NULL),(68,'Amb',0,1,NULL,NULL),(69,'Anchura',1,1,NULL,'cm'),(70,'Hueco interior',-1,1,NULL,NULL),(71,'Tamaño',1,1,NULL,NULL),(72,'Color botón',1,1,NULL,NULL),(73,'Tamaño minimo del botón',1,1,NULL,NULL),(74,'Obtentor',1,1,NULL,NULL),(75,'Logitud del brote',1,1,NULL,NULL),(76,'Tallos / u.v.',1,1,NULL,NULL),(77,'Madera de',1,1,NULL,NULL),(78,'Unidad de venta',1,1,NULL,NULL),(79,'Temporal',1,1,NULL,NULL),(80,'Gramaje/tallo',1,1,NULL,NULL),(81,'Peso/paquete',1,1,NULL,NULL),(82,'Flexibilidad del tallo',1,1,NULL,NULL),(83,'Nº planchas',1,1,NULL,NULL),(84,'Nº páginas',1,1,NULL,NULL),(85,'Editorial',1,1,NULL,NULL),(86,'Idioma',1,1,NULL,NULL),(87,'Fecha publicación',1,1,NULL,NULL),(88,'Cubierta',1,1,NULL,NULL),(89,'Encuadernación',1,1,NULL,NULL),(90,'Autor',1,1,NULL,NULL),(91,'Envoltorio',1,1,NULL,NULL),(92,'Nombre temporal',1,1,NULL,NULL),(93,'Modelo',1,1,NULL,NULL),(94,'Producto',1,1,NULL,NULL),(95,'Título',1,1,NULL,NULL),(96,'Tomo',1,1,NULL,NULL),(97,'Articulo',1,1,NULL,NULL),(98,'Metodo de cultivo',1,1,NULL,NULL),(99,'Edad',1,1,NULL,NULL),(100,'Agotado',1,1,NULL,NULL); +INSERT INTO `tag` VALUES (1,'Color',0,0,'ink',NULL,NULL),(2,'Forma',1,0,NULL,NULL,NULL),(3,'Material',1,0,NULL,NULL,NULL),(4,'Longitud',1,1,NULL,NULL,NULL),(5,'Diámetro',1,1,NULL,'mm',NULL),(6,'Perímetro',1,1,NULL,'mm',NULL),(7,'Ancho de la base',1,1,NULL,'mm',NULL),(8,'Altura',1,1,NULL,'mm',NULL),(9,'Volumen',1,1,NULL,'ml',NULL),(10,'Densidad',1,1,NULL,NULL,NULL),(11,'Calidad',1,0,NULL,NULL,NULL),(12,'Textura',1,0,NULL,NULL,NULL),(13,'Material del mango',1,0,NULL,NULL,NULL),(14,'Compra mínima',1,1,NULL,NULL,NULL),(15,'Nº pétalos',1,1,NULL,NULL,NULL),(16,'Ancho',1,1,NULL,'mm',NULL),(17,'Alto',1,1,NULL,'mm',NULL),(18,'Profundidad',1,1,NULL,'mm',NULL),(19,'Largo',1,1,NULL,'mm',NULL),(20,'Ancho superior',1,1,NULL,'mm',NULL),(21,'Ancho inferior',1,1,NULL,'mm',NULL),(22,'Gramaje',1,0,NULL,'g',NULL),(23,'Tallos',1,1,NULL,NULL,NULL),(24,'Estado',0,0,NULL,NULL,NULL),(25,'Color principal',0,0,NULL,NULL,NULL),(26,'Color secundario',0,0,NULL,NULL,NULL),(27,'Longitud(cm)',1,1,NULL,'cm',NULL),(28,'Diámetro base',1,1,NULL,NULL,NULL),(29,'Colección',1,0,NULL,NULL,NULL),(30,'Uds / caja',1,1,NULL,NULL,NULL),(31,'Contenido',1,0,NULL,NULL,NULL),(32,'Peso',1,1,NULL,'g',NULL),(33,'Grosor',1,1,NULL,'mm',NULL),(34,'Marca',1,0,NULL,NULL,NULL),(35,'Origen',0,0,'origin',NULL,NULL),(36,'Proveedor',1,0,NULL,NULL,NULL),(37,'Productor',1,0,'producer',NULL,NULL),(38,'Duración',1,1,NULL,'s',NULL),(39,'Flor',1,0,NULL,NULL,NULL),(40,'Soporte',1,0,NULL,NULL,NULL),(41,'Tamaño flor',1,1,NULL,NULL,NULL),(42,'Apertura',1,1,NULL,NULL,NULL),(43,'Tallo',0,1,NULL,NULL,NULL),(44,'Numero hojas',1,1,NULL,NULL,NULL),(45,'Dimensiones',1,1,NULL,NULL,NULL),(46,'Diámetro boca',1,1,NULL,NULL,NULL),(47,'Nº flores',1,1,NULL,NULL,NULL),(48,'Uds / paquete',1,1,NULL,NULL,NULL),(49,'Maceta',1,1,NULL,NULL,NULL),(50,'Textura flor',1,1,NULL,NULL,NULL),(51,'Textura hoja',1,1,NULL,NULL,NULL),(52,'Tipo de iva',1,1,NULL,NULL,NULL),(53,'Tronco',1,1,NULL,NULL,NULL),(54,'Hoja',1,1,NULL,NULL,NULL),(55,'Formato',1,1,NULL,NULL,NULL),(56,'Genero',1,1,NULL,NULL,NULL),(57,'Especie',1,1,NULL,NULL,NULL),(58,'Variedad',1,1,NULL,NULL,NULL),(59,'Medida grande',1,0,NULL,NULL,NULL),(60,'Medida mediano',1,0,NULL,NULL,NULL),(61,'Medida pequeño',1,0,NULL,NULL,NULL),(62,'Medida pequeño',1,0,NULL,NULL,NULL),(63,'Recipiente interior',1,1,NULL,NULL,NULL),(64,'Material secundario',1,1,NULL,NULL,NULL),(65,'Colores',1,1,NULL,NULL,NULL),(66,'Referencia',1,1,NULL,NULL,NULL),(67,'Categoria',1,0,NULL,NULL,NULL),(68,'Amb',0,1,NULL,NULL,NULL),(69,'Anchura',1,1,NULL,'cm',NULL),(70,'Hueco interior',-1,1,NULL,NULL,NULL),(71,'Tamaño',1,1,NULL,NULL,NULL),(72,'Color botón',1,1,NULL,NULL,NULL),(73,'Tamaño minimo del botón',1,1,NULL,NULL,NULL),(74,'Obtentor',1,1,NULL,NULL,NULL),(75,'Logitud del brote',1,1,NULL,NULL,NULL),(76,'Tallos / u.v.',1,1,NULL,NULL,NULL),(77,'Madera de',1,1,NULL,NULL,NULL),(78,'Unidad de venta',1,1,NULL,NULL,NULL),(79,'Temporal',1,1,NULL,NULL,NULL),(80,'Gramaje/tallo',1,1,NULL,NULL,NULL),(81,'Peso/paquete',1,1,NULL,NULL,NULL),(82,'Flexibilidad del tallo',1,1,NULL,NULL,NULL),(83,'Nº planchas',1,1,NULL,NULL,NULL),(84,'Nº páginas',1,1,NULL,NULL,NULL),(85,'Editorial',1,1,NULL,NULL,NULL),(86,'Idioma',1,1,NULL,NULL,NULL),(87,'Fecha publicación',1,1,NULL,NULL,NULL),(88,'Cubierta',1,1,NULL,NULL,NULL),(89,'Encuadernación',1,1,NULL,NULL,NULL),(90,'Autor',1,1,NULL,NULL,NULL),(91,'Envoltorio',1,1,NULL,NULL,NULL),(92,'Nombre temporal',1,1,NULL,NULL,NULL),(93,'Modelo',1,1,NULL,NULL,NULL),(94,'Producto',1,1,NULL,NULL,NULL),(95,'Título',1,1,NULL,NULL,NULL),(96,'Tomo',1,1,NULL,NULL,NULL),(97,'Articulo',1,1,NULL,NULL,NULL),(98,'Metodo de cultivo',1,1,NULL,NULL,NULL),(99,'Edad',1,1,NULL,NULL,NULL),(100,'Agotado',1,1,NULL,NULL,NULL),(101,'Altura con asa',1,1,NULL,NULL,NULL); /*!40000 ALTER TABLE `tag` ENABLE KEYS */; UNLOCK TABLES; @@ -201,11 +201,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-02-11 7:09:43 +-- Dump completed on 2019-03-01 13:31:23 USE `vn2008`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- --- Host: db.verdnatura.es Database: vn2008 +-- Host: test-db.verdnatura.es Database: vn2008 -- ------------------------------------------------------ -- Server version 5.6.25-4-log @@ -236,7 +236,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 de ventas rutas',1,0,0),('6240000000',4,'Transportes de ventas',1,0,0),('6240000001',1,'Transporte ventas agencias',1,0,0),('6240000002',1,'Transporte ventas reclamaciones',1,0,0),('6240000567',1,'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',1,'Otros servicios extranjero',1,0,0),('6290000006',5,'Otros servicios extranjero',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),('6660000000',1,'Perdidas en valores representativos de deuda a l/p',0,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),('7710000000',20,'Beneficio procendente vta inm',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); +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 de ventas rutas',1,0,0),('6240000000',4,'Transportes de ventas',1,0,0),('6240000001',1,'Transporte ventas agencias',1,0,0),('6240000002',1,'Transporte ventas reclamaciones',1,0,0),('6240000567',1,'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',1,'Otros servicios extranjero',1,0,0),('6290000006',5,'Otros servicios extranjero',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),('6660000000',1,'Perdidas en valores representativos de deuda a l/p',0,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),('7620000000',16,'Intereses de créditos a l/p',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),('7710000000',20,'Beneficio procendente vta inm',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; @@ -316,7 +316,7 @@ UNLOCK TABLES; LOCK TABLES `escritos` WRITE; /*!40000 ALTER TABLE `escritos` DISABLE KEYS */; -INSERT INTO `escritos` VALUES (1,'Carta_1','Aviso inicial por saldo deudor',1,'0'),(2,'Carta_2','Reiteracion de aviso por saldo deudor',1,'0'),(3,'Cred_Up','Notificación de aumento de crédito',0,'0'),(4,'Cred_down','Notificación de reducción de crédito',0,'0'),(5,'Pet_CC','Petición de datos bancarios B2B',0,'0'),(6,'SolCredito','Solicitud de crédito',0,'0'),(7,'LeyPago','Ley de pagos',0,'0'),(8,'Pet_CC_Core','Petición de datos bancarios CORE',1,'0'),(9,'nueva_alta','Documento de nueva alta de cliente',0,'0'),(10,'client_welcome','Email de bienvenida para nuevo cliente',1,'0'),(11,'setup_printer','Email de instalación de impresora',1,'0'),(12,'client-welcome','Email de bienvenida como nuevo cliente.',0,'0'),(13,'printer-setup','Email de instalación y configuración de impresora de coronas.',0,'0'),(14,'sepa-core','Email de solicitud de datos bancarios core.',0,'1'),(15,'letter-debtor-st','Email de aviso inicial por saldo deudor',0,'1'),(16,'letter-debtor-nd','Email de aviso reiterado por saldo deudor',0,'1'); +INSERT INTO `escritos` VALUES (1,'Carta_1','Aviso inicial por saldo deudor',0,'0'),(2,'Carta_2','Reiteracion de aviso por saldo deudor',0,'0'),(3,'Cred_Up','Notificación de aumento de crédito',0,'0'),(4,'Cred_down','Notificación de reducción de crédito',0,'0'),(5,'Pet_CC','Petición de datos bancarios B2B',0,'0'),(6,'SolCredito','Solicitud de crédito',0,'0'),(7,'LeyPago','Ley de pagos',0,'0'),(8,'Pet_CC_Core','Petición de datos bancarios CORE',0,'0'),(9,'nueva_alta','Documento de nueva alta de cliente',0,'0'),(10,'client_welcome','Email de bienvenida para nuevo cliente',0,'0'),(11,'setup_printer','Email de instalación de impresora',0,'0'),(12,'client-welcome','Email de bienvenida como nuevo cliente',1,'0'),(13,'printer-setup','Email de instalación y configuración de impresora de coronas',1,'0'),(14,'sepa-core','Email de solicitud de datos bancarios core',1,'1'),(15,'letter-debtor-st','Email de aviso inicial por saldo deudor',1,'1'),(16,'letter-debtor-nd','Email de aviso reiterado por saldo deudor',1,'1'); /*!40000 ALTER TABLE `escritos` ENABLE KEYS */; UNLOCK TABLES; @@ -376,7 +376,7 @@ UNLOCK TABLES; LOCK TABLES `department` WRITE; /*!40000 ALTER TABLE `department` DISABLE KEYS */; -INSERT INTO `department` VALUES (1,'VERDNATURA',1,52,1,0,NULL,NULL,NULL,NULL,0),(22,'COMPRAS',29,30,NULL,72,49,596,2,5,0),(23,'CAMARA',23,23,NULL,72,49,604,2,6,0),(31,'INFORMATICA',40,41,NULL,72,44,127,3,9,0),(34,'CONTABILIDAD',35,36,NULL,0,NULL,NULL,NULL,NULL,0),(35,'FINANZAS',33,34,NULL,0,NULL,NULL,NULL,NULL,0),(36,'LABORAL',37,38,NULL,0,NULL,NULL,NULL,NULL,0),(37,'PRODUCCION',42,49,NULL,72,44,230,3,11,0),(38,'SACADO',47,48,NULL,72,37,230,4,14,1),(39,'ENCAJADO',45,46,NULL,72,37,230,4,12,1),(40,'CONTROLADORES',43,44,NULL,72,37,619,4,13,0),(41,'ADMINISTRACION',32,39,NULL,72,44,599,3,8,0),(42,'COMERCIAL',26,31,NULL,72,49,1002,2,3,0),(43,'VENTAS',27,28,NULL,0,NULL,NULL,NULL,NULL,0),(44,'GERENCIA',24,25,NULL,72,49,300,2,7,0),(45,'LOGISTICA',18,45,NULL,72,44,596,3,19,0),(46,'REPARTO',21,22,NULL,72,44,659,3,10,0),(47,'CARGA',15,16,NULL,0,NULL,NULL,NULL,NULL,0),(48,'ALMACENAJE',12,17,NULL,0,NULL,NULL,NULL,NULL,0),(49,'PROPIEDAD',10,11,NULL,72,NULL,1008,1,1,0),(51,'DESCARGA',13,14,NULL,0,NULL,NULL,NULL,NULL,0),(52,'CARGA AEREA',19,20,NULL,72,66,163,4,28,0),(53,'MARKETING Y COMUNICACIÓN',50,51,NULL,72,44,1238,0,0,0),(54,'ORNAMENTALES',54,54,NULL,72,44,433,3,21,0),(55,'TALLER Y CONFECCION',4,9,NULL,72,49,695,2,23,0),(56,'TALLER ARTIFICIAL',7,8,NULL,72,49,1780,2,24,0),(57,'SECO',5,6,NULL,0,NULL,NULL,NULL,NULL,0),(58,'CAMPOS',2,3,NULL,72,49,225,2,2,0),(59,'MANTENIMIENTO',52,53,NULL,72,37,230,4,16,0),(60,'RECLAMACIONES',60,60,NULL,72,42,563,3,20,0),(61,'VNH',61,61,NULL,73,44,1297,3,17,0),(63,'VENTAS FRANCIA',63,63,NULL,72,49,277,2,27,0),(64,'PLANTAS',64,64,NULL,72,49,617,2,25,0),(66,'VERDNAMADRID',66,66,NULL,72,44,163,3,18,0),(68,'COMPLEMENTOS',68,68,NULL,72,64,617,3,26,0),(69,'VERDNABARNA',69,69,NULL,74,44,432,3,22,0),(77,'PALETIZADO',77,77,NULL,72,37,230,4,15,1),(80,'EQUIPO J VALLES',80,80,NULL,72,42,693,3,4,0),(86,'LIMPIEZA',86,86,NULL,72,44,599,0,0,0),(88,'CONTROL',88,88,NULL,0,NULL,NULL,NULL,NULL,0),(89,'COORDINACION',89,89,NULL,0,NULL,NULL,NULL,NULL,1); +INSERT INTO `department` VALUES (1,'VERDNATURA',1,52,1,0,NULL,NULL,NULL,NULL,0,0),(22,'COMPRAS',29,30,NULL,72,49,596,2,5,0,0),(23,'CAMARA',23,23,NULL,72,49,604,2,6,0,0),(31,'INFORMATICA',40,41,NULL,72,44,127,3,9,0,0),(34,'CONTABILIDAD',35,36,NULL,0,NULL,NULL,NULL,NULL,0,0),(35,'FINANZAS',33,34,NULL,0,NULL,NULL,NULL,NULL,0,0),(36,'LABORAL',37,38,NULL,0,NULL,NULL,NULL,NULL,0,0),(37,'PRODUCCION',42,49,NULL,72,44,230,3,11,0,0),(38,'SACADO',47,48,NULL,72,37,230,4,14,1,0),(39,'ENCAJADO',45,46,NULL,72,37,230,4,12,1,0),(40,'CONTROLADORES',43,44,NULL,72,37,619,4,13,0,0),(41,'ADMINISTRACION',32,39,NULL,72,44,599,3,8,0,0),(42,'COMERCIAL',26,31,NULL,72,49,1002,2,3,0,0),(43,'VENTAS',27,28,NULL,0,NULL,NULL,NULL,NULL,0,0),(44,'GERENCIA',24,25,NULL,72,49,300,2,7,0,0),(45,'LOGISTICA',18,45,NULL,72,44,596,3,19,0,0),(46,'REPARTO',21,22,NULL,72,44,659,3,10,0,0),(47,'CARGA',15,16,NULL,0,NULL,NULL,NULL,NULL,0,0),(48,'ALMACENAJE',12,17,NULL,0,NULL,NULL,NULL,NULL,0,0),(49,'PROPIEDAD',10,11,NULL,72,NULL,1008,1,1,0,0),(51,'DESCARGA',13,14,NULL,0,NULL,NULL,NULL,NULL,0,0),(52,'CARGA AEREA',19,20,NULL,72,66,163,4,28,0,0),(53,'MARKETING Y COMUNICACIÓN',50,51,NULL,72,44,1238,0,0,0,0),(54,'ORNAMENTALES',54,54,NULL,72,44,433,3,21,0,2),(55,'TALLER Y CONFECCION',4,9,NULL,72,49,695,2,23,0,0),(56,'TALLER ARTIFICIAL',7,8,NULL,72,49,1780,2,24,0,0),(57,'SECO',5,6,NULL,0,NULL,NULL,NULL,NULL,0,0),(58,'CAMPOS',2,3,NULL,72,49,225,2,2,0,0),(59,'MANTENIMIENTO',52,53,NULL,72,37,230,4,16,0,1),(60,'RECLAMACIONES',60,60,NULL,72,42,563,3,20,0,2),(61,'VNH',61,61,NULL,73,44,1297,3,17,0,2),(63,'VENTAS FRANCIA',63,63,NULL,72,49,277,2,27,0,2),(64,'PLANTAS',64,64,NULL,72,49,617,2,25,0,2),(66,'VERDNAMADRID',66,66,NULL,72,44,163,3,18,0,0),(68,'COMPLEMENTOS',68,68,NULL,72,64,617,3,26,0,0),(69,'VERDNABARNA',69,69,NULL,74,44,432,3,22,0,0),(77,'PALETIZADO',77,77,NULL,72,37,230,4,15,1,0),(80,'EQUIPO J VALLES',80,80,NULL,72,42,693,3,4,0,0),(86,'LIMPIEZA',86,86,NULL,72,44,599,0,0,0,0),(88,'CONTROL',88,88,NULL,0,NULL,NULL,NULL,NULL,0,0),(89,'COORDINACION',89,89,NULL,0,NULL,NULL,NULL,NULL,1,0); /*!40000 ALTER TABLE `department` ENABLE KEYS */; UNLOCK TABLES; @@ -399,11 +399,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-02-11 7:09:43 +-- Dump completed on 2019-03-01 13:31:24 USE `bi`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- --- Host: db.verdnatura.es Database: bi +-- Host: test-db.verdnatura.es Database: bi -- ------------------------------------------------------ -- Server version 5.6.25-4-log @@ -447,11 +447,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-02-11 7:09:43 +-- Dump completed on 2019-03-01 13:31:24 USE `cache`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- --- Host: db.verdnatura.es Database: cache +-- Host: test-db.verdnatura.es Database: cache -- ------------------------------------------------------ -- Server version 5.6.25-4-log @@ -485,11 +485,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-02-11 7:09:44 +-- Dump completed on 2019-03-01 13:31:24 USE `hedera`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- --- Host: db.verdnatura.es Database: hedera +-- Host: test-db.verdnatura.es Database: hedera -- ------------------------------------------------------ -- Server version 5.6.25-4-log @@ -543,11 +543,11 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-02-11 7:09:44 +-- Dump completed on 2019-03-01 13:31:24 USE `postgresql`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- --- Host: db.verdnatura.es Database: postgresql +-- Host: test-db.verdnatura.es Database: postgresql -- ------------------------------------------------------ -- Server version 5.6.25-4-log @@ -618,7 +618,7 @@ UNLOCK TABLES; LOCK TABLES `workcenter` WRITE; /*!40000 ALTER TABLE `workcenter` DISABLE KEYS */; -INSERT INTO `workcenter` VALUES (1,'Silla',20,860,1),(2,'Mercaflor',19,NULL,NULL),(3,'Marjales',26,20006,NULL),(4,'VNH',NULL,NULL,3),(5,'Madrid',28,2843,5),(6,'Vilassar',88,88014,2),(7,'Tenerife',NULL,NULL,10),(8,'Silla-Agrario',26,NULL,NULL); +INSERT INTO `workcenter` VALUES (1,'Silla',20,865,1),(2,'Mercaflor',19,NULL,NULL),(3,'Marjales',26,20006,NULL),(4,'VNH',NULL,NULL,3),(5,'Madrid',28,2843,5),(6,'Vilassar',88,88014,2),(7,'Tenerife',NULL,NULL,10),(8,'Silla-Agrario',26,NULL,NULL); /*!40000 ALTER TABLE `workcenter` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -631,4 +631,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-02-11 7:09:44 +-- Dump completed on 2019-03-01 13:31:24 diff --git a/services/db/install/dump/fixtures.sql b/db/install/dump/fixtures.sql similarity index 86% rename from services/db/install/dump/fixtures.sql rename to db/install/dump/fixtures.sql index b97fb8511..2488c231b 100644 --- a/services/db/install/dump/fixtures.sql +++ b/db/install/dump/fixtures.sql @@ -1,3 +1,5 @@ + + ALTER TABLE `vn`.`itemTaxCountry` AUTO_INCREMENT = 1; ALTER TABLE `vn2008`.`Consignatarios` AUTO_INCREMENT = 1; @@ -8,7 +10,7 @@ INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active` SELECT id, name, CONCAT(name, 'Nick'),MD5('nightmare'), id, 1, CONCAT(name, '@verdnatura.es') FROM `account`.`role`; -INSERT INTO `vn`.`worker`(`id`,`workerCode`, `firstName`, `name`, `userFk`) +INSERT INTO `vn2008`.`Trabajadores`(`Id_Trabajador`,`CodigoTrabajador`, `Nombre`, `Apellidos`, `user_id`) SELECT id,UPPER(LPAD(role, 3, '0')), name, name, id FROM `vn`.`user`; @@ -29,7 +31,7 @@ INSERT INTO `account`.`user`(`id`,`name`,`password`,`role`,`active`,`email`,`lan (111, 'Missing', 'ac754a330530832ba1bf7687f577da91', 2 , 0, NULL, 'es'), (112, 'Trash', 'ac754a330530832ba1bf7687f577da91', 2 , 0, NULL, 'es'); - INSERT INTO `vn`.`worker`(`workerCode`, `id`, `firstName`, `name`, `userFk`) + INSERT INTO `vn2008`.`Trabajadores`(`CodigoTrabajador`, `Id_Trabajador`, `Nombre`, `Apellidos`, `user_id`) VALUES ('LGN', 106, 'David Charles', 'Haller', 106), ('ANT', 107, 'Hank' , 'Pym' , 107), @@ -209,38 +211,65 @@ INSERT INTO `vn`.`clientManaCache`(`clientFk`, `mana`, `dated`) ( 103, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), ( 104, -30, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)); -INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `phone`, `mobile`, `isActive`, `isDefaultAddress`, `clientFk`, `agencyModeFk`, `longitude`, `latitude`, `isEqualizated`) +INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `phone`, `mobile`, `isActive`, `clientFk`, `agencyModeFk`, `longitude`, `latitude`, `isEqualizated`, `isDefaultAddress`) VALUES - (101, 'address 01', 'Somewhere in Thailand', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (102, 'address 02', 'Somewhere in Poland', 'Silla', 46460, 1, 3333333333, 444444444, 1, 0, 109, 2, NULL, NULL, 0), - (103, 'address 03', 'Somewhere in Japan', 'Silla', 46460, 1, 3333333333, 444444444, 1, 0, 109, 2, NULL, NULL, 0), - (104, 'address 04', 'Somewhere in Spain', 'Silla', 46460, 1, 3333333333, 444444444, 1, 0, 109, 2, NULL, NULL, 0), - (105, 'address 05', 'Somewhere in Potugal', 'Silla', 46460, 1, 5555555555, 666666666, 1, 0, 109, 2, NULL, NULL, 0), - (106, 'address 06', 'Somewhere in UK', 'Silla', 46460, 1, 5555555555, 666666666, 1, 0, 109, 2, NULL, NULL, 0), - (107, 'address 07', 'Somewhere in Valencia', 'Silla', 46460, 1, 5555555555, 666666666, 1, 0, 109, 2, NULL, NULL, 0), - (108, 'address 08', 'Somewhere in Silla', 'Silla', 46460, 1, 5555555555, 666666666, 1, 0, 109, 2, NULL, NULL, 0), - (109, 'address 09', 'Somewhere in London', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (110, 'address 10', 'Somewhere in Algemesi', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (111, 'address 11', 'Somewhere in Carlet', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (112, 'address 12', 'Somewhere in Campanar', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (113, 'address 13', 'Somewhere in Malilla', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (114, 'address 14', 'Somewhere in France', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (115, 'address 15', 'Somewhere in Birmingham', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (116, 'address 16', 'Somewhere in Scotland', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (117, 'address 17', 'Somewhere in nowhere', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (118, 'address 18', 'Somewhere over the rainbow', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (119, 'address 19', 'Somewhere in Alberic', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (120, 'address 20', 'Somewhere in Montortal', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (121, 'address 21', 'the bat cave', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 101, 2, NULL, NULL, 0), - (122, 'address 22', 'NY roofs', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 102, 2, NULL, NULL, 0), - (123, 'address 23', 'The phone box', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 103, 2, NULL, NULL, 0), - (124, 'address 24', 'Stark tower', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 104, 2, NULL, NULL, 0), - (125, 'address 25', 'The plastic cell', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 105, 2, NULL, NULL, 0), - (126, 'address 26', 'Many places', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 106, 2, NULL, NULL, 0), - (127, 'address 27', 'Your pocket', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 107, 2, NULL, NULL, 0), - (128, 'address 28', 'Cerebro', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 108, 2, NULL, NULL, 0), - (129, 'address 29', 'Luke Cages Bar', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 110, 2, NULL, NULL, 0), - (130, 'address 30', 'Non valid address', 'Silla', 46460, 1, 1111111111, 222222222, 0, 0, 101, 2, NULL, NULL, 0); + (1, 'Bruce Wayne', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1, 1111111111, 222222222, 1, 101, 2, NULL, NULL, 0, 1), + (2, 'Petter Parker', '20 Ingram Street', 'Silla', 46460, 1, 1111111111, 222222222, 1, 102, 2, NULL, NULL, 0, 1), + (3, 'Clark Kent', '344 Clinton Street', 'Silla', 46460, 1, 1111111111, 222222222, 1, 103, 2, NULL, NULL, 0, 1), + (4, 'Tony Stark', '10880 Malibu Point', 'Silla', 46460, 1, 1111111111, 222222222, 1, 104, 2, NULL, NULL, 0, 1), + (5, 'Max Eisenhardt', 'Unknown Whereabouts', 'Silla', 46460, 1, 1111111111, 222222222, 1, 105, 2, NULL, NULL, 0, 1), + (6, 'DavidCharlesHaller', 'Evil hideout', 'Silla', 46460, 1, 1111111111, 222222222, 1, 106, 2, NULL, NULL, 0, 1), + (7, 'Hank Pym', 'Anthill', 'Silla', 46460, 1, 1111111111, 222222222, 1, 107, 2, NULL, NULL, 0, 1), + (8, 'Charles Xavier', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1, 1111111111, 222222222, 1, 108, 2, NULL, NULL, 0, 1), + (9, 'Bruce Banner', 'Somewhere in New York', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0, 1), + (10, 'Jessica Jones', 'NYCC 2015 Poster', 'Silla', 46460, 1, 1111111111, 222222222, 1, 110, 2, NULL, NULL, 0, 1), + (11, 'Missing', 'The space', 'Silla', 46460, 1, 1111111111, 222222222, 1, 200, 2, NULL, NULL, 0, 1), + (12, 'Trash', 'New York city', 'Silla', 46460, 1, 1111111111, 222222222, 1, 400, 2, NULL, NULL, 0, 1), + (101, 'address 01', 'Somewhere in Thailand', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0, 0), + (102, 'address 02', 'Somewhere in Poland', 'Silla', 46460, 1, 3333333333, 444444444, 1, 109, 2, NULL, NULL, 0, 0), + (103, 'address 03', 'Somewhere in Japan', 'Silla', 46460, 1, 3333333333, 444444444, 1, 109, 2, NULL, NULL, 0, 0), + (104, 'address 04', 'Somewhere in Spain', 'Silla', 46460, 1, 3333333333, 444444444, 1, 109, 2, NULL, NULL, 0, 0), + (105, 'address 05', 'Somewhere in Potugal', 'Silla', 46460, 1, 5555555555, 666666666, 1, 109, 2, NULL, NULL, 0, 0), + (106, 'address 06', 'Somewhere in UK', 'Silla', 46460, 1, 5555555555, 666666666, 1, 109, 2, NULL, NULL, 0, 0), + (107, 'address 07', 'Somewhere in Valencia', 'Silla', 46460, 1, 5555555555, 666666666, 1, 109, 2, NULL, NULL, 0, 0), + (108, 'address 08', 'Somewhere in Silla', 'Silla', 46460, 1, 5555555555, 666666666, 1, 109, 2, NULL, NULL, 0, 0), + (109, 'address 09', 'Somewhere in London', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0, 0), + (110, 'address 10', 'Somewhere in Algemesi', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0, 0), + (111, 'address 11', 'Somewhere in Carlet', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0, 0), + (112, 'address 12', 'Somewhere in Campanar', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0, 0), + (113, 'address 13', 'Somewhere in Malilla', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0, 0), + (114, 'address 14', 'Somewhere in France', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0, 0), + (115, 'address 15', 'Somewhere in Birmingham', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0, 0), + (116, 'address 16', 'Somewhere in Scotland', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0, 0), + (117, 'address 17', 'Somewhere in nowhere', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0, 0), + (118, 'address 18', 'Somewhere over the rainbow', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0, 0), + (119, 'address 19', 'Somewhere in Alberic', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0, 0), + (120, 'address 20', 'Somewhere in Montortal', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0, 0), + (121, 'address 21', 'the bat cave', 'Silla', 46460, 1, 1111111111, 222222222, 1, 101, 2, NULL, NULL, 0, 0), + (122, 'address 22', 'NY roofs', 'Silla', 46460, 1, 1111111111, 222222222, 1, 102, 2, NULL, NULL, 0, 0), + (123, 'address 23', 'The phone box', 'Silla', 46460, 1, 1111111111, 222222222, 1, 103, 2, NULL, NULL, 0, 0), + (124, 'address 24', 'Stark tower', 'Silla', 46460, 1, 1111111111, 222222222, 1, 104, 2, NULL, NULL, 0, 0), + (125, 'address 25', 'The plastic cell', 'Silla', 46460, 1, 1111111111, 222222222, 1, 105, 2, NULL, NULL, 0, 0), + (126, 'address 26', 'Many places', 'Silla', 46460, 1, 1111111111, 222222222, 1, 106, 2, NULL, NULL, 0, 0), + (127, 'address 27', 'Your pocket', 'Silla', 46460, 1, 1111111111, 222222222, 1, 107, 2, NULL, NULL, 0, 0), + (128, 'address 28', 'Cerebro', 'Silla', 46460, 1, 1111111111, 222222222, 1, 108, 2, NULL, NULL, 0, 0), + (129, 'address 29', 'Luke Cages Bar', 'Silla', 46460, 1, 1111111111, 222222222, 1, 110, 2, NULL, NULL, 0, 0), + (130, 'address 30', 'Non valid address', 'Silla', 46460, 1, 1111111111, 222222222, 0, 101, 2, NULL, NULL, 0, 0), + (131, 'Missing', 'The space', 'Silla', 46460, 1, 1111111111, 222222222, 1, 200, 2, NULL, NULL, 0, 0), + (132, 'Trash', 'New York city', 'Silla', 46460, 1, 1111111111, 222222222, 1, 400, 2, NULL, NULL, 0, 0); + +UPDATE `vn`.`client` SET defaultAddressFk = 1 WHERE id = 101; +UPDATE `vn`.`client` SET defaultAddressFk = 2 WHERE id = 102; +UPDATE `vn`.`client` SET defaultAddressFk = 3 WHERE id = 103; +UPDATE `vn`.`client` SET defaultAddressFk = 4 WHERE id = 104; +UPDATE `vn`.`client` SET defaultAddressFk = 5 WHERE id = 105; +UPDATE `vn`.`client` SET defaultAddressFk = 6 WHERE id = 106; +UPDATE `vn`.`client` SET defaultAddressFk = 7 WHERE id = 107; +UPDATE `vn`.`client` SET defaultAddressFk = 8 WHERE id = 108; +UPDATE `vn`.`client` SET defaultAddressFk = 9 WHERE id = 109; +UPDATE `vn`.`client` SET defaultAddressFk = 10 WHERE id = 110; +UPDATE `vn`.`client` SET defaultAddressFk = 11 WHERE id = 200; +UPDATE `vn`.`client` SET defaultAddressFk = 12 WHERE id = 400; INSERT INTO `vn`.`clientCredit`(`id`, `clientFk`, `workerFk`, `amount`, `created`) VALUES @@ -267,15 +296,15 @@ INSERT INTO `vn`.`clientCreditLimit`(`id`, `maxAmount`, `roleFk`) INSERT INTO `vn`.`clientObservation`(`id`, `clientFk`, `workerFk`, `text`, `created`) VALUES - (1, 101, 1, 'Madness, as you know, is like gravity, all it takes is a little push', CURDATE()), - (2, 102, 1, 'With great power, comes great responsibility', CURDATE()), - (3, 103, 3, 'this is a job for Super-Man!', CURDATE()), - (4, 104, 3, 'yes... I am Iron-Man', CURDATE()), - (5, 105, 5, 'They do understand. Our mutant powers make us superior', CURDATE()), - (6, 106, 5, 'My name is Legion, for we are many!', CURDATE()), - (7, 107, 9, 'I think our first move should be calling the Avengers..', CURDATE()), - (8, 108, 9, 'Just because someone stumbles and loses their path, does not mean they are lost forever.', CURDATE()), - (9, 109, 20, 'HULK SMASH! ...', CURDATE()), + (1, 101, 1, 'Madness, as you know, is like gravity, all it takes is a little push', CURDATE()), + (2, 102, 1, 'With great power, comes great responsibility', CURDATE()), + (3, 103, 3, 'this is a job for Super-Man!', CURDATE()), + (4, 104, 3, 'yes... I am Iron-Man', CURDATE()), + (5, 105, 5, 'They do understand. Our mutant powers make us superior', CURDATE()), + (6, 106, 5, 'My name is Legion, for we are many!', CURDATE()), + (7, 107, 9, 'I think our first move should be calling the Avengers..', CURDATE()), + (8, 108, 9, 'Just because someone stumbles and loses their path, does not mean they are lost forever.', CURDATE()), + (9, 109, 20, 'HULK SMASH! ...', CURDATE()), (10, 110, 20, 'They say everyone is born a hero. But if you let it, life will push you over the line until you are the villain.', CURDATE()); INSERT INTO `vn`.`observationType`(`id`,`description`) @@ -547,7 +576,7 @@ INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `pric (5, 1, 2 , 'Object1 Gem1 5', 10, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -10 DAY)), (6, 1, 3 , 'Object1 Gem1 5', 15, 6.50, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -5 DAY)), (7, 2, 11, 'Object2 Gem2 3', 15, 1.30, 0, 0, 0, CURDATE()), - (8, 4, 11, 'Object4 Armor2 2', 10, 3.26, 0, 0, 0, CURDATE()), + (8, 4, 11, 'Object4 Armor2 2', 10, 3.05, 0, 0, 0, CURDATE()), (9, 1, 16, 'Object1 Gem1 5', 5, 9.10, 0, 0, 0, CURDATE()), (10, 2, 16, 'Object2 Gem2 3', 10, 1.07, 0, 0, 0, CURDATE()), (11, 1, 16, 'Object1 Gem1 5', 2, 9.10, 0, 0, 0, CURDATE()), @@ -593,11 +622,11 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`) (5, 29, -18.72), (5, 39, 0.02), (6, 23, 6.5), - (7, 15, 0.29), + (7, 15, 0.2899), (7, 28, 5.6), (7, 29, -4.6), (7, 39, 0.01), - (8, 15, 0.044), + (8, 15, 0.0435), (8, 21, -0.004), (8, 28, 20.72), (8, 29, -19.72), @@ -624,7 +653,7 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`) (12, 29, -19.72), (12, 37, 2), (12, 39, 0.01), - (13, 15, 0.29), + (13, 15, 0.2899), (13, 28, 5.6), (13, 29, -4.6), (13, 39, 0.01), @@ -793,14 +822,14 @@ INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseO (1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000), (2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150, 2000), (3, CURDATE(), CURDATE(), 1, 2, 1, 0.00, 0.00), - (4, DATE_ADD(CURDATE(), INTERVAL -30 DAY), DATE_ADD(CURDATE(), INTERVAL -30 DAY), 1, 2, 1, 50.00, 500); + (4, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 50.00, 500); INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `companyFk`,`ref`) VALUES - ( 1, 1, DATE_ADD(CURDATE(), INTERVAL -30 DAY), 1, 442, 'Movimiento 1'), - ( 2, 2, DATE_ADD(CURDATE(), INTERVAL -30 DAY), 2, 442, 'Movimiento 2'), - ( 3, 1, DATE_ADD(CURDATE(), INTERVAL -30 DAY), 3, 442, 'Movimiento 3'), - ( 4, 2, DATE_ADD(CURDATE(), INTERVAL -30 DAY), 4, 69, 'Movimiento 4'); + ( 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 442, 'Movimiento 1'), + ( 2, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 442, 'Movimiento 2'), + ( 3, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 3, 442, 'Movimiento 3'), + ( 4, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4, 69, 'Movimiento 4'); INSERT INTO `vn`.`agencyProvince`(`provinceFk`, `agencyFk`, `zone`, `warehouseFk`) VALUES @@ -927,7 +956,7 @@ INSERT INTO `hedera`.`orderRowComponent`(`rowFk`, `componentFk`, `price`) (5, 29, -18.72), (5, 39, 0.02), (6, 23, 6.5), - (7, 15, 0.29), + (7, 15, 0.2899), (7, 28, 5.6), (7, 29, -4.6), (7, 39, 0.01), @@ -1061,10 +1090,10 @@ INSERT INTO `vn`.`userConfig` (`userFk`, `warehouseFk`, `companyFk`) INSERT INTO `vn`.`receipt`(`id`, `invoiceFk`, `amountPaid`, `amountUnpaid`, `payed`, `workerFk`, `bankFk`, `clientFk`, `created`, `companyFk`, `isConciliate`) VALUES - (1, 'Cobro web', 100.50, 0.00, CURDATE(), 9, 1, 101, CURDATE(), 442, 1), - (2, 'Cobro web', 200.50, 0.00, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 9, 1, 101, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 442, 1), - (3, 'Cobro en efectivo', 300.00, 100.00, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 9, 1, 102, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 442, 0), - (4, 'Cobro en efectivo', -400.00, -50.00, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 9, 1, 103, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 442, 0); + (1, 'Cobro web', 100.50, 0.00, CURDATE(), 9, 1, 101, CURDATE(), 442, 1), + (2, 'Cobro web', 200.50, 0.00, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 9, 1, 101, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 442, 1), + (3, 'Cobro en efectivo', 300.00, 100.00, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 9, 1, 102, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 442, 0), + (4, 'Cobro en efectivo', -400.00, -50.00, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 9, 1, 103, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 442, 0); INSERT INTO `vn2008`.`workerTeam`(`id`, `team`, `user`) VALUES @@ -1126,5 +1155,3 @@ INSERT INTO `postgresql`.`business_labour`(`business_id`, `notes`, `department_i VALUES (1, NULL, 22, 4, 0, 1, 1, 1, 1), (2, 'From las friday worker ownes the company 1 hour', 23, 1, 0, 1, 0, 1, 1); - - diff --git a/services/db/install/dump/mysqlPlugins.sql b/db/install/dump/mysqlPlugins.sql similarity index 100% rename from services/db/install/dump/mysqlPlugins.sql rename to db/install/dump/mysqlPlugins.sql diff --git a/services/db/install/dump/structure.sql b/db/install/dump/structure.sql similarity index 98% rename from services/db/install/dump/structure.sql rename to db/install/dump/structure.sql index f6428ba5c..70588d75f 100644 --- a/services/db/install/dump/structure.sql +++ b/db/install/dump/structure.sql @@ -1,6 +1,6 @@ -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- --- Host: db.verdnatura.es Database: account +-- Host: test-db.verdnatura.es Database: account -- ------------------------------------------------------ -- Server version 5.6.25-4-log @@ -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=15171 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global users'; +) ENGINE=InnoDB AUTO_INCREMENT=15285 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 */ ; @@ -2440,7 +2440,7 @@ CREATE TABLE `Agencias` ( PRIMARY KEY (`Id_Agencia`), KEY `Agencias` (`Agencia`), KEY `Vista` (`Vista`) -) ENGINE=InnoDB AUTO_INCREMENT=1220 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1221 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=33528 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=34158 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2562,6 +2562,7 @@ CREATE TABLE `Articles` ( `compression` decimal(5,2) NOT NULL DEFAULT '1.00' COMMENT 'Relacion de compresividad entre el volumen de las entradas en Silla y el empaquetado en los envios a clientes.\n\nMenor que 1 significa que se puede comprimir más que el volumen original.', `minimum` decimal(10,0) unsigned NOT NULL DEFAULT '3', `upToDown` decimal(10,0) unsigned NOT NULL DEFAULT '0', + `lastPrice` decimal(10,2) DEFAULT '0.00', PRIMARY KEY (`Id_Article`), KEY `Article` (`Article`), KEY `Color` (`Color`), @@ -2577,7 +2578,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=337333 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=339584 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 */ ; @@ -2759,7 +2760,7 @@ CREATE TABLE `Articles_dits` ( KEY `fgkey1_idx` (`idaccion_dits`), KEY `fgkey2_idx` (`Id_Ticket`), KEY `fgkey3_idx` (`Id_Trabajador`) -) ENGINE=InnoDB AUTO_INCREMENT=21135 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=21244 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2782,7 +2783,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=673960 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=687346 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2908,7 +2909,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=658894 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=664380 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 */ ; @@ -3040,7 +3041,7 @@ CREATE TABLE `Clientes` ( CONSTRAINT `canal_nuevo_cliente` FOREIGN KEY (`chanel_id`) REFERENCES `chanel` (`chanel_id`) ON UPDATE CASCADE, CONSTRAINT `tipos_de_cliente` FOREIGN KEY (`clientes_tipo_id`) REFERENCES `clientes_tipo` (`clientes_tipo_id`) ON UPDATE CASCADE, CONSTRAINT `typeFk` FOREIGN KEY (`typeFk`) REFERENCES `clientes_tipo` (`code`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=15171 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=15285 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 */ ; @@ -3202,7 +3203,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 AUTO_INCREMENT=3 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 */; -- @@ -3323,7 +3324,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=115904 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3405,7 +3406,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=292012599 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB AUTO_INCREMENT=295179612 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 */ ; @@ -3456,6 +3457,9 @@ bi:BEGIN IF NEW.caja IS NULL THEN SET NEW.caja = IFNULL(vIsBox, NEW.caja); END IF; + + UPDATE vn.item SET isActive = 1 WHERE id = NEW.Id_Article ; + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -3650,7 +3654,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=27726 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=27956 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3694,7 +3698,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=26728 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=26883 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 */ ; @@ -3878,7 +3882,7 @@ CREATE TABLE `Contactos` ( PRIMARY KEY (`Id_Contacto`), KEY `Telefono` (`Telefono`), KEY `Movil` (`Movil`) -) ENGINE=InnoDB AUTO_INCREMENT=2684 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2688 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 */ ; @@ -4075,7 +4079,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=160393 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='InnoDB free: 88064 kB; (`Id_Proveedor`) REFER `vn2008/Provee'; +) ENGINE=InnoDB AUTO_INCREMENT=161601 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 */ ; @@ -4236,7 +4240,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=3329258 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3365684 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4254,7 +4258,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=857 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona las entradas con los origenes de compra'; +) ENGINE=InnoDB AUTO_INCREMENT=975 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona las entradas con los origenes de compra'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4342,7 +4346,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=178 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=194 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4498,7 +4502,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=486085 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=486361 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 */ ; @@ -4677,7 +4681,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=2793071 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=FIXED; +) ENGINE=InnoDB AUTO_INCREMENT=2817960 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 */ ; @@ -4878,7 +4882,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=23629103 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=23749175 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 */ ; @@ -5036,7 +5040,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=14455299 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=14754870 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 */ ; @@ -5141,7 +5145,7 @@ CREATE TABLE `Ordenes` ( CONSTRAINT `fgnAtender` FOREIGN KEY (`atenderFk`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, CONSTRAINT `fgnRequester` FOREIGN KEY (`requesterFk`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, CONSTRAINT `fgnTicket` FOREIGN KEY (`ticketFk`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=38997 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=39488 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 */ ; @@ -5245,7 +5249,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=2858 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2862 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5371,7 +5375,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=2697 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2712 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5397,7 +5401,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=719 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=730 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5488,7 +5492,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=539445 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=542659 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 */ ; @@ -5579,7 +5583,7 @@ CREATE TABLE `Relaciones` ( KEY `Id_Contacto` (`Id_Contacto`), KEY `Id_Proveedor` (`Id_Proveedor`), KEY `Id_Cliente` (`Id_Cliente`) -) ENGINE=InnoDB AUTO_INCREMENT=2683 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2687 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5599,7 +5603,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=1209 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1215 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5624,7 +5628,7 @@ CREATE TABLE `Reservas` ( PRIMARY KEY (`Id_Reserva`), KEY `Id_1` (`Id_Ticket`), KEY `Id_Article` (`Id_Article`) -) ENGINE=InnoDB AUTO_INCREMENT=815 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5655,7 +5659,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=47759 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=48347 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 */ ; @@ -5717,7 +5721,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=97 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5843,7 +5847,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=346405 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=347007 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5861,7 +5865,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=36541 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=36559 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5889,7 +5893,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=23999 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=24024 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5947,7 +5951,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=2141408 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2158859 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 */ ; @@ -6050,7 +6054,7 @@ BEGIN IF vEmployee IS NULL THEN SET vEmployee = 20; END IF; - + /* -- Comprobación de VIES IF NEW.empresa_id <> OLD.empresa_id AND vn.getUser() != 2 THEN @@ -6069,7 +6073,7 @@ BEGIN END IF; END IF; - + */ IF NEW.Fecha < '2001-01-01' THEN @@ -6143,7 +6147,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=64352595 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=64394157 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 */ ; @@ -6224,7 +6228,7 @@ CREATE TABLE `Tickets_turno` ( `weekDay` tinyint(1) DEFAULT NULL COMMENT 'funcion de mysql Lunes = 0, Domingo = 6', PRIMARY KEY (`Id_Ticket`), CONSTRAINT `Id_Ticket_fk` FOREIGN KEY (`Id_Ticket`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2124280 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2156930 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6293,7 +6297,7 @@ CREATE TABLE `Tipos` ( CONSTRAINT `Tipos_ibfk_2` FOREIGN KEY (`roleCodeFk`) REFERENCES `account`.`role` (`name`) ON UPDATE CASCADE, CONSTRAINT `Trabajador` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, CONSTRAINT `warehouseFk5` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=240 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Protege la tabla tipos de updates para los 4 parámetros de los compradores, en funcion del valor del campo CodigoRojo de tblContadores.'; +) ENGINE=InnoDB AUTO_INCREMENT=244 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Protege la tabla tipos de updates para los 4 parámetros de los compradores, en funcion del valor del campo CodigoRojo de tblContadores.'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6381,7 +6385,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=1247 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1254 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 */ ; @@ -6508,7 +6512,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=417 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=418 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6534,7 +6538,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=10360 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=10520 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 */; -- @@ -6648,7 +6652,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=3659468 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3669159 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 */ ; @@ -6756,7 +6760,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=18747 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=20237 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 */ ; @@ -6923,7 +6927,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=5225 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=5290 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 */ ; @@ -7089,7 +7093,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=2973 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3013 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7167,7 +7171,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=2998 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3030 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 */ ; @@ -7365,7 +7369,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=737 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=738 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7446,7 +7450,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=2632 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2662 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7544,6 +7548,7 @@ CREATE TABLE `balance_nest_tree` ( `name` text COLLATE utf8_unicode_ci, `id` int(11) NOT NULL AUTO_INCREMENT, `Id_Gasto` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `isSelected` tinyint(1) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=392 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -7564,7 +7569,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=38538 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=39059 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7708,7 +7713,7 @@ CREATE TABLE `buy_edi` ( KEY `barcode` (`barcode`), KEY `fec` (`fec`), KEY `putOrderFk` (`putOrderFk`) -) ENGINE=InnoDB AUTO_INCREMENT=839432 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=850125 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7941,7 +7946,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=100107 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Acciones en respuesta a las reclamaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=101261 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Acciones en respuesta a las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7975,7 +7980,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=52199 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Causas de las reclamaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=52803 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Causas de las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8025,7 +8030,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=135632 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de las reclamaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=136574 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 */ ; @@ -8113,7 +8118,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=58936 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Reclamaciones, tabla principal'; +) ENGINE=InnoDB AUTO_INCREMENT=59576 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Reclamaciones, tabla principal'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8229,7 +8234,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=71643 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; +) ENGINE=InnoDB AUTO_INCREMENT=72248 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8397,7 +8402,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=3592 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de los consignatarios'; +) ENGINE=InnoDB AUTO_INCREMENT=3646 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de los consignatarios'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8441,7 +8446,7 @@ CREATE TABLE `cooler_path_detail` ( `pasillo` varchar(3) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`cooler_path_id`,`pasillo`), UNIQUE KEY `cooler_path_detail_id_UNIQUE` (`cooler_path_detail_id`) -) ENGINE=InnoDB AUTO_INCREMENT=719 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=721 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8479,7 +8484,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=72326 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=73104 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8587,6 +8592,7 @@ CREATE TABLE `department` ( `x` int(11) DEFAULT NULL, `y` int(11) DEFAULT NULL, `production` tinyint(4) NOT NULL DEFAULT '0', + `isSelected` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`department_id`), UNIQUE KEY `lft_UNIQUE` (`lft`), UNIQUE KEY `rgt_UNIQUE` (`rgt`), @@ -8614,7 +8620,7 @@ CREATE TABLE `device` ( PRIMARY KEY (`device_id`), UNIQUE KEY `device_id_UNIQUE` (`device_id`), UNIQUE KEY `sn_UNIQUE` (`sn`) -) ENGINE=InnoDB AUTO_INCREMENT=294 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=289 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9004,7 +9010,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=16913 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=17011 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9034,7 +9040,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=2850506 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2876446 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 */ ; @@ -9182,7 +9188,7 @@ CREATE TABLE `filtros` ( `sql` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `Estanteria` tinyint(1) DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=140 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=142 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9278,7 +9284,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=1164728 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='document managment system'; +) ENGINE=InnoDB AUTO_INCREMENT=1176798 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 */ ; @@ -9477,7 +9483,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=73083 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=73411 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9816,7 +9822,7 @@ CREATE TABLE `mail` ( `recipientFk` int(11) DEFAULT NULL, `plainTextBody` text COLLATE utf8_unicode_ci, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=1600775 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=MyISAM AUTO_INCREMENT=1618503 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9874,7 +9880,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=16102 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=16150 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 */ ; @@ -10083,7 +10089,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=46747 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=47163 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 */ ; @@ -10580,7 +10586,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=60224 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=60631 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 */ ; @@ -10642,7 +10648,7 @@ CREATE TABLE `producer` ( `visible` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`producer_id`), UNIQUE KEY `name_UNIQUE` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=6650 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=7065 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -10811,7 +10817,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=77340 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=77896 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 */ ; @@ -11400,7 +11406,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=119299 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=121033 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11423,7 +11429,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=116632 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=118410 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 */ ; @@ -11466,7 +11472,7 @@ CREATE TABLE `recovery` ( KEY `cliente_idx` (`Id_Cliente`), CONSTRAINT `cliente333` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE, CONSTRAINT `cliente_cliente` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=287 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla apuntaremos los acuerdos de recobro semanal a '; +) ENGINE=InnoDB AUTO_INCREMENT=290 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla apuntaremos los acuerdos de recobro semanal a '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11647,7 +11653,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=82098 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Se borra automaticamente 8 dias en el pasado desde vn2008.clean'; +) ENGINE=InnoDB AUTO_INCREMENT=83737 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 */; -- @@ -11687,7 +11693,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=1019910 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1038812 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11709,7 +11715,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=1976 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1987 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 */ ; @@ -11787,7 +11793,7 @@ CREATE TABLE `sharingclient` ( KEY `Client` (`Id_Cliente`), CONSTRAINT `Clients_key` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE, CONSTRAINT `Trabajadores_key` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=50 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 */ ; @@ -11886,6 +11892,21 @@ CREATE TABLE `state` ( ) 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; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Temporary table structure for view `tag` -- @@ -12165,7 +12186,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=1272076 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; +) ENGINE=InnoDB AUTO_INCREMENT=1285707 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12289,7 +12310,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_cargueras` (`Id_Proveedor`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=123135 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB AUTO_INCREMENT=124354 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 */ ; @@ -12426,7 +12447,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=205491 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=207917 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12456,7 +12477,7 @@ CREATE TABLE `travel_pattern` ( CONSTRAINT `travel_pattern_ibfk_4` FOREIGN KEY (`agency_id`) REFERENCES `Agencias` (`Id_Agencia`) ON UPDATE CASCADE, CONSTRAINT `travel_pattern_ibfk_5` FOREIGN KEY (`warehouse_in`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `travel_pattern_ibfk_6` FOREIGN KEY (`cargoSupplierFk`) REFERENCES `Proveedores` (`Id_Proveedor`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=338 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=339 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12984,6 +13005,22 @@ SET character_set_client = utf8; 1 AS `Fecha`*/; SET character_set_client = @saved_cs_client; +-- +-- Temporary table structure for view `v_descuadre_portekk` +-- + +DROP TABLE IF EXISTS `v_descuadre_portekk`; +/*!50001 DROP VIEW IF EXISTS `v_descuadre_portekk`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `v_descuadre_portekk` AS SELECT + 1 AS `Id_Ticket`, + 1 AS `suma_componente`, + 1 AS `teorico_agencia`, + 1 AS `diferencia`, + 1 AS `Fecha`*/; +SET character_set_client = @saved_cs_client; + -- -- Temporary table structure for view `v_empresa` -- @@ -13083,6 +13120,20 @@ SET character_set_client = utf8; 1 AS `Id_Ruta`*/; SET character_set_client = @saved_cs_client; +-- +-- Temporary table structure for view `v_expeditions_shipping_chargekk` +-- + +DROP TABLE IF EXISTS `v_expeditions_shipping_chargekk`; +/*!50001 DROP VIEW IF EXISTS `v_expeditions_shipping_chargekk`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `v_expeditions_shipping_chargekk` AS SELECT + 1 AS `Id_Ticket`, + 1 AS `shipping_charge`, + 1 AS `Fecha`*/; +SET character_set_client = @saved_cs_client; + -- -- Temporary table structure for view `v_fallo` -- @@ -13786,7 +13837,7 @@ CREATE TABLE `workerTeam` ( PRIMARY KEY (`id`), KEY `user_team_idx` (`user`), CONSTRAINT `user_team` FOREIGN KEY (`user`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=200 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -15182,7 +15233,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` FUNCTION `paymentday`(vDated DATE, vDayToPay INT) RETURNS date BEGIN - +/* OBSOLETO usar vn.getDueDate(vDated DATE, vDayToPay INT)*/ DECLARE vDued DATE; SET vDued = vn.getDueDate(vDated, vDayToPay); @@ -16404,16 +16455,11 @@ DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `agencia_descuadre`(datSince DATE, datTo DATE, intAgency INT, intWarehouseAlias INT) BEGIN - - DECLARE isFile boolean; + DECLARE isFile boolean; DECLARE datTo2359 DATETIME; SET datTo2359 = util.dayEnd(datTo); - - SELECT SUM(price) INTO isFile FROM agencia_descuadre; - - IF NOT IFNULL(isFile,0) THEN - + SELECT t.Id_Ticket,0 AS Total_Agencia,t.Id_Consigna,t.empresa_id,t.warehouse_id, v.suma_componente AS VN, v.suma_componente - shipping_charge AS Difer, e.shipping_charge AS teorico,t.Id_Agencia, t.Bultos,t.Id_Cliente, ap.zona @@ -16433,35 +16479,7 @@ BEGIN JOIN Agencias_province ap ON ap.agency_id = a.agency_id AND ap.warehouse_id = t.warehouse_id AND ap.province_id = c.province_id JOIN warehouse_group wg ON wg.warehouse_id =t.warehouse_id WHERE DATE(t.Fecha) BETWEEN datSince AND datTo2359 AND a.agency_id = intAgency and wg.warehouse_alias_id = intWarehouseAlias; - - ELSE - - SELECT t.Id_Ticket, Round(sum_price , 2) AS Total_Agencia,t.Id_Consigna,t.empresa_id,t.warehouse_id, - v.suma_componente AS VN, IF(isFile,Round(sum_price, 2) - v.suma_componente,v.diferencia) AS Difer, - v.teorico_agencia AS teorico,zd.Id_Agencia, t.Bultos,t.Id_Cliente - FROM - (SELECT - *, SUM(price) sum_price - FROM - (select - t.Id_Ticket, zd.price,t.Id_Consigna, zd.date,t.empresa_id,t.warehouse_id,c.Descuento,t.Id_Agencia - from - agencia_descuadre zd - LEFT JOIN Tickets t ON t.Id_Ticket = zd.Id_Ticket - LEFT JOIN Clientes c ON c.Id_Cliente = t.Id_Cliente - ORDER BY t.Id_Cliente DESC) t - GROUP BY Id_Ticket,`date`) zd - LEFT JOIN - Tickets t ON zd.date = DATE(t.Fecha) - AND zd.Id_Consigna = t.Id_Consigna - AND zd.warehouse_id = t.warehouse_id - AND zd.Id_Agencia = t.Id_Agencia - LEFT JOIN - v_descuadre_porte v ON v.Id_Ticket = t.Id_Ticket - WHERE t.Id_Cliente <> 4712 AND t.Id_Cliente <> 450 - GROUP BY zd.date,Id_Consigna,warehouse_id,zd.Id_Agencia -- HAVING Difer > 0.5 OR Difer < -0.5 jgf 2015-08-18 - ORDER BY v.diferencia; - END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -20385,12 +20403,12 @@ UNION ALL UNION ALL -- Movimientos sin porte en tickets con agencia que SI que deberia de llevar - SELECT m.Id_Ticket, count(Id_Movimiento) as Lineas_totales, Lineas_conPorte + SELECT m.Id_Ticket, count(Id_Movimiento) as Lineas_totales, Lineas_conPorte FROM Movimientos m JOIN Articles a on a.Id_Article = m.Id_Article JOIN Tipos tp on tp.tipo_id = a.tipo_id JOIN Tickets t on m.Id_Ticket = t.Id_Ticket - JOIN v_expeditions_shipping_charge2 v on v.Id_ticket = t.Id_Ticket + JOIN (select Id_Ticket, SUM(shipping_charge) shipping_charge from v_expeditions_shipping_charge2 group by Id_Ticket) v on v.Id_ticket = t.Id_Ticket LEFT JOIN ( SELECT m.Id_Ticket, count(Id_Componente) Lineas_conPorte @@ -20407,9 +20425,6 @@ UNION ALL AND shipping_charge > 1 GROUP BY m.Id_Ticket HAVING Lineas_totales > IFNULL(Lineas_conPorte,0) - - - ) sub JOIN Tickets t ON t.Id_Ticket = sub.Id_Ticket JOIN warehouse w ON w.id = t.warehouse_id @@ -20704,152 +20719,151 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `buy_split`(v_buy INT, v_fv_entry INT, v_pca_entry INT) -BEGIN - DECLARE v_item INT; - DECLARE v_packing INT; - DECLARE v_remaining INT; - DECLARE v_labels INT; - DECLARE v_remainder INT; - DECLARE v_is_buy INT; - DECLARE v_id INT; - DECLARE v_amount INT; - DECLARE v_done BOOL DEFAULT FALSE; - - DECLARE cur CURSOR FOR - SELECT TRUE, c.Id_Compra, c.Cantidad - IFNULL((c.Vida * c.Packing), 0) - FROM Compres c - JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada - JOIN travel t ON t.id = e.travel_id - WHERE c.Id_Article = v_item - AND t.shipment = CURDATE() AND t.warehouse_id_out IN (7, 40) - AND t.warehouse_id NOT IN (44, 1) - AND NOT e.redada AND NOT e.Inventario - AND IFNULL(c.Vida, 0) < c.Etiquetas - LOCK IN SHARE MODE - UNION ALL - SELECT FALSE, m.Id_Movimiento, m.Cantidad - IFNULL(l.stem, 0) - FROM Movimientos m - JOIN Tickets t ON t.Id_Ticket = m.Id_Ticket - LEFT JOIN movement_label l ON l.Id_Movimiento = m.Id_Movimiento - WHERE m.Id_Article = v_item - AND t.Fecha = CURDATE() AND t.warehouse_id IN (7, 40) - AND NOT t.Etiquetasemitidas - AND IFNULL(l.stem, 0) < m.Cantidad - LOCK IN SHARE MODE; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET v_done = TRUE; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - - START TRANSACTION; - - -- Obtiene los datos de la compra - - SELECT Id_Article, Packing, Cantidad - INTO v_item, v_packing, v_remaining - FROM Compres WHERE Id_Compra = v_buy; - - -- Crea splits de los tickets - - DROP TEMPORARY TABLE IF EXISTS tmp.split; - CREATE TEMPORARY TABLE tmp.split - ( - is_buy BOOL, - id INT, - labels INT, - remainder INT - ) - ENGINE = MEMORY; - - OPEN cur; - - l: LOOP - SET v_done = FALSE; - FETCH cur INTO v_is_buy, v_id, v_amount; - - IF v_done OR v_remaining = 0 THEN - LEAVE l; - END IF; - - SET v_amount = LEAST(v_amount, v_remaining); - SET v_remaining = v_remaining - v_amount; - SET v_labels = v_amount DIV v_packing; - - INSERT INTO tmp.split - VALUES (v_is_buy, v_id, v_labels, v_amount % v_packing); - - IF v_is_buy - THEN - UPDATE Compres - SET Vida = Vida + v_labels - WHERE Id_Compra = v_id; - ELSE - INSERT INTO movement_label - SET - Id_Movimiento = v_id, - stem = v_amount, - label = v_labels - ON DUPLICATE KEY UPDATE - stem = stem + VALUES(stem), - label = label + VALUES(label); - END IF; - END LOOP; - - CLOSE cur; - - -- Crea los movimientos de almacén a silla - - CALL buy_transfer (v_buy, v_fv_entry, v_pca_entry); - - UPDATE Compres SET dispatched = Vida * Packing - WHERE Id_Compra = v_buy; - - -- Devuelve los splits creados - - DROP TEMPORARY TABLE IF EXISTS tmp.aux; - CREATE TEMPORARY TABLE tmp.aux - ENGINE = MEMORY - SELECT s.labels, s.remainder, w.`name` destination, - a.Id_Article, a.Article, a.Medida - FROM tmp.split s - JOIN Compres c ON c.Id_Compra = s.id - JOIN Articles a ON a.Id_Article = c.Id_Article - JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada - JOIN travel t ON t.id = e.travel_id - JOIN warehouse w ON t.warehouse_id = w.id - WHERE s.is_buy; - - INSERT INTO tmp.aux - SELECT s.labels, s.remainder, o.Consignatario, - a.Id_Article, a.Article, a.Medida - FROM tmp.split s - JOIN Movimientos m ON m.Id_Movimiento = s.id - JOIN Articles a ON a.Id_Article = m.Id_Article - JOIN Tickets t ON t.Id_Ticket = m.Id_Ticket - JOIN Consignatarios o ON o.Id_Consigna = t.Id_Consigna - WHERE NOT s.is_buy; - - SELECT * FROM tmp.aux; - - -- Limpia y confirma cambios - - DROP TEMPORARY TABLE - tmp.split, - tmp.aux; - - COMMIT; +CREATE DEFINER=`root`@`%` PROCEDURE `buy_split`(IN `v_buy` INT, IN `v_fv_entry` INT, IN `v_pca_entry` INT) +BEGIN + DECLARE v_item INT; + DECLARE v_packing INT; + DECLARE v_remaining INT; + DECLARE v_labels INT; + DECLARE v_remainder INT; + DECLARE v_is_buy INT; + DECLARE v_id INT; + DECLARE v_amount INT; + DECLARE v_done BOOL DEFAULT FALSE; + + DECLARE cur CURSOR FOR + SELECT TRUE, c.Id_Compra, c.Cantidad - IFNULL((c.Vida * c.Packing), 0) + FROM Compres c + JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada + JOIN travel t ON t.id = e.travel_id + WHERE c.Id_Article = v_item + AND t.shipment = CURDATE() AND t.warehouse_id_out IN (7, 40) + AND t.warehouse_id NOT IN (44, 1) + AND NOT e.redada AND NOT e.Inventario + AND IFNULL(c.Vida, 0) < c.Etiquetas + UNION ALL + SELECT FALSE, m.Id_Movimiento, m.Cantidad - IFNULL(l.stem, 0) + FROM Movimientos m + JOIN Tickets t ON t.Id_Ticket = m.Id_Ticket + LEFT JOIN movement_label l ON l.Id_Movimiento = m.Id_Movimiento + WHERE m.Id_Article = v_item + AND t.Fecha = CURDATE() AND t.warehouse_id IN (7, 40) + AND NOT t.Etiquetasemitidas + AND IFNULL(l.stem, 0) < m.Cantidad + LOCK IN SHARE MODE; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET v_done = TRUE; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + START TRANSACTION; + + -- Obtiene los datos de la compra + + SELECT Id_Article, Packing, Cantidad + INTO v_item, v_packing, v_remaining + FROM Compres WHERE Id_Compra = v_buy; + + -- Crea splits de los tickets + + DROP TEMPORARY TABLE IF EXISTS tmp.split; + CREATE TEMPORARY TABLE tmp.split + ( + is_buy BOOL, + id INT, + labels INT, + remainder INT + ) + ENGINE = MEMORY; + + OPEN cur; + + l: LOOP + SET v_done = FALSE; + FETCH cur INTO v_is_buy, v_id, v_amount; + + IF v_done OR v_remaining = 0 THEN + LEAVE l; + END IF; + + SET v_amount = LEAST(v_amount, v_remaining); + SET v_remaining = v_remaining - v_amount; + SET v_labels = v_amount DIV v_packing; + + INSERT INTO tmp.split + VALUES (v_is_buy, v_id, v_labels, v_amount % v_packing); + + IF v_is_buy + THEN + UPDATE Compres + SET Vida = Vida + v_labels + WHERE Id_Compra = v_id; + ELSE + INSERT INTO movement_label + SET + Id_Movimiento = v_id, + stem = v_amount, + label = v_labels + ON DUPLICATE KEY UPDATE + stem = stem + VALUES(stem), + label = label + VALUES(label); + END IF; + END LOOP; + + CLOSE cur; + + -- Crea los movimientos de almacén a silla + + CALL buy_transfer (v_buy, v_fv_entry, v_pca_entry); + + UPDATE Compres SET dispatched = Vida * Packing + WHERE Id_Compra = v_buy; + + -- Devuelve los splits creados + + DROP TEMPORARY TABLE IF EXISTS tmp.aux; + CREATE TEMPORARY TABLE tmp.aux + ENGINE = MEMORY + SELECT s.labels, s.remainder, w.`name` destination, + a.Id_Article, a.Article, a.Medida + FROM tmp.split s + JOIN Compres c ON c.Id_Compra = s.id + JOIN Articles a ON a.Id_Article = c.Id_Article + JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada + JOIN travel t ON t.id = e.travel_id + JOIN warehouse w ON t.warehouse_id = w.id + WHERE s.is_buy; + + INSERT INTO tmp.aux + SELECT s.labels, s.remainder, o.Consignatario, + a.Id_Article, a.Article, a.Medida + FROM tmp.split s + JOIN Movimientos m ON m.Id_Movimiento = s.id + JOIN Articles a ON a.Id_Article = m.Id_Article + JOIN Tickets t ON t.Id_Ticket = m.Id_Ticket + JOIN Consignatarios o ON o.Id_Consigna = t.Id_Consigna + WHERE NOT s.is_buy; + + SELECT * FROM tmp.aux; + + -- Limpia y confirma cambios + + DROP TEMPORARY TABLE + tmp.split, + tmp.aux; + + COMMIT; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -21107,68 +21121,133 @@ BEGIN CALL buy_tarifas_table(idENTRADA); - SELECT AG.m3 * sum( etiquetas * IFNULL(((AG.m3 * cm3_2(C.Id_Cubo, C.Id_Article)) / 1000000) ,0) ) / - sum(etiquetas * IFNULL(((AG.m3 * ( A.density / 167 ) * cm3_2(C.Id_Cubo, C.Id_Article)) / 1000000) ,0)) INTO m3i - FROM Compres C - JOIN Articles A USING(Id_Article) - JOIN Entradas E USING(Id_Entrada) - JOIN Tipos TP USING(tipo_id) - JOIN travel TR ON TR.id = E.travel_id - JOIN Agencias AG ON TR.agency_id = AG.Id_Agencia - WHERE E.Id_Entrada = idENTRADA; - - - UPDATE Compres C - LEFT JOIN Cubos CB USING(Id_Cubo) - JOIN Articles A USING(Id_Article) - JOIN Entradas E USING(Id_Entrada) - LEFT JOIN recibida_entrada re on E.Id_Entrada = re.Id_Entrada - LEFT JOIN awb_recibida ar ON re.awb_recibida = ar.recibida_id - LEFT JOIN v_awb_volumen va ON va.awb_id = ar.awb_id - JOIN Tipos TP USING(tipo_id) - JOIN travel TR ON TR.id = E.travel_id - JOIN Agencias AG ON TR.agency_id = AG.Id_Agencia - JOIN tblTARIFAS TC + LEFT JOIN Cubos CB USING(Id_Cubo) + JOIN Articles A USING(Id_Article) + JOIN Entradas E USING(Id_Entrada) + LEFT JOIN vn.duaEntry de on E.Id_Entrada = de.entryFk + LEFT JOIN vn.dua d ON d.id = de.duaFk + LEFT JOIN v_awb_volumen va ON va.awb_id = d.awbFk + JOIN Tipos TP USING(tipo_id) + JOIN travel TR ON TR.id = E.travel_id + JOIN Agencias AG ON TR.agency_id = AG.Id_Agencia + JOIN tblTARIFAS TC - SET C.Portefijo = @PF:= - IF (va.importe, + SET C.Portefijo = @PF:= + IF (va.importe, - round((va.importe * A.density * CM3_2(C.Id_Cubo, C.Id_Article) / 1000) / (va.Vol_Total * 167 * C.Packing ),3), - - ROUND(IFNULL(((AG.m3 * @cm3:= cm3_2(C.Id_Cubo, C.Id_Article)) / 1000000) / C.Packing,0),3) - ), + round((va.importe * A.density * CM3_2(C.Id_Cubo, C.Id_Article) / 1000) / (va.Vol_Total * 167 * C.Packing ),3), + + ROUND(IFNULL(((AG.m3 * @cm3:= cm3_2(C.Id_Cubo, C.Id_Article)) / 1000000) / C.Packing,0),3) + ), - C.Comisionfija = @CF:= ROUND(IFNULL(E.comision * C.Costefijo / 100,0),3), + C.Comisionfija = @CF:= ROUND(IFNULL(E.comision * C.Costefijo / 100,0),3), - C.Embalajefijo = @EF:= IF(CB.Retornable != 0, 0, ROUND(IFNULL( CB.Valor / C.Packing ,0),3)), + C.Embalajefijo = @EF:= IF(CB.Retornable != 0, 0, ROUND(IFNULL( CB.Valor / C.Packing ,0),3)), - C.Tarifa3 = @t3:= IF(TC.t3 = 0, C.Costefijo,ROUND((C.Costefijo + @CF + @EF + @PF) / ((100 - TC.t3 - TP.promo ) /100) ,2)), -- He añadido que el coste sea igual a tarifa3 si t3 = 0 + C.Tarifa3 = @t3:= IF(TC.t3 = 0, C.Costefijo,ROUND((C.Costefijo + @CF + @EF + @PF) / ((100 - TC.t3 - TP.promo ) /100) ,2)), -- He añadido que el coste sea igual a tarifa3 si t3 = 0 - C.Tarifa2 = @t2:= round(@t3 * (1 + ( (TC.t2 - TC.t3)/100)),2), + C.Tarifa2 = @t2:= round(@t3 * (1 + ( (TC.t2 - TC.t3)/100)),2), - C.Tarifa2 = @t2:= IF(@t2 <= @t3, @t3 , @t2) - - WHERE C.Id_Entrada = idENTRADA ; + C.Tarifa2 = @t2:= IF(@t2 <= @t3, @t3 , @t2) + WHERE C.Id_Entrada = idENTRADA; CASE wh_id WHEN 41 THEN -- Canarias - UPDATE Compres - SET Tarifa2 = Tarifa3 - WHERE Id_Entrada = idENTRADA; - ELSE + UPDATE Compres + SET Tarifa2 = Tarifa3 + WHERE Id_Entrada = idENTRADA; + ELSE - BEGIN - END; + BEGIN + END; END CASE; -- priceBuilder call buy_tarifas_priceBuilder_Entry(idENTRADA); +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 `buy_tarifas_entryTest` */; +/*!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`@`localhost` PROCEDURE `buy_tarifas_entryTest`(IN entryFk INT(11)) +BEGIN + DECLARE datINV DATE; + DECLARE wh_id INT; + DECLARE m3i INTEGER; + + + SELECT warehouse_id INTO wh_id + FROM Entradas + JOIN travel ON travel.id = travel_id + WHERE Id_Entrada = entryFk; + + CALL buy_tarifas_table(entryFk); + + UPDATE Compres C + LEFT JOIN Cubos CB USING(Id_Cubo) + JOIN Articles A USING(Id_Article) + JOIN Entradas E USING(Id_Entrada) + LEFT JOIN vn.duaEntry de on E.Id_Entrada = de.entryFk + LEFT JOIN vn.dua d ON d.id = de.duaFk + LEFT JOIN v_awb_volumen va ON va.awb_id = d.awbFk + JOIN Tipos TP USING(tipo_id) + JOIN travel TR ON TR.id = E.travel_id + JOIN Agencias AG ON TR.agency_id = AG.Id_Agencia + JOIN tblTARIFAS TC + + SET C.Portefijo = @PF:= + IF (va.importe, + + round((va.importe * A.density * CM3_2(C.Id_Cubo, C.Id_Article) / 1000) / (va.Vol_Total * 167 * C.Packing ),3), + + ROUND(IFNULL(((AG.m3 * @cm3:= cm3_2(C.Id_Cubo, C.Id_Article)) / 1000000) / C.Packing,0),3) + ), + + C.Comisionfija = @CF:= ROUND(IFNULL(E.comision * C.Costefijo / 100,0),3), + + C.Embalajefijo = @EF:= IF(CB.Retornable != 0, 0, ROUND(IFNULL( CB.Valor / C.Packing ,0),3)), + + C.Tarifa3 = @t3:= IF(TC.t3 = 0, C.Costefijo,ROUND((C.Costefijo + @CF + @EF + @PF) / ((100 - TC.t3 - TP.promo ) /100) ,2)), -- He añadido que el coste sea igual a tarifa3 si t3 = 0 + + C.Tarifa2 = @t2:= round(@t3 * (1 + ( (TC.t2 - TC.t3)/100)),2), + + C.Tarifa2 = @t2:= IF(@t2 <= @t3, @t3 , @t2) + + WHERE C.Id_Entrada = entryFk; + + CASE wh_id + + WHEN 41 THEN -- Canarias + + UPDATE Compres + SET Tarifa2 = Tarifa3 + WHERE Id_Entrada = entryFk; + ELSE + + BEGIN + END; + + END CASE; + + -- priceBuilder + call buy_tarifas_priceBuilder_Entry(entryFk); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -23559,7 +23638,7 @@ BEGIN ( 'CREATE TEMPORARY TABLE tmp.comparative ENGINE = MEMORY SELECT - an.nicho, p.name Productor, C.Packing, C.Costefijo, C.caja + an.nicho, p.name Productor, C.Packing, A.lastPrice AS CosteFijo, C.caja ,A.Color, Id_Tipo as Tipo,A.tipo_id, o.Abreviatura as Origen, A.Categoria ,A.Tallos, A.Medida, A.Article, TR.CodigoTrabajador @@ -24418,7 +24497,7 @@ ADD KEY bp_Id_Ticket_ix (Id_Ticket); drop temporary table if exists tmp.shipping_porte; create temporary table tmp.shipping_porte -select Id_Ticket, shipping_charge from vn2008.v_expeditions_shipping_charge2 where Fecha >= datFEC group by Id_Ticket; +select Id_Ticket, SUM(shipping_charge) from vn2008.v_expeditions_shipping_charge2 where Fecha >= datFEC group by Id_Ticket; ALTER TABLE tmp.shipping_porte ADD KEY sp_Id_Ticket_ix (Id_Ticket); @@ -25652,148 +25731,148 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `F5`(IN idT BIGINT) -BEGIN -SELECT C.calidad, - LEFT(Article, 4) as Subtipo, - barcode, - 'ASEGURADO' AS asegurado, -/*CASE A.tipo_id -WHEN 75 THEN IF(M.Id_Article IN (120,2388,20100,16,10,130,104851,1,56,238,104850,104849,2),'RAMAJE',R.Reino) -WHEN 68 THEN IF(M.Id_Article IN (11539,10,14),'RAMAJE',R.Reino) -WHEN 69 THEN IF(M.Id_Article IN (41),'RAMAJE',R.Reino) -WHEN 72 THEN IF(M.Id_Article IN (238),'RAMAJE',R.Reino) -WHEN 2 THEN 'CYMBIDIUMS & ANTHURIUMS' -WHEN 122 THEN 'CYMBIDIUMS & ANTHURIUMS' -WHEN 12 THEN 'CYMBIDIUMS & ANTHURIUMS' -WHEN 13 THEN 'CYMBIDIUMS & ANTHURIUMS' -WHEN 14 THEN 'CYMBIDIUMS & ANTHURIUMS' -WHEN 15 THEN 'CYMBIDIUMS & ANTHURIUMS' -WHEN 71 THEN IF(LEFT(Article,2) = 'HC','Flor',R.Reino) -WHEN 19 THEN IF(LEFT(Article,3) IN ('HEL','GIN'),'CYMBIDIUMS & ANTHURIUMS',R.Reino) -WHEN 70 THEN IF(Article like '%red beauty%' or Article like '%clarinervium%','CYMBIDIUMS & ANTHURIUMS',R.Reino) -WHEN 86 THEN 'Flor' -ELSE R.Reino -END as*/ Reino, - /* -CASE A.tipo_id -WHEN 75 THEN IF(M.Id_Article IN (120,2388,20100,16,10,130,104851,1,56,238,104850,104849,2),-1,R.orden) -WHEN 68 THEN IF(M.Id_Article IN (11539,10,14),-1,R.orden) -WHEN 69 THEN IF(M.Id_Article IN (41),-1,R.orden) -WHEN 72 THEN IF(M.Id_Article IN (238),-1,R.orden) -WHEN 2 THEN 0 -WHEN 122 THEN 0 -WHEN 12 THEN 0 -WHEN 13 THEN 0 -WHEN 14 THEN 0 -WHEN 15 THEN 0 -WHEN 71 THEN IF(LEFT(Article,2) = 'HC',1,R.orden) -WHEN 19 THEN IF(LEFT(Article,3) IN ('HEL','GIN'),0,R.orden) -WHEN 70 THEN IF(Article like '%red beauty%' or Article like '%clarinervium%',0,R.orden) -WHEN 86 THEN 1 -ELSE R.orden -END as*/R.orden, - CS.Consignatario, - T.Id_Cliente, - NULL AS Id_Trabajador, - T.Id_Ticket, - T.Fecha, - M.Id_Article, - M.Cantidad, - M.quantity, - M.Cantidad / IF(nz(Gro.Grouping) = 0,1,nz(Gro.Grouping)) as Paquetes, - IF(sis.vHasBeenPrepared, CONCAT(' ----- PREPARADO ----- ', M.Concepte), M.Concepte) as Concepte, - A.Medida, - A.Color, - A.Categoria, - O.Abreviatura as Origen, - T.Localizacion, - CT.CodigoTrabajador as Vendedor, - T.Bultos, - T.Observaciones, - Ag.Agencia Tipo, - NULL AS CodigoTrabajador, - M.OK, - M.Reservado, - A.Tallos, - Gro.Grouping, - IF(`transaction`,right(concat('000000' ,M.Id_Article),6),M.Id_Movimiento) Id_Movimiento, - IF(sis.vHasBeenPrepared,'RES',an.Nicho) as Nicho, - 'PEDIDO ASEGURADO' AS MSG, - T.Id_Ruta, - RT.Id_Vehiculo, - observation_type_id, - group_concat(IF(observation_type_id = 1,text,'') SEPARATOR '') 'sacador', - group_concat(IF(observation_type_id = 2,text,'') SEPARATOR '') 'encajador', - A.Foto, - M.Id_Movimiento movement_id, - lpad(IF(sis.vHasBeenPrepared,99999,ifnull(cooler_path_detail_id, an.Nicho)),5,'0') as path, - M.Descuento,M.Preu, mm.valor as Preparado, mm.original_quantity - , p.`name` producer, - T.warehouse_id, - ST.id as idStowaway, - STP.shipFk as isStowaway, - CS.POBLACION -- JGF 2016-02-16 -FROM - - Tickets T - LEFT JOIN Movimientos M USING(Id_Ticket) - LEFT JOIN (SELECT DISTINCT saleFk, TRUE as vHasBeenPrepared - FROM vn.saleItemShelving sis - JOIN vn.sale s ON s.id = sis.saleFk - WHERE s.ticketFk = idT - AND sis.quantity > 0 - ) sis ON sis.saleFk = M.Id_Movimiento - LEFT JOIN Articles A on A.Id_Article = M.Id_Article - LEFT JOIN Articles_nicho an ON A.Id_Article = an.Id_Article AND an.warehouse_id = T.warehouse_id - LEFT JOIN producer p on p.producer_id = A.producer_id -- JGF 2016-02-16 - LEFT JOIN cooler_path_detail c on left(an.Nicho,3) = pasillo - LEFT JOIN Origen O ON A.id_origen = O.id - LEFT JOIN Clientes C USING(Id_Cliente) - LEFT JOIN Trabajadores CT ON C.Id_Trabajador = CT.Id_Trabajador - INNER JOIN Consignatarios CS ON T.Id_Consigna = CS.Id_Consigna - INNER JOIN Agencias Ag ON Ag.Id_Agencia = T.Id_Agencia - LEFT JOIN ( - SELECT Id_Article, code as barcode - FROM barcodes - GROUP BY Id_Article - ) BC ON BC.Id_Article = A.Id_Article - LEFT JOIN Tipos TP USING(tipo_id) - LEFT JOIN reinos R ON TP.reino_id = R.id - LEFT JOIN Rutas RT USING(Id_Ruta) - LEFT JOIN ticket_observation tobs ON T.Id_Ticket = tobs.Id_ticket - AND (tobs.observation_type_id = 1 or tobs.observation_type_id = 2) - - LEFT JOIN ( - SELECT Id_Article, Grouping - FROM ( - SELECT landing, Id_Article, CASE caja - WHEN 0 THEN 1 - WHEN 2 THEN Packing - ELSE Grouping - END as Grouping - FROM Compres C - JOIN Entradas E USING(Id_Entrada) - JOIN travel TR ON TR.id = travel_id - WHERE warehouse_id = (SELECT warehouse_id FROM Tickets WHERE Id_Ticket = idT) - AND landing between (SELECT FechaInventario FROM tblContadores LIMIT 1) AND (SELECT date(Fecha) FROM Tickets WHERE Id_Ticket = idT) - ORDER BY landing DESC - ) GR1 - GROUP BY Id_Article - - ) Gro ON Gro.Id_Article = M.Id_Article - LEFT JOIN Movimientos_mark mm ON mm.Id_Movimiento = M.Id_Movimiento - LEFT JOIN vn.stowaway ST ON ST.shipFk = idT - LEFT JOIN vn.stowaway STP on STP.id = idT - - WHERE T.Id_Ticket = idT - group by M.Id_Movimiento; +CREATE DEFINER=`root`@`%` PROCEDURE `F5`(IN `idT` BIGINT) +BEGIN +SELECT C.calidad, + LEFT(Article, 4) as Subtipo, + barcode, + 'ASEGURADO' AS asegurado, +/*CASE A.tipo_id +WHEN 75 THEN IF(M.Id_Article IN (120,2388,20100,16,10,130,104851,1,56,238,104850,104849,2),'RAMAJE',R.Reino) +WHEN 68 THEN IF(M.Id_Article IN (11539,10,14),'RAMAJE',R.Reino) +WHEN 69 THEN IF(M.Id_Article IN (41),'RAMAJE',R.Reino) +WHEN 72 THEN IF(M.Id_Article IN (238),'RAMAJE',R.Reino) +WHEN 2 THEN 'CYMBIDIUMS & ANTHURIUMS' +WHEN 122 THEN 'CYMBIDIUMS & ANTHURIUMS' +WHEN 12 THEN 'CYMBIDIUMS & ANTHURIUMS' +WHEN 13 THEN 'CYMBIDIUMS & ANTHURIUMS' +WHEN 14 THEN 'CYMBIDIUMS & ANTHURIUMS' +WHEN 15 THEN 'CYMBIDIUMS & ANTHURIUMS' +WHEN 71 THEN IF(LEFT(Article,2) = 'HC','Flor',R.Reino) +WHEN 19 THEN IF(LEFT(Article,3) IN ('HEL','GIN'),'CYMBIDIUMS & ANTHURIUMS',R.Reino) +WHEN 70 THEN IF(Article like '%red beauty%' or Article like '%clarinervium%','CYMBIDIUMS & ANTHURIUMS',R.Reino) +WHEN 86 THEN 'Flor' +ELSE R.Reino +END as*/ Reino, + /* +CASE A.tipo_id +WHEN 75 THEN IF(M.Id_Article IN (120,2388,20100,16,10,130,104851,1,56,238,104850,104849,2),-1,R.orden) +WHEN 68 THEN IF(M.Id_Article IN (11539,10,14),-1,R.orden) +WHEN 69 THEN IF(M.Id_Article IN (41),-1,R.orden) +WHEN 72 THEN IF(M.Id_Article IN (238),-1,R.orden) +WHEN 2 THEN 0 +WHEN 122 THEN 0 +WHEN 12 THEN 0 +WHEN 13 THEN 0 +WHEN 14 THEN 0 +WHEN 15 THEN 0 +WHEN 71 THEN IF(LEFT(Article,2) = 'HC',1,R.orden) +WHEN 19 THEN IF(LEFT(Article,3) IN ('HEL','GIN'),0,R.orden) +WHEN 70 THEN IF(Article like '%red beauty%' or Article like '%clarinervium%',0,R.orden) +WHEN 86 THEN 1 +ELSE R.orden +END as*/R.orden, + CS.Consignatario, + T.Id_Cliente, + NULL AS Id_Trabajador, + T.Id_Ticket, + T.Fecha, + M.Id_Article, + M.Cantidad, + M.quantity, + M.Cantidad / IF(nz(Gro.Grouping) = 0,1,nz(Gro.Grouping)) as Paquetes, + IF(sis.vHasBeenPrepared, CONCAT(' ----- PREPARADO ----- ', M.Concepte), M.Concepte) as Concepte, + A.Medida, + A.Color, + A.Categoria, + O.Abreviatura as Origen, + T.Localizacion, + CT.CodigoTrabajador as Vendedor, + T.Bultos, + T.Observaciones, + Ag.Agencia Tipo, + NULL AS CodigoTrabajador, + M.OK, + M.Reservado, + A.Tallos, + Gro.Grouping, + IF(`transaction`,right(concat('000000' ,M.Id_Article),6),M.Id_Movimiento) Id_Movimiento, + IF(sis.vHasBeenPrepared,'RES',an.Nicho) as Nicho, + 'PEDIDO ASEGURADO' AS MSG, + T.Id_Ruta, + RT.Id_Vehiculo, + observation_type_id, + group_concat(IF(observation_type_id = 1,text,'') SEPARATOR '') 'sacador', + group_concat(IF(observation_type_id = 2,text,'') SEPARATOR '') 'encajador', + A.Foto, + M.Id_Movimiento movement_id, + lpad(IF(sis.vHasBeenPrepared,99999,ifnull(cooler_path_detail_id, an.Nicho)),5,'0') as path, + M.Descuento,M.Preu, mm.valor as Preparado, mm.original_quantity + , p.`name` producer, + T.warehouse_id, + ST.id as idStowaway, + STP.shipFk as isStowaway, + CS.POBLACION -- JGF 2016-02-16 +FROM + + Tickets T + LEFT JOIN Movimientos M USING(Id_Ticket) + LEFT JOIN (SELECT DISTINCT saleFk, TRUE as vHasBeenPrepared + FROM vn.saleItemShelving sis + JOIN vn.sale s ON s.id = sis.saleFk + WHERE s.ticketFk = idT + AND sis.quantity > 0 + ) sis ON sis.saleFk = M.Id_Movimiento + LEFT JOIN Articles A on A.Id_Article = M.Id_Article + LEFT JOIN Articles_nicho an ON A.Id_Article = an.Id_Article AND an.warehouse_id = T.warehouse_id + LEFT JOIN producer p on p.producer_id = A.producer_id -- JGF 2016-02-16 + LEFT JOIN cooler_path_detail c on left(an.Nicho,3) = pasillo + LEFT JOIN Origen O ON A.id_origen = O.id + LEFT JOIN Clientes C USING(Id_Cliente) + LEFT JOIN Trabajadores CT ON C.Id_Trabajador = CT.Id_Trabajador + INNER JOIN Consignatarios CS ON T.Id_Consigna = CS.Id_Consigna + INNER JOIN Agencias Ag ON Ag.Id_Agencia = T.Id_Agencia + LEFT JOIN ( + SELECT Id_Article, code as barcode + FROM barcodes + GROUP BY Id_Article + ) BC ON BC.Id_Article = A.Id_Article + LEFT JOIN Tipos TP USING(tipo_id) + LEFT JOIN reinos R ON TP.reino_id = R.id + LEFT JOIN Rutas RT USING(Id_Ruta) + LEFT JOIN ticket_observation tobs ON T.Id_Ticket = tobs.Id_ticket + AND (tobs.observation_type_id = 1 or tobs.observation_type_id = 2) + + LEFT JOIN ( + SELECT Id_Article, `Grouping` + FROM ( + SELECT landing, Id_Article, CASE caja + WHEN 0 THEN 1 + WHEN 2 THEN Packing + ELSE `Grouping` + END as `Grouping` + FROM Compres C + JOIN Entradas E USING(Id_Entrada) + JOIN travel TR ON TR.id = travel_id + WHERE warehouse_id = (SELECT warehouse_id FROM Tickets WHERE Id_Ticket = idT) + AND landing between (SELECT FechaInventario FROM tblContadores LIMIT 1) AND (SELECT date(Fecha) FROM Tickets WHERE Id_Ticket = idT) + ORDER BY landing DESC + ) GR1 + GROUP BY Id_Article + + ) Gro ON Gro.Id_Article = M.Id_Article + LEFT JOIN Movimientos_mark mm ON mm.Id_Movimiento = M.Id_Movimiento + LEFT JOIN vn.stowaway ST ON ST.shipFk = idT + LEFT JOIN vn.stowaway STP on STP.id = idT + + WHERE T.Id_Ticket = idT + group by M.Id_Movimiento; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -28842,70 +28921,66 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `item_catalog`( - v_wh INT - ,v_date DATE - ,v_customer INT -) -BEGIN - DECLARE v_cache SMALLINT; - - CALL item_cache (v_cache, 'a', v_wh, v_date); - - DROP TEMPORARY TABLE IF EXISTS item_catalog; - - CREATE TEMPORARY TABLE item_catalog - (KEY (item_id)) - ENGINE = MEMORY - SELECT - b.item_id - ,b.available - ,b.fixed - ,IFNULL(p.PrecioEspecial,( - CASE c.Descuento - WHEN 0 THEN b.rate_0 - WHEN 1 THEN b.rate_1 - WHEN 2 THEN b.rate_2 - WHEN 3 THEN b.rate_3 - ELSE NULL - END - )) AS price - ,be.S1 s1 - ,be.S2 s2 - ,0 discount - ,CASE co.caja WHEN 0 THEN 1 WHEN 2 THEN co.packing ELSE co.grouping END AS grouping - FROM cache_a b - JOIN Clientes c - ON c.Id_cliente = v_customer - JOIN Articles a - ON a.Id_Article = b.item_id - JOIN Tipos t - ON t.tipo_id = a.tipo_id - JOIN reinos r - ON r.id = t.reino_id - JOIN Compres co - ON co.Id_Compra = b.buy_id - LEFT JOIN buy_edi be - ON be.id = co.buy_edi_id - LEFT JOIN PreciosEspeciales p - ON p.Id_Cliente = v_customer AND b.item_id = p.Id_Article - WHERE b.available > 0 AND b.cache_id = v_cache; - -- ON be.compra_id = co.compra_id - -- Cliente Te gustan las flores - - IF NOT v_customer = 3064 - THEN - DELETE c - FROM item_catalog c - JOIN Articles ON item_id = Id_Article - WHERE tipo_id = 105; - END IF; +CREATE DEFINER=`root`@`%` PROCEDURE `item_catalog`(IN `v_wh` INT, IN `v_date` DATE, IN `v_customer` INT) +BEGIN + DECLARE v_cache SMALLINT; + + CALL item_cache (v_cache, 'a', v_wh, v_date); + + DROP TEMPORARY TABLE IF EXISTS item_catalog; + + CREATE TEMPORARY TABLE item_catalog + (KEY (item_id)) + ENGINE = MEMORY + SELECT + b.item_id + ,b.available + ,b.fixed + ,IFNULL(p.PrecioEspecial,( + CASE c.Descuento + WHEN 0 THEN b.rate_0 + WHEN 1 THEN b.rate_1 + WHEN 2 THEN b.rate_2 + WHEN 3 THEN b.rate_3 + ELSE NULL + END + )) AS price + ,be.S1 s1 + ,be.S2 s2 + ,0 discount + ,CASE co.caja WHEN 0 THEN 1 WHEN 2 THEN co.packing ELSE co.grouping END AS `grouping` + FROM cache_a b + JOIN Clientes c + ON c.Id_cliente = v_customer + JOIN Articles a + ON a.Id_Article = b.item_id + JOIN Tipos t + ON t.tipo_id = a.tipo_id + JOIN reinos r + ON r.id = t.reino_id + JOIN Compres co + ON co.Id_Compra = b.buy_id + LEFT JOIN buy_edi be + ON be.id = co.buy_edi_id + LEFT JOIN PreciosEspeciales p + ON p.Id_Cliente = v_customer AND b.item_id = p.Id_Article + WHERE b.available > 0 AND b.cache_id = v_cache; + -- ON be.compra_id = co.compra_id + -- Cliente Te gustan las flores + + IF NOT v_customer = 3064 + THEN + DELETE c + FROM item_catalog c + JOIN Articles ON item_id = Id_Article + WHERE tipo_id = 105; + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31663,12 +31738,19 @@ BEGIN -- Código 100 + INSERT INTO tmp.buffer_problems(Id_Ticket, problem) + SELECT DISTINCT tt.Id_Ticket, 'COD 100' + FROM tmp.ticket_list tt + JOIN vn.ticketRequest tr on tr.ticketFk = tt.Id_Ticket + WHERE tr.isOK IS NULL; + + /* INSERT INTO tmp.buffer_problems(Id_Ticket, problem) SELECT DISTINCT tt.Id_Ticket, 'COD 100' FROM tmp.ticket_list tt JOIN Movimientos m on m.Id_Ticket = tt.Id_Ticket WHERE Id_Article = 100; - +*/ -- Congelado INSERT INTO tmp.buffer_problems(Id_Ticket, problem) @@ -31717,7 +31799,7 @@ 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 `production_buffer_problemsOptimizado` */; +/*!50003 DROP PROCEDURE IF EXISTS `production_buffer_problemsOptimizadokk` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -31727,7 +31809,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `production_buffer_problemsOptimizado`() +CREATE DEFINER=`root`@`%` PROCEDURE `production_buffer_problemsOptimizadokk`() BEGIN /* * Necesita la tabla tmp.ticket_list @@ -39802,87 +39884,87 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ubicator_test`(IN i_wh TINYINT, IN d_fecha DATE,IN filtro VARCHAR(255)) -BEGIN - - - DECLARE date_inv DATE; - - -DROP TEMPORARY TABLE IF EXISTS stock_actual; -DROP TEMPORARY TABLE IF EXISTS vn2008.tmp_ubicator_stock; - - -SELECT FechaInventario INTO date_inv - FROM tblContadores LIMIT 1; - - -CREATE TEMPORARY TABLE stock_actual -SELECT Id_Article article_id,SUM(Cantidad) amount FROM ( - SELECT Id_Article,Cantidad - FROM Compres c - JOIN Entradas e USING(Id_Entrada) - JOIN travel t ON t.id = e.travel_id - WHERE landing BETWEEN date_inv AND d_fecha - AND warehouse_id = i_wh AND NOT Redada - - UNION ALL - - SELECT Id_Article,-Cantidad - FROM Compres c - JOIN Entradas e USING(Id_Entrada) - JOIN travel t ON t.id = e.travel_id - WHERE shipment BETWEEN date_inv AND timestampadd(DAY,-1,d_fecha) - AND warehouse_id_out = i_wh AND NOT Redada - - UNION ALL - - SELECT Id_Article, -Cantidad - FROM Movimientos m - JOIN Tickets t USING(Id_Ticket) - WHERE Fecha BETWEEN date_inv AND timestampadd(DAY,-1,d_fecha) - AND warehouse_id = i_wh - - - -) t GROUP BY article_id; - -/* -SELECT * from stock_actual;*/ - --- TEMPORARY -CALL util.exec (sql_printf(' - CREATE TEMPORARY TABLE IF NOT EXISTS vn2008.tmp_ubicator_stock AS - SELECT A.Id_Article,A.Article, T.Id_Cubo,IF(Z > 0,Z,0) as z,x,y, - CEIL(S.Suma/T.grouping) as etiquetas,A.Medida,A.Nicho - FROM vn2008.Articles A - INNER JOIN - (SELECT article_id, amount as SUMA - FROM vn2008.stock_actual - WHERE amount > 0 - ) as S ON S.article_id = A.Id_Article - LEFT JOIN ( - SELECT * FROM ( - SELECT c.Id_Article item_id, c.Id_Compra id, c.Id_Cubo,c.grouping - FROM vn2008.Compres c INNER JOIN vn2008.Entradas e USING(Id_Entrada) - INNER JOIN vn2008.travel t ON t.id = e.travel_id - WHERE t.landing BETWEEN vn2008.date_inv() AND CURDATE() - AND c.Novincular = FALSE - AND c.Tarifa2 >= 0 AND Id_Cubo IS NOT NULL - ORDER BY 1 = t.warehouse_id DESC, t.landing DESC - ) t1 GROUP BY item_id - ) as T ON T.item_id = A.Id_Article - LEFT JOIN vn2008.Cubos C USING(Id_Cubo) - WHERE %s AND CEIL(S.Suma/T.grouping) > 0',filtro)); - - - +CREATE DEFINER=`root`@`%` PROCEDURE `ubicator_test`(IN `i_wh` TINYINT, IN `d_fecha` DATE, IN `filtro` VARCHAR(255)) +BEGIN + + + DECLARE date_inv DATE; + + +DROP TEMPORARY TABLE IF EXISTS stock_actual; +DROP TEMPORARY TABLE IF EXISTS vn2008.tmp_ubicator_stock; + + +SELECT FechaInventario INTO date_inv + FROM tblContadores LIMIT 1; + + +CREATE TEMPORARY TABLE stock_actual +SELECT Id_Article article_id,SUM(Cantidad) amount FROM ( + SELECT Id_Article,Cantidad + FROM Compres c + JOIN Entradas e USING(Id_Entrada) + JOIN travel t ON t.id = e.travel_id + WHERE landing BETWEEN date_inv AND d_fecha + AND warehouse_id = i_wh AND NOT Redada + + UNION ALL + + SELECT Id_Article,-Cantidad + FROM Compres c + JOIN Entradas e USING(Id_Entrada) + JOIN travel t ON t.id = e.travel_id + WHERE shipment BETWEEN date_inv AND timestampadd(DAY,-1,d_fecha) + AND warehouse_id_out = i_wh AND NOT Redada + + UNION ALL + + SELECT Id_Article, -Cantidad + FROM Movimientos m + JOIN Tickets t USING(Id_Ticket) + WHERE Fecha BETWEEN date_inv AND timestampadd(DAY,-1,d_fecha) + AND warehouse_id = i_wh + + + +) t GROUP BY article_id; + +/* +SELECT * from stock_actual;*/ + +-- TEMPORARY +CALL util.exec (sql_printf(' + CREATE TEMPORARY TABLE IF NOT EXISTS vn2008.tmp_ubicator_stock AS + SELECT A.Id_Article,A.Article, T.Id_Cubo,IF(Z > 0,Z,0) as z,x,y, + CEIL(S.Suma/T.grouping) as etiquetas,A.Medida,A.Nicho + FROM vn2008.Articles A + INNER JOIN + (SELECT article_id, amount as SUMA + FROM vn2008.stock_actual + WHERE amount > 0 + ) as S ON S.article_id = A.Id_Article + LEFT JOIN ( + SELECT * FROM ( + SELECT c.Id_Article item_id, c.Id_Compra id, c.Id_Cubo,c.`grouping` + FROM vn2008.Compres c INNER JOIN vn2008.Entradas e USING(Id_Entrada) + INNER JOIN vn2008.travel t ON t.id = e.travel_id + WHERE t.landing BETWEEN vn2008.date_inv() AND CURDATE() + AND c.Novincular = FALSE + AND c.Tarifa2 >= 0 AND Id_Cubo IS NOT NULL + ORDER BY 1 = t.warehouse_id DESC, t.landing DESC + ) t1 GROUP BY item_id + ) as T ON T.item_id = A.Id_Article + LEFT JOIN vn2008.Cubos C USING(Id_Cubo) + WHERE %s AND CEIL(S.Suma/T.grouping) > 0',filtro)); + + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -41104,7 +41186,7 @@ CREATE TABLE `autoRadioLogCall` ( PRIMARY KEY (`id`), KEY `ticket_idx` (`ticketFk`), CONSTRAINT `ticket` FOREIGN KEY (`ticketFk`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=216 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=306 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41232,7 +41314,8 @@ SET character_set_client = utf8; 1 AS `ediSpecieFk`, 1 AS `countryFk`, 1 AS `restriction`, - 1 AS `description`*/; + 1 AS `description`, + 1 AS `isProtectedZone`*/; SET character_set_client = @saved_cs_client; -- @@ -41630,7 +41713,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=4110 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4111 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41704,7 +41787,7 @@ CREATE TABLE `clientLog` ( 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=191253 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=194129 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42144,7 +42227,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=3019 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3030 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 */ ; @@ -42189,7 +42272,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=2447 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalla los clientes que tienen seguro de credito'; +) ENGINE=InnoDB AUTO_INCREMENT=2482 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 */ ; @@ -42320,7 +42403,10 @@ SET character_set_client = utf8; 1 AS `id`, 1 AS `name`, 1 AS `fatherFk`, - 1 AS `isProduction`*/; + 1 AS `isProduction`, + 1 AS `lft`, + 1 AS `rgt`, + 1 AS `isSelected`*/; SET character_set_client = @saved_cs_client; -- @@ -42413,7 +42499,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=3646 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3678 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42454,7 +42540,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=5519 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=5610 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42474,7 +42560,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=4545 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=4578 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 */; -- @@ -42499,7 +42585,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=3906 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4096 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42595,7 +42681,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=112587 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=116120 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42608,6 +42694,7 @@ DROP TABLE IF EXISTS `envialiaAgency`; CREATE TABLE `envialiaAgency` ( `id` varchar(6) COLLATE utf8_unicode_ci NOT NULL, `route` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, + `agencyName` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -42628,7 +42715,7 @@ CREATE TABLE `envialiaCity` ( PRIMARY KEY (`id`), KEY `agencyFk` (`agencyFk`), KEY `postalCode` (`postalCode`) -) ENGINE=InnoDB AUTO_INCREMENT=527660 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=818150 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42643,7 +42730,7 @@ CREATE TABLE `envialiaConfig` ( `numBox` varchar(3) COLLATE utf8_unicode_ci DEFAULT '001' COMMENT 'cajas por envio', `startRange` bigint(25) DEFAULT NULL COMMENT 'Principio del rango que nos proporciona enviaría', `endRange` bigint(25) DEFAULT NULL COMMENT 'limite del rango que nos proporciona enviaría', - `cargoAgency` bigint(25) DEFAULT '4666' COMMENT 'numero de verdnatura dado por enviaría', + `cargoAgency` varchar(25) COLLATE utf8_unicode_ci DEFAULT '004666' COMMENT 'numero de verdnatura dado por enviaría', `actualNumber` bigint(25) DEFAULT NULL COMMENT 'Numero actual de etiquetas imprimidas , comprimido entre startRange y endRange, ', `isAlreadyNotified` int(1) NOT NULL DEFAULT '0' COMMENT 'Booleano para que el evento vn.envialiaRangeChecker compruebe si se a enviado una notificación\n', `notificationThrehold` int(11) DEFAULT NULL COMMENT 'Umbral para avisar a enviaría de reseetar el startRange y endRange\nSe avisara a enviaría si el umbral + el actualNumber es superior a endRange\n', @@ -43040,7 +43127,7 @@ CREATE TABLE `inventoryFailure` ( CONSTRAINT `inventoryFailure_fk3` FOREIGN KEY (`guiltyFk`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `inventoryFailure_fk4` FOREIGN KEY (`warehouseFk`) REFERENCES `vn2008`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `inventoryFailure_fk5` FOREIGN KEY (`causeFk`) REFERENCES `inventoryFailureCause` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=5110 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=6066 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43311,7 +43398,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=97711 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=98057 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 */; -- @@ -43354,7 +43441,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=1036473 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1036853 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43405,7 +43492,8 @@ SET character_set_client = utf8; 1 AS `tag10`, 1 AS `value10`, 1 AS `minimum`, - 1 AS `upToDown`*/; + 1 AS `upToDown`, + 1 AS `lastPrice`*/; SET character_set_client = @saved_cs_client; -- @@ -43592,7 +43680,7 @@ CREATE TABLE `itemPlacementSupply` ( CONSTRAINT `itemPlacementSupply_fk1` FOREIGN KEY (`itemFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemPlacementSupply_fk2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemPlacementSupply_fk3` FOREIGN KEY (`repoUserFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=188 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de nichos de picking que hay que reponer'; +) ENGINE=InnoDB AUTO_INCREMENT=473 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de nichos de picking que hay que reponer'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43616,7 +43704,8 @@ SET character_set_client = utf8; 1 AS `subName`, 1 AS `size`, 1 AS `workerCode`, - 1 AS `repoCode`*/; + 1 AS `repoCode`, + 1 AS `parking`*/; SET character_set_client = @saved_cs_client; -- @@ -43663,7 +43752,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=53517 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla utilizada para localizar los artículos dentro de los carros. Usado para la gestión del almacén en el altillo '; +) ENGINE=InnoDB AUTO_INCREMENT=56846 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla utilizada para localizar los artículos dentro de los carros. Usado para la gestión del almacén en el altillo '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43737,7 +43826,7 @@ CREATE TABLE `itemShelvingPlacementSupply` ( KEY `itemShelvingPlacementSupply_fk3_idx` (`userFk`), CONSTRAINT `itemShelvingPlacementSupply_fk1` FOREIGN KEY (`itemShelvingFk`) REFERENCES `itemShelving` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemShelvingPlacementSupply_fk2` FOREIGN KEY (`itemPlacementSupplyFk`) REFERENCES `itemPlacementSupply` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de los itemShelving afectados por las ordenes de reposicion de nicho'; +) ENGINE=InnoDB AUTO_INCREMENT=213 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de los itemShelving afectados por las ordenes de reposicion de nicho'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43784,7 +43873,7 @@ CREATE TABLE `itemShelvingSale` ( CONSTRAINT `itemShelvingSale_fk1` FOREIGN KEY (`itemShelvingFk`) REFERENCES `itemShelving` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemShelvingSale_fk2` FOREIGN KEY (`saleFk`) REFERENCES `vn2008`.`Movimientos` (`Id_Movimiento`) ON UPDATE CASCADE, CONSTRAINT `itemShelvingSale_fk3` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle del producto que se retira de los carros, relacionando la linea de movimiento correspondiente'; +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle del producto que se retira de los carros, relacionando la linea de movimiento correspondiente'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43868,7 +43957,7 @@ CREATE TABLE `itemTag` ( KEY `priorityItem` (`priority`,`itemFk`), KEY `value` (`value`), CONSTRAINT `itemFK` FOREIGN KEY (`itemFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1037266 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1069550 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 */ ; @@ -43996,7 +44085,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=619499 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Define la clase de iva por artículo y pais'; +) ENGINE=InnoDB AUTO_INCREMENT=638708 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 */; -- @@ -44087,7 +44176,7 @@ CREATE TABLE `itemTypeTag` ( KEY `itemTypeTagTag_idx` (`tagFk`), CONSTRAINT `itemTypeTagTag` FOREIGN KEY (`tagFk`) REFERENCES `tag` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `itemTypeTagTipos` FOREIGN KEY (`itemTypeFk`) REFERENCES `vn2008`.`Tipos` (`tipo_id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=197 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=224 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44305,7 +44394,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=134 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=168 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44326,7 +44415,7 @@ CREATE TABLE `message` ( KEY `sender` (`sender`), KEY `recipient` (`recipient`), KEY `uuid` (`uuid`(8)) -) ENGINE=InnoDB AUTO_INCREMENT=1749243 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1764066 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44348,7 +44437,7 @@ CREATE TABLE `messageInbox` ( PRIMARY KEY (`id`), KEY `uuid` (`uuid`(8)), KEY `finalRecipient` (`finalRecipient`) -) ENGINE=InnoDB AUTO_INCREMENT=1912806 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1928245 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44582,7 +44671,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=24667 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla con los parkings del altillo'; +) ENGINE=InnoDB AUTO_INCREMENT=24718 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla con los parkings del altillo'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44891,7 +44980,7 @@ CREATE TABLE `priceBuilder` ( KEY `priceBuilder_fk2_idx` (`userFk`), CONSTRAINT `priceBuilder_fk1` FOREIGN KEY (`itemTypeFk`) REFERENCES `vn2008`.`Tipos` (`tipo_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `priceBuilder_fk2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44924,7 +45013,7 @@ CREATE TABLE `priceBuilderTag` ( KEY `priceBuilderTag_fk2_idx` (`tagFk`), CONSTRAINT `priceBuilderTag_fk1` FOREIGN KEY (`priceBuilderFk`) REFERENCES `priceBuilder` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `priceBuilderTag_fk2` FOREIGN KEY (`tagFk`) REFERENCES `tag` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44943,7 +45032,7 @@ CREATE TABLE `priceBuilderWarehouse` ( KEY `priceBuilderWarehouse_fk2_idx` (`priceBuilderFk`), CONSTRAINT `priceBuilderWarehouse_fk1` FOREIGN KEY (`warehouseFk`) REFERENCES `vn2008`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `priceBuilderWarehouse_fk2` FOREIGN KEY (`priceBuilderFk`) REFERENCES `priceBuilder` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45360,7 +45449,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=767859 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=786536 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45465,7 +45554,7 @@ CREATE TABLE `saleItemShelving` ( `ubication` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `saleItemShelving_fk1_idx` (`itemShelvingFk`) -) ENGINE=InnoDB AUTO_INCREMENT=24370 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=25629 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45598,7 +45687,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=121144 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=122260 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45763,7 +45852,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=536997 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=558024 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45826,6 +45915,26 @@ SET character_set_client = utf8; 1 AS `bankEntityFk`*/; SET character_set_client = @saved_cs_client; +-- +-- Temporary table structure for view `supplierPackaging` +-- + +DROP TABLE IF EXISTS `supplierPackaging`; +/*!50001 DROP VIEW IF EXISTS `supplierPackaging`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `supplierPackaging` AS SELECT + 1 AS `supplierFk`, + 1 AS `itemFk`, + 1 AS `longName`, + 1 AS `supplier`, + 1 AS `entryFk`, + 1 AS `landed`, + 1 AS `in`, + 1 AS `out`, + 1 AS `almacen`*/; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `tag` -- @@ -45840,8 +45949,11 @@ CREATE TABLE `tag` ( `isQuantitatif` tinyint(4) NOT NULL DEFAULT '1', `sourceTable` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `unit` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Categorias para etiquetar los productos'; + `ediTypeFk` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `tagEdiTypeFkIdx` (`ediTypeFk`), + CONSTRAINT `fgnTag` FOREIGN KEY (`ediTypeFk`) REFERENCES `edi`.`type` (`type_id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Categorias para etiquetar los productos'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -46052,7 +46164,7 @@ CREATE TABLE `ticketLog` ( KEY `logTicketuserFk` (`userFk`), CONSTRAINT `ticketLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketLog_user` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=4484104 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4637235 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -46124,7 +46236,7 @@ CREATE TABLE `ticketPackaging` ( 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, CONSTRAINT `ticketPackaging_fk3` FOREIGN KEY (`workerFk`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=52703 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=53851 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 */ ; @@ -46212,7 +46324,7 @@ CREATE TABLE `ticketService` ( KEY `fgn_ticketFk_idx` (`ticketFk`), CONSTRAINT `fgn_ticketFk` FOREIGN KEY (`ticketFk`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketServiceIvaGroup` FOREIGN KEY (`taxClassFk`) REFERENCES `vn2008`.`iva_group` (`iva_group_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Servicios asociadas a un ticket'; +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Servicios asociadas a un ticket'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -46449,7 +46561,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=242 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de trabajadores que han realizado una formación'; +) ENGINE=InnoDB AUTO_INCREMENT=243 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 */; -- @@ -46700,7 +46812,9 @@ SET character_set_client = utf8; 1 AS `bossFk`, 1 AS `photo`, 1 AS `fi`, - 1 AS `fiDueDate`*/; + 1 AS `fiDueDate`, + 1 AS `code`, + 1 AS `lastName`*/; SET character_set_client = @saved_cs_client; -- @@ -46772,7 +46886,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=9200 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=9378 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -46822,7 +46936,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=17980894 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=20228093 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -46844,7 +46958,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=8262 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=8634 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -46907,7 +47021,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=1950687 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Fichadas'; +) ENGINE=InnoDB AUTO_INCREMENT=2109507 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Fichadas'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -46924,7 +47038,7 @@ CREATE TABLE `workerTimeControlConfig` ( PRIMARY KEY (`id`), KEY `warehouseFk_1_idx` (`warehouseFk`), CONSTRAINT `warehouseFk_2` FOREIGN KEY (`warehouseFk`) REFERENCES `vn2008`.`warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -47040,7 +47154,7 @@ CREATE TABLE `zone` ( 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 AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -47630,7 +47744,7 @@ CREATE DEFINER=`root`@`%` FUNCTION `clientTaxArea`(vClientId INT, vCompanyId INT BEGIN /** * Devuelve el area de un cliente, - * intracomunitario, extracomunitario y nacional. + * intracomunitario, extracomunitario o nacional. * * @param vClient Id del cliente * @param vCompanyFk Compañia desde la que se factura @@ -48216,15 +48330,15 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `getWorkerCode`() RETURNS varchar(3) CHARSET utf8 COLLATE utf8_unicode_ci +CREATE DEFINER=`root`@`%` FUNCTION `getWorkerCode`() RETURNS varchar(3) CHARSET utf8 BEGIN - DECLARE vUserCode VARCHAR(3); - - SELECT workerCode INTO vUserCode - FROM worker - WHERE userFk = account.userGetId(); - - RETURN vUserCode; +DECLARE vUserCode VARCHAR(3) CHARSET utf8 COLLATE utf8_unicode_ci; + +SELECT workerCode INTO vUserCode +FROM worker +WHERE userFk = account.userGetId(); + +RETURN vUserCode; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -48430,6 +48544,52 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP FUNCTION IF EXISTS `isIntrastatEntry` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `isIntrastatEntry`(vEntryFk INT) RETURNS int(11) +BEGIN + + DECLARE isIntrastatOperation BOOL DEFAULT FALSE; + DECLARE vSupplierCountry INT DEFAULT -1; + DECLARE vClientCountry INT DEFAULT -1; + + SELECT c.id INTO vSupplierCountry + FROM vn.country c + JOIN vn.supplier s ON s.countryFk = c.id + JOIN vn.entry e ON e.supplierFk = s.id + WHERE e.id = vEntryFk + AND c.isUeeMember = TRUE; + + SELECT c.id INTO vClientCountry + FROM vn.country c + JOIN vn.supplier s ON s.countryFk = c.id + JOIN vn.company co ON co.id = s.id + JOIN vn.entry e ON e.companyFk = co.id + WHERE e.id = vEntryFk + AND c.isUeeMember = TRUE; + + IF vSupplierCountry != vClientCountry AND vSupplierCountry * vClientCountry > 0 THEN + + SET isIntrastatOperation = TRUE; + + END IF; + + RETURN isIntrastatOperation; + +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 FUNCTION IF EXISTS `isPalletHomogeneus` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49567,7 +49727,7 @@ BEGIN `s`.`quantity` AS `quantity`, `s`.`concept` AS `concept`, `i`.`size` AS `size`, - `w`.`workerCode` AS `workerCode`, + `w`.`code` AS `workerCode`, `ip`.`code` AS `Nicho`, `ip`.`reserve` AS `Reserva`, `st`.`name` AS `Estado`, @@ -49795,7 +49955,7 @@ BEGIN LEFT JOIN vn.itemShelving it ON it.shelvingFk = s.code SET it.visible = 0 WHERE it.shelvingFk IS NULL; - + CALL vn.ticketPackagingRecovery; INSERT INTO vn.dailyTaskLog(state) VALUES('clean END'); @@ -50342,8 +50502,8 @@ BEGIN JOIN vn.invoiceOut io ON io.clientFk = c.id JOIN vn.address a ON a.clientFk = c.id JOIN vn.province p ON p.id = a.provinceFk - WHERE p.name = 'VALENCIA' - AND io.issued = '2018-11-30' + WHERE p.name = 'MADRID' + AND io.issued = '2019-01-31' AND a.isDefaultAddress AND c.name NOT LIKE 'TR %'; @@ -50869,7 +51029,7 @@ CREATE TEMPORARY TABLE tmp.dayMinuteWorker workerCode , firstName, name, - warehouseFk + IFNULL(warehouseFk,1) warehouseFk FROM vn.workerTimeControl wtc JOIN vn.worker w ON w.userFk = wtc.userFk WHERE timed BETWEEN vDateStart AND vDateEnd @@ -50889,7 +51049,7 @@ CREATE TEMPORARY TABLE tmp.dayMinuteWorker ) sub3 ON sub3.warehouseFk = w.id WHERE estado = 'presente' AND sub3.id BETWEEN HOUR(vDateFrom) *100 + MINUTE(vDateFrom) AND HOUR(vDateTo) *100 + MINUTE(vDateTo); --- SELECT * FROM tmp.dayMinuteWorker; +-- SELECT * FROM tmp.dayMinuteWorker; END ;; DELIMITER ; @@ -51754,6 +51914,34 @@ 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 `getDayExpeditions` */; +/*!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 `getDayExpeditions`() +BEGIN + + SELECT + e.expeditions_id as expeditionFk, + date_format(e.odbc_date,'%Y-%m-%d') as expeditionDate, + e.ticket_id as ticketFk, + t.routeFk as routeFk + FROM vn2008.expeditions e + INNER JOIN vn.ticket t ON t.id = e.ticket_id + WHERE DATE(odbc_date) = CURDATE(); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `getDeliveryWorkers` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -52028,6 +52216,39 @@ BEGIN 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 `intrastat_data_neto_Update` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `intrastat_data_neto_Update`(IN vinvoiceInFk INT) +BEGIN + +UPDATE vn2008.intrastat_data id + JOIN ( + SELECT i.intrastatFk, + sum(r.cm3 * b.quantity) * i.density / 1000000 as neto + FROM vn.entry e + JOIN vn.travel tr ON tr.id = e.travelFk + JOIN vn.buy b ON b.entryFk = e.id + JOIN vn.item i ON i.id = b.itemFk + JOIN bi.rotacion r ON r.Id_Article = i.id AND tr.warehouseInFk = r.warehouse_id + WHERE e.invoiceInFk = vinvoiceInFk + GROUP BY i.intrastatFk) sub ON sub.intrastatFk = id.intrastat_id + SET id.neto = ROUND(sub.neto,1) + WHERE id.recibida_id = vInvoiceInFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -53823,14 +54044,15 @@ BEGIN SELECT vInvoice, pgcFk, SUM(taxableBase) as BASE, - SUM(tax) + CAST(SUM(taxableBase) * rate / 100 AS DECIMAL (10,2)) FROM tmp.ticketTax GROUP BY pgcFk HAVING BASE; - + DROP TEMPORARY TABLE tmp.ticket; DROP TEMPORARY TABLE tmp.ticketTax; DROP TEMPORARY TABLE tmp.ticketAmount; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -54433,7 +54655,7 @@ BEGIN FROM vn.itemPlacementSupplyList ipsl WHERE Saldo > 0 AND (repoUserFk is NULL OR repoUserFk = getUser()) - ORDER BY priority DESC, created + ORDER BY priority ASC, parking DESC, created LIMIT 1; UPDATE vn.itemPlacementSupply @@ -54727,22 +54949,22 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `itemSearchShelving`(vShelvingFk VARCHAR(3)) -BEGIN - - SELECT p.column as col , p.row - FROM vn.shelving s - INNER JOIN parking p - ON s.parkingFk = p.id - WHERE s.code = vShelvingFk; - - +CREATE DEFINER=`root`@`%` PROCEDURE `itemSearchShelving`(IN `vShelvingFk` VARCHAR(3)) +BEGIN + + SELECT p.column as col , p.`row` + FROM vn.shelving s + INNER JOIN parking p + ON s.parkingFk = p.id + WHERE s.code = vShelvingFk; + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -54886,25 +55108,25 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `itemShelvingList`(vShelvingFk VARCHAR(8)) -BEGIN - - /*MODIFICADA POR QUIQUE: OBTENEMOS DEEP Y PARKING*/ - SELECT ish.itemFk as item, - IFNULL(i.longName, CONCAT(i.name, ' ',i.size)) as description, - ish.visible as visible, - ceil(ish.visible/ish.packing) as stickers, - ish.packing as packing, - p.`column` as col, - p.row as row, - ish.id, - s.priority - FROM vn.itemShelving ish - JOIN vn.item i ON i.id = ish.itemFk - INNER JOIN vn.shelving s ON vShelvingFk = s.code COLLATE utf8_unicode_ci - LEFT JOIN vn.parking p ON s.parkingFk = p.id - WHERE ish.shelvingFk COLLATE utf8_unicode_ci =vShelvingFk COLLATE utf8_unicode_ci; - +CREATE DEFINER=`root`@`%` PROCEDURE `itemShelvingList`(IN `vShelvingFk` VARCHAR(8)) +BEGIN + + /*MODIFICADA POR QUIQUE: OBTENEMOS DEEP Y PARKING*/ + SELECT ish.itemFk as item, + IFNULL(i.longName, CONCAT(i.name, ' ',i.size)) as description, + ish.visible as visible, + ceil(ish.visible/ish.packing) as stickers, + ish.packing as packing, + p.`column` as col, + p.`row` as `row`, + ish.id, + s.priority + FROM vn.itemShelving ish + JOIN vn.item i ON i.id = ish.itemFk + INNER JOIN vn.shelving s ON vShelvingFk = s.code COLLATE utf8_unicode_ci + LEFT JOIN vn.parking p ON s.parkingFk = p.id + WHERE ish.shelvingFk COLLATE utf8_unicode_ci =vShelvingFk COLLATE utf8_unicode_ci; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -55052,6 +55274,13 @@ BEGIN vItemPlacementSupplyFk, vQuantity, getUser()); + + UPDATE vn.itemShelving + SET quantity = quantity - vQuantity, + visible = visible - vQuantity, + available = available - vQuantity + WHERE id = vItemShelvingFk; + END ;; DELIMITER ; @@ -55506,6 +55735,12 @@ BEGIN saleFk, vQuantity, getUser()); + + UPDATE vn.itemShelving + SET quantity = quantity - vQuantity, + visible = visible - vQuantity, + available = available - vQuantity + WHERE id = vItemShelvingFk; END ;; DELIMITER ; @@ -57376,84 +57611,84 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `saleItemShelvingMake`(vTicketFk INT, vSectorFk INT) -BEGIN - - SET @rest:= CAST(0 AS DECIMAL(10,0)); - SET @saleFk := CAST(0 AS DECIMAL(10,0)); - SET @reserved := CAST(0 AS DECIMAL(10,0)); - - UPDATE vn.itemShelving ish - JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id - JOIN sale s ON s.id = sis.saleFk - SET ish.visible = sis.quantity + ish.visible, - ish.available = sis.quantity + ish.visible - WHERE s.ticketFk = vTicketFk; - - DELETE sis.* - FROM saleItemShelving sis - JOIN sale s ON s.id = sis.saleFk - WHERE s.ticketFk = vTicketFk; - - INSERT INTO saleItemShelving( saleFk, - itemShelvingFk, - quantity, - ubication) - SELECT saleFk, - itemShelvingFk, - CAST(Reserved as DECIMAL(10,0)) as Reserved, - ubication - FROM - (SELECT saleFk, - itemShelvingFk, - ubication, - @rest := IF(@saleFk = saleFk, @rest, quantity) as Falta, - @reserved := IF(available < @rest, available, IF(@rest < packing,0,@rest)) as Reserved, - @rest := @rest - @reserved, - @saleFk := saleFk - FROM - ( SELECT s.id as saleFk, - ish.created, - ish.id as itemShelvingFk, - ish.available, - s.quantity, - ish.packing, - CONCAT(p.`column`, '-',p.row,': ', sh.code ) as ubication - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.sector sc ON sc.warehouseFk = t.warehouseFk - JOIN vn.parking p ON p.sectorFk = sc.id - JOIN vn.shelving sh ON sh.parkingFk = p.id - JOIN vn.itemShelving ish ON ish.shelvingFk = sh.code AND ish.itemFk = s.itemFk - WHERE t.id = vTicketFk - AND sc.id = vSectorFk - AND s.quantity MOD ish.packing = 0 - AND s.quantity >= ish.packing - ORDER BY s.id, - sh.priority DESC, - ish.packing DESC, - ish.created - ) sub - ) sub2 - WHERE Reserved > 0; - - UPDATE vn.itemShelving ish - JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id - JOIN vn.sale s ON s.id = sis.saleFk - SET ish.available = ish.visible - sis.quantity, - ish.visible = ish.visible - sis.quantity - WHERE s.ticketFk = vTicketFk - AND s.isPicked = FALSE; - - CALL vn.saleItemShelvingIsPicked(vTicketFk, TRUE); - - +CREATE DEFINER=`root`@`%` PROCEDURE `saleItemShelvingMake`(IN `vTicketFk` INT, IN `vSectorFk` INT) +BEGIN + + SET @rest:= CAST(0 AS DECIMAL(10,0)); + SET @saleFk := CAST(0 AS DECIMAL(10,0)); + SET @reserved := CAST(0 AS DECIMAL(10,0)); + + UPDATE vn.itemShelving ish + JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id + JOIN sale s ON s.id = sis.saleFk + SET ish.visible = sis.quantity + ish.visible, + ish.available = sis.quantity + ish.visible + WHERE s.ticketFk = vTicketFk; + + DELETE sis.* + FROM saleItemShelving sis + JOIN sale s ON s.id = sis.saleFk + WHERE s.ticketFk = vTicketFk; + + INSERT INTO saleItemShelving( saleFk, + itemShelvingFk, + quantity, + ubication) + SELECT saleFk, + itemShelvingFk, + CAST(Reserved as DECIMAL(10,0)) as Reserved, + ubication + FROM + (SELECT saleFk, + itemShelvingFk, + ubication, + @rest := IF(@saleFk = saleFk, @rest, quantity) as Falta, + @reserved := IF(available < @rest, available, IF(@rest < packing,0,@rest)) as Reserved, + @rest := @rest - @reserved, + @saleFk := saleFk + FROM + ( SELECT s.id as saleFk, + ish.created, + ish.id as itemShelvingFk, + ish.available, + s.quantity, + ish.packing, + CONCAT(p.`column`, '-',p.`row`,': ', sh.code ) as ubication + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.sector sc ON sc.warehouseFk = t.warehouseFk + JOIN vn.parking p ON p.sectorFk = sc.id + JOIN vn.shelving sh ON sh.parkingFk = p.id + JOIN vn.itemShelving ish ON ish.shelvingFk = sh.code AND ish.itemFk = s.itemFk + WHERE t.id = vTicketFk + AND sc.id = vSectorFk + AND s.quantity MOD ish.packing = 0 + AND s.quantity >= ish.packing + ORDER BY s.id, + sh.priority DESC, + ish.packing DESC, + ish.created + ) sub + ) sub2 + WHERE Reserved > 0; + + UPDATE vn.itemShelving ish + JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id + JOIN vn.sale s ON s.id = sis.saleFk + SET ish.available = ish.visible - sis.quantity, + ish.visible = ish.visible - sis.quantity + WHERE s.ticketFk = vTicketFk + AND s.isPicked = FALSE; + + CALL vn.saleItemShelvingIsPicked(vTicketFk, TRUE); + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -57846,57 +58081,62 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `shelvingPark`(vShelvingFk VARCHAR(8), vParkingCode VARCHAR(8)) -BEGIN - - DECLARE vParkingFk INT DEFAULT 0; - DECLARE idParking INT; - DECLARE vColumn VARCHAR(3); +CREATE DEFINER=`root`@`%` PROCEDURE `shelvingPark`(IN `vShelvingFk` VARCHAR(8), IN `vParkingCode` VARCHAR(8)) +BEGIN + + DECLARE vParkingFk INT DEFAULT 0; + DECLARE idParking INT; + DECLARE vColumn VARCHAR(3); DECLARE vRow VARCHAR(2); + DECLARE vReturn VARCHAR(50); + + /*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 - /*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 - - REPLACE vn.shelving(code, parkingFk, isPrinted, parked) + + REPLACE vn.shelving(code, parkingFk, isPrinted, parked) VALUES(vShelvingFk, vParkingFk, TRUE, NOW()); - SELECT TRUE; - - ELSE + CALL vn.ticketStatePrevious(vShelvingFk); + + ELSE - UPDATE vn.shelving - SET parkingFk = vParkingFk, parked = NOW() + + UPDATE vn.shelving + SET parkingFk = vParkingFk, parked = NOW() WHERE `code` = vShelvingFk COLLATE utf8_unicode_ci; - - SELECT (COUNT(*) > 0) AS IsUpdated + + SELECT (COUNT(*) > 0) AS IsUpdated FROM vn.shelving WHERE parkingFk = vParkingFk - AND `code` = vShelvingFk COLLATE utf8_unicode_ci; - - END IF; - + AND `code` = vShelvingFk COLLATE utf8_unicode_ci; + + END IF; + + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -59939,47 +60179,49 @@ BEGIN WHERE clientFk = vClientId AND isDefaultAddress; END IF; - INSERT INTO vn2008.Tickets ( - Id_Cliente, - Fecha, - Id_Consigna, - Id_Agencia, - Alias, - warehouse_id, - Id_Ruta, - empresa_id, - landing - ) - SELECT - vClientId, - vShipped, - a.id, - IF(vAgencyType, vAgencyType, a.agencyModeFk), - a.nickname, - vWarehouseId, - IF(vRouteFk,vRouteFk,NULL), - vCompanyFk, - vlanded - FROM address a - JOIN agencyMode am ON am.id = a.agencyModeFk - WHERE a.id = vAddressFk; + INSERT INTO vn2008.Tickets ( + Id_Cliente, + Fecha, + Id_Consigna, + Id_Agencia, + Alias, + warehouse_id, + Id_Ruta, + empresa_id, + landing + ) + SELECT + vClientId, + vShipped, + a.id, + IF(vAgencyType, vAgencyType, a.agencyModeFk), + a.nickname, + vWarehouseId, + IF(vRouteFk,vRouteFk,NULL), + vCompanyFk, + vlanded + FROM address a + JOIN agencyMode am ON am.id = a.agencyModeFk + WHERE a.id = vAddressFk; - SET vNewTicket = LAST_INSERT_ID(); + SET vNewTicket = LAST_INSERT_ID(); - INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) - SELECT vNewTicket, ao.observationTypeFk, ao.description - FROM addressObservation ao - JOIN address a ON a.id = ao.addressFk - WHERE a.id = vAddressFk; + INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) + SELECT vNewTicket, ao.observationTypeFk, ao.description + FROM addressObservation ao + JOIN address a ON a.id = ao.addressFk + WHERE a.id = vAddressFk; - CALL logAddWithUser(vNewTicket, vUserId, 'insert', 'ticket', CONCAT('Ha creado el ticket', ' ', vNewTicket)); + -- CALL logAddWithUser(vNewTicket, vUserId, 'insert', 'ticket', CONCAT('Ha creado el ticket', ' ', vNewTicket)); + INSERT INTO vn.ticketLog + SET originFk = vNewTicket, userFk = vUserId, `action` = 'insert', description = CONCAT('Ha creado el ticket:', ' ', vNewTicket); - IF (SELECT isCreatedAsServed FROM vn.client WHERE id = vClientId ) <> FALSE THEN - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - SELECT id, vNewTicket, getWorker() - FROM state - WHERE `code` = 'DELIVERED'; - END IF; + IF (SELECT isCreatedAsServed FROM vn.client WHERE id = vClientId ) <> FALSE THEN + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT id, vNewTicket, getWorker() + FROM state + WHERE `code` = 'DELIVERED'; + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -60033,7 +60275,7 @@ DELIMITER ; /*!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' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetProblems`() BEGIN @@ -60103,13 +60345,18 @@ BEGIN DELETE tl FROM tmp.ticketList tl JOIN tmp.ticketProblems tp ON tl.ticketFk = tp.ticketFk; - + INSERT INTO tmp.ticketProblems(ticketFk, problem) + SELECT DISTINCT tl.ticketFk, 'Code 100' + FROM tmp.ticketList tl + JOIN vn.ticketRequest tr ON tr.ticketFk = tl.ticketFk + WHERE tr.isOK IS NULL; + /* INSERT INTO tmp.ticketProblems(ticketFk, problem) SELECT DISTINCT tl.ticketFk, 'Code 100' FROM tmp.ticketList tl JOIN sale s ON s.ticketFk = tl.ticketFk WHERE s.itemFk = 100; - + */ DELETE tl FROM tmp.ticketList tl JOIN tmp.ticketProblems tp ON tl.ticketFk = tp.ticketFk; @@ -60194,7 +60441,7 @@ DELIMITER ; /*!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' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetTax`() READS SQL DATA @@ -60204,56 +60451,89 @@ BEGIN * un conjunto de tickets. * * @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular - * @return tmp.ticketTax Impuesto desglosado para cada ticket * @return tmp.ticketAmount + * @return tmp.ticketTax Impuesto desglosado para cada ticket. + */ - DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; - CREATE TEMPORARY TABLE tmp.addressCompany - (INDEX (addressFk, companyFk)) - ENGINE = MEMORY - SELECT DISTINCT t.addressFk, t.companyFk - FROM tmp.ticket tmpTicket - JOIN ticket t ON t.id = tmpTicket.ticketFk; + DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; + CREATE TEMPORARY TABLE tmp.addressCompany + (INDEX (addressFk, companyFk)) + ENGINE = MEMORY + SELECT DISTINCT t.addressFk, t.companyFk + FROM tmp.ticket tmpTicket + JOIN ticket t ON t.id = tmpTicket.ticketFk; - CALL addressTaxArea (); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketTax; - CREATE TEMPORARY TABLE tmp.ticketTax - (INDEX (ticketFk)) - ENGINE = MEMORY - SELECT tmpTicket.ticketFk, - bp.pgcFk, - SUM(s.quantity * s.price * (100 - s.discount)/100 ) AS taxableBase, - ROUND(SUM(s.quantity * s.price * (100 - s.discount)/100) * pgc.rate / 100 , 2) AS tax, - tc.code - FROM tmp.ticket tmpTicket - JOIN sale s ON s.ticketFk = tmpTicket.ticketFk - JOIN item i ON i.id = s.itemFk - JOIN ticket t ON t.id = tmpTicket.ticketFk - JOIN supplier su ON su.id = t.companyFk - JOIN tmp.addressTaxArea ata - ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk - JOIN itemTaxCountry itc - ON itc.itemFk = i.id AND itc.countryFk = su.countryFk - JOIN bookingPlanner bp - ON bp.countryFk = su.countryFk - AND bp.taxAreaFk = ata.areaFk - AND bp.taxClassFk = itc.taxClassFk - JOIN pgc ON pgc.code = bp.pgcFk - JOIN taxClass tc ON tc.id = bp.taxClassFk - GROUP BY tmpTicket.ticketFk, pgc.code - HAVING taxableBase != 0; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketAmount; - CREATE TEMPORARY TABLE tmp.ticketAmount - (INDEX (ticketFk)) - ENGINE = MEMORY - SELECT ticketFk, taxableBase, SUM(tax) tax - FROM tmp.ticketTax - GROUP BY ticketFk, code; + CALL addressTaxArea (); + - DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; - DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea; + /** Solo se calcula la base imponible (taxableBase) y el impuesto se calculará posteriormente + * No se debería cambiar el sistema por problemas con los decimales + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketTax; + CREATE TEMPORARY TABLE tmp.ticketTax + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT tmpTicket.ticketFk, + bp.pgcFk, + SUM(s.quantity * s.price * (100 - s.discount)/100 ) AS taxableBase, + pgc.rate, + tc.code + FROM tmp.ticket tmpTicket + JOIN sale s ON s.ticketFk = tmpTicket.ticketFk + JOIN item i ON i.id = s.itemFk + JOIN ticket t ON t.id = tmpTicket.ticketFk + JOIN supplier su ON su.id = t.companyFk + JOIN tmp.addressTaxArea ata + ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk + JOIN itemTaxCountry itc + ON itc.itemFk = i.id AND itc.countryFk = su.countryFk + JOIN bookingPlanner bp + ON bp.countryFk = su.countryFk + AND bp.taxAreaFk = ata.areaFk + AND bp.taxClassFk = itc.taxClassFk + JOIN pgc ON pgc.code = bp.pgcFk + JOIN taxClass tc ON tc.id = bp.taxClassFk + GROUP BY tmpTicket.ticketFk, pgc.code,pgc.rate + HAVING taxableBase != 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketServiceTax; + CREATE TEMPORARY TABLE tmp.ticketServiceTax + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT tt.ticketFk, + SUM(ts.quantity * ts.price) AS taxableBase, + pgc.rate, + tc.code + FROM tmp.ticketTax tt + JOIN ticketService ts ON ts.ticketFk = tt.ticketFk + JOIN ticket t ON t.id = tt.ticketFk + JOIN supplier su ON su.id = t.companyFk + JOIN tmp.addressTaxArea ata + ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk + JOIN bookingPlanner bp + ON bp.countryFk = su.countryFk + AND bp.taxAreaFk = ata.areaFk + AND bp.taxClassFk = ts.taxClassFk + JOIN pgc ON pgc.code = bp.pgcFk AND pgc.rate = tt.rate + JOIN taxClass tc ON tc.id = bp.taxClassFk + GROUP BY tt.ticketFk, tt.code,tt.rate + HAVING taxableBase != 0; + + UPDATE tmp.ticketTax tt + JOIN tmp.ticketServiceTax ts ON tt.ticketFk = ts.ticketFk AND tt.code = ts.code AND tt.rate = ts.rate + SET tt.taxableBase = tt.taxableBase + ts.taxableBase; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketAmount; + CREATE TEMPORARY TABLE tmp.ticketAmount + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT ticketFk, taxableBase, SUM(CAST(taxableBase * rate / 100 AS DECIMAL(10, 2))) tax,code + FROM tmp.ticketTax + GROUP BY ticketFk, code; + + DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; + DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -60268,7 +60548,7 @@ DELIMITER ; /*!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' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetTaxAdd`(vTicketFk INT) BEGIN @@ -60276,7 +60556,6 @@ BEGIN * Añade un ticket a la tabla tmp.ticket para calcular * el IVA y el recargo de equivalencia y devuelve el resultado. */ - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; CREATE TEMPORARY TABLE tmp.ticket ENGINE = MEMORY @@ -60287,7 +60566,7 @@ BEGIN SELECT tt.ticketFk, CAST(tt.taxableBase AS DECIMAL(10, 2)) AS taxableBase, - CAST(tt.tax AS DECIMAL(10, 2)) AS tax, + CAST(tt.rate * tt.taxableBase / 100 AS DECIMAL(10, 2)) AS tax, pgc.*, CAST(IF(pe.equFk IS NULL, taxableBase, 0) AS DECIMAL(10, 2)) AS Base, pgc.rate / 100 as vatPercent @@ -60295,9 +60574,10 @@ BEGIN JOIN vn.pgc ON pgc.code = tt.pgcFk LEFT JOIN vn.pgcEqu pe ON pe.equFk = pgc.code; - DROP TEMPORARY TABLE tmp.ticket; + DROP TEMPORARY TABLE tmp.ticket; DROP TEMPORARY TABLE tmp.ticketTax; DROP TEMPORARY TABLE tmp.ticketAmount; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -60616,13 +60896,13 @@ OPEN rs; FETCH rs INTO vTicketFk, vClientFk, vWarehouseFk, vShipped, vAddressFk,vCompanyFk; WHILE NOT done DO - + CALL vn.ticketCreate(vClientFk,vShipped,vWarehouseFk,vCompanyFk,vAddressFk,vAgenciaEmbalajesFk,NULL,vShipped,vTicketNewFk); - + UPDATE vn.ticketPackaging set ticketFk = vTicketNewFk WHERE ticketFk = vTicketFk; - + CALL vn.ticketStateUpdate(vTicketNewFk, 'DELIVERED'); - + INSERT INTO vn.sale(ticketFk, itemFk, concept) VALUES(vTicketNewFk,90,CONCAT('Embalajes ',vTicketFk)); FETCH rs INTO vTicketFk, vClientFk, vWarehouseFk, vShipped, vAddressFk,vCompanyFk; @@ -60684,12 +60964,14 @@ 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; + DECLARE vLastWorkerFk INT; + DECLARE vStateId INT; - SELECT MAX(inter_id) INTO vControlFk + SELECT MAX(inter_id) INTO vControlFk FROM vncontrol.inter WHERE Id_Ticket = vTicketFk; @@ -60699,26 +60981,34 @@ BEGIN WHERE i.inter_id = vControlFk) = 'PREVIOUS_PREPARATION' THEN - SELECT MAX(inter_id) INTO vControlFk + SELECT inter_id, Id_Trabajador + INTO vControlFk,vLastWorkerFk FROM vncontrol.inter i JOIN vn.state s ON i.state_id = s.id WHERE Id_Ticket = vTicketFk AND inter_id < vControlFk - AND s.code != 'PREVIOUS_PREPARATION'; + AND s.code != 'PREVIOUS_PREPARATION' + ORDER BY inter_id DESC + LIMIT 1; INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador, Id_Supervisor) - SELECT state_id , Id_Ticket, vn.getWorker(), vn.getWorker() + SELECT state_id, Id_Ticket, vLastWorkerFk, vn.getWorker() FROM vncontrol.inter WHERE inter_id = vControlFk; + + SELECT state_id INTO vStateId + 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); + DELETE FROM vn2008.Movimientos_mark + WHERE Id_Movimiento IN (SELECT Id_Movimiento FROM vn2008.Movimientos WHERE Id_Ticket = vTicketFk) + AND valor <> 1 + AND stateFk = 26; + + SELECT TRUE AS IsUpdated; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -61226,7 +61516,7 @@ BEGIN * */ - INSERT INTO worker (workerCode, firstName, name, fi, userFk, bossFk) + INSERT INTO vn2008.Trabajadores(CodigoTrabajador, Nombre, Apellidos, dni, user_id, boss) VALUES (vWorkerCode, vFirstname, vSurnames, vFi, vUserFk, vBossFk); END ;; DELIMITER ; @@ -62326,7 +62616,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=424890 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=432480 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -62427,7 +62717,7 @@ CREATE TABLE `deliveryInformation` ( KEY `fgbSupplyResponse_idx2` (`FirstOrderDateTime`), KEY `fgbSupplyResponse_idx3` (`LatestOrderDateTime`), CONSTRAINT `fgbSupplyResponse` FOREIGN KEY (`supplyResponseID`) REFERENCES `supplyResponse` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=14577393 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=15212514 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -62730,7 +63020,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=447741 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=455151 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -62953,7 +63243,7 @@ CREATE TABLE `supplyResponse` ( `MarketFormCode` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '"002" Standard Sales\n"005" Catalogue (optional)\n"001" Committed (optional)\n"003" Buffer (optional, Clock Pre Sales) ', PRIMARY KEY (`ID`), UNIQUE KEY `ID_UNIQUE` (`ID`) -) ENGINE=InnoDB AUTO_INCREMENT=4316751 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4629106 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -63167,165 +63457,165 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ediLoad`(vEdi INT) -BEGIN - DECLARE vRef INT; - DECLARE vBuy INT; - DECLARE vItem INT; - DECLARE vQty INT; - DECLARE vPackage INT; - DECLARE vIsLot BOOLEAN; - DECLARE vForceToPacking INT DEFAULT 2; - - -- Carga los datos necesarios del EKT - - SELECT ref, qty, package INTO vRef, vQty, vPackage - FROM vn2008.buy_edi e - LEFT JOIN item i ON e.ref = i.id - WHERE e.id = vEdi; - - -- Inserta el cubo si no existe - - IF vPackage = 800 - THEN - SET vPackage = 800 + vQty; - - INSERT IGNORE INTO vn2008.Cubos SET - Id_Cubo = vPackage, - x = 7200 / vQty, - y = 1; - ELSE - INSERT IGNORE INTO vn2008.Cubos (Id_Cubo, X, Y, Z) - SELECT bucket_id, ROUND(x_size/10), ROUND(y_size/10), ROUND(z_size/10) - FROM bucket WHERE bucket_id = vPackage; - - IF ROW_COUNT() > 0 - THEN - INSERT INTO vn2008.mail SET - `subject` = 'Cubo añadido', - `text` = CONCAT('Se ha añadido el cubo: ', vPackage), - `to` = 'ekt@verdnatura.es'; - END IF; - END IF; - - -- Intenta obtener el artículo en base a los atributos holandeses - - INSERT IGNORE INTO item_track SET - item_id = vRef; - - SELECT c.Id_Compra, c.Id_Article INTO vBuy, vItem - FROM vn2008.buy_edi e - JOIN item_track t ON t.item_id = e.ref - LEFT JOIN vn2008.buy_edi l ON l.ref = e.ref - LEFT JOIN vn2008.Compres c ON c.buy_edi_id = l.id - JOIN vn2008.config cfg - WHERE e.id = vEdi - AND l.id != vEdi - AND c.Id_Article != cfg.generic_item - AND IF(t.s1, l.s1 = e.s1, TRUE) - AND IF(t.s2, l.s2 = e.s2, TRUE) - AND IF(t.s3, l.s3 = e.s3, TRUE) - AND IF(t.s4, l.s4 = e.s4, TRUE) - AND IF(t.s5, l.s5 = e.s5, TRUE) - AND IF(t.s6, l.s6 = e.s6, TRUE) - AND IF(t.kop, l.kop = e.kop, TRUE) - AND IF(t.pac, l.pac = e.pac, TRUE) - AND IF(t.cat, l.cat = e.cat, TRUE) - AND IF(t.ori, l.ori = e.ori, TRUE) - AND IF(t.pro, l.pro = e.pro, TRUE) - AND IF(t.sub, l.sub = e.sub, TRUE) - AND IF(t.package, l.package = e.package, TRUE) - AND c.Id_Article < 170000 - ORDER BY l.now DESC, c.Id_Compra ASC LIMIT 1; - - -- Determina si el articulo se vende por lotes - - IF vItem - THEN - SELECT COUNT(*) > 0 INTO vIsLot - FROM vn2008.Articles a - LEFT JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id - WHERE a.Id_Article = vItem - AND t.`transaction`; - - -- Si el articulo se vende por lotes se inserta un nuevo artículo - - IF vIsLot - THEN - INSERT INTO vn2008.Articles ( - Article - ,Medida - ,Categoria - ,Id_Origen - ,iva_group_id - ,Foto - ,Color - ,Codintrastat - ,tipo_id - ,Tallos - ) - SELECT - i.`name` - ,IFNULL(e.s1, e.pac) - ,e.cat - ,IFNULL(o.id, 17) - ,IFNULL(a.iva_group_id, 1) - ,a.Foto - ,a.Color - ,a.Codintrastat - ,IFNULL(a.tipo_id, 10) - ,IF(a.tipo_id = 15, 0, 1) - FROM vn2008.buy_edi e - LEFT JOIN item i ON i.id = e.ref - LEFT JOIN vn2008.Origen o ON o.Abreviatura = e.ori - LEFT JOIN vn2008.Articles a ON a.Id_Article = vItem - WHERE e.id = vEdi; - - SET vItem = LAST_INSERT_ID(); - END IF; - END IF; - - -- Inserta la compra asociada al EKT - - INSERT INTO vn2008.Compres - ( - Id_Entrada - ,buy_edi_id - ,Costefijo - ,Id_Article - ,grouping - ,caja - ,Packing - ,Cantidad - ,Productor - ,Etiquetas - ,Id_Cubo - ) - SELECT - cfg.edi_entry - ,vEdi - ,(@t := IF(a.Tallos, a.Tallos, 1)) * e.pri - ,IFNULL(vItem, cfg.generic_item) - ,IFNULL(c.grouping, e.pac) - ,vForceToPacking - ,@pac := e.pac / @t - ,@pac * e.qty - ,s.company_name - ,e.qty - ,IFNULL(c.Id_Cubo, e.package) - FROM vn2008.buy_edi e - LEFT JOIN vn2008.Compres c ON c.Id_Compra = vBuy - LEFT JOIN vn2008.Articles a ON a.Id_Article = c.Id_Article - LEFT JOIN supplier s ON e.pro = s.supplier_id - JOIN vn2008.config cfg - WHERE e.id = vEdi - LIMIT 1; +CREATE DEFINER=`root`@`%` PROCEDURE `ediLoad`(IN `vEdi` INT) +BEGIN + DECLARE vRef INT; + DECLARE vBuy INT; + DECLARE vItem INT; + DECLARE vQty INT; + DECLARE vPackage INT; + DECLARE vIsLot BOOLEAN; + DECLARE vForceToPacking INT DEFAULT 2; + + -- Carga los datos necesarios del EKT + + SELECT ref, qty, package INTO vRef, vQty, vPackage + FROM vn2008.buy_edi e + LEFT JOIN item i ON e.ref = i.id + WHERE e.id = vEdi; + + -- Inserta el cubo si no existe + + IF vPackage = 800 + THEN + SET vPackage = 800 + vQty; + + INSERT IGNORE INTO vn2008.Cubos SET + Id_Cubo = vPackage, + x = 7200 / vQty, + y = 1; + ELSE + INSERT IGNORE INTO vn2008.Cubos (Id_Cubo, X, Y, Z) + SELECT bucket_id, ROUND(x_size/10), ROUND(y_size/10), ROUND(z_size/10) + FROM bucket WHERE bucket_id = vPackage; + + IF ROW_COUNT() > 0 + THEN + INSERT INTO vn2008.mail SET + `subject` = 'Cubo añadido', + `text` = CONCAT('Se ha añadido el cubo: ', vPackage), + `to` = 'ekt@verdnatura.es'; + END IF; + END IF; + + -- Intenta obtener el artículo en base a los atributos holandeses + + INSERT IGNORE INTO item_track SET + item_id = vRef; + + SELECT c.Id_Compra, c.Id_Article INTO vBuy, vItem + FROM vn2008.buy_edi e + JOIN item_track t ON t.item_id = e.ref + LEFT JOIN vn2008.buy_edi l ON l.ref = e.ref + LEFT JOIN vn2008.Compres c ON c.buy_edi_id = l.id + JOIN vn2008.config cfg + WHERE e.id = vEdi + AND l.id != vEdi + AND c.Id_Article != cfg.generic_item + AND IF(t.s1, l.s1 = e.s1, TRUE) + AND IF(t.s2, l.s2 = e.s2, TRUE) + AND IF(t.s3, l.s3 = e.s3, TRUE) + AND IF(t.s4, l.s4 = e.s4, TRUE) + AND IF(t.s5, l.s5 = e.s5, TRUE) + AND IF(t.s6, l.s6 = e.s6, TRUE) + AND IF(t.kop, l.kop = e.kop, TRUE) + AND IF(t.pac, l.pac = e.pac, TRUE) + AND IF(t.cat, l.cat = e.cat, TRUE) + AND IF(t.ori, l.ori = e.ori, TRUE) + AND IF(t.pro, l.pro = e.pro, TRUE) + AND IF(t.sub, l.sub = e.sub, TRUE) + AND IF(t.package, l.package = e.package, TRUE) + AND c.Id_Article < 170000 + ORDER BY l.now DESC, c.Id_Compra ASC LIMIT 1; + + -- Determina si el articulo se vende por lotes + + IF vItem + THEN + SELECT COUNT(*) > 0 INTO vIsLot + FROM vn2008.Articles a + LEFT JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id + WHERE a.Id_Article = vItem + AND t.`transaction`; + + -- Si el articulo se vende por lotes se inserta un nuevo artículo + + IF vIsLot + THEN + INSERT INTO vn2008.Articles ( + Article + ,Medida + ,Categoria + ,Id_Origen + ,iva_group_id + ,Foto + ,Color + ,Codintrastat + ,tipo_id + ,Tallos + ) + SELECT + i.`name` + ,IFNULL(e.s1, e.pac) + ,e.cat + ,IFNULL(o.id, 17) + ,IFNULL(a.iva_group_id, 1) + ,a.Foto + ,a.Color + ,a.Codintrastat + ,IFNULL(a.tipo_id, 10) + ,IF(a.tipo_id = 15, 0, 1) + FROM vn2008.buy_edi e + LEFT JOIN item i ON i.id = e.ref + LEFT JOIN vn2008.Origen o ON o.Abreviatura = e.ori + LEFT JOIN vn2008.Articles a ON a.Id_Article = vItem + WHERE e.id = vEdi; + + SET vItem = LAST_INSERT_ID(); + END IF; + END IF; + + -- Inserta la compra asociada al EKT + + INSERT INTO vn2008.Compres + ( + Id_Entrada + ,buy_edi_id + ,Costefijo + ,Id_Article + ,`grouping` + ,caja + ,Packing + ,Cantidad + ,Productor + ,Etiquetas + ,Id_Cubo + ) + SELECT + cfg.edi_entry + ,vEdi + ,(@t := IF(a.Tallos, a.Tallos, 1)) * e.pri + ,IFNULL(vItem, cfg.generic_item) + ,IFNULL(c.grouping, e.pac) + ,vForceToPacking + ,@pac := e.pac / @t + ,@pac * e.qty + ,s.company_name + ,e.qty + ,IFNULL(c.Id_Cubo, e.package) + FROM vn2008.buy_edi e + LEFT JOIN vn2008.Compres c ON c.Id_Compra = vBuy + LEFT JOIN vn2008.Articles a ON a.Id_Article = c.Id_Article + LEFT JOIN supplier s ON e.pro = s.supplier_id + JOIN vn2008.config cfg + WHERE e.id = vEdi + LIMIT 1; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -63496,8 +63786,8 @@ CREATE TABLE `departmentCost` ( `workerHours` decimal(10,1) DEFAULT NULL, `labourCost` decimal(10,0) DEFAULT NULL, `dated` date NOT NULL, - PRIMARY KEY (`departmentFk`,`dated`), - CONSTRAINT `departmentCost_fk1` FOREIGN KEY (`departmentFk`) REFERENCES `postgresql`.`department_kk` (`department_id`) ON UPDATE CASCADE + KEY `departmentCost_fk1_idx` (`departmentFk`), + CONSTRAINT `departmentCost_fk1` FOREIGN KEY (`departmentFk`) REFERENCES `vn2008`.`department` (`department_id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -63561,7 +63851,7 @@ CREATE TABLE `indicators` ( `lastYearSales` int(11) DEFAULT NULL, `totalGreuge` int(11) DEFAULT NULL, `latePaymentRate` decimal(5,4) DEFAULT NULL, - `countEmployee` int(11) DEFAULT NULL, + `countEmployee` decimal(10,2) DEFAULT NULL, `averageMana` int(11) DEFAULT NULL, `bankingPool` int(11) DEFAULT NULL, `lastMonthActiveClients` int(11) DEFAULT NULL, @@ -63888,7 +64178,21 @@ CREATE TABLE `productivity` ( `numPaletizadores` int(11) NOT NULL DEFAULT '0', `costPaletizado` double NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=14751516 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=19107758 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `productivity_evolution` +-- + +DROP TABLE IF EXISTS `productivity_evolution`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `productivity_evolution` ( + `dated` date NOT NULL, + `m3productionCost` decimal(10,2) NOT NULL DEFAULT '0.00', + PRIMARY KEY (`dated`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -64465,8 +64769,8 @@ IF DAY(CURDATE()) = 6 THEN SELECT c.id, c.name as clientName, maxIssued as lastInvoiced, - w.workerCode, - b.workerCode as Boss, + w.code, + b.code as Boss, CASE WHEN IFNULL(maxIssued,'2000-01-01') < @tercerAviso THEN 'Tercer Aviso' WHEN maxIssued < @segundoAviso THEN 'Segundo Aviso' @@ -64870,10 +65174,18 @@ BEGIN -- Número de trabajadores activos UPDATE indicators SET countEmployee = - (SELECT count(*) - FROM account.user - WHERE role NOT IN (2, 6, 3, 31,32) - AND active + ( SELECT CAST(SUM(hours_week) / 40 AS DECIMAL (10 , 2 )) + FROM + postgresql.business AS b + JOIN postgresql.profile p ON p.profile_id = b.provider_id + JOIN postgresql.person pe ON pe.person_id = p.person_id + LEFT JOIN + postgresql.business_labour AS bl ON bl.business_id = b.business_id + LEFT JOIN + postgresql.calendar_labour_type AS cl ON cl.calendar_labour_type_id = bl.calendar_labour_type_id + WHERE + (vDated BETWEEN b.date_start AND b.date_end OR (b.date_end IS NULL AND b.date_start <= vDated)) + AND pe.name = 'VERDNATURA LEVANTE SL' ) WHERE updated = vDated; @@ -65062,7 +65374,6 @@ BEGIN JOIN bi.rotacion r ON r.Id_Article = s.itemFk AND r.warehouse_id = t.warehouseFk JOIN vn.address a ON a.id = t.addressFk WHERE v.fecha BETWEEN datSTART AND datEND - AND it.workerFk != 132 -- Miriam AND s.quantity > 0 -- evita abonos AND t.companyFk = 442 -- Verdnatura GROUP BY t.warehouseFk, v.fecha, a.provinceFk; @@ -65511,6 +65822,12 @@ BEGIN costPaletizado FROM tmp.productivity p; + -- Productivity Evolution + REPLACE bs.productivity_evolution(dated, m3productionCost) + SELECT CURDATE(), sum(wCost) / sum(m3) + FROM bs.productivity + WHERE dated BETWEEN TIMESTAMPADD(YEAR,-1,CURDATE()) AND CURDATE(); + DROP TEMPORARY TABLE tmp.dayMinuteWorker; DROP TEMPORARY TABLE tmp.productivity; DROP TEMPORARY TABLE tmp.ticketBuiltTime; @@ -65539,11 +65856,9 @@ DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `productivityLauncher`() BEGIN - -- DECLARE vDateFrom DATE DEFAULT TIMESTAMPADD(MONTH, -3, CURDATE()); + DECLARE vDateFrom DATE DEFAULT TIMESTAMPADD(MONTH, -3, CURDATE()); - DECLARE vDateFrom DATE DEFAULT '2018-03-01'; - - WHILE '2018-03-31' >= vDateFrom DO + WHILE CURDATE() > vDateFrom DO CALL bs.productivityAdd(vDateFrom); @@ -65551,6 +65866,46 @@ BEGIN END WHILE; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `pruebas` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `pruebas`(IN vDateStart DATE, IN vDateEnd DATE) +BEGIN + +WHILE vDateStart <> vDateEnd +DO + UPDATE indicators + SET countEmployee = + ( SELECT CAST(SUM(hours_week) / 40 AS DECIMAL (10 , 2 )) + FROM + postgresql.business AS b + JOIN postgresql.profile p ON p.profile_id = b.provider_id + JOIN postgresql.person pe ON pe.person_id = p.person_id + LEFT JOIN + postgresql.business_labour AS bl ON bl.business_id = b.business_id + LEFT JOIN + postgresql.calendar_labour_type AS cl ON cl.calendar_labour_type_id = bl.calendar_labour_type_id + WHERE + (vDateStart BETWEEN b.date_start AND b.date_end OR (b.date_end IS NULL AND b.date_start <= vDateStart)) + AND pe.name = 'VERDNATURA LEVANTE SL' + ) + WHERE updated = vDateStart; + SET vDateStart = DATE_ADD(vDateStart, INTERVAL 1 DAY); + +END WHILE; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -66172,22 +66527,6 @@ CREATE TABLE `Last_buy_id` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Table structure for table `Last_buy_idBackUpKk` --- - -DROP TABLE IF EXISTS `Last_buy_idBackUpKk`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Last_buy_idBackUpKk` ( - `Id_Article` int(11) NOT NULL DEFAULT '90', - `Id_Compra` int(11) NOT NULL DEFAULT '0', - `warehouse_id` smallint(6) unsigned NOT NULL, - PRIMARY KEY (`Id_Article`,`warehouse_id`), - UNIQUE KEY `Id_Compra_UNIQUE` (`Id_Compra`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Table structure for table `Radar` -- @@ -66835,13 +67174,13 @@ CREATE TABLE `saldos_bancos_pordia` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `sales` +-- Table structure for table `salesKk` -- -DROP TABLE IF EXISTS `sales`; +DROP TABLE IF EXISTS `salesKk`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sales` ( +CREATE TABLE `salesKk` ( `Id_Trabajador` int(10) unsigned NOT NULL, `year` int(10) unsigned NOT NULL, `month` int(10) unsigned NOT NULL, @@ -67864,7 +68203,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `defaultersFromDate`(IN vDate DATE) BEGIN -SELECT t1.*, c.Cliente, w.workerCode, c.pay_met_id,c.Vencimiento +SELECT t1.*, c.Cliente, w.code, c.pay_met_id,c.Vencimiento FROM ( -- Filtramos aquellos clientes cuyo saldo se ha incrementado de ayer a hoy select * from( @@ -67899,6 +68238,104 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `defaulting`(IN vDate DATE) +BEGIN +/*JGF para usar el campo vencimiento de facturas*/ + DECLARE vDone BOOLEAN; + DECLARE vClient INT; + DECLARE vAmount INT; + DECLARE vDued DATE; + DECLARE vAmountInvoice DECIMAL(10,2); + DECLARE vGraceDays INT; + DECLARE defaulters CURSOR FOR + SELECT client, amount, graceDays FROM bi.defaulters d + JOIN vn2008.Clientes c ON c.Id_Cliente = d.client + JOIN vn2008.pay_met pm ON pm.id = c.pay_met_id + WHERE hasChanged AND date = vDate; + + DECLARE invoices CURSOR FOR + SELECT Vencimiento, importe FROM vn2008.Facturas f + WHERE f.Fecha >= '2016-01-01' AND f.Id_Cliente = vClient ORDER BY f.Fecha DESC; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + -- Control + + INSERT INTO vn2008.daily_task_log(consulta) VALUES('defaulting'); + + DELETE FROM bi.defaulters WHERE date = vDate; + + INSERT INTO bi.defaulters(client, date, amount) + SELECT customer_id, vDate, FLOOR(SUM(amount)) AS amount + FROM bi.customerRiskOverdue + GROUP BY customer_id; + + -- marcamos si ha cambiado y heredamos la fecha defaulterSince + UPDATE bi.defaulters d + JOIN ( + SELECT * FROM( + SELECT client, amount , defaulterSince FROM bi.defaulters + WHERE date <= TIMESTAMPADD(DAY,-1, vDate) + ORDER BY date DESC) t GROUP BY client + ) yesterday using(client) + SET d.hasChanged = IF(d.amount <> yesterday.amount, 1, 0), + d.defaulterSince = yesterday.defaulterSince + WHERE d.date = vDate ; + + OPEN defaulters; + defaulters: LOOP + SET vDone = FALSE; + SET vAmount = 0; + FETCH defaulters INTO vClient,vAmount, vGraceDays; + IF vDone THEN + LEAVE defaulters; + END IF; + OPEN invoices; + invoices:LOOP + + FETCH invoices INTO vDued, vAmountInvoice; + IF vDone THEN + LEAVE invoices; + END IF; + + IF TIMESTAMPADD(DAY, vGraceDays, vDued) <= vDate THEN + SET vAmount = vAmount - vAmountInvoice; + IF vAmount <= 0 THEN + + UPDATE defaulters SET defaulterSince = vDued + WHERE client = vClient and date = vDate; + + SET vAmount = 0; + LEAVE invoices; + END IF; + END IF; + END LOOP; + CLOSE invoices; + END LOOP; + CLOSE defaulters; + DELETE FROM bi.defaulting WHERE date = vDate; + + INSERT INTO bi.defaulting(date, amount) + SELECT vDate, SUM(amount) + FROM bi.defaulters + WHERE date = vDate and amount > 0; + + CALL vn.clientFreeze(); +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 `defaultingKk` */; +/*!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 `defaultingKk`(IN vDate DATE) BEGIN DECLARE vDone BOOLEAN; DECLARE vClient INT; @@ -67985,6 +68422,109 @@ 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 `defaultingTest` */; +/*!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 `defaultingTest`(IN vDate DATE) +BEGIN +/*JGF para usar el campo vencimiento de facturas*/ + DECLARE vDone BOOLEAN; + DECLARE vClient INT; + DECLARE vAmount INT; + DECLARE vDued DATE; + DECLARE vAmountInvoice DECIMAL(10,2); + DECLARE vGraceDays INT; + DECLARE defaulters CURSOR FOR + SELECT client, amount, graceDays FROM bi.defaulters d + JOIN vn2008.Clientes c ON c.Id_Cliente = d.client + JOIN vn2008.pay_met pm ON pm.id = c.pay_met_id + WHERE hasChanged AND date = vDate; + + DECLARE invoices CURSOR FOR + SELECT Fecha, importe FROM vn2008.Facturas f + WHERE f.Fecha >= '2016-01-01' AND f.Id_Cliente = vClient ORDER BY f.Fecha DESC; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + -- Control + + INSERT INTO vn2008.daily_task_log(consulta) VALUES('defaulting'); + + DELETE FROM bi.defaulters WHERE date = vDate; + + INSERT INTO bi.defaulters(client, date, amount) + SELECT customer_id, vDate, FLOOR(SUM(amount)) AS amount + FROM bi.customerRiskOverdue + GROUP BY customer_id; + + SELECT * FROM( + SELECT client, amount , defaulterSince FROM bi.defaulters + WHERE date <= TIMESTAMPADD(DAY,-1, vDate) + ORDER BY date DESC) t GROUP BY client; + SELECT * FROM bi.defaulters where client = 14669; + + -- marcamos si ha cambiado y heredamos la fecha defaulterSince + UPDATE bi.defaulters d + JOIN ( + SELECT * FROM( + SELECT client, amount , defaulterSince FROM bi.defaulters + WHERE date <= TIMESTAMPADD(DAY,-1, vDate) + ORDER BY date DESC) t GROUP BY client + ) yesterday using(client) + SET d.hasChanged = IF(d.amount <> yesterday.amount, 1, 0), + d.defaulterSince = yesterday.defaulterSince + WHERE d.date = vDate ; + + OPEN defaulters; + defaulters: LOOP + SET vDone = FALSE; + SET vAmount = 0; + FETCH defaulters INTO vClient,vAmount, vGraceDays; + IF vDone THEN + LEAVE defaulters; + END IF; + OPEN invoices; + invoices:LOOP + + FETCH invoices INTO vDued, vAmountInvoice; + IF vDone THEN + LEAVE invoices; + END IF; + + IF TIMESTAMPADD(DAY, vGraceDays, vDued) <= vDate THEN + SET vAmount = vAmount - vAmountInvoice; + IF vAmount <= 0 THEN + UPDATE defaulters SET defaulterSince = vDued + WHERE client = vClient and date = vDate; + + SET vAmount = 0; + LEAVE invoices; + END IF; + END IF; + END LOOP; + CLOSE invoices; + END LOOP; + CLOSE defaulters; + DELETE FROM bi.defaulting WHERE date = vDate; + + INSERT INTO bi.defaulting(date, amount) + SELECT vDate, SUM(amount) + FROM bi.defaulters + WHERE date = vDate and amount > 0; + + CALL vn.clientFreeze(); +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 `defaulting_launcher` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -69437,7 +69977,7 @@ CREATE TABLE `cdr` ( KEY `dstchannel` (`dst_channel`), KEY `disposition` (`disposition`), KEY `src` (`src`) -) ENGINE=MyISAM AUTO_INCREMENT=250929 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=MyISAM AUTO_INCREMENT=257001 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -70232,7 +70772,7 @@ CREATE TABLE `cache_calc` ( KEY `cache_id` (`cache_id`), KEY `cacheName` (`cacheName`), KEY `expires` (`expires`) -) ENGINE=InnoDB AUTO_INCREMENT=269979 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=279870 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -71866,7 +72406,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=146 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=149 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -71986,7 +72526,7 @@ CREATE TABLE `userConfigView` ( `configuration` text COLLATE utf8_unicode_ci, PRIMARY KEY (`id`), UNIQUE KEY `uniqueUser_TableCode` (`userFk`,`tableCode`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -72138,11 +72678,12 @@ CREATE TABLE `inter` ( KEY `responsable` (`Id_Supervisor`), KEY `ticket` (`Id_Ticket`), KEY `inter_state` (`state_id`), + KEY `inter_id` (`Id_Ticket`,`inter_id`) USING BTREE, CONSTRAINT `currante` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, 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=15165431 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=15462470 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 */ ; @@ -72486,7 +73027,7 @@ CREATE TABLE `imageCollectionSize` ( PRIMARY KEY (`id`), KEY `image_schema_id` (`collectionFk`), CONSTRAINT `imageCollectionSize_ibfk_1` FOREIGN KEY (`collectionFk`) REFERENCES `imageCollection` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -72963,7 +73504,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=13051 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=13054 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -73014,7 +73555,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=1756946 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1779395 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -73116,7 +73657,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=10676154 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=10799021 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 */ ; @@ -73476,7 +74017,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=283173 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Transactions realized through the virtual TPV'; +) ENGINE=InnoDB AUTO_INCREMENT=287580 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Transactions realized through the virtual TPV'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -73511,7 +74052,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=1594561 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1624249 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -73531,7 +74072,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=3504892 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3565746 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -73556,7 +74097,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=2173739 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2208561 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -73576,7 +74117,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=3187466 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3227028 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -74471,45 +75012,45 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `itemGetList`(vWarehouse SMALLINT, vShipping DATE, vCategory INT, vRate TINYINT) -BEGIN - DECLARE vCalc INT; - - CALL cache.available_refresh(vCalc, FALSE, vWarehouse, vShipping); - CALL vn2008.item_last_buy_(vWarehouse, vShipping); - - SELECT a.id, a.`name`, a.category, a.size, a.stems, a.inkFk, a.typeFk, a.image, - c.available, o.`name` origin, t.`name` `type`, - CASE b.groupingMode - WHEN 0 THEN 1 - WHEN 2 THEN b.packing - ELSE b.grouping - END AS grouping, - CASE vRate - WHEN 1 THEN b.price1 - WHEN 2 THEN b.price2 - WHEN 3 THEN b.price3 - ELSE NULL - END AS price - FROM cache.available c - JOIN vn.item a ON a.id = c.item_id - JOIN vn.itemType t ON t.id = a.typeFk - JOIN vn.itemCategory r ON r.id = t.categoryFk - LEFT JOIN vn.origin o ON o.id = a.originFk - JOIN vn2008.t_item_last_buy l ON l.item_id = a.id - JOIN vn.buy b ON b.id = l.buy_id - WHERE c.calc_id = vCalc - AND c.available > 0 - AND a.id != 90 - AND r.display - AND (vCategory IS NULL OR vCategory = r.id) - ORDER BY a.typeFk, a.`name`, a.size; +CREATE DEFINER=`root`@`%` PROCEDURE `itemGetList`(IN `vWarehouse` SMALLINT, IN `vShipping` DATE, IN `vCategory` INT, IN `vRate` TINYINT) +BEGIN + DECLARE vCalc INT; + + CALL cache.available_refresh(vCalc, FALSE, vWarehouse, vShipping); + CALL vn2008.item_last_buy_(vWarehouse, vShipping); + + SELECT a.id, a.`name`, a.category, a.size, a.stems, a.inkFk, a.typeFk, a.image, + c.available, o.`name` origin, t.`name` `type`, + CASE b.groupingMode + WHEN 0 THEN 1 + WHEN 2 THEN b.packing + ELSE b.`grouping` + END AS `grouping`, + CASE vRate + WHEN 1 THEN b.price1 + WHEN 2 THEN b.price2 + WHEN 3 THEN b.price3 + ELSE NULL + END AS price + FROM cache.available c + JOIN vn.item a ON a.id = c.item_id + JOIN vn.itemType t ON t.id = a.typeFk + JOIN vn.itemCategory r ON r.id = t.categoryFk + LEFT JOIN vn.origin o ON o.id = a.originFk + JOIN vn2008.t_item_last_buy l ON l.item_id = a.id + JOIN vn.buy b ON b.id = l.buy_id + WHERE c.calc_id = vCalc + AND c.available > 0 + AND a.id != 90 + AND r.display + AND (vCategory IS NULL OR vCategory = r.id) + ORDER BY a.typeFk, a.`name`, a.size; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -75021,7 +75562,7 @@ BEGIN DECLARE vAddress INT; DECLARE vAgencyMode INT; DECLARE cur CURSOR FOR - SELECT grouping, price, rate + SELECT `grouping`, price, rate FROM tmp.bionic_price WHERE warehouse_id = vWarehouse AND item_id = vItem @@ -75054,7 +75595,7 @@ BEGIN WHERE warehouse_id = vWarehouse AND item_id = vItem; - IF vAmount > vAvailable + IF vAmount > IFNULL(vAvailable, 0) THEN CALL util.throw ('ORDER_ROW_UNAVAILABLE'); END IF; @@ -77036,7 +77577,7 @@ CREATE TABLE `address` ( KEY `address_town_id_idx` (`town_id`), CONSTRAINT `address_ibfk_1` FOREIGN KEY (`address_type_id`) REFERENCES `address_type` (`address_type_id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `address_ibfk_2` FOREIGN KEY (`town_id`) REFERENCES `town` (`town_id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=756 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=761 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -77099,7 +77640,7 @@ CREATE TABLE `bank_account` ( CONSTRAINT `bank_account_bank_account_type_id_fkey` FOREIGN KEY (`bank_account_type_id`) REFERENCES `bank_account_type` (`bank_account_type_id`) ON UPDATE CASCADE, CONSTRAINT `bank_account_nation_id_fkey` FOREIGN KEY (`nation_id`) REFERENCES `nation` (`nation_id`) ON UPDATE CASCADE, CONSTRAINT `bank_profile` FOREIGN KEY (`client_id`) REFERENCES `profile` (`profile_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=740 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=748 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -77242,7 +77783,7 @@ CREATE TABLE `business` ( KEY `bussiness_provider` (`provider_id`), CONSTRAINT `business_client` FOREIGN KEY (`client_id`) REFERENCES `profile` (`profile_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `bussiness_provider` FOREIGN KEY (`provider_id`) REFERENCES `profile` (`profile_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2274 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=2295 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -77481,7 +78022,7 @@ CREATE TABLE `calendar_labour` ( CONSTRAINT `fk_calendar_labour_calendar_free1` FOREIGN KEY (`calendar_free_id`) REFERENCES `calendar_free` (`calendar_free_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_calendar_labour_legend_id` FOREIGN KEY (`calendar_labour_legend_id`) REFERENCES `calendar_labour_legend` (`calendar_labour_legend_id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `workcenter_calendar` FOREIGN KEY (`workcenter_id`) REFERENCES `workcenter` (`workcenter_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=537 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=534 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -77496,7 +78037,7 @@ CREATE TABLE `calendar_labour_legend` ( `descripcion` longtext, PRIMARY KEY (`calendar_labour_legend_id`), UNIQUE KEY `calendar_labour_legend_calendar_labour_legend_id_key` (`calendar_labour_legend_id`) -) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -77657,29 +78198,6 @@ CREATE TABLE `delivery_expedition` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Table structure for table `department_kk` --- - -DROP TABLE IF EXISTS `department_kk`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `department_kk` ( - `department_id` int(11) NOT NULL AUTO_INCREMENT, - `company_id` int(11) NOT NULL, - `father_id` int(11) DEFAULT NULL, - `boss_id` int(11) NOT NULL, - `name` varchar(40) NOT NULL, - `x` int(11) DEFAULT NULL, - `y` int(11) DEFAULT NULL, - `production` tinyint(4) NOT NULL DEFAULT '0', - PRIMARY KEY (`department_id`), - KEY `department_boss_id_idx` (`boss_id`), - KEY `department_company_id_idx` (`company_id`), - CONSTRAINT `dep_org_ibfk_3` FOREIGN KEY (`company_id`) REFERENCES `person` (`person_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=90 DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Table structure for table `discount_type` -- @@ -77839,7 +78357,7 @@ CREATE TABLE `income_employee` ( KEY `fperson_id` (`person_id`), CONSTRAINT `fincometype_id` FOREIGN KEY (`id_incomeType`) REFERENCES `incometype_employee` (`id_incometype`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fperson_id` FOREIGN KEY (`person_id`) REFERENCES `person` (`person_id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=59389 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=61237 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78265,7 +78783,7 @@ CREATE TABLE `media` ( PRIMARY KEY (`media_id`), KEY `media_media_type_id_idx` (`media_type_id`), CONSTRAINT `media_ibfk_1` FOREIGN KEY (`media_type_id`) REFERENCES `media_type` (`media_type_id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=927 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=935 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78620,7 +79138,7 @@ CREATE TABLE `person` ( UNIQUE KEY `person_nif_key` (`nif`), KEY `index1` (`person_id`,`name`,`nickname`,`firstname`), KEY `person_worker` (`id_trabajador`) -) ENGINE=InnoDB AUTO_INCREMENT=984 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=990 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78671,7 +79189,7 @@ CREATE TABLE `profile` ( KEY `profile_person_id_idx` (`person_id`), KEY `profile_profile_type_id_idx` (`profile_type_id`), CONSTRAINT `person_fk` FOREIGN KEY (`person_id`) REFERENCES `person` (`person_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=862 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=868 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78688,7 +79206,7 @@ CREATE TABLE `profile_address` ( PRIMARY KEY (`profile_address_id`), KEY `profile_address_address_id_idx` (`address_id`), KEY `profile_address_profile_id_idx` (`profile_id`) -) ENGINE=InnoDB AUTO_INCREMENT=93 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=98 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78707,7 +79225,7 @@ CREATE TABLE `profile_media` ( KEY `profile_media_profile_id_idx` (`profile_id`), CONSTRAINT `fk_profile_media_media1` FOREIGN KEY (`media_id`) REFERENCES `media` (`media_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `media_ibfk_20` FOREIGN KEY (`profile_id`) REFERENCES `profile` (`profile_id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1075 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=1083 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -80276,6 +80794,24 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `v_descuadre_portekk` +-- + +/*!50001 DROP VIEW IF EXISTS `v_descuadre_portekk`*/; +/*!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 `v_descuadre_portekk` AS select `t`.`Id_Ticket` AS `Id_Ticket`,round(sum((`mc`.`Valor` * `m`.`Cantidad`)),2) AS `suma_componente`,round(`es`.`shipping_charge`,2) AS `teorico_agencia`,round((sum((`mc`.`Valor` * `m`.`Cantidad`)) - `es`.`shipping_charge`),2) AS `diferencia`,`t`.`Fecha` AS `Fecha` from ((((`vn2008`.`Movimientos` `m` left join `vn2008`.`Movimientos_componentes` `mc` on((`m`.`Id_Movimiento` = `mc`.`Id_Movimiento`))) join `vn2008`.`tarifa_componentes` `tc` on(((`tc`.`Id_Componente` = `mc`.`Id_Componente`) and (`tc`.`tarifa_componentes_series_id` = 6)))) join `vn2008`.`Tickets` `t` on((`t`.`Id_Ticket` = `m`.`Id_Ticket`))) left join `vn2008`.`v_expeditions_shipping_charge2` `es` on((`es`.`Id_Ticket` = `t`.`Id_Ticket`))) where ((`t`.`Fecha` >= '2015-09-01') and (`t`.`empresa_id` in (442,791,567))) group by `t`.`Id_Ticket` having ((abs(`diferencia`) > 0.01) or isnull(`diferencia`)) */; +/*!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 `v_empresa` -- @@ -80384,6 +80920,24 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `v_expeditions_shipping_chargekk` +-- + +/*!50001 DROP VIEW IF EXISTS `v_expeditions_shipping_chargekk`*/; +/*!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 `v_expeditions_shipping_chargekk` AS select `t`.`Id_Ticket` AS `Id_Ticket`,sum(`az`.`price`) AS `shipping_charge`,`t`.`Fecha` AS `Fecha` from ((((((`Tickets` `t` join `Clientes` `cli` on((`cli`.`id_cliente` = `t`.`Id_Cliente`))) left join `expeditions` `e` on((`e`.`ticket_id` = `t`.`Id_Ticket`))) join `Consignatarios` `c` on((`c`.`id_consigna` = `t`.`Id_Consigna`))) join `Agencias` `a` on((`a`.`Id_Agencia` = `t`.`Id_Agencia`))) join `Agencias_province` `ap` on(((`t`.`warehouse_id` = `ap`.`warehouse_id`) and (`ap`.`province_id` = `c`.`province_id`) and (`ap`.`agency_id` = `a`.`agency_id`)))) join `Agencias_zonas` `az` on(((`az`.`Id_Agencia` = `t`.`Id_Agencia`) and (`az`.`zona` = `ap`.`zona`) and (`t`.`warehouse_id` = `az`.`warehouse_id`) and (`az`.`Id_Article` = `e`.`EsBulto`)))) where ((`t`.`Fecha` >= '2015-10-01') and (`cli`.`real` <> 0) and (`t`.`empresa_id` in (442,791,567))) group by `t`.`Id_Ticket` */; +/*!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 `v_fallo` -- @@ -81122,8 +81676,8 @@ 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 */ -/*!50001 VIEW `botanicExport` AS select `be`.`botanic_export_id` AS `id`,`be`.`edi_genus_id` AS `ediGenusFk`,`be`.`edi_specie_id` AS `ediSpecieFk`,`be`.`Id_Paises` AS `countryFk`,`be`.`restriction` AS `restriction`,`be`.`description` AS `description` from `vn2008`.`botanic_export` `be` */; +/*!50013 DEFINER=`z-developer`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `botanicExport` AS select `be`.`botanic_export_id` AS `id`,`be`.`edi_genus_id` AS `ediGenusFk`,`be`.`edi_specie_id` AS `ediSpecieFk`,`be`.`Id_Paises` AS `countryFk`,`be`.`restriction` AS `restriction`,`be`.`description` AS `description`,`be`.`isProtectedZone` AS `isProtectedZone` from `vn2008`.`botanic_export` `be` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -81789,7 +82343,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `department` AS select `b`.`department_id` AS `id`,`b`.`name` AS `name`,`b`.`father_id` AS `fatherFk`,`b`.`production` AS `isProduction` from `vn2008`.`department` `b` */; +/*!50001 VIEW `department` AS select `b`.`department_id` AS `id`,`b`.`name` AS `name`,`b`.`father_id` AS `fatherFk`,`b`.`production` AS `isProduction`,`b`.`lft` AS `lft`,`b`.`rgt` AS `rgt`,`b`.`isSelected` AS `isSelected` from `vn2008`.`department` `b` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -82455,7 +83009,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `item` AS select `t`.`Id_Article` AS `id`,`t`.`Article` AS `name`,`t`.`tipo_id` AS `typeFk`,`t`.`Medida` AS `size`,`t`.`Color` AS `inkFk`,`t`.`Categoria` AS `category`,`t`.`Tallos` AS `stems`,`t`.`id_origen` AS `originFk`,`t`.`description` AS `description`,`t`.`producer_id` AS `producerFk`,`t`.`Codintrastat` AS `intrastatFk`,`t`.`offer` AS `isOnOffer`,`t`.`caja` AS `box`,`t`.`expenceFk` AS `expenceFk`,`t`.`bargain` AS `isBargain`,`t`.`comments` AS `comment`,`t`.`relevancy` AS `relevancy`,`t`.`Foto` AS `image`,`t`.`generic` AS `generic`,`t`.`density` AS `density`,`t`.`iva_group_id` AS `taxClassFk`,`t`.`PVP` AS `minPrice`,`t`.`Min` AS `hasMinPrice`,`t`.`isActive` AS `isActive`,`t`.`longName` AS `longName`,`t`.`subName` AS `subName`,`t`.`tag5` AS `tag5`,`t`.`value5` AS `value5`,`t`.`tag6` AS `tag6`,`t`.`value6` AS `value6`,`t`.`tag7` AS `tag7`,`t`.`value7` AS `value7`,`t`.`tag8` AS `tag8`,`t`.`value8` AS `value8`,`t`.`tag9` AS `tag9`,`t`.`value9` AS `value9`,`t`.`tag10` AS `tag10`,`t`.`value10` AS `value10`,`t`.`minimum` AS `minimum`,`t`.`upToDown` AS `upToDown` from `vn2008`.`Articles` `t` */; +/*!50001 VIEW `item` AS select `t`.`Id_Article` AS `id`,`t`.`Article` AS `name`,`t`.`tipo_id` AS `typeFk`,`t`.`Medida` AS `size`,`t`.`Color` AS `inkFk`,`t`.`Categoria` AS `category`,`t`.`Tallos` AS `stems`,`t`.`id_origen` AS `originFk`,`t`.`description` AS `description`,`t`.`producer_id` AS `producerFk`,`t`.`Codintrastat` AS `intrastatFk`,`t`.`offer` AS `isOnOffer`,`t`.`caja` AS `box`,`t`.`expenceFk` AS `expenceFk`,`t`.`bargain` AS `isBargain`,`t`.`comments` AS `comment`,`t`.`relevancy` AS `relevancy`,`t`.`Foto` AS `image`,`t`.`generic` AS `generic`,`t`.`density` AS `density`,`t`.`iva_group_id` AS `taxClassFk`,`t`.`PVP` AS `minPrice`,`t`.`Min` AS `hasMinPrice`,`t`.`isActive` AS `isActive`,`t`.`longName` AS `longName`,`t`.`subName` AS `subName`,`t`.`tag5` AS `tag5`,`t`.`value5` AS `value5`,`t`.`tag6` AS `tag6`,`t`.`value6` AS `value6`,`t`.`tag7` AS `tag7`,`t`.`value7` AS `value7`,`t`.`tag8` AS `tag8`,`t`.`value8` AS `value8`,`t`.`tag9` AS `tag9`,`t`.`value9` AS `value9`,`t`.`tag10` AS `tag10`,`t`.`value10` AS `value10`,`t`.`minimum` AS `minimum`,`t`.`upToDown` AS `upToDown`,`t`.`lastPrice` AS `lastPrice` from `vn2008`.`Articles` `t` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -82581,7 +83135,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemPlacementSupplyList` AS select `ips`.`id` AS `id`,`ips`.`itemFk` AS `itemFk`,`ips`.`quantity` AS `quantity`,`ips`.`priority` AS `priority`,`ips`.`created` AS `created`,`ips`.`userFk` AS `userFk`,`ips`.`repoUserFk` AS `repoUserFk`,(`ips`.`quantity` - sum(ifnull(`isps`.`quantity`,0))) AS `saldo`,concat(`i`.`longName`,' ',`i`.`size`) AS `longName`,`i`.`subName` AS `subName`,`i`.`size` AS `size`,`w`.`workerCode` AS `workerCode`,`rw`.`workerCode` AS `repoCode` from (((((`vn`.`itemPlacementSupply` `ips` join `vn`.`itemShelving` `ish` on((`ish`.`itemFk` = `ips`.`itemFk`))) join `vn`.`item` `i` on((`i`.`id` = `ish`.`itemFk`))) left join `vn`.`worker` `w` on((`w`.`id` = `ips`.`userFk`))) left join `vn`.`worker` `rw` on((`rw`.`id` = `ips`.`repoUserFk`))) left join `vn`.`itemShelvingPlacementSupply` `isps` on((`isps`.`itemShelvingFk` = `ish`.`id`))) group by `ips`.`id` */; +/*!50001 VIEW `itemPlacementSupplyList` AS select `ips`.`id` AS `id`,`ips`.`itemFk` AS `itemFk`,`ips`.`quantity` AS `quantity`,`ips`.`priority` AS `priority`,`ips`.`created` AS `created`,`ips`.`userFk` AS `userFk`,`ips`.`repoUserFk` AS `repoUserFk`,(`ips`.`quantity` - sum(ifnull(`isps`.`quantity`,0))) AS `saldo`,concat(`i`.`longName`,' ',`i`.`size`) AS `longName`,`i`.`subName` AS `subName`,`i`.`size` AS `size`,`w`.`workerCode` AS `workerCode`,`rw`.`workerCode` AS `repoCode`,`p`.`code` AS `parking` from (((((((`vn`.`itemPlacementSupply` `ips` join `vn`.`itemShelving` `ish` on((`ish`.`itemFk` = `ips`.`itemFk`))) join `vn`.`item` `i` on((`i`.`id` = `ish`.`itemFk`))) left join `vn`.`worker` `w` on((`w`.`id` = `ips`.`userFk`))) left join `vn`.`worker` `rw` on((`rw`.`id` = `ips`.`repoUserFk`))) left join `vn`.`itemShelvingPlacementSupply` `isps` on((`isps`.`itemShelvingFk` = `ish`.`id`))) left join `vn`.`shelving` `s` on((`ish`.`shelvingFk` = `s`.`code`))) left join `vn`.`parking` `p` on((`s`.`parkingFk` = `p`.`id`))) group by `ips`.`id` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -82653,7 +83207,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` - `issr`.`removed`)) AS `visible`,min(`ish`.`packing`) AS `packing`,`s`.`description` AS `sector`,sum(`ish`.`visible`) AS `visibleOriginal`,sum(`issr`.`removed`) AS `removed` 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`))) left join `itemShelvingStockRemoved` `issr` on((`issr`.`itemShelvingFk` = `ish`.`id`))) 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`,`s`.`description` AS `sector`,sum(`ish`.`visible`) AS `visibleOriginal`,sum(`issr`.`removed`) AS `removed` 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`))) left join `itemShelvingStockRemoved` `issr` on((`issr`.`itemShelvingFk` = `ish`.`id`))) 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 */; @@ -83612,6 +84166,24 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `supplierPackaging` +-- + +/*!50001 DROP VIEW IF EXISTS `supplierPackaging`*/; +/*!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 `supplierPackaging` AS select `e`.`supplierFk` AS `supplierFk`,`b`.`itemFk` AS `itemFk`,`i`.`longName` AS `longName`,`s`.`name` AS `supplier`,`b`.`entryFk` AS `entryFk`,`tr`.`landed` AS `landed`,-(least(`b`.`quantity`,0)) AS `in`,greatest(`b`.`quantity`,0) AS `out`,`w`.`name` AS `almacen` from ((((((`vn`.`buy` `b` join `vn`.`item` `i` on((`i`.`id` = `b`.`itemFk`))) join `vn`.`packaging` `p` on((`p`.`itemFk` = `i`.`id`))) join `vn`.`entry` `e` on((`e`.`id` = `b`.`entryFk`))) join `vn`.`supplier` `s` on((`s`.`id` = `e`.`supplierFk`))) join `vn`.`travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) join `vn`.`warehouse` `w` on((`w`.`id` = `tr`.`warehouseInFk`))) where `p`.`isPackageReturnable` */; +/*!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 `tagL10n` -- @@ -83841,7 +84413,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketToPrepare` AS select `m`.`Id_Ticket` AS `Id_Ticket`,`mk`.`Id_Movimiento` AS `Id_Movimiento`,`mk`.`Id_Movimiento_mark` AS `Id_Movimiento_mark`,`mk`.`Id_Trabajador` AS `Id_Trabjador`,`m`.`Id_Article` AS `Id_Article`,`m`.`Concepte` AS `Concepte`,`art`.`subName` AS `subName`,(`mk`.`original_quantity` - sum(ifnull(`is`.`quantity`,0))) AS `Cantidad`,`mk`.`original_quantity` AS `original_quantity`,hour(`t`.`shipped`) AS `Hora`,hour(`t`.`shipped`) AS `Departure`,minute(`t`.`shipped`) AS `Minuto`,`am`.`agencyFk` AS `agency_id`,`t`.`warehouseFk` AS `warehouse_id`,`a`.`provinceFk` AS `province_id`,`is`.`quantity` AS `picked` from ((((((`vn2008`.`Movimientos_mark` `mk` join `vn2008`.`Movimientos` `m` on((`m`.`Id_Movimiento` = `mk`.`Id_Movimiento`))) join `vn`.`ticket` `t` on((`m`.`Id_Ticket` = `t`.`id`))) join `vn`.`agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) join `vn`.`address` `a` on((`a`.`id` = `t`.`addressFk`))) left join `vn`.`itemShelvingSale` `is` on((`is`.`saleFk` = `mk`.`Id_Movimiento`))) join `vn2008`.`Articles` `art` on((`art`.`Id_Article` = `m`.`Id_Article`))) where ((`mk`.`stateFk` = 26) and (`mk`.`valor` <> 1)) */; +/*!50001 VIEW `ticketToPrepare` AS select `m`.`Id_Ticket` AS `Id_Ticket`,`mk`.`Id_Movimiento` AS `Id_Movimiento`,`mk`.`Id_Movimiento_mark` AS `Id_Movimiento_mark`,`mk`.`Id_Trabajador` AS `Id_Trabjador`,`m`.`Id_Article` AS `Id_Article`,`m`.`Concepte` AS `Concepte`,`art`.`subName` AS `subName`,`mk`.`original_quantity` AS `Cantidad`,`mk`.`original_quantity` AS `original_quantity`,hour(`t`.`shipped`) AS `Hora`,hour(`t`.`shipped`) AS `Departure`,minute(`t`.`shipped`) AS `Minuto`,`am`.`agencyFk` AS `agency_id`,`t`.`warehouseFk` AS `warehouse_id`,`a`.`provinceFk` AS `province_id`,`is`.`quantity` AS `picked` from ((((((`vn2008`.`Movimientos_mark` `mk` join `vn2008`.`Movimientos` `m` on((`m`.`Id_Movimiento` = `mk`.`Id_Movimiento`))) join `vn`.`ticket` `t` on((`m`.`Id_Ticket` = `t`.`id`))) join `vn`.`agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) join `vn`.`address` `a` on((`a`.`id` = `t`.`addressFk`))) left join `vn`.`itemShelvingSale` `is` on((`is`.`saleFk` = `mk`.`Id_Movimiento`))) join `vn2008`.`Articles` `art` on((`art`.`Id_Article` = `m`.`Id_Article`))) where ((`mk`.`stateFk` = 26) and (`mk`.`valor` <> 1)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -84129,7 +84701,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `worker` AS select `t`.`Id_Trabajador` AS `id`,`t`.`CodigoTrabajador` AS `workerCode`,`t`.`Nombre` AS `firstName`,`t`.`Apellidos` AS `name`,`t`.`user_id` AS `userFk`,`t`.`phone` AS `phone`,`t`.`boss` AS `bossFk`,`t`.`Foto` AS `photo`,`t`.`dni` AS `fi`,`t`.`DniExpiration` AS `fiDueDate` from `vn2008`.`Trabajadores` `t` */; +/*!50001 VIEW `worker` AS select `t`.`Id_Trabajador` AS `id`,`t`.`CodigoTrabajador` AS `workerCode`,`t`.`Nombre` AS `firstName`,`t`.`Apellidos` AS `name`,`t`.`user_id` AS `userFk`,`t`.`phone` AS `phone`,`t`.`boss` AS `bossFk`,`t`.`Foto` AS `photo`,`t`.`dni` AS `fi`,`t`.`DniExpiration` AS `fiDueDate`,`t`.`CodigoTrabajador` AS `code`,`t`.`Apellidos` AS `lastName` from `vn2008`.`Trabajadores` `t` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -84147,7 +84719,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerDepartment` AS select `p`.`id_trabajador` AS `workerFk`,`d`.`name` AS `departmentFk` from (((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`person_id`))) left join (`postgresql`.`business` `b` left join `postgresql`.`business_labour` `bl` on((`b`.`business_id` = `bl`.`business_id`))) on((`pr`.`profile_id` = `b`.`client_id`))) join `vn`.`department` `d` on((`d`.`id` = `bl`.`department_id`))) where (isnull(`b`.`date_end`) or (`b`.`date_end` > curdate())) */; +/*!50001 VIEW `workerDepartment` AS select `p`.`id_trabajador` AS `workerFk`,`d`.`id` AS `departmentFk` from (((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`person_id`))) left join (`postgresql`.`business` `b` left join `postgresql`.`business_labour` `bl` on((`b`.`business_id` = `bl`.`business_id`))) on((`pr`.`profile_id` = `b`.`client_id`))) join `vn`.`department` `d` on((`d`.`id` = `bl`.`department_id`))) where ((isnull(`b`.`date_end`) and (`b`.`date_start` <= curdate())) or ((`b`.`date_end` > curdate()) and (`b`.`date_start` <= curdate()))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -85109,4 +85681,4 @@ USE `postgresql`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-02-11 7:19:22 +-- Dump completed on 2019-03-01 13:39:22 diff --git a/services/db/install/dump/truncateAll.sql b/db/install/dump/truncateAll.sql similarity index 100% rename from services/db/install/dump/truncateAll.sql rename to db/install/dump/truncateAll.sql diff --git a/services/db/tests.js b/db/tests.js similarity index 92% rename from services/db/tests.js rename to db/tests.js index bf2f45b2e..74ea9a80b 100644 --- a/services/db/tests.js +++ b/db/tests.js @@ -18,11 +18,11 @@ let jasmine = new Jasmine(); let SpecReporter = require('jasmine-spec-reporter').SpecReporter; let serviceSpecs = [ - './db/tests/**/*[sS]pec.js' + './tests/**/*[sS]pec.js' ]; jasmine.loadConfig({ - spec_dir: 'services', + spec_dir: 'db', spec_files: serviceSpecs, helpers: [] }); diff --git a/services/db/tests/cache/last_buy_refresh.spec.js b/db/tests/cache/last_buy_refresh.spec.js similarity index 100% rename from services/db/tests/cache/last_buy_refresh.spec.js rename to db/tests/cache/last_buy_refresh.spec.js diff --git a/services/db/tests/vn/buyUltimate.spec.js b/db/tests/vn/buyUltimate.spec.js similarity index 100% rename from services/db/tests/vn/buyUltimate.spec.js rename to db/tests/vn/buyUltimate.spec.js diff --git a/services/db/tests/vn/buyUltimateFromInterval.spec.js b/db/tests/vn/buyUltimateFromInterval.spec.js similarity index 100% rename from services/db/tests/vn/buyUltimateFromInterval.spec.js rename to db/tests/vn/buyUltimateFromInterval.spec.js diff --git a/services/db/tests/vn/logAddWithUser.spec.js b/db/tests/vn/logAddWithUser.spec.js similarity index 100% rename from services/db/tests/vn/logAddWithUser.spec.js rename to db/tests/vn/logAddWithUser.spec.js diff --git a/services/db/tests/vn/ticketCalculateClon.spec.js b/db/tests/vn/ticketCalculateClon.spec.js similarity index 100% rename from services/db/tests/vn/ticketCalculateClon.spec.js rename to db/tests/vn/ticketCalculateClon.spec.js diff --git a/services/db/tests/vn/ticketComponentUpdateSale.spec.js b/db/tests/vn/ticketComponentUpdateSale.spec.js similarity index 100% rename from services/db/tests/vn/ticketComponentUpdateSale.spec.js rename to db/tests/vn/ticketComponentUpdateSale.spec.js diff --git a/services/db/tests/vn/ticketCreateWithUser.spec.js b/db/tests/vn/ticketCreateWithUser.spec.js similarity index 99% rename from services/db/tests/vn/ticketCreateWithUser.spec.js rename to db/tests/vn/ticketCreateWithUser.spec.js index 52a8a1183..e5ff299a7 100644 --- a/services/db/tests/vn/ticketCreateWithUser.spec.js +++ b/db/tests/vn/ticketCreateWithUser.spec.js @@ -183,6 +183,7 @@ describe('ticket ticketCreateWithUser()', () => { params.landed, params.userId ]); + stmts.push(stmt); let ticketAddressIndex = stmts.push(`SELECT addressFk FROM vn.ticket WHERE id = @newTicketId`) - 1; @@ -191,12 +192,9 @@ describe('ticket ticketCreateWithUser()', () => { params.clientFk, ]); let clientDefaultAddressIndex = stmts.push(stmt) - 1; - stmts.push('ROLLBACK'); - let sql = ParameterizedSQL.join(stmts, ';'); let result = await app.models.Ticket.rawStmt(sql); - let ticketAddress = result[ticketAddressIndex][0]; let clientDefaultAddress = result[clientDefaultAddressIndex][0]; diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 958c92d02..b62bbf4a7 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -160,6 +160,16 @@ let actions = { .catch(done); }, + waitToFocus: function(selector, done) { + this.wait(selector) + .evaluate_now(selector => { + let element = document.querySelector(selector); + element.focus(); + }, done, selector) + .then(done) + .catch(done); + }, + isVisible: function(selector, done) { this.wait(selector) .evaluate_now(elementSelector => { @@ -351,6 +361,7 @@ let actions = { accessToSearchResult: function(searchValue, done) { this.write(`vn-searchbar input`, searchValue) .click(`vn-searchbar vn-icon[icon="search"]`) + .wait(100) .waitForNumberOfElements('.searchResult', 1) .evaluate(() => { return document.querySelector('ui-view vn-card vn-table') != null; diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 45a3d4e3e..a37d63854 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -31,6 +31,8 @@ export default { name: `${components.vnTextfield}[name="name"]`, taxNumber: `${components.vnTextfield}[name="fi"]`, socialName: `${components.vnTextfield}[name="socialName"]`, + street: `${components.vnTextfield}[name="street"]`, + city: `${components.vnTextfield}[name="city"]`, userName: `${components.vnTextfield}[name="userName"]`, email: `${components.vnTextfield}[name="email"]`, salesPersonAutocomplete: `vn-autocomplete[field="$ctrl.client.salesPersonFk"]`, @@ -149,6 +151,7 @@ export default { }, clientLog: { logButton: `vn-left-menu a[ui-sref="client.card.log"]`, + lastModificationDate: 'vn-client-log > vn-log vn-table vn-tbody > vn-tr > vn-td:nth-child(1)', lastModificationPreviousValue: 'vn-client-log vn-table vn-td.before', lastModificationCurrentValue: 'vn-client-log vn-table vn-td.after' @@ -165,7 +168,7 @@ export default { }, webPayment: { confirmFirstPaymentButton: 'vn-client-web-payment vn-tr:nth-child(1) vn-icon-button[icon="done_all"]', - firstPaymentConfirmed: 'vn-client-web-payment vn-tr:nth-child(1) vn-icon[icon="check"]' + firstPaymentConfirmed: 'vn-client-web-payment vn-tr:nth-child(1) vn-icon[icon="check"][aria-hidden="false"]' }, itemsIndex: { goBackToModuleIndexButton: `vn-ticket-descriptor a[href="#!/ticket/index"]`, @@ -339,12 +342,13 @@ export default { firstSaleThumbnailImage: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) vn-td:nth-child(3) > img', firstSaleZoomedImage: 'body > div > div > img', firstSaleQuantity: `vn-textfield[model="sale.quantity"]:nth-child(1) input`, + firstSaleQuantityCell: `vn-ticket-sale vn-tr:nth-child(1) > vn-td-editable`, firstSaleQuantityClearInput: `vn-textfield[model="sale.quantity"] div.suffix > i`, firstSaleID: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(4) > span', firstSalePrice: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) > vn-td:nth-child(7) > span', - firstSalePriceInput: 'vn-ticket-sale:nth-child(1) > vn-vertical > vn-popover.edit.dialog-summary.ng-isolate-scope.vn-popover.shown > div > div.content > div > vn-textfield', + firstSalePriceInput: 'vn-ticket-sale:nth-child(1) vn-popover.edit.dialog-summary.ng-isolate-scope.vn-popover.shown vn-textfield input', firstSaleDiscount: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(8) > span', - firstSaleDiscountInput: 'vn-ticket-sale:nth-child(1) vn-ticket-sale-edit-discount > div > vn-textfield > div > div > div.infix > input.ng-not-empty', + firstSaleDiscountInput: 'vn-ticket-sale:nth-child(1) vn-ticket-sale-edit-discount vn-textfield input', firstSaleImport: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(9)', firstSaleReservedIcon: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td:nth-child(2) > vn-icon:nth-child(3)', firstSaleColour: `vn-ticket-sale vn-tr:nth-child(1) vn-td:nth-child(6) section:nth-child(1)`, @@ -468,6 +472,17 @@ export default { secondClaimRedeliveryAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[field="claimDevelopment.claimRedeliveryFk"]', saveDevelopmentButton: `${components.vnSubmit}` }, + claimAction: { + importClaimButton: 'vn-claim-action vn-button[label="Import claim"]', + importTicketButton: 'vn-claim-action vn-button[label="Import ticket"]', + secondImportableTicket: 'vn-claim-action > vn-vertical > vn-popover > div > div.content > div > vn-table > div > vn-tbody > vn-tr:nth-child(2)', + firstLineDestination: 'vn-claim-action vn-tr:nth-child(1) vn-autocomplete[field="saleClaimed.claimDestinationFk"]', + thirdLineDestination: 'vn-claim-action vn-tr:nth-child(3) vn-autocomplete[field="saleClaimed.claimDestinationFk"]', + firstDeleteLine: 'vn-claim-action vn-tr:nth-child(1) vn-icon-button[icon="delete"]', + secondDeleteLine: 'vn-claim-action vn-tr:nth-child(2) vn-icon-button[icon="delete"]', + thirdDeleteLine: 'vn-claim-action vn-tr:nth-child(3) vn-icon-button[icon="delete"]' + + }, ordersIndex: { searchResult: `vn-order-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr`, searchResultDate: `vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(4)`, diff --git a/e2e/paths/claim-module/04_claim_action.spec.js b/e2e/paths/claim-module/04_claim_action.spec.js new file mode 100644 index 000000000..2a61c088f --- /dev/null +++ b/e2e/paths/claim-module/04_claim_action.spec.js @@ -0,0 +1,63 @@ +import selectors from '../../helpers/selectors.js'; +import createNightmare from '../../helpers/nightmare'; + +describe('Claim edit basic data path', () => { + const nightmare = createNightmare(); + + beforeAll(() => { + nightmare + .loginAndModule('administrative', 'claim') + .accessToSearchResult('4') + .accessToSection('claim.card.action'); + }); + + it('should import the claim', async() => { + const result = await nightmare + .waitToClick(selectors.claimAction.importClaimButton) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should import the eighth ticket', async() => { + const result = await nightmare + .waitToClick(selectors.claimAction.importTicketButton) + .waitToClick(selectors.claimAction.secondImportableTicket) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should edit the fourth line destination field', async() => { + const result = await nightmare + .autocompleteSearch(selectors.claimAction.thirdLineDestination, 'Bueno') + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should delete two first lines', async() => { + const result = await nightmare + .waitToClick(selectors.claimAction.secondDeleteLine) + .waitToClick(selectors.claimAction.firstDeleteLine) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should refresh the view to check the remaining line is the expected one', async() => { + const result = await nightmare + .reloadSection('claim.card.action') + .waitToGetProperty(`${selectors.claimAction.firstLineDestination} input`, 'value'); + + expect(result).toEqual('Bueno'); + }); + + it('should delete the current first line', async() => { + const result = await nightmare + .waitToClick(selectors.claimAction.firstDeleteLine) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); +}); diff --git a/e2e/paths/client-module/01_create_client.spec.js b/e2e/paths/client-module/01_create_client.spec.js index 467603d70..0a8396edc 100644 --- a/e2e/paths/client-module/01_create_client.spec.js +++ b/e2e/paths/client-module/01_create_client.spec.js @@ -52,6 +52,8 @@ describe('Client create path', () => { const result = await nightmare .write(selectors.createClientView.name, 'Carol Danvers') .write(selectors.createClientView.socialName, 'AVG tax') + .write(selectors.createClientView.street, 'Many places') + .write(selectors.createClientView.city, 'Silla') .clearInput(selectors.createClientView.email) .write(selectors.createClientView.email, 'incorrect email format') .waitToClick(selectors.createClientView.createButton) diff --git a/e2e/paths/client-module/03_edit_fiscal_data.spec.js b/e2e/paths/client-module/03_edit_fiscal_data.spec.js index e8b4ada00..d837d817e 100644 --- a/e2e/paths/client-module/03_edit_fiscal_data.spec.js +++ b/e2e/paths/client-module/03_edit_fiscal_data.spec.js @@ -58,7 +58,7 @@ describe('Client Edit fiscalData path', () => { .accessToSection('client.card.fiscalData'); }); - it('should receive an error if VIES and EQtax are being ticked together', async() => { + it('should edit the fiscal data', async() => { const result = await nightmare .wait(selectors.clientFiscalData.socialNameInput) .clearInput(selectors.clientFiscalData.socialNameInput) @@ -84,9 +84,17 @@ describe('Client Edit fiscalData path', () => { .waitToClick(selectors.clientFiscalData.saveButton) .waitForLastSnackbar(); - expect(result).toEqual('Cannot check VIES and Equalization Tax'); + expect(result).toEqual('Data saved!'); }, 15000); + it('should propagate the Equalization tax', async() => { + const result = await nightmare + .waitToClick(selectors.clientFiscalData.acceptPropagationButton) + .waitForLastSnackbar(); + + expect(result).toEqual('Equivalent tax spreaded'); + }); + it('should receive an error if the fiscal id contains A or B at the beginning', async() => { const result = await nightmare .waitToClick(selectors.clientFiscalData.viesCheckbox) @@ -108,14 +116,6 @@ describe('Client Edit fiscalData path', () => { expect(result).toEqual('Data saved!'); }); - it('should propagate the Equalization tax', async() => { - const result = await nightmare - .waitToClick(selectors.clientFiscalData.acceptPropagationButton) - .waitForLastSnackbar(); - - expect(result).toEqual('Equivalent tax spreaded'); - }); - // confirm all addresses have now EQtax checked step 1 it(`should click on the addresses button to access to the client's addresses`, async() => { const url = await nightmare diff --git a/e2e/paths/client-module/13_log.spec.js b/e2e/paths/client-module/13_log.spec.js index 2a82744ff..aba23ab72 100644 --- a/e2e/paths/client-module/13_log.spec.js +++ b/e2e/paths/client-module/13_log.spec.js @@ -4,6 +4,8 @@ import createNightmare from '../../helpers/nightmare'; describe('Client log path', () => { const nightmare = createNightmare(); + let date; + beforeAll(() => { nightmare .loginAndModule('employee', 'client') @@ -17,6 +19,7 @@ describe('Client log path', () => { .write(selectors.clientBasicData.nameInput, 'this is a test') .waitToClick(selectors.clientBasicData.saveButton) .waitForLastSnackbar(); + date = new Date(); expect(result).toEqual('Data saved!'); }); @@ -38,9 +41,33 @@ describe('Client log path', () => { }); it('should check the current value of the last logged change', async() => { + let lastModificationDate = await nightmare + .waitToGetProperty(selectors.clientLog.lastModificationDate, 'innerText'); + + let lastModificationPreviousValue = await nightmare + .waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText'); + let lastModificationCurrentValue = await nightmare .waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText'); - expect(lastModificationCurrentValue).toContain('this is a test'); + let month = date.getMonth() + 1; + let day = date.getDate(); + let year = date.getFullYear(); + let hours = date.getHours(); + let minutes = date.getMinutes(); + + if (month.toString().length < 2) month = '0' + month; + if (day.toString().length < 2) day = `0${day}`; + if (hours.toString().length < 2) hours = '0' + hours; + if (minutes.toString().length < 2) minutes = `0${minutes}`; + + let today = [day, month, year].join('/'); + let time = [hours, minutes].join(':'); + + let now = [today, time].join(' '); + + expect(lastModificationDate).toContain(now); + expect(lastModificationPreviousValue).toEqual('name: DavidCharlesHaller'); + expect(lastModificationCurrentValue).toEqual('name: this is a test'); }); }); diff --git a/e2e/paths/client-module/16_web_payment.spec.js b/e2e/paths/client-module/16_web_payment.spec.js index d7f8e88f3..3e9a26b75 100644 --- a/e2e/paths/client-module/16_web_payment.spec.js +++ b/e2e/paths/client-module/16_web_payment.spec.js @@ -1,15 +1,14 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -// #860 E2E client/client/src/web-payment/index.js missing fixtures for another client -xdescribe('Client web Payment', () => { +describe('Client web Payment', () => { const nightmare = createNightmare(); describe('as employee', () => { beforeAll(() => { nightmare .loginAndModule('employee', 'client') - .accessToSearchResult('Bruce Wayne') + .accessToSearchResult('Tony Stark') .accessToSection('client.card.webPayment'); }); @@ -25,13 +24,14 @@ xdescribe('Client web Payment', () => { beforeAll(() => { nightmare .loginAndModule('administrative', 'client') - .accessToSearchResult('Bruce Wayne') + .accessToSearchResult('Tony Stark') .accessToSection('client.card.webPayment'); }); it('should be able to confirm payments', async() => { let exists = await nightmare .waitToClick(selectors.webPayment.confirmFirstPaymentButton) + .wait(selectors.webPayment.firstPaymentConfirmed) .exists(selectors.webPayment.firstPaymentConfirmed); expect(exists).toBeTruthy(); diff --git a/e2e/paths/item-module/09_regularize_item.spec.js b/e2e/paths/item-module/09_regularize_item.spec.js index 1294abf1e..50d5d2f68 100644 --- a/e2e/paths/item-module/09_regularize_item.spec.js +++ b/e2e/paths/item-module/09_regularize_item.spec.js @@ -1,7 +1,8 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -describe('Item regularize path', () => { +// #1186 repearar e2e ticket.sale, item.regularize. +xdescribe('Item regularize path', () => { const nightmare = createNightmare(); beforeAll(() => { nightmare @@ -176,7 +177,7 @@ describe('Item regularize path', () => { it('should search for the ticket with id 23 once again', async() => { const result = await nightmare - .write(selectors.ticketsIndex.searchTicketInput, 'id:23') + .write(selectors.ticketsIndex.searchTicketInput, 'id:24') .waitToClick(selectors.ticketsIndex.searchButton) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .countElement(selectors.ticketsIndex.searchResult); @@ -186,7 +187,7 @@ describe('Item regularize path', () => { it(`should now click on the search result to access to the ticket summary`, async() => { const url = await nightmare - .waitForTextInElement(selectors.ticketsIndex.searchResult, '23') + .waitForTextInElement(selectors.ticketsIndex.searchResult, '24') .waitToClick(selectors.ticketsIndex.searchResult) .waitForURL('/summary') .parsedUrl(); diff --git a/e2e/paths/ticket-module/03_list_sale.spec.js b/e2e/paths/ticket-module/03_list_sale.spec.js index 2813bb988..54d63e26a 100644 --- a/e2e/paths/ticket-module/03_list_sale.spec.js +++ b/e2e/paths/ticket-module/03_list_sale.spec.js @@ -15,21 +15,21 @@ describe('Ticket List sale path', () => { const value = await nightmare .waitToGetProperty(selectors.ticketSales.firstSaleColour, 'innerText'); - expect(value).toContain('Red'); + expect(value).toContain('Yellow'); }); it('should confirm the first ticket sale contains the lenght', async() => { const value = await nightmare .waitToGetProperty(selectors.ticketSales.firstSaleText, 'innerText'); - expect(value).toContain('3'); + expect(value).toContain('5'); }); it('should confirm the first ticket sale contains the price', async() => { const value = await nightmare .waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText'); - expect(value).toContain('1.30'); + expect(value).toContain('2.30'); }); it('should confirm the first ticket sale contains the discount', async() => { @@ -43,7 +43,7 @@ describe('Ticket List sale path', () => { const value = await nightmare .waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText'); - expect(value).toContain('19.50'); + expect(value).toContain('23'); }); it('should navigate to the catalog by pressing the new item button', async() => { diff --git a/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js b/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js index d48b67c81..067cc55e4 100644 --- a/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js +++ b/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js @@ -73,7 +73,7 @@ describe('Ticket Edit basic data path', () => { .wait(1900) .waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText'); - expect(result).toContain('-€187.75'); + expect(result).toContain('-€208.75'); }); it(`should then click next to move on to step three`, async() => { diff --git a/e2e/paths/ticket-module/07_edit_sale.spec.js b/e2e/paths/ticket-module/07_edit_sale.spec.js index 9a0a3f35d..0edba8750 100644 --- a/e2e/paths/ticket-module/07_edit_sale.spec.js +++ b/e2e/paths/ticket-module/07_edit_sale.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -// #1152 refactor ticket.sale, update price no funciona correctamente. +// #1186 repearar e2e ticket.sale, item.regularize. xdescribe('Ticket Edit sale path', () => { const nightmare = createNightmare(); @@ -138,7 +138,7 @@ xdescribe('Ticket Edit sale path', () => { it('should try to add a higher quantity value and then receive an error', async() => { const result = await nightmare - .waitToClick(selectors.ticketSales.firstSaleQuantityClearInput) + .waitToFocus(selectors.ticketSales.firstSaleQuantityCell) .write(selectors.ticketSales.firstSaleQuantity, '9\u000d') .waitForLastSnackbar(); @@ -147,7 +147,7 @@ xdescribe('Ticket Edit sale path', () => { it('should remove 1 from quantity', async() => { const result = await nightmare - .waitToClick(selectors.ticketSales.firstSaleQuantityClearInput) + .waitToFocus(selectors.ticketSales.firstSaleQuantityCell) .write(selectors.ticketSales.firstSaleQuantity, '4\u000d') .waitForLastSnackbar(); @@ -180,7 +180,6 @@ xdescribe('Ticket Edit sale path', () => { it('should update the discount', async() => { const result = await nightmare .waitToClick(selectors.ticketSales.firstSaleDiscount) - .wait('vn-textfield[label="Discount"] > div[class="container selected"]') // a function selects the text after it's loaded .write(selectors.ticketSales.firstSaleDiscountInput, '50\u000d') // .write('body', '\u000d') // simulates enter .waitForLastSnackbar(); @@ -467,7 +466,7 @@ xdescribe('Ticket Edit sale path', () => { .waitToClick(selectors.ticketSales.moreMenuButton) .waitToClick(selectors.ticketSales.moreMenuUpdateDiscount) .write(selectors.ticketSales.moreMenuUpdateDiscountInput, 100) - .write('body', '\u000d') // simulates enter + .write('body', '\u000d') .waitForTextInElement(selectors.ticketSales.totalImport, '0.00') .waitToGetProperty(selectors.ticketSales.totalImport, 'innerText'); @@ -597,16 +596,16 @@ xdescribe('Ticket Edit sale path', () => { describe('when state is preparation and loged as salesPerson', () => { it(`shouldnt be able to edit the sale price`, async() => { const result = await nightmare - .waitToClick(selectors.ticketSales.firstSalePrice) - .exists(selectors.ticketSales.firstSalePriceInput); + .waitToClick(selectors.ticketSales.firstSaleID) + .exists(selectors.ticketSales.firstSalePrice); expect(result).toBeFalsy(); }); it(`shouldnt be able to edit the sale discount`, async() => { const result = await nightmare - .waitToClick(selectors.ticketSales.firstSaleDiscount) - .exists(selectors.ticketSales.firstSaleDiscountInput); + .waitToClick(selectors.ticketSales.firstSaleID) + .exists(selectors.ticketSales.firstSaleDiscount); expect(result).toBeFalsy(); }); diff --git a/front/core/components/button/button.js b/front/core/components/button/button.js index a2b798023..4e5cf50a2 100644 --- a/front/core/components/button/button.js +++ b/front/core/components/button/button.js @@ -15,9 +15,8 @@ export default class Button extends Input { } $onInit() { - if (!this.type) { + if (!this.type) this.type = 'button'; - } } } Button.$inject = ['$element']; diff --git a/front/core/components/searchbar/searchbar.spec.js b/front/core/components/searchbar/searchbar.spec.js new file mode 100644 index 000000000..9e28d0a98 --- /dev/null +++ b/front/core/components/searchbar/searchbar.spec.js @@ -0,0 +1,84 @@ +import './searchbar.js'; + +describe('Component vnSearchbar', () => { + let controller; + let $element; + let $state; + + beforeEach(ngModule('vnCore')); + + beforeEach(angular.mock.inject(($componentController, _$state_) => { + $state = _$state_; + $element = angular.element(`
`); + controller = $componentController('vnSearchbar', {$element, $state}); + controller.panel = 'vn-client-search-panel'; + })); + + describe('$postLink()', () => { + it(`should not call onStateChange() if filter is defined`, () => { + spyOn(controller, 'onStateChange'); + controller.filter = {}; + + controller.$postLink(); + + expect(controller.onStateChange).not.toHaveBeenCalledWith(); + }); + + it(`should call onStateChange() if filter is null`, () => { + spyOn(controller, 'onStateChange'); + controller.filter = null; + + controller.$postLink(); + + expect(controller.onStateChange).toHaveBeenCalledWith(); + }); + }); + + describe('filter() setter', () => { + it(`should call $state.go()`, () => { + controller._filter = {}; + spyOn(controller.$state, 'go'); + controller.filter = {expected: 'filter'}; + + expect(controller._filter).toEqual(controller.filter); + expect(controller.$state.go).toHaveBeenCalledWith('.', Object({q: '{"expected":"filter"}'})); + }); + }); + + describe('openPanel()', () => { + it(`should do nothing if the event is prevented`, () => { + let event = { + defaultPrevented: true, + preventDefault: jasmine.createSpy('preventDefault') + }; + controller.openPanel(event); + + expect(event.preventDefault).not.toHaveBeenCalledWith(); + }); + }); + + describe('getObjectFromString()', () => { + it(`should return a formated object based on the string received for basic search`, () => { + let result = controller.getObjectFromString('Bruce Wayne'); + + expect(result).toEqual({search: 'Bruce Wayne'}); + }); + + it(`should return a formated object based on the string received for advanced search`, () => { + let result = controller.getObjectFromString('id:101 name:(Bruce Wayne)'); + + expect(result).toEqual({id: '101', name: 'Bruce Wayne'}); + }); + + it(`should format the object grouping any unmatched part of the instring of the string to the search property`, () => { + let string = 'I am the search id:101 name:(Bruce Wayne) concatenated value'; + let result = controller.getObjectFromString(string); + + expect(result).toEqual({ + id: '101', + name: 'Bruce Wayne', + search: 'I am the search concatenated value' + }); + }); + }); +}); diff --git a/front/core/components/td-editable/index.html b/front/core/components/td-editable/index.html index 14336126d..8a1e33fe8 100644 --- a/front/core/components/td-editable/index.html +++ b/front/core/components/td-editable/index.html @@ -1,4 +1,2 @@ -