diff --git a/back/methods/collection/getSectors.js b/back/methods/collection/getSectors.js deleted file mode 100644 index 12ad0dc06..000000000 --- a/back/methods/collection/getSectors.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = Self => { - Self.remoteMethod('getSectors', { - description: 'Get all sectors', - accessType: 'READ', - returns: { - type: 'Object', - root: true - }, - http: { - path: `/getSectors`, - verb: 'GET' - } - }); - - Self.getSectors = async() => { - const query = `CALL vn.sector_get()`; - const [result] = await Self.rawSql(query); - return result; - }; -}; diff --git a/back/methods/collection/spec/getSectors.spec.js b/back/methods/collection/spec/getSectors.spec.js deleted file mode 100644 index d8fa60663..000000000 --- a/back/methods/collection/spec/getSectors.spec.js +++ /dev/null @@ -1,11 +0,0 @@ -const {models} = require('vn-loopback/server/server'); - -describe('getSectors()', () => { - it('return list of sectors', async() => { - let response = await models.Collection.getSectors(); - - expect(response.length).toBeGreaterThan(0); - expect(response[0].id).toEqual(1); - expect(response[0].description).toEqual('First sector'); - }); -}); diff --git a/back/models/collection.js b/back/models/collection.js index 1c10d49fa..52ef26e88 100644 --- a/back/models/collection.js +++ b/back/models/collection.js @@ -1,6 +1,5 @@ module.exports = Self => { require('../methods/collection/getCollection')(Self); - require('../methods/collection/getSectors')(Self); require('../methods/collection/setSaleQuantity')(Self); require('../methods/collection/previousLabel')(Self); require('../methods/collection/getTickets')(Self); diff --git a/db/.pullinfo.json b/db/.pullinfo.json index 20a294f1f..f4afbc5fb 100644 --- a/db/.pullinfo.json +++ b/db/.pullinfo.json @@ -1,4 +1,16 @@ { "lastPull": "2024-02-15T08:58:24.000Z", - "shaSums": {} + "shaSums": { + "srt": { + "view": { + "routePalletized": "765f8933a6a5a86dfe8f22825cc77351bc8620cdf1be9d3f25abb130460f3a61", + "ticketPalletized": "c327f3243e717cc607f01d3747967ba68158f90ef1038986b0aa6ae6d5ce7309" + } + }, + "vn": { + "view": { + "expeditionPallet_Print": "288cbd6e8289df083ed5eb1a2c808f7a82ba4c90c8ad9781104808a7a54471fb" + } + } + } } \ No newline at end of file diff --git a/db/dump/.dump/data.sql b/db/dump/.dump/data.sql index 8bbe54598..6fe6c1414 100644 --- a/db/dump/.dump/data.sql +++ b/db/dump/.dump/data.sql @@ -3,8 +3,7 @@ USE `util`; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -INSERT INTO `version` VALUES ('salix','10230','53f69ae8e526a4a5d827c237a5b076d38507b392','2020-11-09 11:06:43',NULL); -INSERT INTO `version` VALUES ('vn-database','10818','b7edbbe12f35d0cbc3e6b83e54977ac1c8acfc74','2024-01-25 10:00:48','10831'); +INSERT INTO `version` VALUES ('vn-database','10861','6685a201143a320920bbe04db7f8d0d1bd32d415','2024-02-15 10:04:54','10886'); INSERT INTO `versionLog` VALUES ('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL); @@ -539,6 +538,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10757','00-firstScript.sql','jen INSERT INTO `versionLog` VALUES ('vn-database','10758','00-sectorType.sql','jenkins@db-proxy1.static.verdnatura.es','2023-12-14 12:17:18',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10758','01-dipole.sql','jenkins@db-proxy1.static.verdnatura.es','2023-12-14 12:17:18',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10758','02-agencyMode.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:32',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10758','03-item.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:44',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10761','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-16 09:30:58',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10764','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2024-01-04 12:07:59',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10768','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-11-30 13:11:37',NULL,NULL); @@ -546,6 +546,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10771','00-firstScript.sql','jen INSERT INTO `versionLog` VALUES ('vn-database','10773','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-11-30 13:11:38',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10775','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2024-01-03 10:18:16',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10778','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-11-30 13:11:38',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10781','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:54',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10782','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2024-01-03 10:18:16',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10783','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-24 14:49:17',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10784','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:32',NULL,NULL); @@ -574,7 +575,45 @@ INSERT INTO `versionLog` VALUES ('vn-database','10815','00-firstScript.sql','jen INSERT INTO `versionLog` VALUES ('vn-database','10816','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:36',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10817','00-invoiceOutConfig_refLen.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-24 21:47:35',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10818','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:36',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10819','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10820','00-grants.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10825','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-01 10:24:54',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10827','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-23 12:32:13',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10828','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10828','01-RevokeClientes_regalos_lista.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10832','00-util_tx_commit.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10832','00-util_tx_rollback.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10832','00-util_tx_start.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10832','01-update_procedure_TravelCloneWithEntries.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10832','02-grant_privileges_util_tx.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10838','00-createInventoryConfig.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-07 22:36:27',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10845','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10848','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','00-roleLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','01-userLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','02-entryLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','03-clientLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','04-itemLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','05-shelvingLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','06-workerLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','07-deviceProductionLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','08-zoneLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','09-rateLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','10-ticketLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','11-userLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','12-routeLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','13-claimLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','14-supplierLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','15-invoiceInLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','16-travelLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','17-packingSiteDeviceLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10851','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-01-30 13:31:15',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10853','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:05',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10853','00-secondScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10854','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-30 16:20:34',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10855','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10858','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10861','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL); /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; @@ -631,7 +670,7 @@ INSERT INTO `role` VALUES (57,'deliveryBoss','Jefe de personal de reparto',1,'20 INSERT INTO `role` VALUES (58,'packager','Departamento encajadores',1,'2019-01-21 13:43:45','2019-01-21 13:43:45',NULL); INSERT INTO `role` VALUES (59,'packagerBoss','Jefe departamento encajadores',1,'2019-01-21 13:44:10','2019-01-21 13:44:10',NULL); INSERT INTO `role` VALUES (60,'productionAssi','Tareas relacionadas con producción y administración',1,'2019-01-29 14:29:01','2019-01-29 14:29:01',NULL); -INSERT INTO `role` VALUES (61,'replenisherBos','Jefe de Complementos/Camara',1,'2019-07-01 08:44:07','2019-07-01 08:44:07',NULL); +INSERT INTO `role` VALUES (61,'replenisherBoss','Jefe de Complementos/Camara',1,'2019-07-01 08:44:07','2024-02-01 12:07:29',19336); INSERT INTO `role` VALUES (62,'noLogin','Role without login access to MySQL',0,'2019-07-01 08:50:19','2019-07-02 15:42:05',NULL); INSERT INTO `role` VALUES (64,'balanceSheet','Consulta de Balance',0,'2019-07-16 14:12:08','2019-07-16 14:12:08',NULL); INSERT INTO `role` VALUES (65,'officeBoss','Jefe de filial',1,'2019-08-02 08:54:26','2019-08-02 08:54:26',NULL); @@ -669,6 +708,7 @@ INSERT INTO `role` VALUES (124,'hrBuyer','Recursos Humanos con Buyer',1,'2023-10 INSERT INTO `role` VALUES (125,'claimViewer','Trabajadores que consulta las reclamaciones ',1,'2023-11-16 09:14:46','2023-11-16 09:14:46',10578); INSERT INTO `role` VALUES (126,'greenhouseBoss','Jefe de invernadero',1,'2023-11-16 14:32:13','2023-11-16 14:32:13',NULL); INSERT INTO `role` VALUES (127,'timeControl','Tablet para fichar',1,'2024-01-09 16:36:56','2024-01-09 16:36:56',NULL); +INSERT INTO `role` VALUES (129,'buyerAssistant','Comprador que tienes mas permisos para ayudar al buyerBoss en algunas tareas',1,'2024-02-06 06:59:12','2024-02-06 06:59:12',783); INSERT INTO `roleInherit` VALUES (1,1,2,NULL); INSERT INTO `roleInherit` VALUES (2,1,3,NULL); @@ -932,6 +972,7 @@ INSERT INTO `roleInherit` VALUES (355,127,11,NULL); INSERT INTO `roleInherit` VALUES (356,123,125,NULL); INSERT INTO `roleInherit` VALUES (357,36,35,NULL); INSERT INTO `roleInherit` VALUES (358,36,49,NULL); +INSERT INTO `roleInherit` VALUES (359,129,35,NULL); INSERT INTO `userPassword` VALUES (1,7,1,0,2,1); @@ -1508,7 +1549,7 @@ INSERT INTO `ACL` VALUES (676,'Ticket','invoiceTickets','WRITE','ALLOW','ROLE',' INSERT INTO `ACL` VALUES (680,'MailAliasAccount','*','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (681,'MailAliasAccount','create','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (682,'MailAliasAccount','deleteById','WRITE','ALLOW','ROLE','employee'); -INSERT INTO `ACL` VALUES (683,'MailAliasAccount','canEditAlias','WRITE','ALLOW','ROLE','itManagement'); +INSERT INTO `ACL` VALUES (683,'MailAliasAccount','canEditAlias','WRITE','ALLOW','ROLE','developerBoss'); INSERT INTO `ACL` VALUES (684,'WorkerDisableExcluded','*','READ','ALLOW','ROLE','itManagement'); INSERT INTO `ACL` VALUES (685,'WorkerDisableExcluded','*','WRITE','ALLOW','ROLE','itManagement'); INSERT INTO `ACL` VALUES (686,'MailForward','*','*','ALLOW','ROLE','hr'); @@ -1519,7 +1560,6 @@ INSERT INTO `ACL` VALUES (690,'Roadmap','*','*','ALLOW','ROLE','palletizerBoss') INSERT INTO `ACL` VALUES (691,'Roadmap','*','*','ALLOW','ROLE','productionBoss'); INSERT INTO `ACL` VALUES (692,'ExpeditionTruck','*','*','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (693,'ExpeditionTruck','*','*','ALLOW','ROLE','productionBoss'); -INSERT INTO `ACL` VALUES (694,'MailAliasAccount','canEditAlias','WRITE','ALLOW','ROLE','marketingBoss'); INSERT INTO `ACL` VALUES (695,'ViaexpressConfig','internationalExpedition','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (696,'ViaexpressConfig','renderer','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (697,'Ticket','transferClient','WRITE','ALLOW','ROLE','administrative'); @@ -1610,6 +1650,8 @@ INSERT INTO `ACL` VALUES (783,'WorkerTimeControl','resendWeeklyHourEmail','WRITE INSERT INTO `ACL` VALUES (784,'VnRole','*','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (785,'VnRole','*','WRITE','ALLOW','ROLE','it'); INSERT INTO `ACL` VALUES (786,'State','isAllEditable','READ','ALLOW','ROLE','delivery'); +INSERT INTO `ACL` VALUES (787,'Ticket','makePdfList','*','ALLOW','ROLE','employee'); +INSERT INTO `ACL` VALUES (788,'Ticket','invoiceTicketsAndPdf','*','ALLOW','ROLE','employee'); INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee'); INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee'); @@ -1708,8 +1750,6 @@ USE `vn`; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -INSERT INTO `agencyTermConfig` VALUES ('6240000000','4721000015',21.0000000000,'Adquisiciones intracomunitarias de servicios'); - INSERT INTO `alertLevel` VALUES ('FREE',0,1); INSERT INTO `alertLevel` VALUES ('ON_PREPARATION',1,1); INSERT INTO `alertLevel` VALUES ('PACKED',2,0); @@ -1909,6 +1949,7 @@ INSERT INTO `component` VALUES (45,'maná reclamacion',7,4,NULL,0,'manaClaim',0) INSERT INTO `component` VALUES (46,'recargo a particular',2,NULL,0.25,0,'individual',0); INSERT INTO `component` VALUES (47,'promocion Italia',4,NULL,NULL,1,'italianOffer',0); INSERT INTO `component` VALUES (48,'fusión de lineas',4,NULL,NULL,1,'lineFusion',0); +INSERT INTO `component` VALUES (49,'sustitución',4,NULL,NULL,1,'substitution',0); INSERT INTO `componentType` VALUES (1,'coste',1,0,'COST'); INSERT INTO `componentType` VALUES (2,'com ventas',1,1,NULL); @@ -1929,59 +1970,61 @@ INSERT INTO `continent` VALUES (3,'África','AF'); INSERT INTO `continent` VALUES (4,'Europa','EU'); INSERT INTO `continent` VALUES (5,'Oceanía','OC'); -INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,106,763,0,0,0,0,28,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,110,763,0,0,0,0,28,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (22,'shopping','COMPRAS',2,3,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (23,'CMA','CAMARA',13,14,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL,NULL); INSERT INTO `department` VALUES (31,'it','INFORMATICA',4,5,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (34,'accounting','CONTABILIDAD',6,7,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (35,'finance','FINANZAS',8,9,NULL,0,0,0,1,0,1,'/1/',NULL,1,'begonya@verdnatura.es',1,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (36,'labor','LABORAL',10,11,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (37,'PROD','PRODUCCION',12,33,NULL,72,1,1,1,10,1,'/1/',NULL,0,NULL,0,1,1,1,NULL,NULL); +INSERT INTO `department` VALUES (37,'PROD','PRODUCCION',12,35,NULL,72,1,1,1,11,1,'/1/',NULL,0,NULL,0,1,1,1,NULL,NULL); INSERT INTO `department` VALUES (38,'picking','SACADO',15,16,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (39,'packing','ENCAJADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (41,'administration','ADMINISTRACION',34,35,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (43,'VT','VENTAS',36,61,NULL,0,0,0,1,12,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (44,'management','GERENCIA',62,63,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',64,65,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (46,'delivery','REPARTO',66,67,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL); -INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',68,69,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',70,71,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',72,73,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',74,75,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',76,77,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (41,'administration','ADMINISTRACION',36,37,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (43,'VT','VENTAS',38,65,NULL,0,0,0,1,13,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (44,'management','GERENCIA',66,67,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',68,69,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (46,'delivery','REPARTO',70,71,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL); +INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',72,73,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',74,75,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',76,77,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (55,NULL,'TALLER NATURAL',19,20,14548,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1118,NULL); INSERT INTO `department` VALUES (56,NULL,'TALLER ARTIFICIAL',21,22,8470,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1927,NULL); -INSERT INTO `department` VALUES (58,'CMP','CAMPOS',78,81,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',82,83,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL); -INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',84,85,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,1,0,0,NULL,NULL); -INSERT INTO `department` VALUES (61,NULL,'VNH',86,89,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',90,91,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (58,'CMP','CAMPOS',82,85,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',86,87,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL); +INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',88,89,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,1,0,0,NULL,NULL); +INSERT INTO `department` VALUES (61,NULL,'VNH',90,93,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',94,95,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (68,NULL,'COMPLEMENTOS',23,24,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL,NULL); -INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',92,93,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (80,NULL,'EQUIPO J VALLES',37,38,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',94,95,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (89,NULL,'COORDINACION',96,97,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (90,NULL,'TRAILER',87,88,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',96,97,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (80,NULL,'EQUIPO J VALLES',39,40,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'equipojvalles@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',98,99,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (89,NULL,'COORDINACION',100,101,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (90,NULL,'TRAILER',91,92,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (91,'artificial','ARTIFICIAL',25,26,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (92,NULL,'EQUIPO SILVERIO',39,40,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (94,NULL,'EQUIPO J BROCAL',41,42,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (95,NULL,'EQUIPO C ZAMBRANO',43,44,4667,0,0,0,2,0,43,'/1/43/','czg_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (96,NULL,'EQUIPO C LOPEZ',45,46,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (115,NULL,'EQUIPO CLAUDI',47,48,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (123,NULL,'EQUIPO ELENA BASCUÑANA',49,50,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',98,99,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (125,NULL,'EQUIPO MIRIAM MAR',51,52,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (92,NULL,'EQUIPO SILVERIO',41,42,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (94,NULL,'EQUIPO J BROCAL',43,44,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',1,'equipojbrocal@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (95,NULL,'EQUIPO C ZAMBRANO',45,46,4667,0,0,0,2,0,43,'/1/43/','czg_equipo',1,'equipoczambrano@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (96,NULL,'EQUIPO C LOPEZ',47,48,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (115,NULL,'EQUIPO CLAUDI',49,50,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (123,NULL,'EQUIPO ELENA BASCUÑANA',51,52,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',102,103,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (125,NULL,'EQUIPO MIRIAM MAR',53,54,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',1,'equipomirgir@verdnatura.es',0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (126,NULL,'PRESERVADO',27,28,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,NULL,NULL); INSERT INTO `department` VALUES (128,NULL,'PALETIZADO',29,30,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (130,NULL,'REVISION',31,32,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',79,80,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL); -INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',53,54,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',55,56,1731,72,0,0,2,0,43,'/1/43/','fra_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (134,NULL,'EQUIPO RODRI',57,58,6264,0,0,0,2,0,43,'/1/43/','rhr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (135,'routers','ENRUTADORES',100,101,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (136,'heavyVehicles','VEHICULOS PESADOS',102,103,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (137,'sorter','SORTER',104,105,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (139,NULL,'EQUIPO MIRIAM MAR 2',59,60,3803,0,0,0,2,0,43,'/1/43/','mir2_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',83,84,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL); +INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',55,56,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',57,58,1731,72,0,0,2,0,43,'/1/43/','fr_equipo',1,'francia@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (134,'portugalTeam','EQUIPO PORTUGAL',59,60,6264,0,0,0,2,0,43,'/1/43/','pt_equipo',1,'portugal@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (135,'routers','ENRUTADORES',104,105,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (136,'heavyVehicles','VEHICULOS PESADOS',106,107,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (137,'sorter','SORTER',108,109,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (139,NULL,'EQUIPO J SORIA ',61,62,3803,0,0,0,2,0,43,'/1/43/','jss_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (140,'hollandTeam','EQUIPO HOLANDA',63,64,NULL,0,0,0,2,0,43,'/1/43/','nl_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (141,NULL,'PREVIA',33,34,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `docuware` VALUES (1,'deliveryNote','Albaranes cliente','find','find','N__ALBAR_N',NULL); INSERT INTO `docuware` VALUES (2,'deliveryNote','Albaranes cliente','store','Archivar','N__ALBAR_N',NULL); diff --git a/db/dump/.dump/privileges.sql b/db/dump/.dump/privileges.sql index 290c8a2a3..4012a6406 100644 --- a/db/dump/.dump/privileges.sql +++ b/db/dump/.dump/privileges.sql @@ -108,7 +108,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','edi','buyer','item_feature','alexm INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','itemTag','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','itemCategoryL10n','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','guest','warehouse','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Vistas','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','guest','Tipos','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','producer','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','mdbVersion','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); @@ -300,7 +299,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','manager','v_botanic_expor INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionPlus','v_Articles_botanical','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Colores','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Clientes','alexm@%','0000-00-00 00:00:00','Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','clientes_regalos_lista_enc','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','jerarquia','juan@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','warehouse','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerBusinessAgreement','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); @@ -335,7 +333,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','preservedBoss','travel',' INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','travel','alexm@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Cubos_Retorno','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','Cubos','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financialBoss','credit','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Cubos','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','Cubos','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','Cubos_Retorno','alexm@%','0000-00-00 00:00:00','Select',''); @@ -492,8 +489,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','Reservas INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','cmr','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Rutas','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','address','alexm@%','0000-00-00 00:00:00','Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','Rutas_Master','alexm@%','0000-00-00 00:00:00','Select,Insert,Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Rutas_monitor','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','address','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','accountingType','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','itemShelvingStock_byWarehouse','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); @@ -588,7 +583,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','marketingBoss','saleGoal','al INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','saleGroup','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','saleGroupDetail','alexm@%','0000-00-00 00:00:00','Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','account_detail','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component_type','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component_type','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vncontrol','employee','accion','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','volumeConfig','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','currency','alexm@%','0000-00-00 00:00:00','Select',''); @@ -831,7 +826,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','printServerQueue__ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','artificialBoss','buy','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','Movimientos','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerAssist','buy','alexm@%','0000-00-00 00:00:00','Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','tarifas','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','receipt','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','producer','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','link','alexm@%','0000-00-00 00:00:00','Select',''); @@ -969,7 +963,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','travel','alexm@%', INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','travelClonedWeekly','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','bi','employee','facturacion_media_anual','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','travelObservation','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','tarifas','alexm@%','0000-00-00 00:00:00','Select,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','travelThermograph','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','tillConfig','juan@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','till','juan@%','0000-00-00 00:00:00','Select',''); @@ -1340,6 +1333,11 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','company','juan@db-p INSERT IGNORE INTO `tables_priv` VALUES ('','srt','grafana','buffer','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','greuge','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','item','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','','Select,Update'); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerBoss','itemShelving','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','negativeOrigin','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryBoss','Vehiculos_consumo','carlosap@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBos','project','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','ink','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); /*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */; /*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */; @@ -1659,6 +1657,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','srt','production','expedition_scan' INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','historico_absoluto','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','historico_multiple','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','client_getDebt','PROCEDURE','guillermo@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','tx_commit','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','hrBoss','balance_create','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','cooler','buyultimate','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','grafana','firstdayofyear','FUNCTION','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); @@ -1812,7 +1811,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','account','guest','myuser_hasroutine INSERT IGNORE INTO `procs_priv` VALUES ('','vn','productionAssi','timebusiness_calculateall','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','timecontrol_geterror','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','logistic','travel_weeklyclone','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','workerTimeControl_add','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPricesByBuy','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','coolerAssist','itemproposal','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','company_getsuppliersdebt','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','agency','desglose_volume','PROCEDURE','juan@10.5.1.2','Execute','0000-00-00 00:00:00'); @@ -1827,7 +1826,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_UTC_TIMESTAMP','F INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_getsaledate','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','ticket_setState','PROCEDURE','guillermo@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','invoicing','invoiceout_new','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','sale_replaceItem','PROCEDURE','jgallego@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','sale_replaceItem','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','ledger_next','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','deliveryAssistant','workerjourney_replace','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','account','developerBoss','role_sync','PROCEDURE','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); @@ -1940,7 +1939,12 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemShelving_getinf INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','collection_get','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','item_comparative','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','sale_getBoxPickingList','PROCEDURE','guillermo@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','worker_isInDepartment','FUNCTION','jgallego@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','worker_isInDepartment','FUNCTION','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','tx_rollback','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','tx_start','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPrices','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPricesByAwb','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPricesByEntry','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); /*!40000 ALTER TABLE `procs_priv` ENABLE KEYS */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -1962,25 +1966,25 @@ INSERT IGNORE INTO `global_priv` VALUES ('','android','{\"access\":0,\"version_ INSERT IGNORE INTO `global_priv` VALUES ('','artificialBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','assetManager','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','buyer','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','buyerBoss','{\"access\": 0, \"version_id\": 100707, \"is_role\": true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','buyerBoss','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); INSERT IGNORE INTO `global_priv` VALUES ('','claimManager','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','cooler','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','coolerAssist','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','coolerBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','coolerBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','customer','{\"access\": 0, \"max_questions\": 0, \"max_updates\": 30000, \"max_connections\": 300000, \"max_user_connections\": 400, \"max_statement_time\": 0.000000, \"is_role\": true,\"version_id\":100707}'); INSERT IGNORE INTO `global_priv` VALUES ('','delivery','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','deliveryAssistant','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','deliveryBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','deliveryBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','developer','{\"access\": 5909905728, \"is_role\": true, \"version_id\": 100707}'); INSERT IGNORE INTO `global_priv` VALUES ('','developerBoss','{\"access\":33554432,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','employee','{\"access\": 0, \"is_role\": true, \"version_id\": 101106}'); INSERT IGNORE INTO `global_priv` VALUES ('','entryEditor','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','ext','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}'); INSERT IGNORE INTO `global_priv` VALUES ('','financial','{\"access\": 0, \"version_id\": 100707, \"is_role\": true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','financialBoss','{\"access\": 0, \"version_id\": 100707, \"is_role\": true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','grafana','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','financialBoss','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','grafana','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','greenhouseBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','guest','{\"access\": 0, \"max_questions\": 40000, \"max_updates\": 1000, \"max_connections\": 150000, \"max_user_connections\": 200, \"max_statement_time\": 0.000000, \"is_role\": true, \"version_id\": 100707}'); +INSERT IGNORE INTO `global_priv` VALUES ('','guest','{\"access\": 0, \"max_questions\": 40000, \"max_updates\": 1000, \"max_connections\": 150000, \"max_user_connections\": 200, \"max_statement_time\": 0.000000, \"is_role\": true, \"version_id\": 101106}'); INSERT IGNORE INTO `global_priv` VALUES ('','handmadeBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','hedera-web','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','hr','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}'); @@ -1989,10 +1993,10 @@ INSERT IGNORE INTO `global_priv` VALUES ('','invoicing','{\"access\":0,\"versio INSERT IGNORE INTO `global_priv` VALUES ('','itBoss','{\"access\": 541165846527, \"is_role\": true, \"version_id\": 100707}'); INSERT IGNORE INTO `global_priv` VALUES ('','itManagement','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','itemPicker','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','logistic','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}'); +INSERT IGNORE INTO `global_priv` VALUES ('','logistic','{\"access\": 0, \"is_role\": true, \"version_id\": 101106}'); INSERT IGNORE INTO `global_priv` VALUES ('','logisticBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','maintenance','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','maintenanceBos','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','maintenanceBos','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','maintenanceBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','manager','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','marketing','{\"access\": 0, \"is_role\": true}'); diff --git a/db/dump/.dump/structure.sql b/db/dump/.dump/structure.sql index 0c7966b82..696cb8359 100644 --- a/db/dump/.dump/structure.sql +++ b/db/dump/.dump/structure.sql @@ -1,4 +1,4 @@ --- MariaDB dump 10.19 Distrib 10.5.21-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.23-MariaDB, for debian-linux-gnu (x86_64) -- -- Host: db.verdnatura.es Database: account -- ------------------------------------------------------ @@ -361,7 +361,6 @@ CREATE TABLE `roleLog` ( KEY `userFk` (`userFk`), KEY `roleLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `roleLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `roleLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `roleLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -503,7 +502,6 @@ CREATE TABLE `userLog` ( KEY `userFk` (`userFk`), KEY `userLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `userLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `userLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `userLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -3210,7 +3208,7 @@ BEGIN tm.year AS Año, tm.month AS Mes, tm.week AS Semana, - v.vista AS Vista, + dm.description AS Vista, bt.importe AS Importe FROM bs.ventas bt LEFT JOIN vn2008.Tipos tp ON tp.tipo_id = bt.tipo_id @@ -3222,7 +3220,7 @@ BEGIN JOIN vn2008.Movimientos m ON m.Id_Movimiento = bt.Id_Movimiento LEFT JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia - LEFT JOIN vn2008.Vistas v ON v.vista_id = a.Vista + LEFT JOIN vn.deliveryMethod dm ON dm.id = a.Vista LEFT JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = t.Id_Consigna LEFT JOIN vn2008.province p ON p.province_id = cs.province_id LEFT JOIN vn2008.warehouse w ON w.id = t.warehouse_id @@ -26171,6 +26169,84 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `tx_commit` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `tx_commit`(isTx BOOL) +BEGIN +/** + * Confirma los cambios asociados a una transacción. + * + * @param isTx es true si existe transacción asociada +*/ + IF isTx THEN + COMMIT; + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `tx_rollback` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `tx_rollback`(isTx BOOL) +BEGIN +/** + * Deshace los cambios asociados a una transacción. + * + * @param isTx es true si existe transacción asociada +*/ + IF isTx THEN + ROLLBACK; + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `tx_start` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `tx_start`(isTx BOOL) +BEGIN +/** + * Inicia una transacción. + * + * @param isTx es true si existe transacción asociada +*/ + IF isTx THEN + START TRANSACTION; + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `warn` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -26282,20 +26358,6 @@ CREATE TABLE `XDiario` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `__coolerPathDetail` --- - -DROP TABLE IF EXISTS `__coolerPathDetail`; -/*!50001 DROP VIEW IF EXISTS `__coolerPathDetail`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `__coolerPathDetail` AS SELECT - 1 AS `id`, - 1 AS `coolerPathFk`, - 1 AS `hallway` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `absenceType` -- @@ -27450,6 +27512,7 @@ CREATE TABLE `calendar` ( `businessFk` int(11) NOT NULL, `dayOffTypeFk` int(11) NOT NULL, `dated` date NOT NULL, + `editorFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `calendar_UN` (`businessFk`,`dated`), KEY `calendar_employee_business_labour_id_idx` (`businessFk`), @@ -27819,7 +27882,6 @@ CREATE TABLE `claimLog` ( KEY `userFk` (`userFk`), KEY `claimLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `claimLog_claimLog` (`originFk`,`creationDate`), - CONSTRAINT `claimOriginFk` FOREIGN KEY (`originFk`) REFERENCES `claim` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `claimUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -28277,7 +28339,6 @@ CREATE TABLE `clientLog` ( KEY `userFk` (`userFk`), KEY `clientLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `clientLog_clientLog` (`originFk`,`creationDate`), - CONSTRAINT `clientLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `clientLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -28446,7 +28507,7 @@ CREATE TABLE `clientSms` ( KEY `clientSms_FK_2` (`ticketFk`), CONSTRAINT `clientSms_FK` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, CONSTRAINT `clientSms_FK_1` FOREIGN KEY (`smsFk`) REFERENCES `sms` (`id`) ON UPDATE CASCADE, - CONSTRAINT `clientSms_FK_2` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON UPDATE CASCADE + CONSTRAINT `clientSms_FK_2` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -29711,7 +29772,6 @@ CREATE TABLE `deviceProductionLog` ( KEY `userFk` (`userFk`), KEY `deviceProductionLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `deviceProductionLog_deviceProductionLog` (`originFk`,`creationDate`), - CONSTRAINT `deviceProductionOriginFk` FOREIGN KEY (`originFk`) REFERENCES `deviceProduction` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `deviceProductionUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -30279,7 +30339,6 @@ CREATE TABLE `entryLog` ( KEY `entryLog_ibfk_2` (`userFk`), KEY `entryLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `entryLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `entryLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `entryLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -31518,6 +31577,30 @@ CREATE TABLE `intrastat` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `inventoryConfig` +-- + +DROP TABLE IF EXISTS `inventoryConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `inventoryConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `maxRecentInventories` int(11) DEFAULT NULL COMMENT 'The maximum number of recent inventories to retain without deletion', + `daysInPastForInventory` int(11) DEFAULT NULL COMMENT 'The number of days in the past to consider for inventory calculations', + `warehouseOutFk` smallint(6) unsigned DEFAULT NULL COMMENT 'The identifier for the inventory output warehouse', + `agencyModeFk` int(11) DEFAULT NULL COMMENT 'The identifier for the default inventory agencyMode', + `supplierFk` int(10) unsigned DEFAULT NULL COMMENT 'The identifier for the default inventory supplier', + PRIMARY KEY (`id`), + KEY `inventoryConfig_supplier_FK` (`supplierFk`), + KEY `inventoryConfig_warehouse_FK` (`warehouseOutFk`), + KEY `inventoryConfig_agencyMode_FK` (`agencyModeFk`), + CONSTRAINT `inventoryConfig_agencyMode_FK` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`), + CONSTRAINT `inventoryConfig_supplier_FK` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`), + CONSTRAINT `inventoryConfig_warehouse_FK_1` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `inventoryFailure` -- @@ -31779,7 +31862,6 @@ CREATE TABLE `invoiceInLog` ( KEY `userFk` (`userFk`), KEY `invoiceInLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `invoiceInLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `invoiceInLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceInLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -32108,7 +32190,7 @@ CREATE TABLE `item` ( `itemPackingTypeFk` varchar(1) DEFAULT NULL, `packingOut` decimal(10,2) DEFAULT NULL COMMENT 'cantidad que cabe en una caja de verdnatura', `genericFk` int(11) DEFAULT NULL COMMENT 'Item genérico', - `packingShelve` int(11) DEFAULT NULL COMMENT 'unidades que caben en una bandeja, en el caso de los sacadores', + `packingShelve__` int(11) DEFAULT NULL COMMENT '@deprecated 2024-31-01', `isLaid` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Indica si el producto se puede tumbar a efectos del transporte desde Holanda', `lastUsed` datetime DEFAULT current_timestamp(), `weightByPiece` int(10) unsigned DEFAULT NULL COMMENT 'peso por defecto para un articulo por tallo/unidad', @@ -32116,6 +32198,7 @@ CREATE TABLE `item` ( `recycledPlastic` int(11) DEFAULT NULL, `nonRecycledPlastic` int(11) DEFAULT NULL, `minQuantity` int(10) unsigned DEFAULT NULL COMMENT 'Cantidad mínima para una línea de venta', + `isBoxPickingMode` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'FALSE: using item.packingOut TRUE: boxPicking using itemShelving.packing', PRIMARY KEY (`id`), UNIQUE KEY `item_supplyResponseFk_idx` (`supplyResponseFk`), KEY `Color` (`inkFk`), @@ -32462,7 +32545,6 @@ CREATE TABLE `itemLog` ( KEY `itemLogUserFk_idx` (`userFk`), KEY `itemLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `itemLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `itemLogItemFk` FOREIGN KEY (`originFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemLogUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -33863,14 +33945,14 @@ DROP TABLE IF EXISTS `operator`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `operator` ( `workerFk` int(10) unsigned NOT NULL, - `numberOfWagons` int(11) DEFAULT 1, + `numberOfWagons` int(11) DEFAULT 2, `trainFk` int(11) NOT NULL DEFAULT 1, `itemPackingTypeFk` varchar(1) NOT NULL DEFAULT 'H', `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT 60, `sectorFk` int(11) DEFAULT NULL, `labelerFk` tinyint(3) unsigned DEFAULT NULL, - `linesLimit` int(11) DEFAULT NULL COMMENT 'Límite de lineas en una colección para la asignación de pedidos', - `volumeLimit` decimal(10,6) DEFAULT NULL COMMENT 'Límite de volumen en una colección para la asignación de pedidos', + `linesLimit` int(11) DEFAULT 20 COMMENT 'Límite de lineas en una colección para la asignación de pedidos', + `volumeLimit` decimal(10,6) DEFAULT 0.500000 COMMENT 'Límite de volumen en una colección para la asignación de pedidos', PRIMARY KEY (`workerFk`), KEY `operator_FK` (`workerFk`), KEY `operator_FK_1` (`trainFk`), @@ -34278,7 +34360,6 @@ CREATE TABLE `packingSiteDeviceLog` ( KEY `userFk` (`userFk`), KEY `packingSiteDeviceLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `packingSiteDeviceLog_packingSiteDeviceLog` (`originFk`,`creationDate`), - CONSTRAINT `packingSiteDeviceLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `packingSiteDeviceLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -35080,11 +35161,14 @@ CREATE TABLE `productionConfig` ( `shortageAddressFk` int(11) DEFAULT NULL COMMENT 'Consignatario por defecto para añadir un item de alta', `clientSelfConsumptionFk` int(11) DEFAULT NULL COMMENT 'Cliente para crear el ticket de autoconsumo', `itemPreviousDefaultSize` int(11) DEFAULT NULL COMMENT 'Altura por defecto para los artículos de previa', + `addressSelfConsumptionFk` int(11) DEFAULT 2613 COMMENT 'Consignatario para crear el ticket de autoconsumo', PRIMARY KEY (`id`), KEY `productionConfig_FK` (`shortageAddressFk`), KEY `productionConfig_FK_1` (`clientSelfConsumptionFk`), + KEY `productionConfig_FK_2` (`addressSelfConsumptionFk`), CONSTRAINT `productionConfig_FK` FOREIGN KEY (`shortageAddressFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE, - CONSTRAINT `productionConfig_FK_1` FOREIGN KEY (`clientSelfConsumptionFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `productionConfig_FK_1` FOREIGN KEY (`clientSelfConsumptionFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `productionConfig_FK_2` FOREIGN KEY (`addressSelfConsumptionFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Recoge los parámetros que condicionan la producción'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -35487,7 +35571,6 @@ CREATE TABLE `rateLog` ( KEY `logRateuserFk` (`userFk`), KEY `rateLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `rateLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `rateOriginFk` FOREIGN KEY (`originFk`) REFERENCES `rate` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `rateUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -35962,7 +36045,6 @@ CREATE TABLE `routeLog` ( KEY `userFk` (`userFk`), KEY `routeLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `routeLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `routeLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `route` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `routeLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -36931,7 +37013,6 @@ CREATE TABLE `shelvingLog` ( KEY `userFk` (`userFk`), KEY `shelvingLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `shelvingLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `shelvingLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `shelving` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `shelvingLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -37636,8 +37717,7 @@ CREATE TABLE `supplierLog` ( KEY `supplierLog_ibfk_2` (`userFk`), KEY `supplierLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `supplierLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `supplierLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE, - CONSTRAINT `supplierLog_supplierFk` FOREIGN KEY (`originFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `supplierLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -38165,7 +38245,6 @@ CREATE TABLE `ticketLog` ( KEY `logTicketuserFk` (`userFk`), KEY `ticketLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `ticketLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `ticketLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketLog_user` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -38542,11 +38621,11 @@ DROP TABLE IF EXISTS `ticketStateToday`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; /*!50001 CREATE VIEW `ticketStateToday` AS SELECT - 1 AS `ticket`, + 1 AS `ticketFk`, 1 AS `state`, 1 AS `productionOrder`, 1 AS `alertLevel`, - 1 AS `worker`, + 1 AS `userFk`, 1 AS `code`, 1 AS `updated`, 1 AS `isPicked` */; @@ -39102,7 +39181,6 @@ CREATE TABLE `travelLog` ( KEY `userFk` (`userFk`), KEY `travelLog_changedModel` (`changedModel`,`changedModelId`,`originFk`), KEY `travelLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `travelLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `travel` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `travelLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -39299,7 +39377,6 @@ CREATE TABLE `userLog` ( PRIMARY KEY (`id`), KEY `originFk` (`originFk`), KEY `userFk` (`userFk`), - CONSTRAINT `userLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `userLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -39790,7 +39867,7 @@ CREATE TABLE `worker` ( `lastName` varchar(50) DEFAULT NULL, `sub` int(11) unsigned DEFAULT NULL, `photo` blob DEFAULT NULL, - `phone` varchar(9) DEFAULT NULL, + `phone` varchar(15) DEFAULT NULL, `mobileExtension` int(4) DEFAULT NULL, `bossFk` int(10) unsigned DEFAULT 103, `fiDueDate` datetime DEFAULT NULL, @@ -40176,7 +40253,7 @@ CREATE TABLE `workerLog` ( `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), `description` text DEFAULT NULL, - `changedModel` enum('Worker','Calendar','WorkerTimeControlMail','Business','WorkerDms') NOT NULL DEFAULT 'Worker', + `changedModel` enum('Worker','Calendar','WorkerTimeControlMail','Business','WorkerDms','WorkerTimeControl') NOT NULL DEFAULT 'Worker', `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), `changedModelId` int(11) NOT NULL, @@ -40185,8 +40262,7 @@ CREATE TABLE `workerLog` ( KEY `userFk_idx` (`userFk`), KEY `workerLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `workerLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `userFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `workerFk` FOREIGN KEY (`originFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `userFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -40419,11 +40495,14 @@ CREATE TABLE `workerTimeControl` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userFk` int(10) unsigned NOT NULL, `timed` datetime NOT NULL, + `direction` enum('in','out','middle') DEFAULT 'middle', `manual` tinyint(4) NOT NULL DEFAULT 0, `order` int(11) DEFAULT NULL, + `device` varchar(255) DEFAULT NULL COMMENT 'Dispositivo en el que se ha fichado', `warehouseFk` smallint(6) unsigned DEFAULT NULL, - `direction` enum('in','out','middle') DEFAULT 'middle', `isSendMail` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Fichadas generadas autómaticamente con el procedimiento vn.workerTimeControl_sendMail', + `logExclude` tinyint(1) GENERATED ALWAYS AS (if(`manual`,0,1)) VIRTUAL, + `editorFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `userFk_Timed_uniq` (`userFk`,`timed`), KEY `warehouseFkfk1_idx` (`warehouseFk`), @@ -40957,7 +41036,6 @@ CREATE TABLE `zoneLog` ( KEY `userFk` (`userFk`), KEY `zoneLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `zoneLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `zoneLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `zoneLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -45653,144 +45731,6 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP FUNCTION IF EXISTS `workerTimeControl_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `workerTimeControl_add`(vUserFk INT, vWarehouseFk INT, vTimed DATETIME, vIsManual BOOL) RETURNS int(11) - DETERMINISTIC -BEGIN - DECLARE vDirection VARCHAR(6); - DECLARE vLastIn DATETIME; - DECLARE vDayStayMax INT; - DECLARE vHasDirectionOut INT; - DECLARE vLastInsertedId INT; - - SELECT dayStayMax INTO vDayStayMax - FROM workerTimeControlParams; - - SELECT timeWorkerControl_getDirection(vUserFk,vTimed) INTO vDirection; - - IF vDirection = 'out' THEN - - SELECT MAX(timed) INTO vLastIn - FROM workerTimeControl - WHERE userFk = vUserFk - AND direction = 'in' - AND timed < vTimed; - - UPDATE workerTimeControl wtc - SET wtc.direction = 'middle' - WHERE userFk = vUserFk - AND direction = 'out' - AND timed BETWEEN vLastIn AND vTimed; - - ELSE IF vDirection = 'in' THEN - - SELECT COUNT(*) INTO vHasDirectionOut - FROM workerTimeControl wtc - WHERE userFk = vUserFk - AND direction = 'out' - AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); - - UPDATE workerTimeControl wtc - SET wtc.direction = IF (vHasDirectionOut,'middle','out') - WHERE userFk = vUserFk - AND direction = 'in' - AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); - - END IF; - END IF; - - INSERT INTO workerTimeControl(userFk, timed, warehouseFk, direction, manual) - VALUES(vUserFk, vTimed, vWarehouseFk, vDirection, vIsManual); - - SET vLastInsertedId = LAST_INSERT_ID(); - - CALL workerTimeControlSOWP(vUserFk, vTimed); - - RETURN vLastInsertedId; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP FUNCTION IF EXISTS `workerTimeControl_addDirection` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `workerTimeControl_addDirection`(vUserFk INT, vWarehouseFk INT, vTimed DATETIME, vIsManual BOOL) RETURNS int(11) - DETERMINISTIC -BEGIN - DECLARE vDirection VARCHAR(6); - DECLARE vLastIn DATETIME; - DECLARE vDayStayMax INT; - DECLARE vHasDirectionOut INT; - DECLARE vLastInsertedId INT; - - SELECT dayStayMax INTO vDayStayMax - FROM workerTimeControlParams; - - SELECT timeWorkerControl_getDirection(vUserFk,vTimed) INTO vDirection; - - IF vDirection = 'out' THEN - - SELECT MAX(timed) INTO vLastIn - FROM workerTimeControl - WHERE userFk = vUserFk - AND direction = 'in' - AND timed < vTimed; - - UPDATE workerTimeControl wtc - SET wtc.direction = 'middle' - WHERE userFk = vUserFk - AND direction = 'out' - AND timed BETWEEN vLastIn AND vTimed; - - ELSE IF vDirection = 'in' THEN - - SELECT COUNT(*) INTO vHasDirectionOut - FROM workerTimeControl wtc - WHERE userFk = vUserFk - AND direction = 'out' - AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); - - UPDATE workerTimeControl wtc - SET wtc.direction = IF (vHasDirectionOut,'middle','out') - WHERE userFk = vUserFk - AND direction = 'in' - AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); - - END IF; - END IF; - - INSERT INTO workerTimeControl(userFk, timed, warehouseFk, direction, manual) - VALUES(vUserFk, vTimed, vWarehouseFk, vDirection, vIsManual); - - SET vLastInsertedId = LAST_INSERT_ID(); - - CALL workerTimeControlSOWP(vUserFk, vTimed); - - RETURN vLastInsertedId; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `worker_getCode` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45875,38 +45815,38 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `worker_isInDepartment` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `worker_isInDepartment`(vDepartmentCode VARCHAR(255)) RETURNS int(11) DETERMINISTIC -BEGIN -/** - * Devuelve booleano si el trabajador conectado pertenece - * al departamento vDepartmentCode o a sus departamentos subordinados - * - * @param vDepartmentCode code del departamento que se desea comprobar. - * @return Devuelve verdadero si es jefe del empleado por escala jerárquica. - */ - DECLARE vIsInDepartment BOOLEAN; - WITH RECURSIVE department AS ( - SELECT d.id FROM vn.department d WHERE code = vDepartmentCode - UNION - SELECT d.id - FROM department ds - JOIN vn.department d ON ds.id = d.parentFk - ) - SELECT COUNT(*) INTO vIsInDepartment FROM department ds - JOIN vn.workerDepartment wd ON wd.departmentFk = ds.id - WHERE wd.workerFk = account.myUser_getId(); - - RETURN vIsInDepartment; +BEGIN +/** + * Devuelve booleano si el trabajador conectado pertenece + * al departamento vDepartmentCode o a sus departamentos subordinados + * + * @param vDepartmentCode code del departamento que se desea comprobar. + * @return Devuelve verdadero si es jefe del empleado por escala jerárquica. + */ + DECLARE vIsInDepartment BOOLEAN; + WITH RECURSIVE department AS ( + SELECT d.id FROM vn.department d WHERE code = vDepartmentCode + UNION + SELECT d.id + FROM department ds + JOIN vn.department d ON ds.id = d.parentFk + ) + SELECT COUNT(*) INTO vIsInDepartment FROM department ds + JOIN vn.workerDepartment wd ON wd.departmentFk = ds.id + WHERE wd.workerFk = account.myUser_getId(); + + RETURN vIsInDepartment; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -47949,6 +47889,7 @@ BEGIN DECLARE v26Month DATE; DECLARE v3Month DATE; DECLARE vTrashId VARCHAR(15); + DECLARE v2Years DATE; DECLARE v5Years DATE; SET vDateShort = util.VN_CURDATE() - INTERVAL 2 MONTH; @@ -47958,6 +47899,7 @@ BEGIN SET v18Month = util.VN_CURDATE() - INTERVAL 18 MONTH; SET v26Month = util.VN_CURDATE() - INTERVAL 26 MONTH; SET v3Month = util.VN_CURDATE() - INTERVAL 3 MONTH; + SET v2Years = util.VN_CURDATE() - INTERVAL 2 YEAR; SET v5Years = util.VN_CURDATE() - INTERVAL 5 YEAR; DELETE FROM ticketParking WHERE created < vDateShort; @@ -48102,7 +48044,11 @@ BEGIN FROM tmp.duaToDelete tmp JOIN vn.dua d ON d.id = tmp.id; - DELETE FROM vn.awb WHERE created < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE()); + DELETE a + FROM vn.awb a + LEFT JOIN vn.travel t ON t.awbFk = a.id + WHERE a.created < v2Years + AND t.id IS NULL; -- Borra los registros de collection y ticketcollection DELETE FROM vn.collection WHERE created < vDateShort; @@ -51437,71 +51383,75 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `duaInvoiceInBooking`(vDuaFk INT) BEGIN - +/** + * Genera el asiento de un DUA y marca las entradas como confirmadas + * + * @param vDuaFk Id del dua a recalcular + */ DECLARE done BOOL DEFAULT FALSE; DECLARE vInvoiceFk INT; - DECLARE vASIEN BIGINT DEFAULT 0; - DECLARE vCounter INT DEFAULT 0; - + DECLARE vASIEN BIGINT DEFAULT 0; + DECLARE vCounter INT DEFAULT 0; + DECLARE rs CURSOR FOR - SELECT e.invoiceInFk + SELECT DISTINCT e.invoiceInFk FROM entry e JOIN duaEntry de ON de.entryFk = e.id - JOIN invoiceIn ii ON ii.id = e.invoiceInFk - WHERE de.duaFk = vDuaFk + JOIN invoiceIn ii ON ii.id = e.invoiceInFk + WHERE de.duaFk = vDuaFk AND de.customsValue AND ii.isBooked = FALSE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; OPEN rs; - + UPDATE invoiceIn ii JOIN entry e ON e.invoiceInFk = ii.id - JOIN duaEntry de ON de.entryFk = e.id - JOIN dua d ON d.id = de.duaFk + JOIN duaEntry de ON de.entryFk = e.id + JOIN dua d ON d.id = de.duaFk SET ii.isBooked = TRUE, ii.booked = IFNULL(ii.booked,d.booked), ii.operated = IFNULL(ii.operated,d.operated), - ii.issued = IFNULL(ii.issued,d.issued), - ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried), - e.isConfirmed = TRUE + ii.issued = IFNULL(ii.issued,d.issued), + ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried), + e.isConfirmed = TRUE WHERE d.id = vDuaFk; - - SELECT IFNULL(ASIEN,0) INTO vASIEN + + SELECT IFNULL(ASIEN,0) INTO vASIEN FROM dua WHERE id = vDuaFk; - + FETCH rs INTO vInvoiceFk; - + WHILE NOT done DO CALL invoiceIn_booking(vInvoiceFk); - - IF vCounter > 0 OR vASIEN > 0 THEN - + + IF vCounter > 0 OR vASIEN > 0 THEN + UPDATE vn2008.XDiario x - JOIN vn.ledgerConfig lc ON lc.lastBookEntry = x.ASIEN - SET x.ASIEN = vASIEN; - - ELSE - - SELECT lastBookEntry INTO vASIEN FROM vn.ledgerConfig; - + JOIN ledgerConfig lc ON lc.lastBookEntry = x.ASIEN + SET x.ASIEN = vASIEN; + + ELSE + + SELECT lastBookEntry INTO vASIEN FROM ledgerConfig; + END IF; - - SET vCounter = vCounter + 1; - + + SET vCounter = vCounter + 1; + FETCH rs INTO vInvoiceFk; END WHILE; - - CLOSE rs; - - UPDATE dua - SET ASIEN = vASIEN - WHERE id = vDuaFk; - + + CLOSE rs; + + UPDATE dua + SET ASIEN = vASIEN + WHERE id = vDuaFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -54397,184 +54347,177 @@ DELIMITER ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryMake`(vDate DATE, vWh INT) -proc: BEGIN +CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryMake`(vInventoryDate DATE) +BEGIN /** -* Recalcula los inventarios de todos los almacenes, si vWh = 0 +* Recalculate the inventories * -* @param vDate Fecha de los nuevos inventarios -* @param vWh almacen al cual hacer el inventario +* @param vInventoryDate date for the new inventory */ - DECLARE vDone BOOL; DECLARE vEntryFk INT; DECLARE vTravelFk INT; DECLARE vDateLastInventory DATE; - DECLARE vDateYesterday DATETIME DEFAULT vDate - INTERVAL 1 SECOND; + DECLARE vDateYesterday DATETIME DEFAULT vInventoryDate - INTERVAL 1 SECOND; DECLARE vWarehouseOutFkInventory INT; DECLARE vInventorySupplierFk INT; DECLARE vAgencyModeFkInventory INT; + DECLARE vMaxRecentInventories INT; + DECLARE vWarehouseFk INT; DECLARE cWarehouses CURSOR FOR SELECT id FROM warehouse - WHERE isInventory - AND vWh IN (0,id); + WHERE isInventory; + + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + SELECT inventorySupplierFk INTO vInventorySupplierFk FROM entryConfig LIMIT 1; + SELECT inventoried INTO vDateLastInventory FROM config LIMIT 1; + SELECT maxRecentInventories, + warehouseOutFk, + agencyModeFk + INTO vMaxRecentInventories, + vWarehouseOutFkInventory, + vAgencyModeFkInventory + FROM inventoryConfig + LIMIT 1; + + IF vDateLastInventory IS NULL + OR vInventorySupplierFk IS NULL + OR vMaxRecentInventories IS NULL + OR vInventoryDate IS NULL + OR vWarehouseOutFkInventory IS NULL + OR vAgencyModeFkInventory IS NULL THEN + CALL util.throw('Some config parameters are not set'); + END IF; + + START TRANSACTION; + OPEN cWarehouses; + -- Environment variable to disable the triggers of the affected tables SET @isModeInventory := TRUE; l: LOOP - SET vDone = FALSE; - FETCH cWarehouses INTO vWh; + SET vEntryFk = NULL; + SET vTravelFk = NULL; + + FETCH cWarehouses INTO vWarehouseFk; IF vDone THEN LEAVE l; END IF; - SELECT w.id INTO vWarehouseOutFkInventory - FROM warehouse w - WHERE w.code = 'inv'; - - SELECT inventorySupplierFk INTO vInventorySupplierFk - FROM entryConfig; - - SELECT am.id INTO vAgencyModeFkInventory - FROM agencyMode am - where code = 'inv'; - - SELECT MAX(landed) INTO vDateLastInventory - FROM travel tr - JOIN entry e ON e.travelFk = tr.id - JOIN buy b ON b.entryFk = e.id - WHERE warehouseOutFk = vWarehouseOutFkInventory - AND landed < vDate - AND e.supplierFk = vInventorySupplierFk - AND warehouseInFk = vWh - AND NOT isRaid; - - IF vDateLastInventory IS NULL THEN - SELECT inventoried INTO vDateLastInventory FROM config; - END IF; - - -- Generamos travel, si no existe. - SET vTravelFK = 0; - + -- Generate travel, if it does not exist SELECT id INTO vTravelFk FROM travel WHERE warehouseOutFk = vWarehouseOutFkInventory - AND warehouseInFk = vWh - AND landed = vDate + AND warehouseInFk = vWarehouseFk + AND landed = vInventoryDate AND agencyModeFk = vAgencyModeFkInventory AND ref = 'inventario' LIMIT 1; - IF NOT vTravelFK THEN - - INSERT INTO travel SET - warehouseOutFk = vWarehouseOutFkInventory, - warehouseInFk = vWh, - shipped = vDate, - landed = vDate, - agencyModeFk = vAgencyModeFkInventory, - ref = 'inventario', - isDelivered = TRUE, - isReceived = TRUE; + IF vTravelFk IS NULL THEN + INSERT INTO travel + SET warehouseOutFk = vWarehouseOutFkInventory, + warehouseInFk = vWarehouseFk, + shipped = vInventoryDate, + landed = vInventoryDate, + agencyModeFk = vAgencyModeFkInventory, + ref = 'inventario', + isDelivered = TRUE, + isReceived = TRUE; SELECT LAST_INSERT_ID() INTO vTravelFk; - END IF; - -- Generamos entrada si no existe, o la vaciamos. - SET vEntryFk = 0; - + -- Generate an entry if it does not exist, or we empty it SELECT id INTO vEntryFk FROM entry WHERE supplierFk = vInventorySupplierFk AND travelFk = vTravelFk; - IF NOT vEntryFk THEN - - INSERT INTO entry SET - supplierFk = vInventorySupplierFk, - isConfirmed = TRUE, - isOrdered = TRUE, - travelFk = vTravelFk; + IF vEntryFk IS NULL THEN + INSERT INTO entry + SET supplierFk = vInventorySupplierFk, + isConfirmed = TRUE, + isOrdered = TRUE, + travelFk = vTravelFk; SELECT LAST_INSERT_ID() INTO vEntryFk; - ELSE - DELETE FROM buy WHERE entryFk = vEntryFk; - END IF; - -- Preparamos tabla auxilar - CREATE OR REPLACE TEMPORARY TABLE tmp.inventory ( - itemFk INT(11) NOT NULL PRIMARY KEY, - quantity int(11) DEFAULT '0', - buyingValue decimal(10,4) DEFAULT '0.0000', - freightValue decimal(10,3) DEFAULT '0.000', - packing int(11) DEFAULT '0', - `grouping` smallint(5) unsigned NOT NULL DEFAULT '1', - groupingMode tinyint(4) NOT NULL DEFAULT 0 , - comissionValue decimal(10,3) DEFAULT '0.000', - packageValue decimal(10,3) DEFAULT '0.000', - packageFk varchar(10) COLLATE utf8_unicode_ci DEFAULT '--', - price1 decimal(10,2) DEFAULT '0.00', - price2 decimal(10,2) DEFAULT '0.00', - price3 decimal(10,2) DEFAULT '0.00', - minPrice decimal(10,2) DEFAULT '0.00', - producer varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - INDEX (itemFK)) ENGINE = MEMORY; + -- Prepare the auxiliary table + CREATE OR REPLACE TEMPORARY TABLE tInventory ( + itemFk INT(11) NOT NULL PRIMARY KEY, + quantity int(11) DEFAULT '0', + buyingValue decimal(10,4) DEFAULT '0.0000', + freightValue decimal(10,3) DEFAULT '0.000', + packing int(11) DEFAULT '0', + `grouping` smallint(5) unsigned NOT NULL DEFAULT '1', + groupingMode tinyint(4) NOT NULL DEFAULT 0 , + comissionValue decimal(10,3) DEFAULT '0.000', + packageValue decimal(10,3) DEFAULT '0.000', + packageFk varchar(10) COLLATE utf8_unicode_ci DEFAULT '--', + price1 decimal(10,2) DEFAULT '0.00', + price2 decimal(10,2) DEFAULT '0.00', + price3 decimal(10,2) DEFAULT '0.00', + minPrice decimal(10,2) DEFAULT '0.00', + producer varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + INDEX (itemFK) + ) ENGINE = MEMORY; - -- Compras - INSERT INTO tmp.inventory(itemFk,quantity) + -- Buys + INSERT INTO tInventory(itemFk, quantity) SELECT b.itemFk, SUM(b.quantity) FROM buy b JOIN entry e ON e.id = b.entryFk JOIN travel tr ON tr.id = e.travelFk - WHERE tr.warehouseInFk = vWh - AND tr.landed BETWEEN vDateLastInventory - AND vDateYesterday + WHERE tr.warehouseInFk = vWarehouseFk + AND tr.landed BETWEEN vDateLastInventory AND vDateYesterday AND NOT isRaid GROUP BY b.itemFk; - SELECT vDateLastInventory , vDateYesterday; - -- Traslados - INSERT INTO tmp.inventory(itemFk, quantity) + -- Transfers + INSERT INTO tInventory(itemFk, quantity) SELECT itemFk, quantityOut - FROM ( + FROM ( SELECT b.itemFk,- SUM(b.quantity) quantityOut FROM buy b JOIN entry e ON e.id = b.entryFk JOIN travel tr ON tr.id = e.travelFk - WHERE tr.warehouseOutFk = vWh - AND tr.shipped BETWEEN vDateLastInventory - AND vDateYesterday + WHERE tr.warehouseOutFk = vWarehouseFk + AND tr.shipped BETWEEN vDateLastInventory AND vDateYesterday AND NOT isRaid GROUP BY b.itemFk ) sub ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity, 0) + sub.quantityOut; - -- Ventas - INSERT INTO tmp.inventory(itemFk,quantity) + -- Sales + INSERT INTO tInventory(itemFk, quantity) SELECT itemFk, saleOut - FROM ( + FROM ( SELECT s.itemFk, - SUM(s.quantity) saleOut FROM sale s JOIN ticket t ON t.id = s.ticketFk - WHERE t.warehouseFk = vWh + WHERE t.warehouseFk = vWarehouseFk AND t.shipped BETWEEN vDateLastInventory AND vDateYesterday GROUP BY s.itemFk ) sub ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity,0) + sub.saleOut; - -- Actualiza valores de la ultima compra - UPDATE tmp.inventory inv - JOIN cache.last_buy lb ON lb.item_id = inv.itemFk AND lb.warehouse_id = vWh + -- Update values of the last purchase + UPDATE tInventory inv + JOIN cache.last_buy lb ON lb.item_id = inv.itemFk AND lb.warehouse_id = vWarehouseFk JOIN buy b ON b.id = lb.buy_id JOIN item i ON i.id = b.itemFk LEFT JOIN producer p ON p.id = i.producerFk @@ -54592,7 +54535,7 @@ proc: BEGIN inv.minPrice = b.minPrice, inv.producer = p.name; - INSERT INTO buy( itemFk, + INSERT INTO buy(itemFk, quantity, buyingValue, freightValue, @@ -54622,43 +54565,54 @@ proc: BEGIN price3, minPrice, vEntryFk - FROM tmp.inventory; + FROM tInventory; - SELECT vWh, COUNT(*), util.VN_NOW() FROM tmp.inventory; - - -- Actualizamos el campo lastUsed de item - UPDATE item i - JOIN tmp.inventory i2 ON i2.itemFk = i.id - SET i.lastUsed = NOW() - WHERE i2.quantity; - - -- DROP TEMPORARY TABLE tmp.inventory; + -- Update the 'lastUsed' field of the item + UPDATE item i + JOIN tInventory i2 ON i2.itemFk = i.id + SET i.lastUsed = NOW() + WHERE i2.quantity; + + DROP TEMPORARY TABLE tInventory; END LOOP; - + CLOSE cWarehouses; - UPDATE config SET inventoried = vDate; - SET @isModeInventory := FALSE; + UPDATE config SET inventoried = vInventoryDate; - DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete; - CREATE TEMPORARY TABLE tmp.entryToDelete - (INDEX(entryId) USING BTREE) ENGINE = MEMORY - SELECT e.id as entryId, - t.id as travelId + SET @isModeInventory := FALSE; + + CREATE OR REPLACE TEMPORARY TABLE tEntryToDelete + (INDEX(entryId)) ENGINE = MEMORY + SELECT e.id entryId, + t.id travelId FROM travel t JOIN `entry` e ON e.travelFk = t.id + JOIN ( + SELECT t.shipped + FROM travel t + JOIN `entry` e ON e.travelFk = t.id + WHERE e.supplierFk = vInventorySupplierFk + AND t.shipped <= vInventoryDate + GROUP BY t.shipped + ORDER BY t.shipped DESC + OFFSET vMaxRecentInventories ROWS + ) sub WHERE e.supplierFk = vInventorySupplierFk - AND t.shipped <= util.VN_CURDATE() - INTERVAL 12 DAY - AND (DAY(t.shipped) <> 1 OR shipped < util.VN_CURDATE() - INTERVAL 12 DAY); + AND t.shipped IN (sub.shipped); - DELETE e + DELETE e FROM `entry` e - JOIN tmp.entryToDelete tmp ON tmp.entryId = e.id; + JOIN tEntryToDelete tmp ON tmp.entryId = e.id; DELETE IGNORE t FROM travel t - JOIN tmp.entryToDelete tmp ON tmp.travelId = t.id; + JOIN tEntryToDelete tmp ON tmp.travelId = t.id; + + DROP TEMPORARY TABLE IF EXISTS tEntryToDelete; + + COMMIT; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -54678,11 +54632,12 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryMakeLauncher`() BEGIN /** - * Recalcula los inventarios de todos los almacenes. + * Recalculate the inventories of all warehouses */ - - call vn.inventoryMake(TIMESTAMPADD(DAY, -10, util.VN_CURDATE()), 0); - + CALL inventoryMake( + util.VN_CURDATE() - + INTERVAL (SELECT daysInPastForInventory FROM inventoryConfig LIMIT 1) DAY + ); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -55072,33 +55027,36 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTaxMakeByDua`(vDuaFk INT) BEGIN - - DECLARE done BOOL DEFAULT FALSE; +/** + * Borra los valores de duaTax y sus vctos. y los vuelve a crear en base a la tabla duaEntry + * + * @param vDuaFk Id del dua a recalcular + */ + DECLARE vDone BOOL DEFAULT FALSE; DECLARE vInvoiceInFk INT; - DECLARE rs CURSOR FOR - SELECT invoiceInFk - FROM entry e - JOIN duaEntry de ON de.entryFk = e.id - WHERE de.duaFk = vDuaFk; + DECLARE vInvoices CURSOR FOR + SELECT DISTINCT invoiceInFk + FROM entry e + JOIN duaEntry de ON de.entryFk = e.id + WHERE de.duaFk = vDuaFk; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - OPEN rs; + OPEN vInvoices; + l: LOOP + SET vDone = FALSE; + FETCH vInvoices INTO vInvoiceInFk; - FETCH rs INTO vInvoiceInFk; - - WHILE NOT done DO + IF vDone THEN + LEAVE l; + END IF; CALL vn2008.recibidaIvaInsert(vInvoiceInFk); CALL invoiceInDueDay_recalc(vInvoiceInFk); - FETCH rs INTO vInvoiceInFk; - - END WHILE; - - CLOSE rs; - + END LOOP; + CLOSE vInvoices; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -55153,33 +55111,36 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromDua`(vDuaFk INT) BEGIN - - DECLARE done BOOL DEFAULT FALSE; +/** + * Borra los valores de duaTax y sus vctos. y los vuelve a crear en base a la tabla duaEntry + * + * @param vDuaFk Id del dua a recalcular + */ + DECLARE vDone BOOL DEFAULT FALSE; DECLARE vInvoiceInFk INT; - DECLARE rs CURSOR FOR - SELECT invoiceInFk + DECLARE vInvoices CURSOR FOR + SELECT DISTINCT invoiceInFk FROM entry e JOIN duaEntry de ON de.entryFk = e.id WHERE de.duaFk = vDuaFk; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - OPEN rs; + OPEN vInvoices; + l: LOOP + SET vDone = FALSE; + FETCH vInvoices INTO vInvoiceInFk; - FETCH rs INTO vInvoiceInFk; - - WHILE NOT done DO + IF vDone THEN + LEAVE l; + END IF; CALL invoiceInTax_getFromEntries(vInvoiceInFk); CALL invoiceInDueDay_calculate(vInvoiceInFk); - - FETCH rs INTO vInvoiceInFk; - - END WHILE; - - CLOSE rs; + END LOOP; + CLOSE vInvoices; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -55196,15 +55157,24 @@ DELIMITER ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromEntries`(IN vId INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromEntries`(IN vInvoiceInFk INT) BEGIN DECLARE vRate DOUBLE DEFAULT 1; DECLARE vDated DATE; DECLARE vExpenseFk VARCHAR(10); + DECLARE vIsBooked BOOLEAN DEFAULT FALSE; + SELECT isBooked INTO vIsBooked + FROM invoiceIn ii + WHERE id = vInvoiceInFk; + + IF vIsBooked THEN + CALL util.throw('A booked invoice cannot be modified'); + END IF; + SELECT MAX(rr.dated) INTO vDated FROM referenceRate rr - JOIN invoiceIn ii ON ii.id = vId + JOIN invoiceIn ii ON ii.id = vInvoiceInFk WHERE rr.dated <= ii.issued AND rr.currencyFk = ii.currencyFk ; @@ -55221,7 +55191,7 @@ BEGIN LIMIT 1; DELETE FROM invoiceInTax - WHERE invoiceInFk = vId; + WHERE invoiceInFk = vInvoiceInFk; INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenseFk, foreignValue, taxTypeSageFk, transactionTypeSageFk) SELECT ii.id, @@ -55236,7 +55206,7 @@ BEGIN JOIN buy b ON b.entryFk = e.id LEFT JOIN referenceRate rr ON rr.currencyFk = ii.currencyFk AND rr.dated = ii.issued - WHERE ii.id = vId + WHERE ii.id = vInvoiceInFk HAVING taxableBase IS NOT NULL; END ;; DELIMITER ; @@ -57526,9 +57496,15 @@ DELIMITER ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar`(vSectorFk INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar`( + vSectorFk INT +) proc:BEGIN - +/** + * Calcula la información detallada respecto un sector. + * + * @param vSectorFk Id de sector + */ DECLARE vCalcVisibleFk INT; DECLARE vCalcAvailableFk INT; DECLARE hasFatherSector BOOLEAN; @@ -57617,7 +57593,7 @@ proc:BEGIN JOIN vn.item i ON i.id = ishr.itemFk LEFT JOIN (SELECT s.itemFk, sum(s.quantity) as notPickedYed FROM vn.ticket t - JOIN vn.ticketStateToday tst ON tst.ticket = t.id + JOIN vn.ticketStateToday tst ON tst.ticketFk = t.id JOIN vn.sale s ON s.ticketFk = t.id WHERE t.warehouseFk = vWarehouseFk AND tst.alertLevel = 0 @@ -58917,20 +58893,23 @@ BEGIN DECLARE vCompanyFk INT; DECLARE vAgencyModeFk INT; DECLARE vItemShelvingFk INT; + DECLARE vAddressFk INT; SELECT c.id, pc.clientSelfConsumptionFk, - s.warehouseFk + s.warehouseFk, + pc.addressSelfConsumptionFk INTO vCompanyFk, vClientFk, - vWarehouseFk + vWarehouseFk, + vAddressFk FROM company c JOIN address a ON a.clientFk = c.clientFk JOIN warehouse w ON w.addressFk = a.id JOIN sector s ON s.warehouseFk = w.id JOIN parking p ON p.sectorFk = s.id JOIN shelving s2 ON s2.parkingFk = p.id - JOIN productionConfig pc ON TRUE + JOIN productionConfig pc WHERE s2.code = vShelvingFk; IF vClientFk IS NULL THEN @@ -58962,7 +58941,7 @@ BEGIN vClientFk, vWarehouseFk, CURDATE(), - NULL, + vAddressFk, vCompanyFk, NULL, vTicketFk @@ -61214,36 +61193,6 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `item_updatePackingShelve` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_updatePackingShelve`(vSelf INT, vPacking INT) -BEGIN - - /** - * Actualiza el valor de item.packingShelve - * - * @param vSelf Identificador de vn.item - * @param vPacking Cantidad de unidades de venta que caben en una bandeja - */ - - UPDATE vn.item i - SET i.packingShelve = vPacking - WHERE i.id = vSelf; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_updatePackingType` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63332,8 +63281,8 @@ proc: BEGIN rm.bufferFk FROM tmp.productionTicket tt JOIN ticket t ON tt.ticketFk = t.id - LEFT JOIN ticketStateToday tst ON tst.ticket = t.id - LEFT JOIN state st ON st.id = tst.state + LEFT JOIN ticketStateToday tst ON tst.ticketFk = t.id + LEFT JOIN `state` st ON st.id = tst.state LEFT JOIN client c ON c.id = t.clientFk LEFT JOIN worker wk ON wk.id = c.salesPersonFk JOIN address a ON a.id = t.addressFk @@ -65549,7 +65498,7 @@ BEGIN CALL productionControl(vWarehouseFk, 0); - -- Products without vn.item.packingOut, pay atention to vn.itemShelving.packing + -- Products with vn.item.isBoxPickingMode = TRUE, pay atention to vn.itemShelving.packing CREATE OR REPLACE TEMPORARY TABLE tmp.sale (saleFk INT PRIMARY KEY) SELECT @@ -65585,7 +65534,7 @@ BEGIN LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk LEFT JOIN buy b ON b.id = lb.buy_id WHERE s.quantity BETWEEN ish.packing AND (ish.visible - IFNULL(tISS.reserve,0)) - AND i.packingOut IS NULL + AND i.isBoxPickingMode AND NOT pb.problem AND sgd.saleFk IS NULL AND p.sectorFk = vSectorFk @@ -65732,7 +65681,6 @@ DECLARE vIsCollection BOOL; s.isAdded, IF(c.workerFk IS NULL, getUser(), c.workerFk) workerFk, IF(SUM(iss.quantity) IS NULL, 0, SUM(iss.quantity)) pickedQuantity, - i.packingShelve, MIN(iss.created) picked, IF(sm.id, TRUE, FALSE) hasMistake, sg.sectorFk @@ -66287,148 +66235,148 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sale_replaceItem` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_replaceItem`(vSaleFk INT, vNewItemFk INT, vQuantity INT) -BEGIN -/** - * Añade un nuevo articulo para sustituir a otro, y actualiza la memoria de sustituciones. - * - * @param vSaleFk id de la tabla sale - * @param vNewItemFk articulo sustituto - * @param vQuantity cantidad que se va a sustituir - */ - DECLARE vTicketFk INT; - DECLARE vItemFk INT; - DECLARE vWarehouseFk SMALLINT; - DECLARE vDate DATE; - DECLARE vGrouping INT; - DECLARE vGroupingModeFk INT; - DECLARE vPacking INT; - DECLARE vRoundQuantity INT DEFAULT 1; - DECLARE vLanded DATE; - DECLARE vAddressFk INT; - DECLARE vAgencyModeFk INT; - DECLARE vNewPrice DECIMAL(10,2); - DECLARE vOldPrice DECIMAL(10,2); - DECLARE vOption INT DEFAULT NULL; - DECLARE vNewSaleFk INT; - DECLARE vChangePrice INT DEFAULT 1; - DECLARE vBuyerDiscount INT DEFAULT 4; - DECLARE vManaDiscount INT DEFAULT 3; - DECLARE vForceToGrouping INT DEFAULT 1; - DECLARE vForceToPacking INT DEFAULT 2; - DECLARE vFinalPrice DECIMAL(10,2); - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - - SELECT s.ticketFk, - LEAST(s.quantity, vQuantity), - s.itemFk, - t.shipped, - t.warehouseFk, - t.landed, - t.addressFk, - t.agencyModeFk, - s.price - INTO vTicketFk, - vQuantity, - vItemFk, - vDate, - vWarehouseFk, - vLanded, - vAddressFk, - vAgencyModeFk, - vOldPrice - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - WHERE s.id = vSaleFk; - - CALL buyUltimate(vWarehouseFk, vDate); - - SELECT `grouping`, groupingMode, packing - INTO vGrouping,vGroupingModeFk,vPacking - FROM buy b - JOIN tmp.buyUltimate tmp ON b.id = tmp.buyFk - WHERE tmp.itemFk = vNewItemFk AND tmp.WarehouseFk = vWarehouseFk; - - IF vGroupingModeFk = vForceToPacking AND vPacking > 0 THEN - SET vRoundQuantity = vPacking; - END IF; - IF vGroupingModeFk = vForceToGrouping AND vGrouping > 0 THEN - SET vRoundQuantity = vGrouping; - END IF; - - CALL catalog_calcFromItem( - vLanded, - vAddressFk, - vAgencyModeFk, - vNewItemFk); - - SELECT price INTO vNewPrice - FROM tmp.ticketCalculateItem; - - IF vNewPrice IS NULL THEN - CALL util.throw('price retrieval failed'); - END IF; - IF vNewPrice > vOldPrice THEN - SET vFinalPrice = vOldPrice; - IF worker_isInDepartment('vt') THEN - SET vOption = vManaDiscount; - ELSE - SET vOption = vBuyerDiscount; - END IF; - ELSE - SET vFinalPrice = vNewPrice; - SET vOption = vChangePrice; - END IF; - - START TRANSACTION; - - UPDATE sale - SET quantity = quantity - vQuantity - WHERE id = vSaleFk; - - INSERT INTO vn.sale(ticketFk, - itemFk, - quantity, - concept, - price) - SELECT vTicketFk, - vNewItemFk, - CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, CONCAT('+ ',i.longName), - vFinalPrice - FROM vn.item i - WHERE id = vNewItemFk; - - SELECT LAST_INSERT_ID() INTO vNewSaleFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) - ENGINE = MEMORY - SELECT id saleFk, vWarehouseFk warehouseFk - FROM sale s WHERE id = vNewSaleFk; - - CALL ticketComponentUpdateSale(vOption); - CALL catalog_componentPurge(); - - INSERT INTO itemProposal(itemFk, mateFk, counter) - VALUES(vItemFk, vNewItemFk, 1) - ON DUPLICATE KEY UPDATE counter = counter + 1; - - COMMIT; +BEGIN +/** + * Añade un nuevo articulo para sustituir a otro, y actualiza la memoria de sustituciones. + * + * @param vSaleFk id de la tabla sale + * @param vNewItemFk articulo sustituto + * @param vQuantity cantidad que se va a sustituir + */ + DECLARE vTicketFk INT; + DECLARE vItemFk INT; + DECLARE vWarehouseFk SMALLINT; + DECLARE vDate DATE; + DECLARE vGrouping INT; + DECLARE vGroupingModeFk INT; + DECLARE vPacking INT; + DECLARE vRoundQuantity INT DEFAULT 1; + DECLARE vLanded DATE; + DECLARE vAddressFk INT; + DECLARE vAgencyModeFk INT; + DECLARE vNewPrice DECIMAL(10,2); + DECLARE vOldPrice DECIMAL(10,2); + DECLARE vOption INT DEFAULT NULL; + DECLARE vNewSaleFk INT; + DECLARE vChangePrice INT DEFAULT 1; + DECLARE vBuyerDiscount INT DEFAULT 4; + DECLARE vManaDiscount INT DEFAULT 3; + DECLARE vForceToGrouping INT DEFAULT 1; + DECLARE vForceToPacking INT DEFAULT 2; + DECLARE vFinalPrice DECIMAL(10,2); + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + SELECT s.ticketFk, + LEAST(s.quantity, vQuantity), + s.itemFk, + t.shipped, + t.warehouseFk, + t.landed, + t.addressFk, + t.agencyModeFk, + s.price + INTO vTicketFk, + vQuantity, + vItemFk, + vDate, + vWarehouseFk, + vLanded, + vAddressFk, + vAgencyModeFk, + vOldPrice + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + WHERE s.id = vSaleFk; + + CALL buyUltimate(vWarehouseFk, vDate); + + SELECT `grouping`, groupingMode, packing + INTO vGrouping,vGroupingModeFk,vPacking + FROM buy b + JOIN tmp.buyUltimate tmp ON b.id = tmp.buyFk + WHERE tmp.itemFk = vNewItemFk AND tmp.WarehouseFk = vWarehouseFk; + + IF vGroupingModeFk = vForceToPacking AND vPacking > 0 THEN + SET vRoundQuantity = vPacking; + END IF; + IF vGroupingModeFk = vForceToGrouping AND vGrouping > 0 THEN + SET vRoundQuantity = vGrouping; + END IF; + + CALL catalog_calcFromItem( + vLanded, + vAddressFk, + vAgencyModeFk, + vNewItemFk); + + SELECT price INTO vNewPrice + FROM tmp.ticketCalculateItem; + + IF vNewPrice IS NULL THEN + CALL util.throw('price retrieval failed'); + END IF; + IF vNewPrice > vOldPrice THEN + SET vFinalPrice = vOldPrice; + IF worker_isInDepartment('vt') THEN + SET vOption = vManaDiscount; + ELSE + SET vOption = vBuyerDiscount; + END IF; + ELSE + SET vFinalPrice = vNewPrice; + SET vOption = vChangePrice; + END IF; + + START TRANSACTION; + + UPDATE sale + SET quantity = quantity - vQuantity + WHERE id = vSaleFk; + + INSERT INTO vn.sale(ticketFk, + itemFk, + quantity, + concept, + price) + SELECT vTicketFk, + vNewItemFk, + CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, CONCAT('+ ',i.longName), + vFinalPrice + FROM vn.item i + WHERE id = vNewItemFk; + + SELECT LAST_INSERT_ID() INTO vNewSaleFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (saleFk)) + ENGINE = MEMORY + SELECT id saleFk, vWarehouseFk warehouseFk + FROM sale s WHERE id = vNewSaleFk; + + CALL ticketComponentUpdateSale(vOption); + CALL catalog_componentPurge(); + + INSERT INTO itemProposal(itemFk, mateFk, counter) + VALUES(vItemFk, vNewItemFk, 1) + ON DUPLICATE KEY UPDATE counter = counter + 1; + + COMMIT; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -67801,25 +67749,6 @@ BEGIN GROUP BY p.supplierFk) sdpmc ON sdpmc.supplierFk = s.id SET s.isPayMethodChecked = FALSE; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `test` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `test`() -BEGIN -select 'procedimiento ejecutado con éxito'; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -68653,7 +68582,7 @@ BEGIN JOIN vn.parking p ON p.id = tp.parkingFk JOIN vn.sector sc ON sc.id = p.sectorFk LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = tp.ticketFk - JOIN vn.ticketStateToday tst ON tst.ticket = tp.ticketFk + JOIN vn.ticketStateToday tst ON tst.ticketFk = tp.ticketFk JOIN vn.ticket t ON t.id = tp.ticketFk JOIN vn.zone z ON z.id = t.zoneFk JOIN vn.agencyMode am ON am.id = z.agencyModeFk @@ -68956,7 +68885,7 @@ BEGIN JOIN vn.parking p ON p.id = tp.parkingFk JOIN vn.sector sc ON sc.id = p.sectorFk LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = tp.ticketFk - JOIN vn.ticketStateToday tst ON tst.ticket = tp.ticketFk + JOIN vn.ticketStateToday tst ON tst.ticketFk = tp.ticketFk JOIN vn.ticket t ON t.id = tp.ticketFk JOIN vn.zone z ON z.id = t.zoneFk JOIN vn.agencyMode am ON am.id = z.agencyModeFk @@ -69073,7 +69002,7 @@ BEGIN SELECT s.alertLevel INTO vAlertLevel FROM state s JOIN ticketStateToday tst ON tst.state = s.id - WHERE tst.ticket = vTicketFk + WHERE tst.ticketFk = vTicketFk LIMIT 1; IF vAlertLevel < 2 THEN @@ -70917,47 +70846,58 @@ DELIMITER ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getMovable`(vTicketFk INT, vDatedNew DATETIME, vWarehouseFk INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getMovable`( + vTicketFk INT, + vNewShipped DATETIME, + vWarehouseFk INT +) BEGIN /** * Cálcula el stock movible para los artículos de un ticket - * vDatedNew debe ser menor que vDatedOld, en los otros casos se + * vNewShipped debe ser menor que vOldShipped, en los otros casos se * asume que siempre es posible * * @param vTicketFk -> Ticket - * @param vDatedNew -> Nueva fecha + * @param vNewShipped -> Nueva fecha * @return Sales con Movible -*/ - DECLARE vDatedOld DATETIME; - SET vDatedNew = DATE_ADD(vDatedNew, INTERVAL 1 DAY); +*/ + DECLARE vOldShipped DATETIME; - SELECT t.shipped INTO vDatedOld - FROM ticket t + SELECT t.shipped INTO vOldShipped + FROM ticket t WHERE t.id = vTicketFk; - CALL item_getStock(vWarehouseFk, vDatedNew, NULL); - CALL item_getMinacum(vWarehouseFk, vDatedNew, DATEDIFF(DATE_SUB(vDatedOld, INTERVAL 1 DAY), vDatedNew), NULL); - - SELECT s.id, - s.itemFk, - s.quantity, - s.concept, - s.price, + -- Añadimos un dia más para calcular el stock hasta vNewShipped inclusive + CALL item_getStock(vWarehouseFk, DATE_ADD(vNewShipped, INTERVAL 1 DAY), NULL); + CALL item_getMinacum( + vWarehouseFk, + vNewShipped, + DATEDIFF(DATE_SUB(vOldShipped, INTERVAL 1 DAY), vNewShipped), + NULL + ); + + SELECT s.id, + s.itemFk, + s.quantity, + s.concept, + s.price, s.reserved, - s.discount, - i.image, - i.subName, + s.discount, + i.image, + i.subName, il.stock + IFNULL(im.amount, 0) AS movable FROM ticket t JOIN sale s ON s.ticketFk = t.id - JOIN item i ON i.id = s.itemFk - LEFT JOIN tmp.itemMinacum im ON im.itemFk = s.itemFk AND im.warehouseFk = vWarehouseFk + JOIN item i ON i.id = s.itemFk + LEFT JOIN tmp.itemMinacum im ON im.itemFk = s.itemFk + AND im.warehouseFk = vWarehouseFk LEFT JOIN tmp.itemList il ON il.itemFk = s.itemFk WHERE t.id = vTicketFk; - DROP TEMPORARY TABLE IF EXISTS tmp.itemList; - DROP TEMPORARY TABLE IF EXISTS tmp.itemMinacum; - + DROP TEMPORARY TABLE IF EXISTS + tmp.itemList, + tmp.itemMinacum; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -72880,29 +72820,6 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.timeControl; DROP TEMPORARY TABLE IF EXISTS tmp.timeControlAux; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `timeWorkerControl_check` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `timeWorkerControl_check`(vUserFk INT, vDated DATE,vTabletFk VARCHAR(100)) -proc: BEGIN -/** - * deprecated call workerTimeControl_check - */ -CALL vn.workerTimeControl_check(vUserFk,vDated,vTabletFk); - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -73194,22 +73111,21 @@ DELIMITER ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_cloneWithEntries`( - IN vTravelFk INT, - IN vDateStart DATE, + IN vTravelFk INT, + IN vDateStart DATE, IN vDateEnd DATE, IN vWarehouseOutFk INT, - IN vWarehouseInFk INT, - IN vRef VARCHAR(255), - IN vAgencyModeFk INT, + IN vWarehouseInFk INT, + IN vRef VARCHAR(255), + IN vAgencyModeFk INT, OUT vNewTravelFk INT) BEGIN /** * Clona un travel junto con sus entradas y compras - * * @param vTravelFk travel plantilla a clonar * @param vDateStart fecha del shipment del nuevo travel * @param vDateEnd fecha del landing del nuevo travel - * @param vWarehouseOutFk fecha del salida del nuevo travel + * @param vWarehouseOutFk warehouse del salida del nuevo travel * @param vWarehouseInFk warehouse de landing del nuevo travel * @param vRef referencia del nuevo travel * @param vAgencyModeFk del nuevo travel @@ -73219,34 +73135,35 @@ BEGIN DECLARE vEvaNotes VARCHAR(255); DECLARE vDone BOOL; DECLARE vAuxEntryFk INT; + DECLARE vTx BOOLEAN DEFAULT @@in_transaction; DECLARE vRsEntry CURSOR FOR SELECT e.id FROM entry e JOIN travel t ON t.id = e.travelFk WHERE e.travelFk = vTravelFk; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; + BEGIN + CALL util.tx_rollback(vTx); RESIGNAL; END; - - START TRANSACTION; + + CALL util.tx_start(vTx); INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, `ref`, isDelivered, isReceived, m3, cargoSupplierFk, kg,clonedFrom) SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3,cargoSupplierFk, kg,vTravelFk FROM travel WHERE id = vTravelFk; - + SET vNewTravelFk = LAST_INSERT_ID(); SET vDone = FALSE; SET @isModeInventory = TRUE; OPEN vRsEntry; - + l: LOOP SET vDone = FALSE; FETCH vRsEntry INTO vAuxEntryFk; @@ -73256,7 +73173,7 @@ BEGIN END IF; CALL entry_cloneHeader(vAuxEntryFk, vNewEntryFk, vNewTravelFk); - CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk); + CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk); SELECT evaNotes INTO vEvaNotes FROM entry @@ -73270,7 +73187,7 @@ BEGIN SET @isModeInventory = FALSE; CLOSE vRsEntry; - COMMIT; + CALL util.tx_commit(vTx); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -74778,88 +74695,6 @@ BEGIN INSERT INTO vn.workerMistake(userFk, workerMistakeTypeFk) VALUES(vWorkerFk, vWorkerMistakeTypeFk); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlAdd` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlAdd`(IN vUserFk INT, IN vWarehouseFk INT, IN vDated DATETIME) -BEGIN - - /*INSERT INTO workerTimeControl(userFk, timed, manual, warehouseFk) - VALUES(vUserFk, vDated, FALSE, vWarehouseFk); - - CALL vn.workerTimeControlSOWP(vUserFk , vDated);*/ - - CALL vn.workerTimeControl_add(vUserFk,vWarehouseFk,util.VN_NOW(),FALSE); - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlPinGenerate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlPinGenerate`( - vWorkerFk INT) -BEGIN -/** - * Create new pin for workerFk or new pin for all workers if vWorkerFk is null - * - */ - - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlSetOrder` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlSetOrder`() -BEGIN - - SET @order := 1; - SET @userFk := 0; - SET @day := 0; - - UPDATE tmp.workerTimeControl - SET `order` = IF(userFk = @userFk AND day(timed) = @day, @order := @order + 1, @order := 1), - userFk = @userFk := userFk, - manual = manual + (0 * @day := day(timed)) - ORDER BY userFk, timed; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -74894,27 +74729,6 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_add`(IN vUserFk INT, IN vWarehouseFk INT, IN vTimed DATETIME, IN vIsManual BOOL) -BEGIN - - - SELECT workerTimeControl_add(vUserFk,vWarehouseFk,vTimed,vIsManual); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_calculateOddDays` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -75309,33 +75123,35 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_clockIn` */; /*!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 = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_clockIn`( vWorkerFk INT, vTimed DATETIME, - vDirection VARCHAR(10) + vDirection VARCHAR(10), + vDevice VARCHAR(255) ) BEGIN /** - * Verifica si el empleado puede fichar - * @param vWorkerFk Identificador del trabajador - * @param vTimed valor de la fichada, IF vTimed IS NULL vTimed = NOW - * @param vDirection solo se pueden pasa los valores del campo - * workerTimeControl.direction ENUM('in', 'out', 'middle') - * @return Si todo es correcto, retorna el número de id la tabla workerTimeControl. - * Si hay algún problema, devuelve el mesaje que se debe mostrar al usuario - * Solo retorna el primer problema, en caso de no ocurrir ningún error se añadirá - * fichada a la tabla vn.workerTimeControl - */ - +* Verifica si el empleado puede fichar +* @param vWorkerFk Identificador del trabajador +* @param vTimed Balor de la fichada, IF vTimed IS NULL vTimed = NOW +* @param vDirection Solo se pueden pasa los valores del campo +* workerTimeControl.direction ENUM('in', 'out', 'middle') +* @param vDevice Dispositivo en el que se ha fichado +* @return Si todo es correcto, retorna el número de id la tabla workerTimeControl. +* Si hay algún problema, devuelve el mesaje que se debe mostrar al usuario +* Solo retorna el primer problema, en caso de no ocurrir ningún error se añadirá +* fichada a la tabla vn.workerTimeControl +*/ + DECLARE vLastIn DATETIME; DECLARE vLastOut DATETIME; DECLARE vNextIn DATETIME; @@ -75588,16 +75404,16 @@ BEGIN GROUP BY breakCounter HAVING hasError LIMIT 1; - + IF vIsError THEN SET vErrorCode = 'BREAK_WEEK'; CALL util.throw(vErrorCode); END IF; END IF; - - -- SE PERMITE FICHAR - INSERT INTO workerTimeControl(userFk, timed, direction, `manual`) - VALUES(vWorkerFk, vTimed, vDirection, vIsManual); + + -- Se permite fichar + INSERT INTO workerTimeControl(userFk, timed, direction, device, `manual`) + VALUES(vWorkerFk, vTimed, vDirection, vDevice, vIsManual); SELECT LAST_INSERT_ID() id; @@ -75867,58 +75683,6 @@ BEGIN CALL vn.workerTimeControlSOWP(vUserFk, vTimed); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_repair` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_repair`() -proc: BEGIN -/** - * Corrige las fichadas - * - */ - -/*1- poner todos a middle*/ -UPDATE vn.workerTimeControl SET direction = 'middle'; - -/*2- poner los out*/ -UPDATE vn.workerTimeControl wtc - JOIN - (SELECT userFk,MAX(timed) maxTimed FROM - (SELECT id, userFk, timed, date(timed) dated - FROM vn.workerTimeControl - ) sub - GROUP BY userFk,dated - )sub - SET direction = "out" - WHERE wtc.userFk = sub.userFk - AND wtc.timed = sub.maxTimed; - - /*3- poner los in*/ -UPDATE vn.workerTimeControl wtc - JOIN - (SELECT userFk,MIN(timed) maxTimed FROM - (SELECT id, userFk, timed, date(timed) dated - FROM vn.workerTimeControl - ) sub - GROUP BY userFk,dated - )sub - SET direction = "in" - WHERE wtc.userFk = sub.userFk - AND wtc.timed = sub.maxTimed ; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -76094,34 +75858,6 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_setOrder` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_setOrder`(vUserFk INT, vStarted DATE, vFinished DATE) -BEGIN - - SET @order := 0; - SET @day := '2000-01-01'; - - UPDATE vn.workerTimeControl w - SET w.`order` = @order := IF(@day = @day := date(timed), @order, 0) + 1 - WHERE w.userFk = vUserFk - AND w.timed BETWEEN vStarted AND util.dayend(vFinished) - ORDER BY w.timed; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_weekCheckBreak` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -79800,60 +79536,6 @@ SET character_set_client = utf8; 1 AS `description` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `Rutas_Master` --- - -DROP TABLE IF EXISTS `Rutas_Master`; -/*!50001 DROP VIEW IF EXISTS `Rutas_Master`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Rutas_Master` AS SELECT - 1 AS `id`, - 1 AS `warehouse_id`, - 1 AS `km`, - 1 AS `bultos`, - 1 AS `vehiculos_coste`, - 1 AS `personal_coste`, - 1 AS `vehiculos_numero`, - 1 AS `personal_numero`, - 1 AS `gasoil`, - 1 AS `autonomos`, - 1 AS `año`, - 1 AS `mes`, - 1 AS `gastos`, - 1 AS `bultos_autonomos`, - 1 AS `coste_km`, - 1 AS `coste_bulto`, - 1 AS `coste_bulto_autonomo`, - 1 AS `odbc_date` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `Rutas_monitor` --- - -DROP TABLE IF EXISTS `Rutas_monitor`; -/*!50001 DROP VIEW IF EXISTS `Rutas_monitor`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Rutas_monitor` AS SELECT - 1 AS `Id_Ruta`, - 1 AS `name`, - 1 AS `Ubicacion`, - 1 AS `pedidosEncajados`, - 1 AS `pedidosLibres`, - 1 AS `pedidosProduccion`, - 1 AS `bultos`, - 1 AS `notas`, - 1 AS `fecha`, - 1 AS `dockFk`, - 1 AS `m3`, - 1 AS `priority`, - 1 AS `etd`, - 1 AS `expeditionTruckFk` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `Saldos_Prevision` -- @@ -80193,37 +79875,6 @@ CREATE TABLE `Vehiculos_consumo` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_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 */; --- --- Temporary table structure for view `VerEspionaje` --- - -DROP TABLE IF EXISTS `VerEspionaje`; -/*!50001 DROP VIEW IF EXISTS `VerEspionaje`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `VerEspionaje` AS SELECT - 1 AS `CodigoTrabajador`, - 1 AS `Fecha`, - 1 AS `HoraEntrada`, - 1 AS `HoraSalida`, - 1 AS `Id_Equipo`, - 1 AS `Id_Trabajador` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `Vistas` --- - -DROP TABLE IF EXISTS `Vistas`; -/*!50001 DROP VIEW IF EXISTS `Vistas`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Vistas` AS SELECT - 1 AS `vista_id`, - 1 AS `code`, - 1 AS `vista` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `XDiario` -- @@ -80603,7 +80254,7 @@ CREATE TABLE `awb_component` ( `Id_Moneda` tinyint(3) unsigned NOT NULL DEFAULT 2, `recibida_id` mediumint(8) unsigned DEFAULT NULL, PRIMARY KEY (`id`), - UNIQUE KEY `unique_idx` (`awb_id`,`Id_Proveedor`,`awb_component_type_id`,`Fecha`), + UNIQUE KEY `unique_idx` (`awb_id`,`Id_Proveedor`,`awb_component_type_id`), KEY `Id_Moneda` (`Id_Moneda`), KEY `awb_component_fk` (`awb_component_type_id`), KEY `awb_role_fk` (`awb_role_id`), @@ -81212,84 +80863,6 @@ SET character_set_client = utf8; 1 AS `addressFk` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `client_observation` --- - -DROP TABLE IF EXISTS `client_observation`; -/*!50001 DROP VIEW IF EXISTS `client_observation`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `client_observation` AS SELECT - 1 AS `client_observation_id`, - 1 AS `Id_Cliente`, - 1 AS `Id_Trabajador`, - 1 AS `text`, - 1 AS `odbc_date` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `clientes_gestdoc` --- - -DROP TABLE IF EXISTS `clientes_gestdoc`; -/*!50001 DROP VIEW IF EXISTS `clientes_gestdoc`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `clientes_gestdoc` AS SELECT - 1 AS `Id_Cliente`, - 1 AS `gest_doc_id` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `clientes_regalos_enc` --- - -DROP TABLE IF EXISTS `clientes_regalos_enc`; -/*!50001 DROP VIEW IF EXISTS `clientes_regalos_enc`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `clientes_regalos_enc` AS SELECT - 1 AS `Id_Cliente`, - 1 AS `Id_Regalo`, - 1 AS `odbc_date` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `clientes_regalos_lista_enc` --- - -DROP TABLE IF EXISTS `clientes_regalos_lista_enc`; -/*!50001 DROP VIEW IF EXISTS `clientes_regalos_lista_enc`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `clientes_regalos_lista_enc` AS SELECT - 1 AS `Id_Regalo`, - 1 AS `Descripcion`, - 1 AS `foto`, - 1 AS `activo`, - 1 AS `datstart`, - 1 AS `datend`, - 1 AS `warehouse_id`, - 1 AS `province_id`, - 1 AS `countryFk` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `clientes_tipo` --- - -DROP TABLE IF EXISTS `clientes_tipo`; -/*!50001 DROP VIEW IF EXISTS `clientes_tipo`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `clientes_tipo` AS SELECT - 1 AS `clientes_tipo_id`, - 1 AS `code`, - 1 AS `tipo`, - 1 AS `isCreatedAsServed` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `commission` -- @@ -81404,20 +80977,6 @@ CREATE TABLE `cooler_path` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Define el orden en que se imprimen los F5'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `cooler_path_detail` --- - -DROP TABLE IF EXISTS `cooler_path_detail`; -/*!50001 DROP VIEW IF EXISTS `cooler_path_detail`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `cooler_path_detail` AS SELECT - 1 AS `cooler_path_detail_id`, - 1 AS `cooler_path_id`, - 1 AS `pasillo` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `cp` -- @@ -81435,22 +80994,6 @@ CREATE TABLE `cp` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Relacio de codis postals i el municipi al qual se asigna'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `credit` --- - -DROP TABLE IF EXISTS `credit`; -/*!50001 DROP VIEW IF EXISTS `credit`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `credit` AS SELECT - 1 AS `id`, - 1 AS `Id_Cliente`, - 1 AS `Id_Trabajador`, - 1 AS `amount`, - 1 AS `odbc_date` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `credit_card` -- @@ -81900,25 +81443,6 @@ SET character_set_client = utf8; 1 AS `hasCompany` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `escritos_det` --- - -DROP TABLE IF EXISTS `escritos_det`; -/*!50001 DROP VIEW IF EXISTS `escritos_det`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `escritos_det` AS SELECT - 1 AS `id`, - 1 AS `Id_Cliente`, - 1 AS `escritos_id`, - 1 AS `fecha`, - 1 AS `Id_Trabajador`, - 1 AS `userFk`, - 1 AS `empresa_id`, - 1 AS `saldo` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `expeditions` -- @@ -82327,74 +81851,6 @@ SET character_set_client = utf8; 1 AS `ticketFk` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `iva_codigo` --- - -DROP TABLE IF EXISTS `iva_codigo`; -/*!50001 DROP VIEW IF EXISTS `iva_codigo`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `iva_codigo` AS SELECT - 1 AS `id`, - 1 AS `fecha`, - 1 AS `codigo`, - 1 AS `iva_tipo_id`, - 1 AS `iva`, - 1 AS `recargo`, - 1 AS `tipo`, - 1 AS `link`, - 1 AS `isActive`, - 1 AS `updated`, - 1 AS `transactionCode` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `iva_group` --- - -DROP TABLE IF EXISTS `iva_group`; -/*!50001 DROP VIEW IF EXISTS `iva_group`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `iva_group` AS SELECT - 1 AS `iva_group_id`, - 1 AS `description`, - 1 AS `code` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `iva_group_codigo` --- - -DROP TABLE IF EXISTS `iva_group_codigo`; -/*!50001 DROP VIEW IF EXISTS `iva_group_codigo`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `iva_group_codigo` AS SELECT - 1 AS `iva_group_id`, - 1 AS `date`, - 1 AS `iva_codigo_id` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `iva_tipo` --- - -DROP TABLE IF EXISTS `iva_tipo`; -/*!50001 DROP VIEW IF EXISTS `iva_tipo`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `iva_tipo` AS SELECT - 1 AS `id`, - 1 AS `alias`, - 1 AS `isAccrued`, - 1 AS `serie_id`, - 1 AS `TIPOOPE`, - 1 AS `descripcion`, - 1 AS `Id_Pais` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `jerarquia` -- @@ -82545,89 +82001,6 @@ CREATE TABLE `nichos` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `observation_type` --- - -DROP TABLE IF EXISTS `observation_type`; -/*!50001 DROP VIEW IF EXISTS `observation_type`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `observation_type` AS SELECT - 1 AS `observation_type_id`, - 1 AS `description` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `order` --- - -DROP TABLE IF EXISTS `order`; -/*!50001 DROP VIEW IF EXISTS `order`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `order` AS SELECT - 1 AS `id`, - 1 AS `date_make`, - 1 AS `date_send`, - 1 AS `customer_id`, - 1 AS `delivery_method_id`, - 1 AS `agency_id`, - 1 AS `address_id`, - 1 AS `note`, - 1 AS `confirmed`, - 1 AS `is_bionic`, - 1 AS `source_app` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `order_Tickets` --- - -DROP TABLE IF EXISTS `order_Tickets`; -/*!50001 DROP VIEW IF EXISTS `order_Tickets`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `order_Tickets` AS SELECT - 1 AS `order_id`, - 1 AS `Id_Ticket` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `order_component` --- - -DROP TABLE IF EXISTS `order_component`; -/*!50001 DROP VIEW IF EXISTS `order_component`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `order_component` AS SELECT - 1 AS `order_row_id`, - 1 AS `component_id`, - 1 AS `price` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `order_row` --- - -DROP TABLE IF EXISTS `order_row`; -/*!50001 DROP VIEW IF EXISTS `order_row`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `order_row` AS SELECT - 1 AS `id`, - 1 AS `order_id`, - 1 AS `item_id`, - 1 AS `warehouse_id`, - 1 AS `shipment`, - 1 AS `amount`, - 1 AS `price`, - 1 AS `rate`, - 1 AS `created`, - 1 AS `Id_Movimiento` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `pago` -- @@ -83335,58 +82708,6 @@ CREATE TABLE `scan_line` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `sharingcart` --- - -DROP TABLE IF EXISTS `sharingcart`; -/*!50001 DROP VIEW IF EXISTS `sharingcart`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `sharingcart` AS SELECT - 1 AS `id`, - 1 AS `Id_Trabajador`, - 1 AS `datSTART`, - 1 AS `datEND`, - 1 AS `Id_Suplente`, - 1 AS `odbc_date` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `sharingclient` --- - -DROP TABLE IF EXISTS `sharingclient`; -/*!50001 DROP VIEW IF EXISTS `sharingclient`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `sharingclient` AS SELECT - 1 AS `id`, - 1 AS `Id_Trabajador`, - 1 AS `datSTART`, - 1 AS `datEND`, - 1 AS `Id_Cliente` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `sms` --- - -DROP TABLE IF EXISTS `sms`; -/*!50001 DROP VIEW IF EXISTS `sms`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `sms` AS SELECT - 1 AS `id`, - 1 AS `Id_trabajador`, - 1 AS `from`, - 1 AS `to`, - 1 AS `text`, - 1 AS `sent`, - 1 AS `response`, - 1 AS `DATE_ODBC` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `sort_merge_results_ernesto` -- @@ -83510,24 +82831,6 @@ SET character_set_client = utf8; 1 AS `base` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `tarifas` --- - -DROP TABLE IF EXISTS `tarifas`; -/*!50001 DROP VIEW IF EXISTS `tarifas`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `tarifas` AS SELECT - 1 AS `tarifa_id`, - 1 AS `fecha`, - 1 AS `warehouse_id`, - 1 AS `t0`, - 1 AS `t1`, - 1 AS `t2`, - 1 AS `t3` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `tblContadores` -- @@ -83659,48 +82962,6 @@ SET character_set_client = utf8; 1 AS `model` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `ticketCreationData` --- - -DROP TABLE IF EXISTS `ticketCreationData`; -/*!50001 DROP VIEW IF EXISTS `ticketCreationData`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `ticketCreationData` AS SELECT - 1 AS `DiadelaSemana`, - 1 AS `Hora`, - 1 AS `Fecha`, - 1 AS `Dispositivo` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `ticketMRW` --- - -DROP TABLE IF EXISTS `ticketMRW`; -/*!50001 DROP VIEW IF EXISTS `ticketMRW`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `ticketMRW` AS SELECT - 1 AS `id_Agencia`, - 1 AS `empresa_id`, - 1 AS `Consignatario`, - 1 AS `DOMICILIO`, - 1 AS `POBLACION`, - 1 AS `CODPOSTAL`, - 1 AS `telefono`, - 1 AS `movil`, - 1 AS `IF`, - 1 AS `Id_Ticket`, - 1 AS `warehouse_id`, - 1 AS `Id_Consigna`, - 1 AS `CodigoPais`, - 1 AS `Fecha`, - 1 AS `province_id`, - 1 AS `landing` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `ticket_location__` -- @@ -83796,32 +83057,6 @@ CREATE TABLE `tmpNEWTARIFAS` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `tr2` --- - -DROP TABLE IF EXISTS `tr2`; -/*!50001 DROP VIEW IF EXISTS `tr2`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `tr2` AS SELECT - 1 AS `id`, - 1 AS `shipped`, - 1 AS `shipmentHour`, - 1 AS `landed`, - 1 AS `landingHour`, - 1 AS `warehouseInFk`, - 1 AS `warehouseOutFk`, - 1 AS `agencyFk`, - 1 AS `ref`, - 1 AS `isDelivered`, - 1 AS `isReceived`, - 1 AS `m3`, - 1 AS `kg`, - 1 AS `cargoSupplierFk`, - 1 AS `totalEntries` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `transport` -- @@ -83921,24 +83156,6 @@ CREATE TABLE `travel_reserve` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='En esta tabla almacenamos los m3 que cada comprador tiene asignados, por travel.'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `travel_thermograph` --- - -DROP TABLE IF EXISTS `travel_thermograph`; -/*!50001 DROP VIEW IF EXISTS `travel_thermograph`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `travel_thermograph` AS SELECT - 1 AS `thermograph_id`, - 1 AS `odbc_date`, - 1 AS `warehouse_id`, - 1 AS `travel_id`, - 1 AS `temperature`, - 1 AS `result`, - 1 AS `gestdoc_id` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `trolley` -- @@ -84098,53 +83315,6 @@ SET character_set_client = utf8; 1 AS `ediBotanic` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `v_account` --- - -DROP TABLE IF EXISTS `v_account`; -/*!50001 DROP VIEW IF EXISTS `v_account`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_account` AS SELECT - 1 AS `user_id` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `v_analisis_ventas` --- - -DROP TABLE IF EXISTS `v_analisis_ventas`; -/*!50001 DROP VIEW IF EXISTS `v_analisis_ventas`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_analisis_ventas` AS SELECT - 1 AS `Familia`, - 1 AS `Reino`, - 1 AS `Comercial`, - 1 AS `Comprador`, - 1 AS `Provincia`, - 1 AS `almacen`, - 1 AS `Año`, - 1 AS `Mes`, - 1 AS `Semana`, - 1 AS `Vista`, - 1 AS `Importe` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `v_barcodes` --- - -DROP TABLE IF EXISTS `v_barcodes`; -/*!50001 DROP VIEW IF EXISTS `v_barcodes`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_barcodes` AS SELECT - 1 AS `code`, - 1 AS `Id_Article` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `v_compres` -- @@ -84211,41 +83381,6 @@ SET character_set_client = utf8; 1 AS `producer_id` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `v_departure_limit` --- - -DROP TABLE IF EXISTS `v_departure_limit`; -/*!50001 DROP VIEW IF EXISTS `v_departure_limit`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_departure_limit` AS SELECT - 1 AS `warehouse_id`, - 1 AS `fecha`, - 1 AS `hora`, - 1 AS `minSpeed` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `v_descuadre_bionic` --- - -DROP TABLE IF EXISTS `v_descuadre_bionic`; -/*!50001 DROP VIEW IF EXISTS `v_descuadre_bionic`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_descuadre_bionic` AS SELECT - 1 AS `Id_Ticket`, - 1 AS `Alias`, - 1 AS `Concepte`, - 1 AS `suma_componente`, - 1 AS `Preu`, - 1 AS `Descuento`, - 1 AS `diferencia`, - 1 AS `Fecha`, - 1 AS `benvenut` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `v_empresa` -- @@ -84272,24 +83407,6 @@ SET character_set_client = utf8; 1 AS `abbreviation` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `v_inter` --- - -DROP TABLE IF EXISTS `v_inter`; -/*!50001 DROP VIEW IF EXISTS `v_inter`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_inter` AS SELECT - 1 AS `inter_id`, - 1 AS `state_id`, - 1 AS `nota`, - 1 AS `odbc_date`, - 1 AS `Id_Ticket`, - 1 AS `Id_Trabajador`, - 1 AS `Id_supervisor` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `v_jerarquia` -- @@ -84303,84 +83420,6 @@ SET character_set_client = utf8; 1 AS `boss_id` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `v_miriam` --- - -DROP TABLE IF EXISTS `v_miriam`; -/*!50001 DROP VIEW IF EXISTS `v_miriam`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_miriam` AS SELECT - 1 AS `Id_Article`, - 1 AS `Concepte`, - 1 AS `Cantidad`, - 1 AS `Preu`, - 1 AS `Descuento`, - 1 AS `Fecha`, - 1 AS `Id_Cliente`, - 1 AS `Importe` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `v_price_fixed` --- - -DROP TABLE IF EXISTS `v_price_fixed`; -/*!50001 DROP VIEW IF EXISTS `v_price_fixed`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_price_fixed` AS SELECT - 1 AS `warehouse_id`, - 1 AS `item_id`, - 1 AS `rate_0`, - 1 AS `rate_1`, - 1 AS `rate_2`, - 1 AS `rate_3`, - 1 AS `date_start`, - 1 AS `date_end`, - 1 AS `bonus`, - 1 AS `grouping`, - 1 AS `Packing`, - 1 AS `caja` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `v_price_fixed_group` --- - -DROP TABLE IF EXISTS `v_price_fixed_group`; -/*!50001 DROP VIEW IF EXISTS `v_price_fixed_group`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_price_fixed_group` AS SELECT - 1 AS `warehouse_id`, - 1 AS `item_id`, - 1 AS `rate_0`, - 1 AS `rate_1`, - 1 AS `rate_2`, - 1 AS `rate_3`, - 1 AS `date_start`, - 1 AS `date_end`, - 1 AS `bonus`, - 1 AS `grouping`, - 1 AS `Packing`, - 1 AS `caja` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `v_ticket_amount` --- - -DROP TABLE IF EXISTS `v_ticket_amount`; -/*!50001 DROP VIEW IF EXISTS `v_ticket_amount`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_ticket_amount` AS SELECT - 1 AS `Id_Ticket`, - 1 AS `amount` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `v_ventes` -- @@ -84425,32 +83464,6 @@ SET character_set_client = utf8; 1 AS `producer_id` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `v_warehouse` --- - -DROP TABLE IF EXISTS `v_warehouse`; -/*!50001 DROP VIEW IF EXISTS `v_warehouse`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_warehouse` AS SELECT - 1 AS `id`, - 1 AS `almacen` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `v_xsubclien` --- - -DROP TABLE IF EXISTS `v_xsubclien`; -/*!50001 DROP VIEW IF EXISTS `v_xsubclien`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_xsubclien` AS SELECT - 1 AS `Id_Cliente`, - 1 AS `empresa_id` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `v_xsubcuentas` -- @@ -84473,19 +83486,6 @@ SET character_set_client = utf8; 1 AS `IDNIF` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `v_xsubprov` --- - -DROP TABLE IF EXISTS `v_xsubprov`; -/*!50001 DROP VIEW IF EXISTS `v_xsubprov`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_xsubprov` AS SELECT - 1 AS `proveedor_id`, - 1 AS `empresa_id` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `versiones` -- @@ -84517,52 +83517,6 @@ CREATE TABLE `viaxpress` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `vnCreditClassification` --- - -DROP TABLE IF EXISTS `vnCreditClassification`; -/*!50001 DROP VIEW IF EXISTS `vnCreditClassification`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `vnCreditClassification` AS SELECT - 1 AS `id`, - 1 AS `client`, - 1 AS `dateStart`, - 1 AS `dateEnd` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `vnCreditInsurance` --- - -DROP TABLE IF EXISTS `vnCreditInsurance`; -/*!50001 DROP VIEW IF EXISTS `vnCreditInsurance`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `vnCreditInsurance` AS SELECT - 1 AS `id`, - 1 AS `creditClassification`, - 1 AS `credit`, - 1 AS `creationDate`, - 1 AS `grade` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `vnSolunionCAP` --- - -DROP TABLE IF EXISTS `vnSolunionCAP`; -/*!50001 DROP VIEW IF EXISTS `vnSolunionCAP`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `vnSolunionCAP` AS SELECT - 1 AS `creditInsurance`, - 1 AS `dateStart`, - 1 AS `dateEnd`, - 1 AS `dateLeaving` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `warehouse` -- @@ -84591,19 +83545,6 @@ SET character_set_client = utf8; 1 AS `hasConfectionTeam` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `warehouse_alias` --- - -DROP TABLE IF EXISTS `warehouse_alias`; -/*!50001 DROP VIEW IF EXISTS `warehouse_alias`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `warehouse_alias` AS SELECT - 1 AS `warehouse_alias_id`, - 1 AS `alias` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `warehouse_filtro` -- @@ -84738,20 +83679,6 @@ CREATE TABLE `wks` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `workcenter_holiday` --- - -DROP TABLE IF EXISTS `workcenter_holiday`; -/*!50001 DROP VIEW IF EXISTS `workcenter_holiday`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `workcenter_holiday` AS SELECT - 1 AS `workcenter_id`, - 1 AS `day`, - 1 AS `year` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `workerDocument` -- @@ -84781,21 +83708,6 @@ SET character_set_client = utf8; 1 AS `user` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `zoneNickname` --- - -DROP TABLE IF EXISTS `zoneNickname`; -/*!50001 DROP VIEW IF EXISTS `zoneNickname`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `zoneNickname` AS SELECT - 1 AS `warehouse_id`, - 1 AS `agency_id`, - 1 AS `zona`, - 1 AS `alias` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `zones` -- @@ -85865,14 +84777,12 @@ proc: BEGIN SET vDate2000 = util.VN_CURDATE() + INTERVAL (2000 - YEAR(util.VN_CURDATE())) YEAR; SET vRangeDeleteTicket = 60; - DELETE FROM Rutas_monitor WHERE fecha < vDate; DELETE FROM cdr WHERE calldate < vDate18; DELETE FROM Monitoring WHERE ODBC_TIME < vDate; DELETE FROM Conteo WHERE Fecha < vDate; DELETE FROM XDiario WHERE FECHA < vDate3 OR FECHA IS NULL; DELETE FROM mail WHERE DATE_ODBC < vDate; DELETE FROM expeditions_deleted WHERE odbc_date < vDate26; - DELETE FROM sms WHERE DATE_ODBC < vDate18; DELETE FROM Movimientos_mark WHERE odbc_date < vDate; DELETE FROM Splits WHERE Fecha < vDate18; @@ -85892,8 +84802,6 @@ proc: BEGIN JOIN Tickets t ON m.Id_Ticket = t.Id_Ticket WHERE t.Fecha < vDate; DELETE FROM Remesas WHERE `Fecha Remesa` < vDate18; - DELETE FROM sharingcart where datEND < vDate; - DELETE FROM sharingclient where datEND < vDate; DELETE tt.* FROM Tickets_turno tt @@ -86366,7 +85274,20 @@ BEGIN SELECT t.Id_Ticket, Alias, cast(amount as decimal(10,2)) Importe, Domicilio, POBLACION FROM Tickets t JOIN Consignatarios cs ON t.Id_Consigna = cs.Id_Consigna - JOIN v_ticket_amount v ON v.Id_Ticket = t.Id_Ticket + JOIN ( + SELECT `Movimientos`.`Id_Ticket` AS `Id_Ticket`, + sum( + `Movimientos`.`Cantidad` * `Movimientos`.`Preu` * (100 - `Movimientos`.`Descuento`) / 100 + ) AS `amount` + FROM ( + `vn2008`.`Movimientos` + JOIN `vn2008`.`Tickets` ON( + `Movimientos`.`Id_Ticket` = `Tickets`.`Id_Ticket` + ) + ) + WHERE `Tickets`.`Fecha` >= `util`.`VN_CURDATE`() + INTERVAL -6 MONTH + GROUP BY `Movimientos`.`Id_Ticket` + ) v ON v.Id_Ticket = t.Id_Ticket WHERE t.Fecha BETWEEN v_Date AND util.dayEnd(v_Date) AND t.Id_Cliente = v_Client_Id; @@ -89675,24 +88596,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `__coolerPathDetail` --- - -/*!50001 DROP VIEW IF EXISTS `__coolerPathDetail`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `__coolerPathDetail` AS select `c`.`cooler_path_detail_id` AS `id`,`c`.`cooler_path_id` AS `coolerPathFk`,`c`.`pasillo` AS `hallway` from `vn2008`.`cooler_path_detail` `c` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `agencyTerm` -- @@ -90228,7 +89131,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionPallet_Print` AS select `et2`.`description` AS `truck`,`t`.`routeFk` AS `routeFk`,`r`.`description` AS `zone`,count(`es`.`id`) AS `eti`,`ep`.`id` AS `palletFk`,`et`.`id` <=> `rm`.`expeditionTruckFk` AS `isMatch`,`t`.`warehouseFk` AS `warehouseFk`,if(`r`.`created` > `util`.`VN_CURDATE`() + interval 1 day,ucase(dayname(`r`.`created`)),NULL) AS `nombreDia` from (((((((`vn`.`expeditionTruck` `et` join `vn`.`expeditionPallet` `ep` on(`ep`.`truckFk` = `et`.`id`)) join `vn`.`expeditionScan` `es` on(`es`.`palletFk` = `ep`.`id`)) join `vn`.`expedition` `e` on(`e`.`id` = `es`.`expeditionFk`)) join `vn`.`ticket` `t` on(`t`.`id` = `e`.`ticketFk`)) join `vn`.`route` `r` on(`r`.`id` = `t`.`routeFk`)) left join `vn2008`.`Rutas_monitor` `rm` on(`rm`.`Id_Ruta` = `r`.`id`)) left join `vn`.`expeditionTruck` `et2` on(`et2`.`id` = `rm`.`expeditionTruckFk`)) group by `ep`.`id`,`t`.`routeFk` */; +/*!50001 VIEW `expeditionPallet_Print` AS select `et2`.`description` AS `truck`,`t`.`routeFk` AS `routeFk`,`r`.`description` AS `zone`,count(`es`.`id`) AS `eti`,`ep`.`id` AS `palletFk`,`et`.`id` <=> `rm`.`expeditionTruckFk` AS `isMatch`,`t`.`warehouseFk` AS `warehouseFk`,if(`r`.`created` > `util`.`VN_CURDATE`() + interval 1 day,ucase(dayname(`r`.`created`)),NULL) AS `nombreDia` from (((((((`expeditionTruck` `et` join `expeditionPallet` `ep` on(`ep`.`truckFk` = `et`.`id`)) join `expeditionScan` `es` on(`es`.`palletFk` = `ep`.`id`)) join `expedition` `e` on(`e`.`id` = `es`.`expeditionFk`)) join `ticket` `t` on(`t`.`id` = `e`.`ticketFk`)) join `route` `r` on(`r`.`id` = `t`.`routeFk`)) left join `routesMonitor` `rm` on(`rm`.`routeFk` = `r`.`id`)) left join `expeditionTruck` `et2` on(`et2`.`id` = `rm`.`expeditionTruckFk`)) group by `ep`.`id`,`t`.`routeFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -90660,7 +89563,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingAvailable` AS select `s`.`id` AS `saleFk`,`tst`.`updated` AS `Modificado`,`s`.`ticketFk` AS `ticketFk`,0 AS `isPicked`,`s`.`itemFk` AS `itemFk`,`s`.`quantity` AS `quantity`,`s`.`concept` AS `concept`,`i`.`size` AS `size`,`st`.`name` AS `Estado`,`st`.`sectorProdPriority` AS `sectorProdPriority`,`stock`.`visible` AS `available`,`stock`.`sectorFk` AS `sectorFk`,`stock`.`shelvingFk` AS `matricula`,`stock`.`parkingFk` AS `parking`,`stock`.`itemShelvingFk` AS `itemShelving`,`am`.`name` AS `Agency`,`t`.`shipped` AS `shipped`,`stock`.`grouping` AS `grouping`,`stock`.`packing` AS `packing`,`z`.`hour` AS `hour`,`st`.`isPreviousPreparable` AS `isPreviousPreparable`,`sv`.`physicalVolume` AS `physicalVolume`,`t`.`warehouseFk` AS `warehouseFk` from (((((((((`sale` `s` join `ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `agencyMode` `am` on(`am`.`id` = `t`.`agencyModeFk`)) join `ticketStateToday` `tst` on(`tst`.`ticket` = `t`.`id`)) join `state` `st` on(`st`.`id` = `tst`.`state`)) join `item` `i` on(`i`.`id` = `s`.`itemFk`)) join `itemShelvingStock` `stock` on(`stock`.`itemFk` = `i`.`id`)) left join `saleTracking` `stk` on(`stk`.`saleFk` = `s`.`id`)) left join `zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `saleVolume` `sv` on(`sv`.`saleFk` = `s`.`id`)) where `t`.`shipped` between `util`.`yesterday`() and `util`.`dayend`(`util`.`VN_CURDATE`()) and `stk`.`id` is null and `stock`.`visible` > 0 and `stk`.`saleFk` is null and `st`.`isPreviousPreparable` <> 0 */; +/*!50001 VIEW `itemShelvingAvailable` AS select `s`.`id` AS `saleFk`,`tst`.`updated` AS `Modificado`,`s`.`ticketFk` AS `ticketFk`,0 AS `isPicked`,`s`.`itemFk` AS `itemFk`,`s`.`quantity` AS `quantity`,`s`.`concept` AS `concept`,`i`.`size` AS `size`,`st`.`name` AS `Estado`,`st`.`sectorProdPriority` AS `sectorProdPriority`,`stock`.`visible` AS `available`,`stock`.`sectorFk` AS `sectorFk`,`stock`.`shelvingFk` AS `matricula`,`stock`.`parkingFk` AS `parking`,`stock`.`itemShelvingFk` AS `itemShelving`,`am`.`name` AS `Agency`,`t`.`shipped` AS `shipped`,`stock`.`grouping` AS `grouping`,`stock`.`packing` AS `packing`,`z`.`hour` AS `hour`,`st`.`isPreviousPreparable` AS `isPreviousPreparable`,`sv`.`physicalVolume` AS `physicalVolume`,`t`.`warehouseFk` AS `warehouseFk` from (((((((((`sale` `s` join `ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `agencyMode` `am` on(`am`.`id` = `t`.`agencyModeFk`)) join `ticketStateToday` `tst` on(`tst`.`ticketFk` = `t`.`id`)) join `state` `st` on(`st`.`id` = `tst`.`state`)) join `item` `i` on(`i`.`id` = `s`.`itemFk`)) join `itemShelvingStock` `stock` on(`stock`.`itemFk` = `i`.`id`)) left join `saleTracking` `stk` on(`stk`.`saleFk` = `s`.`id`)) left join `zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `saleVolume` `sv` on(`sv`.`saleFk` = `s`.`id`)) where `t`.`shipped` between `util`.`yesterday`() and `util`.`dayend`(`util`.`VN_CURDATE`()) and `stk`.`id` is null and `stock`.`visible` > 0 and `stk`.`saleFk` is null and `st`.`isPreviousPreparable` <> 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -91488,7 +90391,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketDownBuffer` AS select `td`.`ticketFk` AS `ticketFk`,`td`.`created` AS `created`,`td`.`selected` AS `selected`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `sacador`,`pk`.`code` AS `parking` from ((((`ticketDown` `td` join `ticketParking` `tp` on(`tp`.`ticketFk` = `td`.`ticketFk`)) join `parking` `pk` on(`pk`.`id` = `tp`.`parkingFk`)) join `ticketStateToday` `tst` on(`tst`.`ticket` = `td`.`ticketFk`)) join `worker` `w` on(`w`.`id` = `tst`.`worker`)) where `td`.`selected` = 2 */; +/*!50001 VIEW `ticketDownBuffer` AS select `td`.`ticketFk` AS `ticketFk`,`td`.`created` AS `created`,`td`.`selected` AS `selected`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `sacador`,`pk`.`code` AS `parking` from ((((`ticketDown` `td` join `ticketParking` `tp` on(`tp`.`ticketFk` = `td`.`ticketFk`)) join `parking` `pk` on(`pk`.`id` = `tp`.`parkingFk`)) join `ticketStateToday` `tst` on(`tst`.`ticketFk` = `td`.`ticketFk`)) join `worker` `w` on(`w`.`id` = `tst`.`userFk`)) where `td`.`selected` = 2 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -91632,7 +90535,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketStateToday` AS select `ts`.`ticketFk` AS `ticket`,`ts`.`state` AS `state`,`ts`.`productionOrder` AS `productionOrder`,`ts`.`alertLevel` AS `alertLevel`,`ts`.`userFk` AS `worker`,`ts`.`code` AS `code`,`ts`.`updated` AS `updated`,`ts`.`isPicked` AS `isPicked` from (`ticketState` `ts` join `ticket` `t` on(`t`.`id` = `ts`.`ticketFk`)) where `t`.`shipped` between `util`.`VN_CURDATE`() and `MIDNIGHT`(`util`.`VN_CURDATE`()) */; +/*!50001 VIEW `ticketStateToday` AS select `ts`.`ticketFk` AS `ticketFk`,`ts`.`state` AS `state`,`ts`.`productionOrder` AS `productionOrder`,`ts`.`alertLevel` AS `alertLevel`,`ts`.`userFk` AS `userFk`,`ts`.`code` AS `code`,`ts`.`updated` AS `updated`,`ts`.`isPicked` AS `isPicked` from (`ticketState` `ts` join `ticket` `t` on(`t`.`id` = `ts`.`ticketFk`)) where `t`.`shipped` between `util`.`VN_CURDATE`() and `MIDNIGHT`(`util`.`VN_CURDATE`()) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -92028,7 +90931,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `zoneEstimatedDelivery` AS select `t`.`zoneFk` AS `zoneFk`,`zc`.`hour` AS `zoneClosureHour`,`z`.`hour` AS `zoneHour`,`sv`.`volume` AS `volume`,`al`.`hasToRecalcPrice` AS `hasToRecalcPrice`,`lhp`.`m3` AS `m3`,`dl`.`minSpeed` AS `minSpeed` from ((((((((((`vn`.`ticket` `t` join `vn`.`ticketStateToday` `tst` on(`tst`.`ticket` = `t`.`id`)) join `vn`.`state` `s` on(`s`.`id` = `tst`.`state`)) join `vn`.`saleVolume` `sv` on(`sv`.`ticketFk` = `t`.`id`)) left join `vn`.`lastHourProduction` `lhp` on(`lhp`.`warehouseFk` = `t`.`warehouseFk`)) join `vn`.`warehouse` `w` on(`w`.`id` = `t`.`warehouseFk`)) join `vn`.`warehouseAlias` `wa` on(`wa`.`id` = `w`.`aliasFk`)) straight_join `vn`.`zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `vn`.`zoneClosure` `zc` on(`zc`.`zoneFk` = `t`.`zoneFk` and `zc`.`dated` = `util`.`VN_CURDATE`())) left join `cache`.`departure_limit` `dl` on(`dl`.`warehouse_id` = `t`.`warehouseFk` and `dl`.`fecha` = `util`.`VN_CURDATE`())) join `vn`.`alertLevel` `al` on(`al`.`id` = `s`.`alertLevel`)) where `w`.`hasProduction` <> 0 and cast(`t`.`shipped` as date) = `util`.`VN_CURDATE`() */; +/*!50001 VIEW `zoneEstimatedDelivery` AS select `t`.`zoneFk` AS `zoneFk`,`zc`.`hour` AS `zoneClosureHour`,`z`.`hour` AS `zoneHour`,`sv`.`volume` AS `volume`,`al`.`hasToRecalcPrice` AS `hasToRecalcPrice`,`lhp`.`m3` AS `m3`,`dl`.`minSpeed` AS `minSpeed` from ((((((((((`vn`.`ticket` `t` join `vn`.`ticketStateToday` `tst` on(`tst`.`ticketFk` = `t`.`id`)) join `vn`.`state` `s` on(`s`.`id` = `tst`.`state`)) join `vn`.`saleVolume` `sv` on(`sv`.`ticketFk` = `t`.`id`)) left join `vn`.`lastHourProduction` `lhp` on(`lhp`.`warehouseFk` = `t`.`warehouseFk`)) join `vn`.`warehouse` `w` on(`w`.`id` = `t`.`warehouseFk`)) join `vn`.`warehouseAlias` `wa` on(`wa`.`id` = `w`.`aliasFk`)) straight_join `vn`.`zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `vn`.`zoneClosure` `zc` on(`zc`.`zoneFk` = `t`.`zoneFk` and `zc`.`dated` = `util`.`VN_CURDATE`())) left join `cache`.`departure_limit` `dl` on(`dl`.`warehouse_id` = `t`.`warehouseFk` and `dl`.`fecha` = `util`.`VN_CURDATE`())) join `vn`.`alertLevel` `al` on(`al`.`id` = `s`.`alertLevel`)) where `w`.`hasProduction` <> 0 and cast(`t`.`shipped` as date) = `util`.`VN_CURDATE`() */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -92633,42 +91536,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `Rutas_Master` --- - -/*!50001 DROP VIEW IF EXISTS `Rutas_Master`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Rutas_Master` AS select `rm`.`id` AS `id`,`rm`.`warehouseFk` AS `warehouse_id`,`rm`.`km` AS `km`,`rm`.`packages` AS `bultos`,`rm`.`vehicleCost` AS `vehiculos_coste`,`rm`.`staffCost` AS `personal_coste`,`rm`.`vehicle` AS `vehiculos_numero`,`rm`.`staff` AS `personal_numero`,`rm`.`fuel` AS `gasoil`,`rm`.`freelancers` AS `autonomos`,`rm`.`year` AS `año`,`rm`.`month` AS `mes`,`rm`.`expense` AS `gastos`,`rm`.`freelancersPackages` AS `bultos_autonomos`,`rm`.`kmCost` AS `coste_km`,`rm`.`packageCost` AS `coste_bulto`,`rm`.`freelancerPackageCost` AS `coste_bulto_autonomo`,`rm`.`created` AS `odbc_date` from `vn`.`routeMaster` `rm` */; -/*!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 `Rutas_monitor` --- - -/*!50001 DROP VIEW IF EXISTS `Rutas_monitor`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Rutas_monitor` AS select `vn`.`routesMonitor`.`routeFk` AS `Id_Ruta`,`vn`.`routesMonitor`.`name` AS `name`,`vn`.`routesMonitor`.`beachFk` AS `Ubicacion`,`vn`.`routesMonitor`.`ticketPacked` AS `pedidosEncajados`,`vn`.`routesMonitor`.`ticketFree` AS `pedidosLibres`,`vn`.`routesMonitor`.`ticketProduction` AS `pedidosProduccion`,`vn`.`routesMonitor`.`packages` AS `bultos`,`vn`.`routesMonitor`.`note` AS `notas`,`vn`.`routesMonitor`.`dated` AS `fecha`,`vn`.`routesMonitor`.`dockFk` AS `dockFk`,`vn`.`routesMonitor`.`m3` AS `m3`,`vn`.`routesMonitor`.`priority` AS `priority`,`vn`.`routesMonitor`.`etd` AS `etd`,`vn`.`routesMonitor`.`expeditionTruckFk` AS `expeditionTruckFk` from `vn`.`routesMonitor` */; -/*!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 `Tickets` -- @@ -92813,42 +91680,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `VerEspionaje` --- - -/*!50001 DROP VIEW IF EXISTS `VerEspionaje`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `VerEspionaje` AS select `Trabajadores`.`CodigoTrabajador` AS `CodigoTrabajador`,`vn2008`.`Espionajes`.`Fecha` AS `Fecha`,`vn2008`.`Espionajes`.`HoraEntrada` AS `HoraEntrada`,`vn2008`.`Espionajes`.`HoraSalida` AS `HoraSalida`,`vn2008`.`Espionajes`.`Id_Equipo` AS `Id_Equipo`,`Trabajadores`.`Id_Trabajador` AS `Id_Trabajador` from (`vn2008`.`Espionajes` join `vn2008`.`Trabajadores` on(`vn2008`.`Espionajes`.`Id_Trabajador` = `Trabajadores`.`Id_Trabajador`)) order by `Trabajadores`.`CodigoTrabajador`,`vn2008`.`Espionajes`.`Fecha` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `Vistas` --- - -/*!50001 DROP VIEW IF EXISTS `Vistas`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Vistas` AS select `dm`.`id` AS `vista_id`,`dm`.`code` AS `code`,`dm`.`description` AS `vista` from `vn`.`deliveryMethod` `dm` */; -/*!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 `XDiario` -- @@ -93209,96 +92040,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `client_observation` --- - -/*!50001 DROP VIEW IF EXISTS `client_observation`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `client_observation` AS select `co`.`id` AS `client_observation_id`,`co`.`clientFk` AS `Id_Cliente`,`co`.`workerFk` AS `Id_Trabajador`,`co`.`text` AS `text`,`co`.`created` AS `odbc_date` from `vn`.`clientObservation` `co` */; -/*!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 `clientes_gestdoc` --- - -/*!50001 DROP VIEW IF EXISTS `clientes_gestdoc`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientes_gestdoc` AS select `cd`.`clientFk` AS `Id_Cliente`,`cd`.`dmsFk` AS `gest_doc_id` from `vn`.`clientDms` `cd` */; -/*!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 `clientes_regalos_enc` --- - -/*!50001 DROP VIEW IF EXISTS `clientes_regalos_enc`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientes_regalos_enc` AS select `cpg`.`clientFk` AS `Id_Cliente`,`cpg`.`giftFk` AS `Id_Regalo`,`cpg`.`added` AS `odbc_date` from `vn`.`clientPackagingGifts` `cpg` */; -/*!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 `clientes_regalos_lista_enc` --- - -/*!50001 DROP VIEW IF EXISTS `clientes_regalos_lista_enc`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientes_regalos_lista_enc` AS select `pg`.`id` AS `Id_Regalo`,`pg`.`description` AS `Descripcion`,`pg`.`photo` AS `foto`,if(`util`.`VN_CURDATE`() between `pg`.`started` and `pg`.`ended`,1,0) AS `activo`,`pg`.`started` AS `datstart`,`pg`.`ended` AS `datend`,ifnull(`pg`.`warehouseFk`,0) AS `warehouse_id`,ifnull(`pg`.`provinceFk`,0) AS `province_id`,ifnull(`pg`.`countryFk`,0) AS `countryFk` from `vn`.`packagingGifts` `pg` */; -/*!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 `clientes_tipo` --- - -/*!50001 DROP VIEW IF EXISTS `clientes_tipo`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientes_tipo` AS select `ct`.`id` AS `clientes_tipo_id`,`ct`.`code` AS `code`,`ct`.`type` AS `tipo`,`ct`.`isCreatedAsServed` AS `isCreatedAsServed` from `vn`.`clientType` `ct` */; -/*!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 `config_host` -- @@ -93335,42 +92076,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `cooler_path_detail` --- - -/*!50001 DROP VIEW IF EXISTS `cooler_path_detail`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `cooler_path_detail` AS select `cpd`.`id` AS `cooler_path_detail_id`,`cpd`.`coolerPathFk` AS `cooler_path_id`,`cpd`.`hallway` AS `pasillo` from `vn`.`coolerPathDetail` `cpd` */; -/*!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 `credit` --- - -/*!50001 DROP VIEW IF EXISTS `credit`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `credit` AS select `c`.`id` AS `id`,`c`.`clientFk` AS `Id_Cliente`,`c`.`workerFk` AS `Id_Trabajador`,`c`.`amount` AS `amount`,`c`.`created` AS `odbc_date` from `vn`.`clientCredit` `c` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `deliveryPoint` -- @@ -93677,24 +92382,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `escritos_det` --- - -/*!50001 DROP VIEW IF EXISTS `escritos_det`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `escritos_det` AS select `cs`.`id` AS `id`,`cs`.`clientFk` AS `Id_Cliente`,`cs`.`typeFk` AS `escritos_id`,`cs`.`created` AS `fecha`,`cs`.`workerFk` AS `Id_Trabajador`,`cs`.`userFk` AS `userFk`,`cs`.`companyFk` AS `empresa_id`,`cs`.`balance` AS `saldo` from `vn`.`clientSample` `cs` */; -/*!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 `expeditions` -- @@ -93857,78 +92544,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `iva_codigo` --- - -/*!50001 DROP VIEW IF EXISTS `iva_codigo`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `iva_codigo` AS select `tc`.`id` AS `id`,`tc`.`dated` AS `fecha`,`tc`.`code` AS `codigo`,`tc`.`taxTypeFk` AS `iva_tipo_id`,`tc`.`rate` AS `iva`,`tc`.`equalizationTax` AS `recargo`,`tc`.`type` AS `tipo`,`tc`.`link` AS `link`,`tc`.`isActive` AS `isActive`,`tc`.`updated` AS `updated`,`tc`.`transactionCode` AS `transactionCode` from `vn`.`taxCode` `tc` */; -/*!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 `iva_group` --- - -/*!50001 DROP VIEW IF EXISTS `iva_group`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `iva_group` AS select `tc`.`id` AS `iva_group_id`,`tc`.`description` AS `description`,`tc`.`code` AS `code` from `vn`.`taxClass` `tc` */; -/*!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 `iva_group_codigo` --- - -/*!50001 DROP VIEW IF EXISTS `iva_group_codigo`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `iva_group_codigo` AS select `tcc`.`taxClassFk` AS `iva_group_id`,`tcc`.`effectived` AS `date`,`tcc`.`taxCodeFk` AS `iva_codigo_id` from `vn`.`taxClassCode` `tcc` */; -/*!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 `iva_tipo` --- - -/*!50001 DROP VIEW IF EXISTS `iva_tipo`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `iva_tipo` AS select `tt`.`id` AS `id`,`tt`.`nickname` AS `alias`,`tt`.`isAccrued` AS `isAccrued`,`tt`.`serial` AS `serie_id`,`tt`.`TIPOOPE` AS `TIPOOPE`,`tt`.`description` AS `descripcion`,`tt`.`countryFk` AS `Id_Pais` from `vn`.`taxType` `tt` */; -/*!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 `mail` -- @@ -93983,96 +92598,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `observation_type` --- - -/*!50001 DROP VIEW IF EXISTS `observation_type`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `observation_type` AS select `co`.`id` AS `observation_type_id`,`co`.`description` AS `description` from `vn`.`observationType` `co` */; -/*!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 `order` --- - -/*!50001 DROP VIEW IF EXISTS `order`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `order` AS select `hedera`.`order`.`id` AS `id`,`hedera`.`order`.`date_make` AS `date_make`,`hedera`.`order`.`date_send` AS `date_send`,`hedera`.`order`.`customer_id` AS `customer_id`,`hedera`.`order`.`delivery_method_id` AS `delivery_method_id`,`hedera`.`order`.`agency_id` AS `agency_id`,`hedera`.`order`.`address_id` AS `address_id`,`hedera`.`order`.`note` AS `note`,`hedera`.`order`.`confirmed` AS `confirmed`,`hedera`.`order`.`is_bionic` AS `is_bionic`,`hedera`.`order`.`source_app` AS `source_app` from `hedera`.`order` */; -/*!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 `order_Tickets` --- - -/*!50001 DROP VIEW IF EXISTS `order_Tickets`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `order_Tickets` AS select `ot`.`orderFk` AS `order_id`,`ot`.`ticketFk` AS `Id_Ticket` from `vn`.`orderTicket` `ot` */; -/*!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 `order_component` --- - -/*!50001 DROP VIEW IF EXISTS `order_component`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `order_component` AS select `c`.`order_row_id` AS `order_row_id`,`c`.`component_id` AS `component_id`,`c`.`price` AS `price` from `hedera`.`order_component` `c` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `order_row` --- - -/*!50001 DROP VIEW IF EXISTS `order_row`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `order_row` AS select `order_row`.`id` AS `id`,`order_row`.`order_id` AS `order_id`,`order_row`.`item_id` AS `item_id`,`order_row`.`warehouse_id` AS `warehouse_id`,`order_row`.`shipment` AS `shipment`,`order_row`.`amount` AS `amount`,`order_row`.`price` AS `price`,`order_row`.`rate` AS `rate`,`order_row`.`created` AS `created`,`order_row`.`Id_Movimiento` AS `Id_Movimiento` from `hedera`.`order_row` */; -/*!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 `pago` -- @@ -94451,60 +92976,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `sharingcart` --- - -/*!50001 DROP VIEW IF EXISTS `sharingcart`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `sharingcart` AS select `sc`.`id` AS `id`,`sc`.`workerFk` AS `Id_Trabajador`,`sc`.`started` AS `datSTART`,`sc`.`ended` AS `datEND`,`sc`.`workerSubstitute` AS `Id_Suplente`,`sc`.`created` AS `odbc_date` from `vn`.`sharingCart` `sc` */; -/*!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 `sharingclient` --- - -/*!50001 DROP VIEW IF EXISTS `sharingclient`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `sharingclient` AS select `sc`.`id` AS `id`,`sc`.`workerFk` AS `Id_Trabajador`,`sc`.`started` AS `datSTART`,`sc`.`ended` AS `datEND`,`sc`.`clientFk` AS `Id_Cliente` from `vn`.`sharingClient` `sc` */; -/*!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 `sms` --- - -/*!50001 DROP VIEW IF EXISTS `sms`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `sms` AS select `t`.`id` AS `id`,`t`.`senderFk` AS `Id_trabajador`,`t`.`sender` AS `from`,`t`.`destination` AS `to`,`t`.`message` AS `text`,`t`.`statusCode` AS `sent`,`t`.`status` AS `response`,`t`.`created` AS `DATE_ODBC` from `vn`.`sms` `t` */; -/*!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 `state` -- @@ -94577,24 +93048,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `tarifas` --- - -/*!50001 DROP VIEW IF EXISTS `tarifas`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `tarifas` AS select `r`.`id` AS `tarifa_id`,`r`.`dated` AS `fecha`,`r`.`warehouseFk` AS `warehouse_id`,`r`.`rate0` AS `t0`,`r`.`rate1` AS `t1`,`r`.`rate2` AS `t2`,`r`.`rate3` AS `t3` from `vn`.`rate` `r` */; -/*!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 `tblContadores` -- @@ -94631,42 +93084,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `ticketCreationData` --- - -/*!50001 DROP VIEW IF EXISTS `ticketCreationData`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketCreationData` AS select dayname(`h`.`confirm_date`) AS `DiadelaSemana`,hour(`h`.`confirm_date`) AS `Hora`,cast(`h`.`confirm_date` as date) AS `Fecha`,`h`.`source_app` AS `Dispositivo` from `hedera`.`order` `h` where `h`.`confirm_date` <> 0 */; -/*!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 `ticketMRW` --- - -/*!50001 DROP VIEW IF EXISTS `ticketMRW`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketMRW` AS select `Tickets`.`Id_Agencia` AS `id_Agencia`,`Tickets`.`empresa_id` AS `empresa_id`,`Consignatarios`.`consignatario` AS `Consignatario`,`Consignatarios`.`domicilio` AS `DOMICILIO`,`Consignatarios`.`poblacion` AS `POBLACION`,`Consignatarios`.`codPostal` AS `CODPOSTAL`,`Consignatarios`.`telefono` AS `telefono`,`Consignatarios`.`movil` AS `movil`,`Clientes`.`if` AS `IF`,`Tickets`.`Id_Ticket` AS `Id_Ticket`,`Tickets`.`warehouse_id` AS `warehouse_id`,`Consignatarios`.`id_consigna` AS `Id_Consigna`,`Paises`.`Codigo` AS `CodigoPais`,`Tickets`.`Fecha` AS `Fecha`,`province`.`province_id` AS `province_id`,`Tickets`.`landing` AS `landing` from ((((`vn2008`.`Clientes` join `vn2008`.`Consignatarios` on(`Clientes`.`id_cliente` = `Consignatarios`.`Id_cliente`)) join `vn2008`.`Tickets` on(`Consignatarios`.`id_consigna` = `Tickets`.`Id_Consigna`)) join `vn2008`.`province` on(`Consignatarios`.`province_id` = `province`.`province_id`)) join `vn2008`.`Paises` on(`province`.`Paises_Id` = `Paises`.`Id`)) */; -/*!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 `ticket_observation` -- @@ -94721,24 +93138,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `tr2` --- - -/*!50001 DROP VIEW IF EXISTS `tr2`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `tr2` AS select `vn`.`travel`.`id` AS `id`,`vn`.`travel`.`shipped` AS `shipped`,`vn`.`travel`.`shipmentHour` AS `shipmentHour`,`vn`.`travel`.`landed` AS `landed`,`vn`.`travel`.`landingHour` AS `landingHour`,`vn`.`travel`.`warehouseInFk` AS `warehouseInFk`,`vn`.`travel`.`warehouseOutFk` AS `warehouseOutFk`,`vn`.`travel`.`agencyModeFk` AS `agencyFk`,`vn`.`travel`.`ref` AS `ref`,`vn`.`travel`.`isDelivered` AS `isDelivered`,`vn`.`travel`.`isReceived` AS `isReceived`,`vn`.`travel`.`m3` AS `m3`,`vn`.`travel`.`kg` AS `kg`,`vn`.`travel`.`cargoSupplierFk` AS `cargoSupplierFk`,`vn`.`travel`.`totalEntries` AS `totalEntries` from `vn`.`travel` */; -/*!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 `travel` -- @@ -94757,24 +93156,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `travel_thermograph` --- - -/*!50001 DROP VIEW IF EXISTS `travel_thermograph`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `travel_thermograph` AS select `tt`.`thermographFk` AS `thermograph_id`,`tt`.`created` AS `odbc_date`,`tt`.`warehouseFk` AS `warehouse_id`,`tt`.`travelFk` AS `travel_id`,`tt`.`temperatureFk` AS `temperature`,`tt`.`result` AS `result`,`tt`.`dmsFk` AS `gestdoc_id` from `vn`.`travelThermograph` `tt` */; -/*!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_Articles_botanical` -- @@ -94793,60 +93174,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `v_account` --- - -/*!50001 DROP VIEW IF EXISTS `v_account`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_account` AS select `a`.`id` AS `user_id` from `account`.`account` `a` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_analisis_ventas` --- - -/*!50001 DROP VIEW IF EXISTS `v_analisis_ventas`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_analisis_ventas` AS select `bi`.`analisis_ventas`.`Familia` AS `Familia`,`bi`.`analisis_ventas`.`Reino` AS `Reino`,`bi`.`analisis_ventas`.`Comercial` AS `Comercial`,`bi`.`analisis_ventas`.`Comprador` AS `Comprador`,`bi`.`analisis_ventas`.`Provincia` AS `Provincia`,`bi`.`analisis_ventas`.`almacen` AS `almacen`,`bi`.`analisis_ventas`.`Año` AS `Año`,`bi`.`analisis_ventas`.`Mes` AS `Mes`,`bi`.`analisis_ventas`.`Semana` AS `Semana`,`bi`.`analisis_ventas`.`Vista` AS `Vista`,`bi`.`analisis_ventas`.`Importe` AS `Importe` from `bi`.`analisis_ventas` */; -/*!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_barcodes` --- - -/*!50001 DROP VIEW IF EXISTS `v_barcodes`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_barcodes` AS select `Articles`.`Id_Article` AS `code`,`Articles`.`Id_Article` AS `Id_Article` from `vn2008`.`Articles` union all select `barcodes`.`code` AS `code`,`barcodes`.`Id_Article` AS `Id_Article` from `vn2008`.`barcodes` union all select `c`.`Id_Compra` AS `Id_Compra`,`c`.`Id_Article` AS `Id_Article` from ((`vn2008`.`Compres` `c` join `vn2008`.`Entradas` `e` on(`c`.`Id_Entrada` = `e`.`Id_Entrada`)) join `vn2008`.`travel` `tr` on(`tr`.`id` = `e`.`travel_id`)) where `tr`.`landing` >= `util`.`VN_CURDATE`() + interval -15 day */; -/*!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_compres` -- @@ -94865,42 +93192,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `v_departure_limit` --- - -/*!50001 DROP VIEW IF EXISTS `v_departure_limit`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_departure_limit` AS select `cache`.`departure_limit`.`warehouse_id` AS `warehouse_id`,`cache`.`departure_limit`.`fecha` AS `fecha`,`cache`.`departure_limit`.`hora` AS `hora`,`cache`.`departure_limit`.`minSpeed` AS `minSpeed` from `cache`.`departure_limit` */; -/*!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_descuadre_bionic` --- - -/*!50001 DROP VIEW IF EXISTS `v_descuadre_bionic`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_descuadre_bionic` AS select `t`.`Id_Ticket` AS `Id_Ticket`,`t`.`Alias` AS `Alias`,`m`.`Concepte` AS `Concepte`,sum(`mc`.`Valor`) AS `suma_componente`,`m`.`Preu` AS `Preu`,`m`.`Descuento` AS `Descuento`,`m`.`Preu` * (100 - `m`.`Descuento`) / 100 - sum(`mc`.`Valor`) AS `diferencia`,`t`.`Fecha` AS `Fecha`,`m`.`Preu` > 0 and `tp`.`reino_id` <> 6 and `a`.`tipo_id` not in (7,115) AS `benvenut` from ((((((`vn2008`.`Movimientos` `m` join `vn2008`.`Tickets` `t` on(`m`.`Id_Ticket` = `t`.`Id_Ticket`)) join `vn2008`.`Clientes` `c` on(`t`.`Id_Cliente` = `c`.`id_cliente`)) join `vn2008`.`warehouse` `w` on(`w`.`id` = `t`.`warehouse_id`)) join `vn2008`.`Articles` `a` on(`m`.`Id_Article` = `a`.`Id_Article`)) join `vn2008`.`Tipos` `tp` on(`a`.`tipo_id` = `tp`.`tipo_id`)) left join `vn2008`.`Movimientos_componentes` `mc` on(`m`.`Id_Movimiento` = `mc`.`Id_Movimiento`)) where `t`.`Fecha` >= '2015-09-01' and `t`.`empresa_id` in (442,791,567) and `w`.`reserve` <> 0 and `c`.`real` <> 0 and `tp`.`reino_id` <> 6 group by `m`.`Id_Movimiento` having abs(`diferencia`) > 0.01 or `diferencia` is null */; -/*!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` -- @@ -94919,24 +93210,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `v_inter` --- - -/*!50001 DROP VIEW IF EXISTS `v_inter`*/; -/*!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 = utf8mb3 */; -/*!50001 SET character_set_results = utf8mb3 */; -/*!50001 SET collation_connection = utf8mb3_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_inter` AS select `tt`.`id` AS `inter_id`,`tt`.`stateFk` AS `state_id`,`tt`.`notes` AS `nota`,`tt`.`created` AS `odbc_date`,`tt`.`ticketFk` AS `Id_Ticket`,`tt`.`userFk` AS `Id_Trabajador`,`tt`.`supervisorFk` AS `Id_supervisor` from `vn`.`ticketTracking` `tt` */; -/*!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_jerarquia` -- @@ -94955,78 +93228,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `v_miriam` --- - -/*!50001 DROP VIEW IF EXISTS `v_miriam`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_miriam` AS select `M`.`Id_Article` AS `Id_Article`,`M`.`Concepte` AS `Concepte`,`M`.`Cantidad` AS `Cantidad`,`M`.`Preu` AS `Preu`,`M`.`Descuento` AS `Descuento`,`T`.`Fecha` AS `Fecha`,`T`.`Id_Cliente` AS `Id_Cliente`,`M`.`Cantidad` * `M`.`Preu` * (100 - `M`.`Descuento`) / 100 AS `Importe` from (((`vn2008`.`Tickets` `T` join `vn2008`.`Movimientos` `M` on(`T`.`Id_Ticket` = `M`.`Id_Ticket`)) join `vn2008`.`Articles` `A` on(`M`.`Id_Article` = `A`.`Id_Article`)) join `vn2008`.`Tipos` `TP` on(`A`.`tipo_id` = `TP`.`tipo_id`)) where `T`.`Fecha` >= '2011-01-01' and `A`.`tipo_id` = 7 */; -/*!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_price_fixed` --- - -/*!50001 DROP VIEW IF EXISTS `v_price_fixed`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_price_fixed` AS select `pf`.`warehouse_id` AS `warehouse_id`,`pf`.`item_id` AS `item_id`,`pf`.`rate_0` AS `rate_0`,`pf`.`rate_1` AS `rate_1`,`pf`.`rate_2` AS `rate_2`,`pf`.`rate_3` AS `rate_3`,`pf`.`date_start` AS `date_start`,`pf`.`date_end` AS `date_end`,`pf`.`bonus` AS `bonus`,`pf`.`grouping` AS `grouping`,`pf`.`Packing` AS `Packing`,`pf`.`caja` AS `caja` from `vn2008`.`price_fixed` `pf` where `pf`.`warehouse_id` < 1000 union all select `wg`.`warehouse_id` AS `warehouse_id`,`pf`.`item_id` AS `item_id`,`pf`.`rate_0` AS `rate_0`,`pf`.`rate_1` AS `rate_1`,`pf`.`rate_2` AS `rate_2`,`pf`.`rate_3` AS `rate_3`,`pf`.`date_start` AS `date_start`,`pf`.`date_end` AS `date_end`,`pf`.`bonus` AS `bonus`,`pf`.`grouping` AS `grouping`,`pf`.`Packing` AS `Packing`,`pf`.`caja` AS `caja` from (`vn2008`.`price_fixed` `pf` join `vn2008`.`warehouse_group` `wg`) where `wg`.`warehouse_alias_id` + 1000 = `pf`.`warehouse_id` */; -/*!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_price_fixed_group` --- - -/*!50001 DROP VIEW IF EXISTS `v_price_fixed_group`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_price_fixed_group` AS select `pf`.`warehouse_id` AS `warehouse_id`,`pf`.`item_id` AS `item_id`,`pf`.`rate_0` AS `rate_0`,`pf`.`rate_1` AS `rate_1`,`pf`.`rate_2` AS `rate_2`,`pf`.`rate_3` AS `rate_3`,`pf`.`date_start` AS `date_start`,`pf`.`date_end` AS `date_end`,`pf`.`bonus` AS `bonus`,`pf`.`grouping` AS `grouping`,`pf`.`Packing` AS `Packing`,`pf`.`caja` AS `caja` from `vn2008`.`v_price_fixed` `pf` group by `pf`.`warehouse_id`,`pf`.`item_id`,`pf`.`date_start`,`pf`.`date_end` */; -/*!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_ticket_amount` --- - -/*!50001 DROP VIEW IF EXISTS `v_ticket_amount`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_ticket_amount` AS select `Movimientos`.`Id_Ticket` AS `Id_Ticket`,sum(`Movimientos`.`Cantidad` * `Movimientos`.`Preu` * (100 - `Movimientos`.`Descuento`) / 100) AS `amount` from (`vn2008`.`Movimientos` join `vn2008`.`Tickets` on(`Movimientos`.`Id_Ticket` = `Tickets`.`Id_Ticket`)) where `Tickets`.`Fecha` >= `util`.`VN_CURDATE`() + interval -6 month group by `Movimientos`.`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_ventes` -- @@ -95045,42 +93246,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `v_warehouse` --- - -/*!50001 DROP VIEW IF EXISTS `v_warehouse`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_warehouse` AS select `warehouse`.`id` AS `id`,`warehouse`.`name` AS `almacen` from `vn2008`.`warehouse` union all select 1000 + `warehouse_alias`.`warehouse_alias_id` AS `warehouse_alias_id`,concat(`warehouse_alias`.`alias`,'(G)') AS `concat(alias, '(G)')` from `vn2008`.`warehouse_alias` */; -/*!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_xsubclien` --- - -/*!50001 DROP VIEW IF EXISTS `v_xsubclien`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_xsubclien` AS select distinct `Facturas`.`Id_Cliente` AS `Id_Cliente`,`Facturas`.`empresa_id` AS `empresa_id` from `vn2008`.`Facturas` where `Facturas`.`Fecha` > `util`.`VN_CURDATE`() + interval -2 month union select `Recibos`.`Id_Cliente` AS `Id_Cliente`,`Recibos`.`empresa_id` AS `empresa_id` from `vn2008`.`Recibos` where `Recibos`.`Fechacobro` > `util`.`VN_CURDATE`() + interval -2 month */; -/*!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_xsubcuentas` -- @@ -95094,25 +93259,7 @@ USE `vn2008`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_xsubcuentas` AS select `Clientes`.`Cuenta` AS `COD`,`Clientes`.`razonSocial` AS `TITULO`,concat(if(`p`.`CEE` = 1 and ascii(left(`Clientes`.`if`,1)) < 58,`p`.`Codigo`,''),`Clientes`.`if`) AS `NIF`,`Clientes`.`domicilio` AS `DOMICILIO`,`Clientes`.`poblacion` AS `POBLACION`,`province`.`name` AS `PROVINCIA`,`Clientes`.`codPostal` AS `CODPOSTAL`,`p`.`Codigo` AS `country_code`,`v_xsubclien`.`empresa_id` AS `empresa_id`,substr(`Clientes`.`e-mail`,1,coalesce(nullif(locate(',',`Clientes`.`e-mail`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0 or `p`.`CEE` = 1 and `Clientes`.`vies` = 0,1,if(`p`.`CEE` = 1 and `Clientes`.`vies` <> 0,2,4)) AS `IDNIF` from (((`vn2008`.`Clientes` join `vn2008`.`v_xsubclien` on(`Clientes`.`id_cliente` = `v_xsubclien`.`Id_Cliente`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Clientes`.`Id_Pais`)) join `vn2008`.`province` on(`Clientes`.`province_id` = `province`.`province_id`)) group by `Clientes`.`id_cliente`,`v_xsubclien`.`empresa_id` union all select `Proveedores`.`cuenta` AS `Cuenta`,`Proveedores`.`Proveedor` AS `Proveedor`,concat(if(`p`.`CEE` = 1 and ascii(left(`Proveedores`.`NIF`,1)) < 58,`p`.`Codigo`,''),`Proveedores`.`NIF`) AS `NIF`,`Proveedores`.`Domicilio` AS `Domicilio`,`Proveedores`.`Localidad` AS `Localidad`,`prov`.`name` AS `Provincia`,`Proveedores`.`codpos` AS `CP`,`p`.`Codigo` AS `country_code`,`v_xsubprov`.`empresa_id` AS `empresa_id`,substr(`c`.`email`,1,coalesce(nullif(locate(',',`c`.`email`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0,1,if(`p`.`CEE` = 1,2,4)) AS `IDNIF` from ((((`vn2008`.`Proveedores` join `vn2008`.`v_xsubprov` on(`Proveedores`.`Id_Proveedor` = `v_xsubprov`.`proveedor_id`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Proveedores`.`pais_id`)) left join `vn2008`.`province` `prov` on(`prov`.`province_id` = `Proveedores`.`province_id`)) left join `vn`.`supplierContact` `c` on(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`)) where `Proveedores`.`oficial` <> 0 group by `v_xsubprov`.`proveedor_id`,`v_xsubprov`.`empresa_id` union all select `Gastos`.`Id_Gasto` collate utf8mb3_unicode_ci AS `Id_Gasto`,`Gastos`.`Gasto` collate utf8mb3_unicode_ci AS `Gasto`,NULL AS `NULL`,NULL AS `My_exp_NULL`,NULL AS `My_exp_1_NULL`,NULL AS `My_exp_2_NULL`,NULL AS `My_exp_3_NULL`,NULL AS `country_code`,`e`.`id` AS `id`,NULL AS `EMAIL`,1 AS `IDNIF` from (`vn2008`.`Gastos` join `vn2008`.`empresa` `e` on(`e`.`id` = 442)) union all select `Bancos`.`Cuenta` AS `Cuenta`,`Bancos`.`Banco` AS `Banco`,NULL AS `NULL`,NULL AS `My_exp_NULL`,NULL AS `My_exp_1_NULL`,NULL AS `My_exp_2_NULL`,NULL AS `My_exp_3_NULL`,NULL AS `country_code`,`e`.`id` AS `id`,NULL AS `EMAIL`,1 AS `IDNIF` from (`vn2008`.`Bancos` join `vn2008`.`empresa` `e` on(`e`.`id` = 442)) union all select lpad(right(`Proveedores`.`cuenta`,5),10,'47510000') AS `Cuenta`,`Proveedores`.`Proveedor` AS `Proveedor`,`Proveedores`.`NIF` AS `NIF`,`Proveedores`.`Domicilio` AS `Domicilio`,`Proveedores`.`Localidad` AS `Localidad`,`prov`.`name` AS `Provincia`,`Proveedores`.`codpos` AS `CP`,`p`.`Codigo` AS `country_code`,`v_xsubprov`.`empresa_id` AS `empresa_id`,substr(`c`.`email`,1,coalesce(nullif(locate(',',`c`.`email`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0,1,if(`p`.`CEE` = 1,2,4)) AS `IDNIF` from ((((`vn2008`.`Proveedores` join `vn2008`.`v_xsubprov` on(`Proveedores`.`Id_Proveedor` = `v_xsubprov`.`proveedor_id`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Proveedores`.`pais_id`)) left join `vn2008`.`province` `prov` on(`prov`.`province_id` = `Proveedores`.`province_id`)) left join `vn`.`supplierContact` `c` on(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`)) where (`Proveedores`.`cuenta` like '_____3____' or `Proveedores`.`cuenta` like '_____2____') and `Proveedores`.`oficial` = 1 group by `v_xsubprov`.`proveedor_id`,`v_xsubprov`.`empresa_id` */; -/*!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_xsubprov` --- - -/*!50001 DROP VIEW IF EXISTS `v_xsubprov`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_xsubprov` AS select `recibida`.`proveedor_id` AS `proveedor_id`,`recibida`.`empresa_id` AS `empresa_id` from `vn2008`.`recibida` where `recibida`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `recibida`.`proveedor_id`,`recibida`.`empresa_id` union all select `pago`.`id_proveedor` AS `id_proveedor`,`pago`.`empresa_id` AS `empresa_id` from `vn2008`.`pago` where `pago`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `pago`.`id_proveedor`,`pago`.`empresa_id` */; +/*!50001 VIEW `v_xsubcuentas` AS select `Clientes`.`Cuenta` AS `COD`,`Clientes`.`razonSocial` AS `TITULO`,concat(if(`p`.`CEE` = 1 and ascii(left(`Clientes`.`if`,1)) < 58,`p`.`Codigo`,''),`Clientes`.`if`) AS `NIF`,`Clientes`.`domicilio` AS `DOMICILIO`,`Clientes`.`poblacion` AS `POBLACION`,`province`.`name` AS `PROVINCIA`,`Clientes`.`codPostal` AS `CODPOSTAL`,`p`.`Codigo` AS `country_code`,`sub`.`empresa_id` AS `empresa_id`,substr(`Clientes`.`e-mail`,1,coalesce(nullif(locate(',',`Clientes`.`e-mail`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0 or `p`.`CEE` = 1 and `Clientes`.`vies` = 0,1,if(`p`.`CEE` = 1 and `Clientes`.`vies` <> 0,2,4)) AS `IDNIF` from (((`vn2008`.`Clientes` join (select distinct `Facturas`.`Id_Cliente` AS `Id_Cliente`,`Facturas`.`empresa_id` AS `empresa_id` from `vn2008`.`Facturas` where `Facturas`.`Fecha` > `util`.`VN_CURDATE`() + interval -2 month union select `Recibos`.`Id_Cliente` AS `Id_Cliente`,`Recibos`.`empresa_id` AS `empresa_id` from `vn2008`.`Recibos` where `Recibos`.`Fechacobro` > `util`.`VN_CURDATE`() + interval -2 month) `sub` on(`Clientes`.`id_cliente` = `sub`.`Id_Cliente`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Clientes`.`Id_Pais`)) join `vn2008`.`province` on(`Clientes`.`province_id` = `province`.`province_id`)) group by `Clientes`.`id_cliente`,`sub`.`empresa_id` union all select `Proveedores`.`cuenta` AS `Cuenta`,`Proveedores`.`Proveedor` AS `Proveedor`,concat(if(`p`.`CEE` = 1 and ascii(left(`Proveedores`.`NIF`,1)) < 58,`p`.`Codigo`,''),`Proveedores`.`NIF`) AS `NIF`,`Proveedores`.`Domicilio` AS `Domicilio`,`Proveedores`.`Localidad` AS `Localidad`,`prov`.`name` AS `Provincia`,`Proveedores`.`codpos` AS `CP`,`p`.`Codigo` AS `country_code`,`sub`.`empresa_id` AS `empresa_id`,substr(`c`.`email`,1,coalesce(nullif(locate(',',`c`.`email`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0,1,if(`p`.`CEE` = 1,2,4)) AS `IDNIF` from ((((`vn2008`.`Proveedores` join (select `recibida`.`proveedor_id` AS `proveedor_id`,`recibida`.`empresa_id` AS `empresa_id` from `vn2008`.`recibida` where `recibida`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `recibida`.`proveedor_id`,`recibida`.`empresa_id` union all select `pago`.`id_proveedor` AS `id_proveedor`,`pago`.`empresa_id` AS `empresa_id` from `vn2008`.`pago` where `pago`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `pago`.`id_proveedor`,`pago`.`empresa_id`) `sub` on(`Proveedores`.`Id_Proveedor` = `sub`.`proveedor_id`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Proveedores`.`pais_id`)) left join `vn2008`.`province` `prov` on(`prov`.`province_id` = `Proveedores`.`province_id`)) left join `vn`.`supplierContact` `c` on(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`)) where `Proveedores`.`oficial` <> 0 group by `sub`.`proveedor_id`,`sub`.`empresa_id` union all select `Gastos`.`Id_Gasto` collate utf8mb3_unicode_ci AS `Id_Gasto`,`Gastos`.`Gasto` collate utf8mb3_unicode_ci AS `Gasto`,NULL AS `NULL`,NULL AS `My_exp_NULL`,NULL AS `My_exp_1_NULL`,NULL AS `My_exp_2_NULL`,NULL AS `My_exp_3_NULL`,NULL AS `country_code`,`e`.`id` AS `id`,NULL AS `EMAIL`,1 AS `IDNIF` from (`vn2008`.`Gastos` join `vn2008`.`empresa` `e` on(`e`.`id` = 442)) union all select `Bancos`.`Cuenta` AS `Cuenta`,`Bancos`.`Banco` AS `Banco`,NULL AS `NULL`,NULL AS `My_exp_NULL`,NULL AS `My_exp_1_NULL`,NULL AS `My_exp_2_NULL`,NULL AS `My_exp_3_NULL`,NULL AS `country_code`,`e`.`id` AS `id`,NULL AS `EMAIL`,1 AS `IDNIF` from (`vn2008`.`Bancos` join `vn2008`.`empresa` `e` on(`e`.`id` = 442)) union all select lpad(right(`Proveedores`.`cuenta`,5),10,'47510000') AS `Cuenta`,`Proveedores`.`Proveedor` AS `Proveedor`,`Proveedores`.`NIF` AS `NIF`,`Proveedores`.`Domicilio` AS `Domicilio`,`Proveedores`.`Localidad` AS `Localidad`,`prov`.`name` AS `Provincia`,`Proveedores`.`codpos` AS `CP`,`p`.`Codigo` AS `country_code`,`sub`.`empresa_id` AS `empresa_id`,substr(`c`.`email`,1,coalesce(nullif(locate(',',`c`.`email`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0,1,if(`p`.`CEE` = 1,2,4)) AS `IDNIF` from ((((`vn2008`.`Proveedores` join (select `recibida`.`proveedor_id` AS `proveedor_id`,`recibida`.`empresa_id` AS `empresa_id` from `vn2008`.`recibida` where `recibida`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `recibida`.`proveedor_id`,`recibida`.`empresa_id` union all select `pago`.`id_proveedor` AS `id_proveedor`,`pago`.`empresa_id` AS `empresa_id` from `vn2008`.`pago` where `pago`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `pago`.`id_proveedor`,`pago`.`empresa_id`) `sub` on(`Proveedores`.`Id_Proveedor` = `sub`.`proveedor_id`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Proveedores`.`pais_id`)) left join `vn2008`.`province` `prov` on(`prov`.`province_id` = `Proveedores`.`province_id`)) left join `vn`.`supplierContact` `c` on(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`)) where (`Proveedores`.`cuenta` like '_____3____' or `Proveedores`.`cuenta` like '_____2____') and `Proveedores`.`oficial` = 1 group by `sub`.`proveedor_id`,`sub`.`empresa_id` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95135,60 +93282,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `vnCreditClassification` --- - -/*!50001 DROP VIEW IF EXISTS `vnCreditClassification`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `vnCreditClassification` AS select `vn`.`creditClassification`.`id` AS `id`,`vn`.`creditClassification`.`client` AS `client`,`vn`.`creditClassification`.`dateStart` AS `dateStart`,`vn`.`creditClassification`.`dateEnd` AS `dateEnd` from `vn`.`creditClassification` */; -/*!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 `vnCreditInsurance` --- - -/*!50001 DROP VIEW IF EXISTS `vnCreditInsurance`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `vnCreditInsurance` AS select `vn`.`creditInsurance`.`id` AS `id`,`vn`.`creditInsurance`.`creditClassification` AS `creditClassification`,`vn`.`creditInsurance`.`credit` AS `credit`,`vn`.`creditInsurance`.`creationDate` AS `creationDate`,`vn`.`creditInsurance`.`grade` AS `grade` from `vn`.`creditInsurance` */; -/*!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 `vnSolunionCAP` --- - -/*!50001 DROP VIEW IF EXISTS `vnSolunionCAP`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `vnSolunionCAP` AS select `vn`.`solunionCAP`.`creditInsurance` AS `creditInsurance`,`vn`.`solunionCAP`.`dateStart` AS `dateStart`,`vn`.`solunionCAP`.`dateEnd` AS `dateEnd`,`vn`.`solunionCAP`.`dateLeaving` AS `dateLeaving` from `vn`.`solunionCAP` */; -/*!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 `warehouse` -- @@ -95207,42 +93300,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `warehouse_alias` --- - -/*!50001 DROP VIEW IF EXISTS `warehouse_alias`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `warehouse_alias` AS select `wa`.`id` AS `warehouse_alias_id`,`wa`.`name` AS `alias` from `vn`.`warehouseAlias` `wa` */; -/*!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 `workcenter_holiday` --- - -/*!50001 DROP VIEW IF EXISTS `workcenter_holiday`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workcenter_holiday` AS select `wh`.`workCenterFk` AS `workcenter_id`,`wh`.`days` AS `day`,`wh`.`year` AS `year` from `vn`.`workCenterHoliday` `wh` */; -/*!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 `workerDocument` -- @@ -95278,24 +93335,6 @@ USE `vn2008`; /*!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 `zoneNickname` --- - -/*!50001 DROP VIEW IF EXISTS `zoneNickname`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `zoneNickname` AS select `ap`.`warehouse_id` AS `warehouse_id`,`ap`.`agency_id` AS `agency_id`,`ap`.`zona` AS `zona`,concat('ZONA ',`ap`.`zona`,' ',if(`ap`.`zona` = 20,'Madrid',`p`.`name`)) AS `alias` from (`vn2008`.`Agencias_province` `ap` join `vn2008`.`province` `p` on(`p`.`province_id` = `ap`.`province_id`)) group by `ap`.`zona`,`ap`.`warehouse_id`,`ap`.`agency_id` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -95306,4 +93345,4 @@ USE `vn2008`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-01-25 16:24:11 +-- Dump completed on 2024-02-15 10:21:18 diff --git a/db/dump/.dump/triggers.sql b/db/dump/.dump/triggers.sql index f68b463d2..2da83db43 100644 --- a/db/dump/.dump/triggers.sql +++ b/db/dump/.dump/triggers.sql @@ -1,4 +1,4 @@ --- MariaDB dump 10.19 Distrib 10.5.21-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.23-MariaDB, for debian-linux-gnu (x86_64) -- -- Host: db.verdnatura.es Database: account -- ------------------------------------------------------ @@ -517,7 +517,7 @@ USE `bs`; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `bs`.`clientNewBorn_BEFORE_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `bs`.`clientNewBorn_beforeUpdate` BEFORE UPDATE ON `clientNewBorn` FOR EACH ROW BEGIN @@ -540,7 +540,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `bs`.`nightTaskBeforeInsert` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `bs`.`nightTask_beforeInsert` BEFORE INSERT ON `nightTask` FOR EACH ROW BEGIN @@ -566,7 +566,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `bs`.`nightTaskBeforeUpdate` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `bs`.`nightTask_beforeUpdate` BEFORE UPDATE ON `nightTask` FOR EACH ROW BEGIN @@ -610,7 +610,7 @@ USE `edi`; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`item_feature_bi` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`item_feature_beforeInsert` BEFORE INSERT ON `item_feature` FOR EACH ROW BEGIN @@ -632,7 +632,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`putOrder_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`putOrder_beforeInsert` BEFORE INSERT ON `putOrder` FOR EACH ROW BEGIN @@ -658,7 +658,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`BEFORE UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`putOrder_beforeUpdate` BEFORE UPDATE ON `putOrder` FOR EACH ROW BEGIN @@ -708,7 +708,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`putOrder_AFTER_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`putOrder_afterUpdate` AFTER UPDATE ON `putOrder` FOR EACH ROW BEGIN @@ -795,7 +795,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`supplyResponse_AFTER_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`supplyResponse_afterUpdate` AFTER UPDATE ON `supplyResponse` FOR EACH ROW BEGIN @@ -1412,7 +1412,7 @@ USE `sage`; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `sage`.`movConta_BEFORE_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `sage`.`movConta_beforeUpdate` BEFORE UPDATE ON `movConta` FOR EACH ROW BEGIN @@ -1446,7 +1446,7 @@ USE `srt`; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `srt`.`expedition_BU` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `srt`.`expedition_beforeUpdate` BEFORE UPDATE ON `expedition` FOR EACH ROW BEGIN @@ -1464,11 +1464,11 @@ DELIMITER ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `srt`.`moving_AI` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `srt`.`moving_afterInsert` AFTER INSERT ON `moving` FOR EACH ROW BEGIN @@ -1924,7 +1924,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_BI` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_beforeInsert` BEFORE INSERT ON `autonomy` FOR EACH ROW BEGIN @@ -1946,7 +1946,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_BU` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_beforeUpdate` BEFORE UPDATE ON `autonomy` FOR EACH ROW BEGIN @@ -1974,7 +1974,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_AD` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_afterDelete` AFTER DELETE ON `autonomy` FOR EACH ROW BEGIN @@ -1994,7 +1994,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`awb_bi` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`awb_beforeInsert` BEFORE INSERT ON `awb` FOR EACH ROW BEGIN @@ -2059,7 +2059,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`budgetNotes_BeforeInsert` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`budgetNotes_beforeInsert` BEFORE INSERT ON `budgetNotes` FOR EACH ROW BEGIN @@ -2551,6 +2551,70 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`calendar_beforeInsert` + BEFORE INSERT ON `calendar` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = 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 = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`calendar_beforeUpdate` + BEFORE UPDATE ON `calendar` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = 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 = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`calendar_afterDelete` + AFTER DELETE ON `calendar` + FOR EACH ROW +BEGIN + INSERT INTO workerLog + SET `action` = 'delete', + `changedModel` = 'Calendar', + `changedModelId` = OLD.id, + `userFk` = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = 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 = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claim_beforeInsert` BEFORE INSERT ON `claim` FOR EACH ROW @@ -3026,13 +3090,13 @@ 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 = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_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' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`client_AfterInsert` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`client_afterInsert` AFTER INSERT ON `client` FOR EACH ROW BEGIN @@ -3246,15 +3310,15 @@ 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 = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_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' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER clientCredit_AfterInsert -AFTER INSERT -ON clientCredit FOR EACH ROW +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientCredit_afterInsert` + AFTER INSERT ON `clientCredit` + FOR EACH ROW BEGIN DECLARE vSender VARCHAR(50); @@ -3501,39 +3565,39 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`collection_BEFORE_UPDATE` - BEFORE UPDATE ON `collection` - FOR EACH ROW -BEGIN - - DECLARE vStateFk INT; - DECLARE vTotalLines INT; - DECLARE vPickedLines INT; - - IF NEW.saleTotalCount <= NEW.salePickedCount - AND (NEW.saleTotalCount != OLD.saleTotalCount - OR NEW.salePickedCount != OLD.salePickedCount) - THEN - - SELECT id INTO vStateFk - FROM vn.state - WHERE code = 'PREPARED'; - - SET NEW.stateFk = vStateFk; - - END IF; - - IF NEW.saleTotalCount > NEW.salePickedCount - AND (NEW.saleTotalCount != OLD.saleTotalCount OR NEW.salePickedCount != OLD.salePickedCount) THEN - - SELECT id INTO vStateFk - FROM vn.state - WHERE code = 'ON_PREPARATION'; - - SET NEW.stateFk = vStateFk; - - END IF; - +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`collection_beforeUpdate` + BEFORE UPDATE ON `collection` + FOR EACH ROW +BEGIN + + DECLARE vStateFk INT; + DECLARE vTotalLines INT; + DECLARE vPickedLines INT; + + IF NEW.saleTotalCount <= NEW.salePickedCount + AND (NEW.saleTotalCount != OLD.saleTotalCount + OR NEW.salePickedCount != OLD.salePickedCount) + THEN + + SELECT id INTO vStateFk + FROM vn.state + WHERE code = 'PREPARED'; + + SET NEW.stateFk = vStateFk; + + END IF; + + IF NEW.saleTotalCount > NEW.salePickedCount + AND (NEW.saleTotalCount != OLD.saleTotalCount OR NEW.salePickedCount != OLD.salePickedCount) THEN + + SELECT id INTO vStateFk + FROM vn.state + WHERE code = 'ON_PREPARATION'; + + SET NEW.stateFk = vStateFk; + + END IF; + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -3743,7 +3807,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`country_AFTER_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`country_afterInsert` AFTER INSERT ON `country` FOR EACH ROW BEGIN @@ -4414,7 +4478,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`duaTax_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`duaTax_beforeInsert` BEFORE INSERT ON `duaTax` FOR EACH ROW BEGIN @@ -4435,7 +4499,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`duaTax_BEFORE_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`duaTax_beforeUpdate` BEFORE UPDATE ON `duaTax` FOR EACH ROW BEGIN @@ -4858,7 +4922,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionPallet_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionPallet_beforeInsert` BEFORE INSERT ON `expeditionPallet` FOR EACH ROW BEGIN @@ -4886,7 +4950,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionScan_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionScan_beforeInsert` BEFORE INSERT ON `expeditionScan` FOR EACH ROW BEGIN @@ -4908,7 +4972,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionState_BeforeInsert` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionState_beforeInsert` BEFORE INSERT ON `expeditionState` FOR EACH ROW BEGIN @@ -4922,15 +4986,15 @@ 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 = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_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' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER expeditionState_AfterInsert -AFTER INSERT -ON expeditionState FOR EACH ROW +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionState_afterInsert` + AFTER INSERT ON `expeditionState` + FOR EACH ROW BEGIN UPDATE vn.expedition e @@ -4952,7 +5016,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionTruck_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionTruck_beforeInsert` BEFORE INSERT ON `expeditionTruck` FOR EACH ROW BEGIN @@ -4974,7 +5038,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionTruck_BEFORE_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionTruck_beforeUpdate` BEFORE UPDATE ON `expeditionTruck` FOR EACH ROW BEGIN @@ -4996,7 +5060,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`floramondoConfig_AFTER_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`floramondoConfig_afterInsert` AFTER INSERT ON `floramondoConfig` FOR EACH ROW BEGIN @@ -5122,7 +5186,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_bi` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_beforeInsert` BEFORE INSERT ON `invoiceIn` FOR EACH ROW BEGIN @@ -5186,7 +5250,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_bu` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_beforeUpdate` BEFORE UPDATE ON `invoiceIn` FOR EACH ROW BEGIN @@ -5227,7 +5291,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_au` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_afterUpdate` AFTER UPDATE ON `invoiceIn` FOR EACH ROW BEGIN @@ -5664,15 +5728,7 @@ BEGIN DECLARE vNewPackingShelve INT; SET NEW.editorFk = account.myUser_getId(); - - IF ISNULL(NEW.packingShelve) AND NOT ISNULL(NEW.packingOut) THEN - SELECT NEW.packingOut * vc.shelveVolume / vc.standardFlowerBox - INTO vNewPackingShelve - FROM vn.volumeConfig vc; - - SET NEW.packingShelve = vNewPackingShelve; - END IF; - + IF NEW.itemPackingTypeFk = '' THEN SET NEW.itemPackingTypeFk = NULL; END IF; @@ -5867,7 +5923,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemCategory_AFTER_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemCategory_afterInsert` AFTER INSERT ON `itemCategory` FOR EACH ROW BEGIN @@ -5955,7 +6011,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_beforeInsert` BEFORE INSERT ON `itemShelving` FOR EACH ROW BEGIN @@ -5977,7 +6033,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_AFTER_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_afterInsert` AFTER INSERT ON `itemShelving` FOR EACH ROW INSERT INTO vn.itemShelvingLog( itemShelvingFk, @@ -6011,7 +6067,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_BEFORE_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_beforeUpdate` BEFORE UPDATE ON `itemShelving` FOR EACH ROW BEGIN @@ -6034,11 +6090,10 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_AFTER_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_afterUpdate` AFTER UPDATE ON `itemShelving` FOR EACH ROW - - INSERT INTO itemShelvingLog +INSERT INTO itemShelvingLog SET itemShelvingFk = NEW.id, workerFk = account.myUser_getId(), accion = 'CAMBIO', @@ -6061,7 +6116,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_BEFORE_DELETE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_beforeDelete` BEFORE DELETE ON `itemShelving` FOR EACH ROW INSERT INTO vn.itemShelvingLog(itemShelvingFk, @@ -6106,13 +6161,13 @@ 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 = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_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' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelvingSale_AFTER_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelvingSale_afterInsert` AFTER INSERT ON `itemShelvingSale` FOR EACH ROW BEGIN @@ -6366,7 +6421,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`machine_BI` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`machine_beforeInsert` BEFORE INSERT ON `machine` FOR EACH ROW BEGIN @@ -6584,7 +6639,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_beforeInsert` BEFORE INSERT ON `parking` FOR EACH ROW BEGIN @@ -6606,7 +6661,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_BEFORE_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_beforeUpdate` BEFORE UPDATE ON `parking` FOR EACH ROW BEGIN @@ -6935,13 +6990,13 @@ DELIMITER ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER projectNotes_BeforeInsert -BEFORE INSERT -ON projectNotes FOR EACH ROW +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`projectNotes_beforeInsert` + BEFORE INSERT ON `projectNotes` + FOR EACH ROW BEGIN IF ISNULL(NEW.userFk) THEN @@ -7742,7 +7797,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_BEFORE_DELETE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_beforeDelete` BEFORE DELETE ON `sale` FOR EACH ROW BEGIN @@ -7832,7 +7887,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleBuy_beforeInsert` BEFORE INSERT ON `saleBuy` FOR EACH ROW BEGIN @@ -7854,31 +7909,6 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleBuy_AI` - AFTER INSERT ON `saleBuy` - FOR EACH ROW -BEGIN -/* Activar de nuevo cuando volvamos a vender fruta y verdura - * - UPDATE vn.sale s - SET s.concept = CONCAT(s.concept, ' Lote: ', NEW.buyFk) - WHERE s.id = NEW.saleFk; -*/ -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = 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 = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleGroup_beforeInsert` BEFORE INSERT ON `saleGroup` FOR EACH ROW @@ -7943,7 +7973,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleTracking_After_Insert` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleTracking_afterInsert` AFTER INSERT ON `saleTracking` FOR EACH ROW BEGIN @@ -8122,7 +8152,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`shelving_BEFORE_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`shelving_beforeUpdate` BEFORE UPDATE ON `shelving` FOR EACH ROW BEGIN @@ -8174,7 +8204,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_AFTER_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_afterInsert` AFTER INSERT ON `solunionCAP` FOR EACH ROW BEGIN @@ -8197,7 +8227,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_AFTER_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_afterUpdate` AFTER UPDATE ON `solunionCAP` FOR EACH ROW BEGIN @@ -8227,7 +8257,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_BEFORE_DELETE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_beforeDelete` BEFORE DELETE ON `solunionCAP` FOR EACH ROW BEGIN @@ -8250,7 +8280,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`specie_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`specie_beforeInsert` BEFORE INSERT ON `specie` FOR EACH ROW BEGIN @@ -8270,7 +8300,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`specie_BEFORE_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`specie_beforeUpdate` BEFORE UPDATE ON `specie` FOR EACH ROW BEGIN @@ -8582,7 +8612,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`tag_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`tag_beforeInsert` BEFORE INSERT ON `tag` FOR EACH ROW BEGIN @@ -9051,7 +9081,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketPackaging_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketPackaging_beforeInsert` BEFORE INSERT ON `ticketPackaging` FOR EACH ROW BEGIN @@ -9117,7 +9147,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketParking_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketParking_beforeInsert` BEFORE INSERT ON `ticketParking` FOR EACH ROW BEGIN @@ -9313,7 +9343,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_ai` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_afterInsert` AFTER INSERT ON `ticketService` FOR EACH ROW BEGIN @@ -9355,7 +9385,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_au` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_afterUpdate` AFTER UPDATE ON `ticketService` FOR EACH ROW BEGIN @@ -9380,7 +9410,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_ad` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_afterDelete` AFTER DELETE ON `ticketService` FOR EACH ROW BEGIN @@ -9450,7 +9480,7 @@ DELIMITER ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketTracking_beforeUpdate` BEFORE UPDATE ON `ticketTracking` @@ -9632,7 +9662,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`time_AFTER_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`time_afterUpdate` AFTER UPDATE ON `time` FOR EACH ROW BEGIN @@ -10203,13 +10233,11 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_AI` - AFTER INSERT ON `workerTimeControl` - FOR EACH ROW -BEGIN - IF NEW.timed > DATE_ADD(util.VN_NOW(), INTERVAL 1 DAY) THEN - CALL util.throw('date in the future'); - END IF; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_beforeInsert` + BEFORE INSERT ON `workerTimeControl` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10225,7 +10253,73 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workingHoursBeforeInsert` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_afterInsert` + AFTER INSERT ON `workerTimeControl` + FOR EACH ROW +BEGIN + IF NEW.timed > (util.VN_NOW() + INTERVAL 1 DAY) THEN + CALL util.throw('date in the future'); + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = 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 = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_beforeUpdate` + BEFORE UPDATE ON `workerTimeControl` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = 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 = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_afterDelete` + AFTER DELETE ON `workerTimeControl` + FOR EACH ROW +BEGIN + INSERT INTO workerLog + SET `action` = 'delete', + `changedModel` = 'WorkerTimeControl', + `changedModelId` = OLD.id, + `userFk` = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = 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 = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workingHours_beforeInsert` BEFORE INSERT ON `workingHours` FOR EACH ROW BEGIN @@ -10375,7 +10469,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_BI` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_beforeInsert` BEFORE INSERT ON `zoneExclusion` FOR EACH ROW BEGIN @@ -10397,7 +10491,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_BU` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_beforeUpdate` BEFORE UPDATE ON `zoneExclusion` FOR EACH ROW BEGIN @@ -10619,7 +10713,7 @@ USE `vn2008`; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`Conteo_ai` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`Conteo_afterInsert` AFTER INSERT ON `Conteo` FOR EACH ROW BEGIN @@ -10645,7 +10739,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`account_conciliacion_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`account_conciliacion_beforeInsert` BEFORE INSERT ON `account_conciliacion` FOR EACH ROW set new.id_calculated = replace( @@ -10671,7 +10765,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`agency_hourBeforeInsert` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`agency_hour_beforeInsert` BEFORE INSERT ON `agency_hour` FOR EACH ROW BEGIN @@ -10704,7 +10798,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`agency_hour_AFTER_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`agency_hour_afterUpdate` AFTER UPDATE ON `agency_hour` FOR EACH ROW BEGIN @@ -10734,7 +10828,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`awb_recibida_ad` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`awb_recibida_afterDelete` AFTER DELETE ON `awb_recibida` FOR EACH ROW IF (SELECT COUNT(*) FROM recibida_iva where recibida_id = OLD.recibida_id) = 0 @@ -10759,10 +10853,9 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`movement_label_au` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`movement_label_afterUpdate` AFTER UPDATE ON `movement_label` FOR EACH ROW --- Edit trigger body code below this line. Do not edit lines above this one IF NEW.stem >= (SELECT Cantidad FROM Movimientos WHERE Id_Movimiento = NEW.Id_Movimiento) THEN UPDATE Movimientos SET OK = 1 WHERE Id_Movimiento = NEW.Id_Movimiento; END IF */;; @@ -10777,4 +10870,4 @@ DELIMITER ; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-01-25 16:24:46 +-- Dump completed on 2024-02-15 10:21:45 diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 094b956af..43293c9ea 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -653,6 +653,7 @@ INSERT INTO `vn`.`expense`(`id`, `name`, `isWithheld`) (7001000000, 'Mercaderia', 0), (7050000000, 'Prestacion de servicios', 1); +INSERT INTO `vn`.`agencyTermConfig` VALUES ('6240000000','4721000015',21.0000000000,'Adquisiciones intracomunitarias de servicios'); INSERT INTO `vn`.`invoiceOutExpense`(`id`, `invoiceOutFk`, `amount`, `expenseFk`, `created`) VALUES @@ -728,7 +729,7 @@ INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agen INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`, `cmrFk`) VALUES (1 , 3, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 121, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1), - (2 , 1, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 1, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 2), + (2 , 1, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 1, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 2), (3 , 1, 7, 1, 6, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL, 3), (4 , 3, 2, 1, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 9, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL, NULL), (5 , 3, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL, NULL), diff --git a/db/routines/bs/procedures/ventas_contables_add.sql b/db/routines/bs/procedures/ventas_contables_add.sql index 9988c8b29..12b2738f3 100644 --- a/db/routines/bs/procedures/ventas_contables_add.sql +++ b/db/routines/bs/procedures/ventas_contables_add.sql @@ -1,7 +1,7 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`ventas_contables_add`(IN vYear INT, IN vMonth INT) BEGIN - + /** * Reemplaza las ventas contables del último año. * Es el origen de datos para el balance de Entradas @@ -13,8 +13,8 @@ BEGIN DECLARE TIPO_PATRIMONIAL INT DEFAULT 188; - DELETE FROM bs.ventas_contables - WHERE year = vYear + DELETE FROM bs.ventas_contables + WHERE year = vYear AND month = vMonth; DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; @@ -25,7 +25,7 @@ BEGIN FROM vn2008.Tickets t JOIN vn.invoiceOut io ON io.id = t.Factura WHERE year(io.issued) = vYear - AND month(io.issued) = vMonth; + AND month(io.issued) = vMonth; INSERT INTO bs.ventas_contables(year , month @@ -35,7 +35,7 @@ BEGIN , tipo_id , empresa_id , gasto) - + SELECT vYear , vMonth , round(sum(Cantidad * Preu * (100 - m.Descuento)/100)) @@ -47,13 +47,13 @@ BEGIN , tp.reino_id , a.tipo_id , t.empresa_id - , 7000000000 + , a.expenseFk + IF(e.empresa_grupo = e2.empresa_grupo ,1 ,IF(e2.empresa_grupo,2,0) - ) * 1000000 - + tp.reino_id * 10000 as Gasto - FROM vn2008.Movimientos m + ) * 100000 + + tp.reino_id * 1000 as Gasto + FROM vn2008.Movimientos m JOIN vn2008.Tickets t on t.Id_Ticket = m.Id_Ticket JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna JOIN vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente @@ -67,7 +67,7 @@ BEGIN AND m.Descuento <> 100 AND a.tipo_id != TIPO_PATRIMONIAL GROUP BY grupo, reino_id, tipo_id, empresa_id, Gasto; - + INSERT INTO bs.ventas_contables(year , month , venta @@ -86,17 +86,17 @@ BEGIN ) as grupo , NULL , NULL - , t.companyFk + , t.companyFk , 7050000000 - FROM vn.ticketService ts + FROM vn.ticketService ts JOIN vn.ticket t ON ts.ticketFk = t.id - JOIN vn.address a on a.id = t.addressFk - JOIN vn.client cl on cl.id = a.clientFk + JOIN vn.address a on a.id = t.addressFk + JOIN vn.client cl on cl.id = a.clientFk JOIN tmp.ticket_list tt on tt.Id_Ticket = t.id - JOIN vn.company c on c.id = t.companyFk + JOIN vn.company c on c.id = t.companyFk LEFT JOIN vn.company c2 on c2.clientFk = cl.id - GROUP BY grupo, t.companyFk ; - + GROUP BY grupo, t.companyFk ; + DROP TEMPORARY TABLE tmp.ticket_list; END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/itemProposal_Add.sql b/db/routines/vn/procedures/itemProposal_Add.sql deleted file mode 100644 index ac4dfa5d5..000000000 --- a/db/routines/vn/procedures/itemProposal_Add.sql +++ /dev/null @@ -1,70 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemProposal_Add`(vSaleFk INT, vMateFk INT, vQuantity INT) -BEGIN -/** - * Añade un nuevo articulo para sustituir a otro, y actualiza la memoria de sustituciones. - * - * @param vSaleFk id de la tabla sale - * @param vMateFk articulo sustituto - * @ param vQuantity cantidad que se va a sustituir - */ - DECLARE vTicketFk INT; - DECLARE vItemFk INT; - DECLARE vWarehouseFk SMALLINT; - DECLARE vDate DATE; - DECLARE vGrouping INT; - DECLARE vBox INT; - DECLARE vPacking INT; - DECLARE vRoundQuantity INT DEFAULT 1; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - - SELECT s.ticketFk, LEAST(s.quantity, vQuantity), s.itemFk,t.shipped,t.warehouseFk - INTO vTicketFk, vQuantity, vItemFk,vDate,vWarehouseFk - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - WHERE s.id = vSaleFk; - - CALL buyUltimate(vWarehouseFk, vDate); - - SELECT `grouping`, groupingMode, packing INTO vGrouping, vBox, vPacking - FROM buy b - JOIN tmp.buyUltimate tmp ON b.id = tmp.buyFk - WHERE tmp.itemFk = vMateFk AND tmp.WarehouseFk = vWarehouseFk; - - IF vBox = 2 AND vPacking > 0 THEN - SET vRoundQuantity = vPacking; - END IF; - IF vBox = 1 AND vGrouping > 0 THEN - SET vRoundQuantity = vGrouping; - END IF; - - START TRANSACTION; - - UPDATE sale - SET quantity = quantity - vQuantity - WHERE id = vSaleFk; - - INSERT INTO sale(ticketFk, itemFk, quantity, concept) - SELECT vTicketFk, - vMateFk, - CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, - CONCAT('+ ',i.longName) - FROM item i - WHERE id = vMateFk; - - SELECT LAST_INSERT_ID() INTO vSaleFk; - - CALL sale_calculateComponent(vSaleFk, NULL); - - INSERT INTO itemProposal(itemFk, mateFk, counter) - VALUES(vItemFk, vMateFk, 1) - ON DUPLICATE KEY UPDATE counter = counter + 1; - - COMMIT; -END$$ -DELIMITER ; diff --git a/db/routines/vn/procedures/itemShelving_add.sql b/db/routines/vn/procedures/itemShelving_add.sql index 02762fa0b..2a4676b50 100644 --- a/db/routines/vn/procedures/itemShelving_add.sql +++ b/db/routines/vn/procedures/itemShelving_add.sql @@ -19,6 +19,10 @@ BEGIN DECLARE vItemFk INT; SELECT barcodeToItem(vBarcode) INTO vItemFk; + + SET vPacking = COALESCE(vPacking, GREATEST(vn.itemPacking(vBarcode,vWarehouseFk), 1)); + + SET vQuantity = vQuantity * vPacking; IF (SELECT COUNT(*) FROM shelving WHERE code = vShelvingFk COLLATE utf8_unicode_ci) = 0 THEN diff --git a/db/routines/vn/procedures/sale_getBoxPickingList.sql b/db/routines/vn/procedures/sale_getBoxPickingList.sql index 0f2b2bc71..0af23e945 100644 --- a/db/routines/vn/procedures/sale_getBoxPickingList.sql +++ b/db/routines/vn/procedures/sale_getBoxPickingList.sql @@ -17,7 +17,6 @@ BEGIN CALL productionControl(vWarehouseFk, 0); - -- Products with vn.item.isBoxPickingMode = TRUE, pay atention to vn.itemShelving.packing CREATE OR REPLACE TEMPORARY TABLE tmp.sale (saleFk INT PRIMARY KEY) SELECT @@ -29,7 +28,7 @@ BEGIN MAKETIME(pb.HH,pb.mm,0) etd, pb.routeFk, FLOOR(s.quantity / ish.packing) stickers, - ish.packing, + IF(i.isBoxPickingMode, ish.packing, i.packingOut) packing, b.packagingFk FROM sale s JOIN item i ON i.id = s.itemFk @@ -52,8 +51,8 @@ BEGIN LEFT JOIN ticketState ts ON ts.ticketFk = s.ticketFk LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk LEFT JOIN buy b ON b.id = lb.buy_id - WHERE s.quantity BETWEEN ish.packing AND (ish.visible - IFNULL(tISS.reserve,0)) - AND i.isBoxPickingMode + WHERE IF(i.isBoxPickingMode, ish.packing, i.packingOut) + <= LEAST(s.quantity, ish.visible - IFNULL(tISS.reserve,0)) AND NOT pb.problem AND sgd.saleFk IS NULL AND p.sectorFk = vSectorFk @@ -64,47 +63,13 @@ BEGIN GROUP BY s.id ORDER BY etd; - -- Remaining products, vn.item.packingOut - INSERT IGNORE INTO tmp.sale - SELECT - s.ticketFk, - s.id saleFk, - s.itemFk, - s.concept, - s.quantity, - MAKETIME(pb.HH,pb.mm,0) etd, - pb.routeFk, - s.quantity / i.packingOut stickers, - i.packingOut, - pc.defaultBigPackageFk - FROM sale s - JOIN item i ON i.id = s.itemFk - JOIN itemShelving ish ON ish.itemFk = s.itemFk - JOIN shelving sh ON sh.code = ish.shelvingFk - JOIN parking p ON p.id = sh.parkingFk - JOIN tmp.productionBuffer pb ON pb.ticketFk = s.ticketFk - JOIN agencyMode am ON am.id = pb.agencyModeFk - JOIN packagingConfig pc - LEFT JOIN routesMonitor rm ON rm.routeFk = pb.routeFk - LEFT JOIN itemShelvingStock iss ON iss.itemFk = s.itemFk AND iss.sectorFk = p.sectorFk - LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = s.id - LEFT JOIN ticketState ts ON ts.ticketFk = s.ticketFk - WHERE s.quantity >= i.packingOut - AND NOT pb.problem - AND s.quantity > 0 - AND sgd.saleFk IS NULL - AND p.sectorFk = vSectorFk - AND ts.isPreviousPreparable - AND iss.visible >= s.quantity - AND ((rm.bufferFk AND rm.isPickingAllowed) - OR am.code = 'REC_ALG') - AND pb.shipped = vDated - GROUP BY s.id - ORDER BY etd; - - SELECT * FROM tmp.sale; + SELECT * + FROM tmp.sale + WHERE stickers; DROP TEMPORARY TABLE tmp.productionBuffer; DROP TEMPORARY TABLE tmp.sale; END$$ DELIMITER ; + +CALL `vn`.`sale_getBoxPickingList`(1, curdate()); \ No newline at end of file diff --git a/db/routines/vn/procedures/sector_get.sql b/db/routines/vn/procedures/sector_get.sql deleted file mode 100644 index fe978203a..000000000 --- a/db/routines/vn/procedures/sector_get.sql +++ /dev/null @@ -1,13 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sector_get`() -BEGIN - -/** - * Obtiene los sectores -*/ - - SELECT s.id,s.description,s.warehouseFk - FROM vn.sector s; - -END$$ -DELIMITER ; diff --git a/db/routines/vn/triggers/ticket_beforeUpdate.sql b/db/routines/vn/triggers/ticket_beforeUpdate.sql index 0836b2486..72831bc3d 100644 --- a/db/routines/vn/triggers/ticket_beforeUpdate.sql +++ b/db/routines/vn/triggers/ticket_beforeUpdate.sql @@ -4,7 +4,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticket_beforeUpdate` FOR EACH ROW BEGIN DECLARE vNewTime TIME; - DECLARE vHasTicketRefund BOOL; SET NEW.editorFk = account.myUser_getId(); @@ -64,14 +63,5 @@ BEGIN CALL vn.routeUpdateM3(NEW.routeFk); END IF; - - SELECT COUNT(*) INTO vHasTicketRefund - FROM ticketRefund - WHERE originalTicketFk = NEW.id - OR refundTicketFk = NEW.id; - - IF vHasTicketRefund AND NEW.clientFk <> OLD.clientFk THEN - CALL util.throw('The ticket has a refund associated'); - END IF; END$$ DELIMITER ; diff --git a/db/routines/vn/views/__coolerPathDetail.sql b/db/routines/vn/views/__coolerPathDetail.sql deleted file mode 100644 index 375d9e2d0..000000000 --- a/db/routines/vn/views/__coolerPathDetail.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn`.`__coolerPathDetail` -AS SELECT `c`.`cooler_path_detail_id` AS `id`, - `c`.`cooler_path_id` AS `coolerPathFk`, - `c`.`pasillo` AS `hallway` -FROM `vn2008`.`cooler_path_detail` `c` diff --git a/db/routines/vn/views/zoneEstimatedDelivery.sql b/db/routines/vn/views/zoneEstimatedDelivery.sql index 081ccb0bd..90c7381d8 100644 --- a/db/routines/vn/views/zoneEstimatedDelivery.sql +++ b/db/routines/vn/views/zoneEstimatedDelivery.sql @@ -17,19 +17,17 @@ FROM ( ( ( ( - ( - `vn`.`ticket` `t` - JOIN `vn`.`ticketStateToday` `tst` ON(`tst`.`ticketFk` = `t`.`id`) - ) - JOIN `vn`.`state` `s` ON(`s`.`id` = `tst`.`state`) + `vn`.`ticket` `t` + JOIN `vn`.`ticketStateToday` `tst` ON(`tst`.`ticketFk` = `t`.`id`) ) - JOIN `vn`.`saleVolume` `sv` ON(`sv`.`ticketFk` = `t`.`id`) + JOIN `vn`.`state` `s` ON(`s`.`id` = `tst`.`state`) ) - LEFT JOIN `vn`.`lastHourProduction` `lhp` ON(`lhp`.`warehouseFk` = `t`.`warehouseFk`) + JOIN `vn`.`saleVolume` `sv` ON(`sv`.`ticketFk` = `t`.`id`) ) - JOIN `vn`.`warehouse` `w` ON(`w`.`id` = `t`.`warehouseFk`) + LEFT JOIN `vn`.`lastHourProduction` `lhp` ON(`lhp`.`warehouseFk` = `t`.`warehouseFk`) + ) + JOIN `vn`.`warehouse` `w` ON(`w`.`id` = `t`.`warehouseFk`) ) - JOIN `vn`.`warehouseAlias` `wa` ON(`wa`.`id` = `w`.`aliasFk`) ) STRAIGHT_JOIN `vn`.`zone` `z` ON(`z`.`id` = `t`.`zoneFk`) ) LEFT JOIN `vn`.`zoneClosure` `zc` ON( @@ -43,6 +41,5 @@ FROM ( ) ) JOIN `vn`.`alertLevel` `al` ON(`al`.`id` = `s`.`alertLevel`) - ) WHERE `w`.`hasProduction` <> 0 - AND cast(`t`.`shipped` AS date) = `util`.`VN_CURDATE`() + AND cast(`t`.`shipped` AS date) = `util`.`VN_CURDATE`() \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/12-account_conciliacion.sql b/db/versions/10835-brownCarnation/12-account_conciliacion.sql index d8469e035..22399da1b 100644 --- a/db/versions/10835-brownCarnation/12-account_conciliacion.sql +++ b/db/versions/10835-brownCarnation/12-account_conciliacion.sql @@ -1,4 +1,4 @@ -DROP TRIGGER IF EXISTS vn2008.account_conciliacion_BEFORE_INSERT; +DROP TRIGGER IF EXISTS vn2008.account_conciliacion_beforeInsert; ALTER TABLE IF EXISTS `vn2008`.`account_conciliacion` RENAME `vn`.`accountReconciliation`; diff --git a/db/versions/10835-brownCarnation/25-awb_recibida.sql b/db/versions/10835-brownCarnation/25-awb_recibida.sql index e403775c9..82dc01ab2 100644 --- a/db/versions/10835-brownCarnation/25-awb_recibida.sql +++ b/db/versions/10835-brownCarnation/25-awb_recibida.sql @@ -1,4 +1,4 @@ -DROP TRIGGER IF EXISTS vn2008.awb_recibida_ad; +DROP TRIGGER IF EXISTS vn2008.awb_recibida_afterDelete; ALTER TABLE IF EXISTS `vn2008`.`awb_recibida` RENAME `vn`.`awbInvoiceIn`; diff --git a/db/versions/10862-navyHydrangea/00-alterAgencyTermConfig.sql b/db/versions/10862-navyHydrangea/00-alterAgencyTermConfig.sql new file mode 100644 index 000000000..3409b762e --- /dev/null +++ b/db/versions/10862-navyHydrangea/00-alterAgencyTermConfig.sql @@ -0,0 +1,3 @@ +USE vn; +ALTER TABLE vn.agencyTermConfig + ADD CONSTRAINT agencyTermConfig_expense_FK FOREIGN KEY (expenseFk) REFERENCES vn.expense(id) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/db/versions/10862-navyHydrangea/00-alterGastosResumen.sql b/db/versions/10862-navyHydrangea/00-alterGastosResumen.sql new file mode 100644 index 000000000..307b8f205 --- /dev/null +++ b/db/versions/10862-navyHydrangea/00-alterGastosResumen.sql @@ -0,0 +1,11 @@ +USE vn; + +ALTER TABLE vn2008.gastos_resumen MODIFY COLUMN Id_Gasto varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL; + +DELETE gr.* + FROM vn2008.gastos_resumen gr LEFT JOIN vn.expense e ON gr.Id_Gasto = e.id + WHERE e.id IS NULL; + +ALTER TABLE vn2008.gastos_resumen + ADD CONSTRAINT gastos_resumen_expense_FK + FOREIGN KEY (Id_Gasto) REFERENCES vn.expense(id) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/db/versions/10862-navyHydrangea/00-alterInvoiceOutTaxConfig.sql b/db/versions/10862-navyHydrangea/00-alterInvoiceOutTaxConfig.sql new file mode 100644 index 000000000..fc5025c18 --- /dev/null +++ b/db/versions/10862-navyHydrangea/00-alterInvoiceOutTaxConfig.sql @@ -0,0 +1,5 @@ +USE vn; +ALTER TABLE vn.invoiceOutTaxConfig MODIFY COLUMN expenseFk varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL NULL; + +ALTER TABLE vn.invoiceOutTaxConfig + ADD CONSTRAINT invoiceOutTaxConfig_expense_FK FOREIGN KEY (expenseFk) REFERENCES vn.expense(id) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/db/versions/10862-navyHydrangea/00-alterItemGroupToOffer.sql b/db/versions/10862-navyHydrangea/00-alterItemGroupToOffer.sql new file mode 100644 index 000000000..68611c13c --- /dev/null +++ b/db/versions/10862-navyHydrangea/00-alterItemGroupToOffer.sql @@ -0,0 +1,5 @@ +USE edi; +ALTER TABLE edi.item_groupToOffer MODIFY COLUMN expenseFk varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '7001000000' NULL; + +ALTER TABLE edi.item_groupToOffer + ADD CONSTRAINT item_groupToOffer_expense_FK FOREIGN KEY (expenseFk) REFERENCES vn.expense(id) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/db/versions/10862-navyHydrangea/01-ventasContablesPk.sql b/db/versions/10862-navyHydrangea/01-ventasContablesPk.sql new file mode 100644 index 000000000..3f8bf2c79 --- /dev/null +++ b/db/versions/10862-navyHydrangea/01-ventasContablesPk.sql @@ -0,0 +1,14 @@ +USE vn; +-- Eliminar la clave primaria actual +ALTER TABLE bs.ventas_contables DROP PRIMARY KEY; + +-- Agregar la nueva clave primaria incluyendo el campo `gasto` +ALTER TABLE bs.ventas_contables ADD PRIMARY KEY (`year`, `month`, `grupo`, `reino_id`, `tipo_id`, `empresa_id`, `gasto`); + +DELETE vc.* FROM bs.ventas_contables vc LEFT JOIN vn.expense e ON e.id = vc.gasto WHERE e.id IS NULL; + +ALTER TABLE bs.ventas_contables + MODIFY COLUMN gasto VARCHAR(10) + CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL; + +ALTER TABLE bs.ventas_contables ADD CONSTRAINT ventas_contables_expense_FK FOREIGN KEY (gasto) REFERENCES vn.expense(id) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/db/versions/10862-navyHydrangea/02-updateExpenseRegularize.sql b/db/versions/10862-navyHydrangea/02-updateExpenseRegularize.sql new file mode 100644 index 000000000..90d865c1d --- /dev/null +++ b/db/versions/10862-navyHydrangea/02-updateExpenseRegularize.sql @@ -0,0 +1,8 @@ +DELETE FROM vn.expense + WHERE id ='' AND id IS NULL AND isWithheld = FALSE; +UPDATE vn.expense + SET id='7002090000' + WHERE id='7002009000'; +UPDATE vn.expense + SET id='7001090000' + WHERE id='7001009000'; diff --git a/db/versions/10862-navyHydrangea/03-updateExpense.sql b/db/versions/10862-navyHydrangea/03-updateExpense.sql new file mode 100644 index 000000000..a44c4c504 --- /dev/null +++ b/db/versions/10862-navyHydrangea/03-updateExpense.sql @@ -0,0 +1,44 @@ +UPDATE vn.expense +SET id = CASE id + WHEN 7000010000 THEN 7001001000 + WHEN 7000020000 THEN 7001002000 + WHEN 7000030000 THEN 7001003000 + WHEN 7000040000 THEN 7001004000 + WHEN 7000050000 THEN 7001005000 + WHEN 7000060000 THEN 7001006000 + WHEN 7000070000 THEN 7001007000 + WHEN 7002060000 THEN 7001206000 + WHEN 7002070000 THEN 7001207000 + WHEN 7002030000 THEN 7001203000 + WHEN 7002040000 THEN 7001204000 + WHEN 7002050000 THEN 7001205000 + WHEN 7002020000 THEN 7001202000 + WHEN 7002010000 THEN 7001201000 + WHEN 7001060000 THEN 7001106000 + WHEN 7001070000 THEN 7001107000 + WHEN 7001030000 THEN 7001103000 + WHEN 7001040000 THEN 7001104000 + WHEN 7001050000 THEN 7001105000 + WHEN 7001020000 THEN 7001102000 + WHEN 7001010000 THEN 7001101000 + WHEN 7000080000 THEN 7040008000 + WHEN 7001080000 THEN 7000108000 + WHEN 7002080000 THEN 7001208000 + WHEN 7000090000 THEN 7001009000 + WHEN 7002090000 THEN 7001209000 + WHEN 7002100000 THEN 7001210000 + WHEN 7001090000 THEN 7001109000 + WHEN 7001100000 THEN 7001110000 + WHEN 7000120000 THEN 7001012000 + WHEN 7002120000 THEN 7001212000 + WHEN 7000130000 THEN 7001013000 + WHEN 7000140000 THEN 7001014000 + ELSE id +END +WHERE id IN (7000010000, 7000020000, 7000030000, 7000040000, 7000050000, + 7000060000, 7000070000, 7002060000, 7002070000, 7002030000, + 7002040000, 7002050000, 7002020000, 7002010000, 7001060000, + 7001070000, 7001030000, 7001040000, 7001050000, 7001020000, + 7001010000, 7000080000, 7001080000, 7002080000, 7000090000, + 7002090000, 7002100000, 7001090000, 7001100000, + 7000120000, 7002120000, 7000130000, 7000140000); diff --git a/db/versions/10862-navyHydrangea/04-updateExpenseConflict.sql b/db/versions/10862-navyHydrangea/04-updateExpenseConflict.sql new file mode 100644 index 000000000..0e008081b --- /dev/null +++ b/db/versions/10862-navyHydrangea/04-updateExpenseConflict.sql @@ -0,0 +1,6 @@ +UPDATE vn.expense +SET id = CASE id + WHEN 7000100000 THEN 7001010000 + ELSE id +END +WHERE id IN (7000100000); diff --git a/db/versions/10885-wheatHydrangea/00-revokeUpdateClient.sql b/db/versions/10885-wheatHydrangea/00-revokeUpdateClient.sql new file mode 100644 index 000000000..b22e09615 --- /dev/null +++ b/db/versions/10885-wheatHydrangea/00-revokeUpdateClient.sql @@ -0,0 +1,37 @@ +REVOKE UPDATE ON vn.ticket FROM employee; + +GRANT UPDATE (id, + warehouseFk, + shipped, + nickname, + refFk, + addressFk, + workerFk, + observations, + isSigned, + isLabeled, + isPrinted, + packages, + location, + hour, + created, + isBlocked, + solution, + routeFk, + priority, + hasPriority, + companyFk, + agencyModeFk, + landed, + isBoxed, + isDeleted, + zoneFk, + zonePrice, + zoneBonus, + totalWithVat, + totalWithoutVat, + weight, + clonedFrom, + cmrFk, + editorFk) + ON vn.ticket TO employee; diff --git a/db/versions/10890-redOrchid/00-firstScript.sql b/db/versions/10890-redOrchid/00-firstScript.sql new file mode 100644 index 000000000..17bf974a1 --- /dev/null +++ b/db/versions/10890-redOrchid/00-firstScript.sql @@ -0,0 +1,3 @@ +-- Place your SQL code here +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) +VALUES( 'Ticket', 'myLastModified', '*', 'ALLOW', 'ROLE', 'production'); \ No newline at end of file diff --git a/modules/item/back/methods/item-shelving/specs/addListByItem.spec.js b/modules/item/back/methods/item-shelving/specs/addListByItem.spec.js new file mode 100644 index 000000000..e31ff2e61 --- /dev/null +++ b/modules/item/back/methods/item-shelving/specs/addListByItem.spec.js @@ -0,0 +1,55 @@ +const {models} = require('vn-loopback/server/server'); +const LoopBackContext = require('loopback-context'); + +describe('ItemShelving upsertItem()', () => { + const warehouseFk = 1; + let ctx; + let options; + let tx; + + beforeEach(async() => { + ctx = { + req: { + accessToken: {userId: 9}, + headers: {origin: 'http://localhost'} + }, + args: {} + }; + + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: ctx.req + }); + + options = {transaction: tx}; + tx = await models.ItemShelving.beginTransaction({}); + options.transaction = tx; + }); + + afterEach(async() => { + await tx.rollback(); + }); + + it('should add two new records', async() => { + const shelvingFk = 'ZPP'; + const items = [1, 1, 1, 2]; + + await models.ItemShelving.upsertItem(ctx, shelvingFk, items, warehouseFk, options); + const itemShelvings = await models.ItemShelving.find({where: {shelvingFk}}, options); + + expect(itemShelvings.length).toEqual(2); + }); + + it('should update the visible items', async() => { + const shelvingFk = 'GVC'; + const items = [2, 2]; + const {visible: itemsBefore} = await models.ItemShelving.findOne({ + where: {shelvingFk, itemFk: items[0]} + }, options); + await models.ItemShelving.upsertItem(ctx, shelvingFk, items, warehouseFk, options); + const {visible: itemsAfter} = await models.ItemShelving.findOne({ + where: {shelvingFk, itemFk: items[0]} + }, options); + + expect(itemsAfter).toEqual(itemsBefore + 2); + }); +}); diff --git a/modules/item/back/methods/item-shelving/upsertItem.js b/modules/item/back/methods/item-shelving/upsertItem.js new file mode 100644 index 000000000..49c2f1b0d --- /dev/null +++ b/modules/item/back/methods/item-shelving/upsertItem.js @@ -0,0 +1,64 @@ +module.exports = Self => { + Self.remoteMethodCtx('upsertItem', { + description: 'Add a record or update it if it already exists.', + accessType: 'WRITE', + accepts: [{ + arg: 'shelvingFk', + type: 'string', + required: true, + }, + { + arg: 'items', + type: ['number'], + required: true, + description: 'array of item foreign keys' + }, + { + arg: 'warehouseFk', + type: 'number', + required: true + }], + + http: { + path: `/upsertItem`, + verb: 'POST' + } + }); + + Self.upsertItem = async(ctx, shelvingFk, items, warehouseFk, options) => { + const myOptions = {userId: ctx.req.accessToken.userId}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + const discardItems = new Set(); + const itemCounts = items.reduce((acc, item) => { + acc[item] = (acc[item] || 0) + 1; + return acc; + }, {}); + + try { + for (let item of items) { + if (!discardItems.has(item)) { + let quantity = itemCounts[item]; + discardItems.add(item); + + await Self.rawSql('CALL vn.itemShelving_add(?, ?, ?, NULL, NULL, NULL, ?)', + [shelvingFk, item, quantity, warehouseFk], myOptions + ); + } + } + + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/item/back/models/item-shelving.js b/modules/item/back/models/item-shelving.js index 98ff18931..c031d8271 100644 --- a/modules/item/back/models/item-shelving.js +++ b/modules/item/back/models/item-shelving.js @@ -1,4 +1,5 @@ module.exports = Self => { require('../methods/item-shelving/deleteItemShelvings')(Self); + require('../methods/item-shelving/upsertItem')(Self); require('../methods/item-shelving/getInventory')(Self); }; diff --git a/modules/ticket/back/methods/ticket/myLastModified.js b/modules/ticket/back/methods/ticket/myLastModified.js new file mode 100644 index 000000000..a47ea570f --- /dev/null +++ b/modules/ticket/back/methods/ticket/myLastModified.js @@ -0,0 +1,25 @@ +module.exports = Self => { + Self.remoteMethodCtx('myLastModified', { + description: 'Get list of last tickets which user has modified', + accessType: 'READ', + returns: { + type: 'object', + root: true + }, + http: { + path: `/myLastModified`, + verb: 'GET' + } + }); + + Self.myLastModified = async ctx => { + const userId = ctx.req.accessToken.userId; + const query = + `SELECT ticketFk, MAX(created) created + FROM ticketTracking tt + WHERE tt.userFk = ? + GROUP BY ticketFk + LIMIT 5;`; + return await Self.rawSql(query, [userId]); + }; +}; diff --git a/modules/ticket/back/methods/ticket/specs/myLastModified.spec.js b/modules/ticket/back/methods/ticket/specs/myLastModified.spec.js new file mode 100644 index 000000000..6f245a032 --- /dev/null +++ b/modules/ticket/back/methods/ticket/specs/myLastModified.spec.js @@ -0,0 +1,10 @@ +const {models} = require('vn-loopback/server/server'); + +describe('myLastModified()', () => { + it('return list of last tickets which user has modified', async() => { + let ctx = {req: {accessToken: {userId: 100}}}; + let response = await models.Ticket.myLastModified(ctx); + + expect(response.length).toBeGreaterThan(0); + }); +}); diff --git a/modules/ticket/back/methods/ticket/specs/transferClient.spec.js b/modules/ticket/back/methods/ticket/specs/transferClient.spec.js index 5a9edd17e..5f1c09776 100644 --- a/modules/ticket/back/methods/ticket/specs/transferClient.spec.js +++ b/modules/ticket/back/methods/ticket/specs/transferClient.spec.js @@ -1,49 +1,60 @@ const models = require('vn-loopback/server/server').models; describe('Ticket transferClient()', () => { - const userId = 9; - const activeCtx = { - accessToken: {userId: userId}, - }; - const ctx = {req: activeCtx}; + const originalTicketId = 8; + const refundTicketId = 24; + const clientId = 1; + let ctx; + let options; + let tx; + beforeEach(async() => { + ctx = { + req: { + accessToken: {userId: 9}, + headers: {origin: 'http://localhost'} + }, + args: {} + }; + + options = {transaction: tx}; + tx = await models.Ticket.beginTransaction({}); + options.transaction = tx; + }); + + afterEach(async() => { + await tx.rollback(); + }); it('should throw an error as the ticket is not editable', async() => { - const tx = await models.Ticket.beginTransaction({}); - let error; - try { - const options = {transaction: tx}; const ticketId = 4; const clientId = 1; await models.Ticket.transferClient(ctx, ticketId, clientId, options); - - await tx.rollback(); } catch (e) { - await tx.rollback(); - error = e; + expect(e.message).toEqual(`This ticket is locked`); } - - expect(error.message).toEqual(`This ticket is locked`); }); - it('should be assigned a different clientFk', async() => { - const tx = await models.Ticket.beginTransaction({}); - let updatedTicket; - const ticketId = 10; - const clientId = 1; + it('should be assigned a different clientFk in the original ticket', async() => { + await models.Ticket.transferClient(ctx, 2, clientId, options); + const afterTransfer = await models.Ticket.findById(2, null, options); - try { - const options = {transaction: tx}; + expect(afterTransfer.clientFk).toEqual(clientId); + }); - await models.Ticket.transferClient(ctx, ticketId, clientId, options); - updatedTicket = await models.Ticket.findById(ticketId, {fields: ['clientFk']}, options); + it('should be assigned a different clientFk in the original and refund ticket and claim', async() => { + await models.Ticket.transferClient(ctx, originalTicketId, clientId, options); - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } + const [originalTicket, refundTicket] = await models.Ticket.find({ + where: {id: {inq: [originalTicketId, refundTicketId]}} + }, options); - expect(updatedTicket.clientFk).toEqual(clientId); + const claim = await models.Claim.findOne({ + where: {ticketFk: originalTicketId} + }, options); + + expect(originalTicket.clientFk).toEqual(clientId); + expect(refundTicket.clientFk).toEqual(clientId); + expect(claim.clientFk).toEqual(clientId); }); }); diff --git a/modules/ticket/back/methods/ticket/transferClient.js b/modules/ticket/back/methods/ticket/transferClient.js index 60e70d710..d38c0e8a7 100644 --- a/modules/ticket/back/methods/ticket/transferClient.js +++ b/modules/ticket/back/methods/ticket/transferClient.js @@ -2,20 +2,17 @@ module.exports = Self => { Self.remoteMethodCtx('transferClient', { description: 'Transfering ticket to another client', accessType: 'WRITE', - accepts: [ - { - arg: 'id', - type: 'number', - required: true, - description: 'the ticket id', - http: {source: 'path'} - }, - { - arg: 'clientFk', - type: 'number', - required: true, - }, - ], + accepts: [{ + arg: 'id', + type: 'number', + required: true, + description: 'the ticket id', + http: {source: 'path'} + }, { + arg: 'clientFk', + type: 'number', + required: true, + }], http: { path: `/:id/transferClient`, verb: 'PATCH' @@ -25,21 +22,51 @@ module.exports = Self => { Self.transferClient = async(ctx, id, clientFk, options) => { const models = Self.app.models; const myOptions = {}; + let tx; + if (typeof options == 'object') Object.assign(myOptions, options); - await Self.isEditableOrThrow(ctx, id, myOptions); + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } - const ticket = await models.Ticket.findById( - id, - {fields: ['id', 'shipped', 'clientFk', 'addressFk']}, - myOptions - ); - const client = await models.Client.findById(clientFk, {fields: ['id', 'defaultAddressFk']}, myOptions); + try { + await Self.isEditableOrThrow(ctx, id, myOptions); - await ticket.updateAttributes({ - clientFk, - addressFk: client.defaultAddressFk, - }); + const ticketRefund = await models.TicketRefund.findOne({ + where: {or: [{originalTicketFk: id}, {refundTicketFk: id}]}, + include: [{relation: 'refundTicket'}, {relation: 'originalTicket'}] + }, myOptions); + + const {defaultAddressFk: addressFk} = await models.Client.findById(clientFk, + {fields: ['id', 'defaultAddressFk']}, myOptions); + + const attributes = {clientFk, addressFk}; + + const tickets = []; + const ticketIds = []; + + if (ticketRefund) { + const {refundTicket, originalTicket} = ticketRefund; + tickets.push(refundTicket(), originalTicket()); + + for (const ticket of tickets) { + await ticket.updateAttributes(attributes, myOptions); + ticketIds.push(ticket.id); + } + } else { + await Self.updateAll({id}, attributes, myOptions); + ticketIds.push(id); + } + + await models.Claim.updateAll({ticketFk: {inq: ticketIds}}, {clientFk}, myOptions); + + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } }; }; diff --git a/modules/ticket/back/models/ticket-methods.js b/modules/ticket/back/models/ticket-methods.js index 8914e9c4f..d204a8102 100644 --- a/modules/ticket/back/models/ticket-methods.js +++ b/modules/ticket/back/models/ticket-methods.js @@ -45,4 +45,5 @@ module.exports = function(Self) { require('../methods/ticket/invoiceTickets')(Self); require('../methods/ticket/invoiceTicketsAndPdf')(Self); require('../methods/ticket/docuwareDownload')(Self); + require('../methods/ticket/myLastModified')(Self); }; diff --git a/myt.config.yml b/myt.config.yml index 2e37a0d97..0b1d62d25 100755 --- a/myt.config.yml +++ b/myt.config.yml @@ -44,7 +44,6 @@ fixtures: - module - defaultViewConfig vn: - - agencyTermConfig - alertLevel - bookingPlanner - businessType diff --git a/package.json b/package.json index 089684de8..47b3a1564 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "24.8.0", + "version": "24.10.0", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0", @@ -56,7 +56,7 @@ "@babel/plugin-syntax-dynamic-import": "^7.7.4", "@babel/preset-env": "^7.11.0", "@babel/register": "^7.7.7", - "@verdnatura/myt": "^1.6.6", + "@verdnatura/myt": "^1.6.7", "angular-mocks": "^1.7.9", "babel-jest": "^26.0.1", "babel-loader": "^8.2.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 221008dd9..025be234e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -93,8 +93,11 @@ dependencies: specifier: ^1.3.0 version: 1.3.0 puppeteer: - specifier: ^21.10.0 - version: 21.10.0 + specifier: ^21.11.0 + version: 21.11.0 + read-chunk: + specifier: ^3.2.0 + version: 3.2.0 require-yaml: specifier: 0.0.1 version: 0.0.1 @@ -128,8 +131,8 @@ devDependencies: specifier: ^7.7.7 version: 7.23.7(@babel/core@7.23.9) '@verdnatura/myt': - specifier: ^1.6.6 - version: 1.6.6 + specifier: ^1.6.7 + version: 1.6.7 angular-mocks: specifier: ^1.7.9 version: 1.8.3 @@ -2630,8 +2633,8 @@ packages: dev: false optional: true - /@verdnatura/myt@1.6.6: - resolution: {integrity: sha512-5KHi9w1baEQ6Oe/pAR8pl0oD5yyJJuPirE+ZhygreUGGURfig4VekjhlGE3WEbWquDiIAMi89J1VQ+1Ba0+jQw==} + /@verdnatura/myt@1.6.7: + resolution: {integrity: sha512-t/Q1T3QzHpZFdxwIyQL/CV5g+HJvWE6Q65VeA9k0svZdX/vezgnQ21nkI+wuvIurIl6BXqq2Arx7EWYkAhGNNA==} hasBin: true dependencies: '@sqltools/formatter': 1.2.5 @@ -4057,8 +4060,8 @@ packages: engines: {node: '>=6.0'} dev: true - /chromium-bidi@0.5.6(devtools-protocol@0.0.1232444): - resolution: {integrity: sha512-ber8smgoAs4EqSUHRb0I8fpx371ZmvsdQav8HRM9oO4fk5Ox16vQiNYXlsZkRj4FfvVL2dCef+zBFQixp+79CA==} + /chromium-bidi@0.5.8(devtools-protocol@0.0.1232444): + resolution: {integrity: sha512-blqh+1cEQbHBKmok3rVJkBlBxt9beKBgOsxbFgs7UJcoVbbeZ+K7+6liAsjgpc8l1Xd55cQUy14fXZdGSb4zIw==} peerDependencies: devtools-protocol: '*' dependencies: @@ -10680,7 +10683,6 @@ packages: /p-try@2.2.0: resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} engines: {node: '>=6'} - dev: true /pac-proxy-agent@7.0.1: resolution: {integrity: sha512-ASV8yU4LLKBAjqIPMbrgtaKIvxQri/yh2OpI+S6hVa9JRkUI3Y3NPFbfngDtY7oFtSMD3w31Xns89mDa3Feo5A==} @@ -11220,12 +11222,12 @@ packages: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} - /puppeteer-core@21.10.0: - resolution: {integrity: sha512-NVaqO3K462qwMuLO4Gurs/Mau1Wss+08QgNYzF0dIqZWMvpskrt/TbxbmHU+7zMTUOvPEq/lR4BLJmjMBgBGfQ==} + /puppeteer-core@21.11.0: + resolution: {integrity: sha512-ArbnyA3U5SGHokEvkfWjW+O8hOxV1RSJxOgriX/3A4xZRqixt9ZFHD0yPgZQF05Qj0oAqi8H/7stDorjoHY90Q==} engines: {node: '>=16.13.2'} dependencies: '@puppeteer/browsers': 1.9.1 - chromium-bidi: 0.5.6(devtools-protocol@0.0.1232444) + chromium-bidi: 0.5.8(devtools-protocol@0.0.1232444) cross-fetch: 4.0.0 debug: 4.3.4(supports-color@6.1.0) devtools-protocol: 0.0.1232444 @@ -11237,15 +11239,15 @@ packages: - utf-8-validate dev: false - /puppeteer@21.10.0: - resolution: {integrity: sha512-Y1yQjcLE00hHTDAmv3M3A6hhW0Ytjdp6xr6nyjl7FZ7E7hzp/6Rsw80FbaTJzJHFCplBNi082wrgynbmD7RlYw==} + /puppeteer@21.11.0: + resolution: {integrity: sha512-9jTHuYe22TD3sNxy0nEIzC7ZrlRnDgeX3xPkbS7PnbdwYjl2o/z/YuCrRBwezdKpbTDTJ4VqIggzNyeRcKq3cg==} engines: {node: '>=16.13.2'} hasBin: true requiresBuild: true dependencies: '@puppeteer/browsers': 1.9.1 cosmiconfig: 9.0.0 - puppeteer-core: 21.10.0 + puppeteer-core: 21.11.0 transitivePeerDependencies: - bufferutil - encoding @@ -11367,6 +11369,14 @@ packages: resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==} dev: true + /read-chunk@3.2.0: + resolution: {integrity: sha512-CEjy9LCzhmD7nUpJ1oVOE6s/hBkejlcJEgLQHVnQznOSilOPb+kpKktlLfFDK3/WP43+F80xkUTM2VOkYoSYvQ==} + engines: {node: '>=6'} + dependencies: + pify: 4.0.1 + with-open-file: 0.1.7 + dev: false + /read-pkg-up@1.0.1: resolution: {integrity: sha512-WD9MTlNtI55IwYUS27iHh9tK3YoIVhxis8yKhLpTqWtml739uXc9NWTpxoHkfZf3+DkCCsXox94/VWZniuZm6A==} engines: {node: '>=0.10.0'} @@ -14119,6 +14129,15 @@ packages: resolution: {integrity: sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==} dev: true + /with-open-file@0.1.7: + resolution: {integrity: sha512-ecJS2/oHtESJ1t3ZfMI3B7KIDKyfN0O16miWxdn30zdh66Yd3LsRFebXZXq6GU4xfxLf6nVxp9kIqElb5fqczA==} + engines: {node: '>=6'} + dependencies: + p-finally: 1.0.0 + p-try: 2.2.0 + pify: 4.0.1 + dev: false + /word-count@0.2.2: resolution: {integrity: sha512-tPRTbQ+nTCPY3F0z1f/y0PX22ScE6l/4/8j9KqA3h77JhlZ/w6cbVS8LIO5Pq/aV96SWBOoiE2IEgzxF0Cn+kA==} dev: false