Compare commits
71 Commits
Author | SHA1 | Date |
---|---|---|
Guillermo Bonet | 2572182a89 | |
Guillermo Bonet | c83e6a8bbd | |
Ivan Mas | b68ffb0819 | |
Ivan Mas | 23fb04876c | |
Guillermo Bonet | 065f13557b | |
Jon Elias | b1dda9f82b | |
Jon Elias | c06f2c4e6f | |
Alex Moreno | 1d8dcdf63f | |
Javi Gallego | 399081f83c | |
Javi Gallego | 4f3c101e42 | |
Alex Moreno | 1cd083ac68 | |
Alex Moreno | a713ef64e8 | |
Alex Moreno | 48d4bab706 | |
Jon Elias | c3a5a5da27 | |
Jon Elias | ecee47f859 | |
Jon Elias | ad0c1eb4c5 | |
Alex Moreno | e0a5a3cd8c | |
Pablo Natek | 98b68a2c74 | |
Jon Elias | fb57a1fa31 | |
Jon Elias | 5221b9254a | |
Alex Moreno | 7092226c01 | |
Javier Segarra | c80ce7d7a7 | |
Javi Gallego | 0ad26b336d | |
Javi Gallego | 1f23ebf6d5 | |
Ivan Mas | 1cc6e37697 | |
Jorge Penadés | 879ffcad64 | |
Javi Gallego | be50c91299 | |
Javi Gallego | a26de63660 | |
Javi Gallego | 8ca5808554 | |
Javi Gallego | 49d87ea44f | |
Javi Gallego | 98e2483565 | |
Javi Gallego | 5acd4520f8 | |
JOSE ANTONIO TUBAU RODRIGUEZ | 49263a5458 | |
JOSE ANTONIO TUBAU RODRIGUEZ | 0665453465 | |
JOSE ANTONIO TUBAU RODRIGUEZ | a2218b41f8 | |
Jorge Penadés | 549cb7633e | |
Ivan Mas | c59cae9f74 | |
Ivan Mas | da4968f8b1 | |
Pablo Natek | ea4b118015 | |
Javi Gallego | a99d7adfe8 | |
Pablo Natek | b838e988e0 | |
Pablo Natek | 49c30890e5 | |
Javi Gallego | 9ae27e104e | |
Carlos Andrés | 8ca8e11f1c | |
Carlos Andrés | 83d46d0a28 | |
Ivan Mas | b7666f5395 | |
Ivan Mas | 148ab57b1a | |
Javi Gallego | 6c2d7641f5 | |
Ivan Mas | 5620242d7e | |
Ivan Mas | 1ba23ad450 | |
Ivan Mas | ae220007e4 | |
Ivan Mas | ab5cf0f497 | |
Alex Moreno | 42c3cdae5d | |
Ivan Mas | af86bb24c4 | |
Javi Gallego | e748e9a012 | |
Ivan Mas | 10e332ca85 | |
Jon Elias | 2c0f596175 | |
Ivan Mas | bbc4eff922 | |
Ivan Mas | c593b95935 | |
Jon Elias | da824516f3 | |
Jon Elias | 2ec0d7f186 | |
Jon Elias | e91386dc92 | |
Jon Elias | f4015117e3 | |
Jon Elias | 8e2359a672 | |
Jon Elias | ce77d4bf2b | |
Jon Elias | a6799cba0f | |
Jon Elias | 698ef3dec3 | |
Jon Elias | 5d4b79e313 | |
Jon Elias | 451e3bebef | |
Jon Elias | da749a5dcb | |
Jon Elias | 6fbc5a1a54 |
|
@ -19,7 +19,7 @@ module.exports = Self => {
|
|||
if (acl.principalType == 'ROLE' && acl.permission == 'ALLOW') {
|
||||
const staticAcl = {
|
||||
model: model.name,
|
||||
property: '*',
|
||||
property: acl.property,
|
||||
accessType: acl.accessType,
|
||||
permission: acl.permission,
|
||||
principalType: acl.principalType,
|
||||
|
|
|
@ -4,7 +4,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 ('vn-database','11377','d3fe5098277c3935c434838b53facb271f84ebec','2024-12-10 07:22:33','11379');
|
||||
INSERT INTO `version` VALUES ('vn-database','11385','72bf27f08d3ddf646ec0bb6594fc79cecd4b72f2','2025-01-07 07:46:33','11395');
|
||||
|
||||
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);
|
||||
|
@ -1083,6 +1083,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','11322','00-entryAcl.sql','jenkin
|
|||
INSERT INTO `versionLog` VALUES ('vn-database','11324','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-13 10:49:47',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11325','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-26 07:05:30',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11326','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-26 07:05:30',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11327','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2025-01-07 07:46:24',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11330','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-26 07:05:30',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11331','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-26 07:05:30',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11332','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-12-10 07:20:04',NULL,NULL);
|
||||
|
@ -1110,6 +1111,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','11348','00-firstScript.sql','jen
|
|||
INSERT INTO `versionLog` VALUES ('vn-database','11349','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-26 07:28:14',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11350','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-26 07:28:14',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11351','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-12-10 07:20:04',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11352','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2025-01-07 07:46:24',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11353','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-26 07:28:14',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11354','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-12-10 07:20:04',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11355','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-26 07:28:14',NULL,NULL);
|
||||
|
@ -1120,6 +1122,8 @@ INSERT INTO `versionLog` VALUES ('vn-database','11362','00-firstScript.sql','jen
|
|||
INSERT INTO `versionLog` VALUES ('vn-database','11363','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-12-10 07:20:04',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11366','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-12-10 07:20:04',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11367','00-deprecate.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-12-10 07:20:04',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11368','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2025-01-07 07:46:32',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11368','01-acls.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2025-01-07 07:46:32',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11369','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-12-10 07:20:05',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11371','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-12-10 07:20:05',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11371','01-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-12-10 07:20:47',NULL,NULL);
|
||||
|
@ -1128,7 +1132,13 @@ INSERT INTO `versionLog` VALUES ('vn-database','11371','03-firstScript.sql','jen
|
|||
INSERT INTO `versionLog` VALUES ('vn-database','11372','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-12-09 13:30:30',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11373','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-12-02 16:09:01',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11375','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-12-03 08:58:20',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11376','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2025-01-07 07:46:32',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11377','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-12-10 07:22:31',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11378','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2025-01-07 07:46:32',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11379','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2025-01-07 07:46:32',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11379','01-secScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2025-01-07 07:46:32',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11384','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2025-01-07 07:46:32',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11385','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2025-01-07 07:46:33',NULL,NULL);
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
|
@ -2128,7 +2138,7 @@ INSERT INTO `ACL` VALUES (746,'Claim','getSummary','READ','ALLOW','ROLE','claimV
|
|||
INSERT INTO `ACL` VALUES (747,'CplusRectificationType','*','READ','ALLOW','ROLE','administrative',NULL);
|
||||
INSERT INTO `ACL` VALUES (748,'SiiTypeInvoiceOut','*','READ','ALLOW','ROLE','salesPerson',NULL);
|
||||
INSERT INTO `ACL` VALUES (749,'InvoiceCorrectionType','*','READ','ALLOW','ROLE','salesPerson',NULL);
|
||||
INSERT INTO `ACL` VALUES (750,'InvoiceOut','transfer','WRITE','ALLOW','ROLE','administrative',NULL);
|
||||
INSERT INTO `ACL` VALUES (750,'InvoiceOut','transfer','WRITE','ALLOW','ROLE','administrative',13657);
|
||||
INSERT INTO `ACL` VALUES (751,'Application','executeProc','*','ALLOW','ROLE','employee',NULL);
|
||||
INSERT INTO `ACL` VALUES (752,'Application','executeFunc','*','ALLOW','ROLE','employee',NULL);
|
||||
INSERT INTO `ACL` VALUES (753,'NotificationSubscription','getList','READ','ALLOW','ROLE','employee',NULL);
|
||||
|
@ -2369,6 +2379,10 @@ INSERT INTO `ACL` VALUES (1006,'Entry','latestBuysFilter','READ','ALLOW','ROLE',
|
|||
INSERT INTO `ACL` VALUES (1007,'ItemShelving','getItemsByReviewOrder','READ','ALLOW','ROLE','production',19294);
|
||||
INSERT INTO `ACL` VALUES (1008,'Entry','buyLabelSupplier','READ','ALLOW','ROLE','employee',19295);
|
||||
INSERT INTO `ACL` VALUES (1009,'Entry','buyLabel','READ','ALLOW','ROLE','supplier',19295);
|
||||
INSERT INTO `ACL` VALUES (1010,'InventoryConfig','find','READ','ALLOW','ROLE','buyer',10578);
|
||||
INSERT INTO `ACL` VALUES (1011,'SiiTypeInvoiceIn','find','READ','ALLOW','ROLE','salesPerson',10578);
|
||||
INSERT INTO `ACL` VALUES (1012,'OsrmConfig','optimize','READ','ALLOW','ROLE','employee',10578);
|
||||
INSERT INTO `ACL` VALUES (1013,'Route','optimizePriority','*','ALLOW','ROLE','employee',10578);
|
||||
|
||||
INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee');
|
||||
INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee');
|
||||
|
@ -2525,9 +2539,8 @@ INSERT INTO `companyI18n` VALUES (442,'en','In compliance with the provisions of
|
|||
INSERT INTO `companyI18n` VALUES (442,'fr','Conformément aux dispositions de la loi organique 15/1999 sur la protection des données personnelles, nous vous informons que les données personnelles que vous fournissez seront incluses dans des dossiers. VERDNATURA LEVANTE S.L., vous pouvez à tout moment, exercer les droits d``accès, de rectification, d``annulation et d``opposition, en communiquant par écrit au siège social de la société. Le dossier a pour objet la gestion administrative, la comptabilité et la facturation.');
|
||||
INSERT INTO `companyI18n` VALUES (442,'pt','Em cumprimento do disposto na lei Orgânica 15/1999, de Protecção de Dados de Carácter Pessoal, comunicamos que os dados pessoais que facilite se incluirão nos ficheiros automatizados de VERDNATURA LEVANTE S.L., podendo em todo momento exercer os direitos de acesso, rectificação, cancelação e oposição, comunicando por escrito ao domicílio social da entidade. A finalidade do ficheiro é a gestão administrativa, contabilidade e facturação.');
|
||||
|
||||
INSERT INTO `cplusRectificationType` VALUES (1,'Campo vacio');
|
||||
INSERT INTO `cplusRectificationType` VALUES (1,'S – Por sustitución');
|
||||
INSERT INTO `cplusRectificationType` VALUES (2,'I – Por diferencias');
|
||||
INSERT INTO `cplusRectificationType` VALUES (3,'S – Por sustitución');
|
||||
|
||||
INSERT INTO `cplusSubjectOp` VALUES (1,'Campo vacio');
|
||||
INSERT INTO `cplusSubjectOp` VALUES (2,'S1 – Sujeta – No exenta');
|
||||
|
@ -2619,6 +2632,8 @@ INSERT INTO `claimResult` VALUES (26,'Decepcion/Esperaba mas');
|
|||
INSERT INTO `claimResult` VALUES (27,'Otros');
|
||||
INSERT INTO `claimResult` VALUES (28,'Baboso/Cocido');
|
||||
INSERT INTO `claimResult` VALUES (29,'Videocámaras');
|
||||
INSERT INTO `claimResult` VALUES (30,'Manipulado');
|
||||
INSERT INTO `claimResult` VALUES (31,'ReclamReclamado PR/AG');
|
||||
|
||||
INSERT INTO `component` VALUES (10,'Precios Especiales',4,NULL,NULL,1,'specialPrices',0);
|
||||
INSERT INTO `component` VALUES (14,'porte extra por dia semana',6,NULL,NULL,1,'extraCostPerWeekDay',0);
|
||||
|
@ -2725,7 +2740,7 @@ INSERT INTO `department` VALUES (146,NULL,'VERDNACOLOMBIA',3,4,NULL,72,0,0,2,0,2
|
|||
INSERT INTO `department` VALUES (147,'spainTeamAsia','EQUIPO ESPAÑA ASIA',71,72,40214,0,0,0,2,0,43,'/1/43/','esA_equipo',1,'esA@verdnatura.es',0,0,0,0,NULL,NULL,'5500',NULL);
|
||||
INSERT INTO `department` VALUES (148,'franceTeamCatchment','EQUIPO CAPTACIÓN FRANCIA',73,74,25178,0,0,0,2,0,43,'/1/43/',NULL,1,NULL,0,0,0,0,NULL,NULL,'6000',NULL);
|
||||
INSERT INTO `department` VALUES (149,'spainTeamCatchment','EQUIPO ESPAÑA CAPTACIÓN',75,76,1203,0,0,0,2,0,43,'/1/43/','es_captacion_equipo',1,'es_captacion@verdnatura.es',0,0,0,0,NULL,NULL,'5700',NULL);
|
||||
INSERT INTO `department` VALUES (150,'spainTeamLevanteIslands','EQUIPO ESPAÑA LEVANTE/ISLAS',77,78,1118,0,0,0,2,0,43,'/1/43/','es_levanteislas_equipo',1,'levanteislas.verdnatura@gmail.com',0,0,0,0,NULL,NULL,'5000',NULL);
|
||||
INSERT INTO `department` VALUES (150,'spainTeamLevanteIslands','EQUIPO ESPAÑA LEVANTE',77,78,1118,0,0,0,2,0,43,'/1/43/','es_levante_equipo',1,'levanteislas.verdnatura@gmail.com',0,0,0,0,NULL,NULL,'5000',NULL);
|
||||
INSERT INTO `department` VALUES (151,'spainTeamNorthwest','EQUIPO ESPAÑA NOROESTE',79,80,7102,0,0,0,2,0,43,'/1/43/','es_noroeste_equipo',1,'noroeste.verdnatura@gmail.com',0,0,0,0,NULL,NULL,'5300',NULL);
|
||||
INSERT INTO `department` VALUES (152,'spainTeamNortheast','EQUIPO ESPAÑA NORESTE',81,82,1118,0,0,0,2,0,43,'/1/43/','es_noreste_equipo',1,'noreste.verdnatura@gmail.com',0,0,0,0,NULL,NULL,'5200',NULL);
|
||||
INSERT INTO `department` VALUES (153,'spainTeamSouth','EQUIPO ESPAÑA SUR',83,84,36578,0,0,0,2,0,43,'/1/43/','es_sur_equipo',1,'sur.verdnatura@gmail.com',0,0,0,0,NULL,NULL,'5400',NULL);
|
||||
|
|
|
@ -979,7 +979,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','bi','officeBoss','Greuge_Evolution'
|
|||
INSERT IGNORE INTO `tables_priv` VALUES ('','bi','claimManager','rotacion','alexm@%','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','bs','grafana','sale','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','zonePromo__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','accountingConfig','alexm@%','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','accountingConfig','carlosap@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Update','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','accountingType','alexm@%','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','agencyMode','alexm@%','0000-00-00 00:00:00','Insert,Update','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','cache','employee','visible','juan@10.5.1.2','0000-00-00 00:00:00','Select','');
|
||||
|
@ -1417,9 +1417,11 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','accountDetail',
|
|||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBoss','project','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBoss','machineDetail','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','workerActivityType','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyerSalesAssistant','route','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','delivery','zoneConfig','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyerSalesAssistant','route','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','workCenter','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerSalesAssistant','Rutas','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','marketingBoss','specialPrice','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','genericAllocation','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','businessReasonEnd','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
|
@ -1488,6 +1490,10 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemBaseTag',
|
|||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemBreederTag','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','itemShelvingLog','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','itemTextureTag','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','travelThermograph','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','thermograph','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerSalesAssistant','Tickets','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','sim','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
/*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */;
|
||||
|
||||
/*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */;
|
||||
|
@ -1873,6 +1879,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesAssistant','subordinateget
|
|||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_afterUpsert','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','util','grafana','dayend','FUNCTION','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','srt','production','buffer_settypebyname','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','grafana','clientGetMana','FUNCTION','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','barcodeToItem','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','ticket_splititempackingtype','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','entry_getCommission','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
|
||||
|
|
|
@ -2569,28 +2569,6 @@ SET character_set_client = utf8;
|
|||
1 AS `Consumo` */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Temporary table structure for view `rotacion`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `rotacion`;
|
||||
/*!50001 DROP VIEW IF EXISTS `rotacion`*/;
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE VIEW `rotacion` AS SELECT
|
||||
1 AS `Id_Article`,
|
||||
1 AS `warehouse_id`,
|
||||
1 AS `total`,
|
||||
1 AS `rotacion`,
|
||||
1 AS `cm3`,
|
||||
1 AS `almacenaje`,
|
||||
1 AS `manipulacion`,
|
||||
1 AS `auxiliar`,
|
||||
1 AS `mermas`,
|
||||
1 AS `cm3reparto`,
|
||||
1 AS `grams` */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Table structure for table `rutasBoard`
|
||||
--
|
||||
|
@ -17481,10 +17459,10 @@ BEGIN
|
|||
/**
|
||||
* Traslada la info de contabilidad relacionada con las facturas recibidas
|
||||
*
|
||||
* @vInvoiceInFk Factura recibida
|
||||
* @vXDiarioFk Id tabla XDiario
|
||||
* @param vInvoiceInFk Factura recibida
|
||||
* @param vXDiarioFk Id tabla XDiario
|
||||
*/
|
||||
DECLARE vInvoiceInOriginalFk INT;
|
||||
DECLARE vInvoiceInOriginalFk INT;
|
||||
DECLARE vDone BOOL DEFAULT FALSE;
|
||||
DECLARE vBase DOUBLE;
|
||||
DECLARE vVat DOUBLE;
|
||||
|
@ -17502,7 +17480,7 @@ BEGIN
|
|||
DECLARE vIsInformativeExportation BOOL DEFAULT FALSE;
|
||||
|
||||
DECLARE vCursor CURSOR FOR
|
||||
SELECT it.taxableBase,
|
||||
SELECT SUM(it.taxableBase),
|
||||
CAST(SUM((( it.taxableBase / 100) * t.PorcentajeIva)) AS DECIMAL (10,2)),
|
||||
t.PorcentajeIva,
|
||||
it.transactionTypeSageFk,
|
||||
|
@ -17681,32 +17659,31 @@ BEGIN
|
|||
FROM vn.invoiceInCorrection
|
||||
WHERE correctingFk = vInvoiceInFk;
|
||||
|
||||
IF vInvoiceInOriginalFk THEN
|
||||
|
||||
IF vInvoiceInOriginalFk THEN
|
||||
UPDATE movContaIVA mci
|
||||
JOIN vn.invoiceInRefund iir ON iir.invoiceInRefundFk = vInvoiceInFk
|
||||
JOIN vn.invoiceInCorrection iic ON iic.correctingFk = vInvoiceInFk
|
||||
JOIN vn.siiTypeInvoiceIn st ON st.id = iic.siiTypeInvoiceInFk
|
||||
JOIN (SELECT issued,
|
||||
SUM(sub.taxableBase) taxableBase,
|
||||
SUM(sub.taxableBase) taxableBase,
|
||||
SUM(ROUND((sub.taxableBase * sub.PorcentajeIva) / 100 , 2)) vat
|
||||
FROM(SELECT issued,
|
||||
SUM(iit.taxableBase) taxableBase,
|
||||
SUM(iit.taxableBase) taxableBase,
|
||||
ti.PorcentajeIva
|
||||
FROM vn.invoiceIn i
|
||||
FROM vn.invoiceIn i
|
||||
JOIN vn.invoiceInTax iit ON iit.invoiceInFk = i.id
|
||||
JOIN sage.TiposIva ti ON ti.CodigoIva = iit.taxTypeSageFk
|
||||
JOIN TiposIva ti ON ti.CodigoIva = iit.taxTypeSageFk
|
||||
WHERE i.id = vInvoiceInOriginalFk
|
||||
GROUP BY ti.CodigoIva)sub
|
||||
)invoiceInOriginal
|
||||
JOIN ClavesOperacion co ON co.Descripcion = 'Factura rectificativa'
|
||||
SET mci.TipoRectificativa = iir.refundCategoryFk,
|
||||
mci.ClaseAbonoRectificativas = iir.refundType,
|
||||
mci.ClaseAbonoRectificativas = iir.refundType,
|
||||
mci.FechaFacturaOriginal = invoiceInOriginal.issued,
|
||||
mci.FechaOperacion = invoiceInOriginal.issued,
|
||||
mci.BaseImponibleOriginal = invoiceInOriginal.taxableBase,
|
||||
mci.CuotaIvaOriginal = invoiceInOriginal.vat,
|
||||
mci.ClaveOperacionFactura = co.ClaveOperacionFactura_
|
||||
WHERE mci.id = vXDiarioFk;
|
||||
|
||||
END IF;
|
||||
END ;;
|
||||
DELIMITER ;
|
||||
|
@ -18178,6 +18155,7 @@ BEGIN
|
|||
UPDATE movContaIVA mci
|
||||
JOIN vn.invoiceOut i ON i.id = vInvoiceOutCorrectedFk
|
||||
JOIN vn.invoiceCorrection ic ON ic.correctedFk = vInvoiceOutCorrectedFk
|
||||
JOIN vn.siiTypeInvoiceOut st ON st.id = ic.siiTypeInvoiceOutFk
|
||||
JOIN (SELECT SUM(IF(IFNULL(e.vatFk, TRUE), iot.taxableBase, 0)) taxableBase,
|
||||
SUM(IF(IFNULL(e.vatFk, TRUE), iot.vat, 0)) vat,
|
||||
SUM(IF(IFNULL(e.vatFk, TRUE), 0, iot.vat)) equ
|
||||
|
@ -18186,8 +18164,8 @@ BEGIN
|
|||
WHERE iot.invoiceOutFk = vInvoiceOutCorrectedFk
|
||||
) tax
|
||||
JOIN ClavesOperacion co ON co.Descripcion = 'Factura rectificativa'
|
||||
SET mci.TipoRectificativa = 2,
|
||||
mci.ClaseAbonoRectificativas = 1,
|
||||
SET mci.TipoRectificativa = ic.cplusRectificationTypeFk,
|
||||
mci.ClaseAbonoRectificativas = REGEXP_REPLACE(st.`code`, '[^0-9]', ''),
|
||||
mci.FechaFacturaOriginal = i.issued,
|
||||
mci.FechaOperacion = i.issued,
|
||||
mci.BaseImponibleOriginal = tax.taxableBase,
|
||||
|
@ -29528,14 +29506,16 @@ CREATE TABLE `deviceProductionUser` (
|
|||
`userFk` int(10) unsigned NOT NULL,
|
||||
`created` timestamp NULL DEFAULT current_timestamp(),
|
||||
`editorFk` int(10) unsigned DEFAULT NULL,
|
||||
`simSerialNumber` text DEFAULT NULL,
|
||||
`simFk` varchar(25) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `deviceProductionUser_unique` (`deviceProductionFk`),
|
||||
KEY `userFgn_idx` (`userFk`),
|
||||
KEY `deviceProductionUser_fk_editor` (`editorFk`),
|
||||
KEY `deviceProductionUser_sim_FK` (`simFk`),
|
||||
CONSTRAINT `deviceProductionUser_PK` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `deviceProductionUser_deviceProduction_FK` FOREIGN KEY (`deviceProductionFk`) REFERENCES `deviceProduction` (`id`),
|
||||
CONSTRAINT `deviceProductionUser_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`)
|
||||
CONSTRAINT `deviceProductionUser_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`),
|
||||
CONSTRAINT `deviceProductionUser_sim_FK` FOREIGN KEY (`simFk`) REFERENCES `sim` (`code`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
|
@ -31354,13 +31334,27 @@ CREATE TABLE `inventoryConfig` (
|
|||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `inventoryFailure`
|
||||
-- Table structure for table `inventoryFailureCause__`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `inventoryFailure`;
|
||||
DROP TABLE IF EXISTS `inventoryFailureCause__`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `inventoryFailure` (
|
||||
CREATE TABLE `inventoryFailureCause__` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`description` varchar(100) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='@deprecated 2024-12-16';
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `inventoryFailure__`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `inventoryFailure__`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `inventoryFailure__` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`dated` date NOT NULL,
|
||||
`itemFk` int(11) NOT NULL,
|
||||
|
@ -31381,22 +31375,8 @@ CREATE TABLE `inventoryFailure` (
|
|||
CONSTRAINT `inventoryFailure_fk2` FOREIGN KEY (`throwerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `inventoryFailure_fk3` FOREIGN KEY (`guiltyFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `inventoryFailure_fk4` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `inventoryFailure_fk5` FOREIGN KEY (`causeFk`) REFERENCES `inventoryFailureCause` (`id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `inventoryFailureCause`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `inventoryFailureCause`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `inventoryFailureCause` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`description` varchar(100) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||
CONSTRAINT `inventoryFailure_fk5` FOREIGN KEY (`causeFk`) REFERENCES `inventoryFailureCause__` (`id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='@deprecated 2024-12-16';
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
|
@ -31554,18 +31534,18 @@ CREATE TABLE `invoiceInCorrection` (
|
|||
`correctingFk` mediumint(8) unsigned NOT NULL COMMENT 'Factura rectificativa',
|
||||
`correctedFk` mediumint(8) unsigned NOT NULL COMMENT 'Factura rectificada',
|
||||
`cplusRectificationTypeFk` int(10) unsigned NOT NULL,
|
||||
`siiTypeInvoiceOutFk` int(10) unsigned NOT NULL,
|
||||
`siiTypeInvoiceInFk` int(10) unsigned NOT NULL,
|
||||
`invoiceCorrectionTypeFk` int(11) NOT NULL DEFAULT 3,
|
||||
PRIMARY KEY (`correctingFk`),
|
||||
KEY `invoiceInCorrection_correctedFk` (`correctedFk`),
|
||||
KEY `invoiceInCorrection_cplusRectificationTypeFk` (`cplusRectificationTypeFk`),
|
||||
KEY `invoiceInCorrection_siiTypeInvoiceOut` (`siiTypeInvoiceOutFk`),
|
||||
KEY `invoiceInCorrection_siiTypeInvoiceIn` (`siiTypeInvoiceInFk`),
|
||||
KEY `invoiceInCorrection_invoiceCorrectionTypeFk` (`invoiceCorrectionTypeFk`),
|
||||
CONSTRAINT `invoiceInCorrection_correctedFk` FOREIGN KEY (`correctedFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `invoiceInCorrection_correctingFk` FOREIGN KEY (`correctingFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `invoiceInCorrection_cplusRectificationTypeFk` FOREIGN KEY (`cplusRectificationTypeFk`) REFERENCES `cplusRectificationType` (`id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `invoiceInCorrection_invoiceCorrectionTypeFk` FOREIGN KEY (`invoiceCorrectionTypeFk`) REFERENCES `invoiceCorrectionType` (`id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `invoiceInCorrection_siiTypeInvoiceOut` FOREIGN KEY (`siiTypeInvoiceOutFk`) REFERENCES `siiTypeInvoiceOut` (`id`) ON UPDATE CASCADE
|
||||
CONSTRAINT `invoiceInCorrection_siiTypeInvoiceIn` FOREIGN KEY (`siiTypeInvoiceInFk`) REFERENCES `siiTypeInvoiceIn` (`id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
|
@ -33837,7 +33817,9 @@ DROP TABLE IF EXISTS `mistakeType`;
|
|||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `mistakeType` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`code` varchar(50) DEFAULT NULL,
|
||||
`description` varchar(45) NOT NULL,
|
||||
`time` int(10) DEFAULT NULL COMMENT 'Segundos que se suelen tardar en arreglar el fallo',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
@ -34204,6 +34186,22 @@ CREATE TABLE `osTicketConfig` (
|
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `osrmConfig`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `osrmConfig`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `osrmConfig` (
|
||||
`id` int(10) unsigned NOT NULL,
|
||||
`url` varchar(100) NOT NULL COMMENT 'Dirección base de la API',
|
||||
`tolerance` decimal(6,6) NOT NULL DEFAULT 0.000000 COMMENT 'Tolerancia entre las coordenadas enviadas y las retornadas',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `osrmConfig_check` CHECK (`id` = 1)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `outgoingInvoiceVat`
|
||||
--
|
||||
|
@ -35763,26 +35761,6 @@ CREATE TABLE `punchState` (
|
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Table for storing punches that have cars with errors';
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `quadmindsApiConfig`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `quadmindsApiConfig`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `quadmindsApiConfig` (
|
||||
`id` int(10) unsigned NOT NULL,
|
||||
`url` varchar(255) DEFAULT NULL,
|
||||
`key` varchar(255) DEFAULT NULL,
|
||||
`maxObjects` int(11) DEFAULT NULL COMMENT 'Número máximo de objetos en el array por petición',
|
||||
`limit` int(11) DEFAULT NULL COMMENT 'Limite de objetos solicitados por petición',
|
||||
`orderTimeFrom` varchar(5) DEFAULT NULL COMMENT 'Inicio de ventana horaria de pedido',
|
||||
`orderTimeTo` varchar(5) DEFAULT NULL COMMENT 'Fin de ventana horaria de pedido',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `quadMindsConfig_check` CHECK (`id` = 1)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `quality`
|
||||
--
|
||||
|
@ -37542,6 +37520,23 @@ CREATE TABLE `siiTypeInvoiceOut` (
|
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Tipo de Factura Emitidas en el suministro de inmediato';
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `sim`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `sim`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `sim` (
|
||||
`code` varchar(25) NOT NULL COMMENT 'No se ha puesto BIGINT por incompatibilidad con Access',
|
||||
`line` varchar(15) NOT NULL CHECK (`line` regexp '^[0-9]+$'),
|
||||
`ext` int(4) NOT NULL,
|
||||
`pin` varchar(4) NOT NULL CHECK (`pin` regexp '^[0-9]+$'),
|
||||
`puk` varchar(15) NOT NULL CHECK (`pin` regexp '^[0-9]+$'),
|
||||
PRIMARY KEY (`code`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `sinister`
|
||||
--
|
||||
|
@ -41255,7 +41250,7 @@ CREATE TABLE `zone` (
|
|||
`hour` datetime NOT NULL,
|
||||
`agencyModeFk` int(11) NOT NULL,
|
||||
`travelingDays` int(11) NOT NULL DEFAULT 1,
|
||||
`price` double NOT NULL DEFAULT 0 CHECK (`price` > 0),
|
||||
`price` decimal(10,2) DEFAULT NULL,
|
||||
`bonus` double NOT NULL DEFAULT 0,
|
||||
`isVolumetric` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`inflation` decimal(5,2) NOT NULL DEFAULT 1.00,
|
||||
|
@ -41264,11 +41259,14 @@ CREATE TABLE `zone` (
|
|||
`code` varchar(45) DEFAULT NULL,
|
||||
`editorFk` int(10) unsigned DEFAULT NULL,
|
||||
`itemMaxLength` int(11) DEFAULT NULL COMMENT 'Longitud maxima para articulos acostados que esa agencia puede transportar',
|
||||
`addressFk` int(11) DEFAULT NULL COMMENT 'Punto de distribución de donde salen para repartir',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `fk_zone_2_idx` (`agencyModeFk`),
|
||||
KEY `zone_name_idx` (`name`),
|
||||
KEY `zone_fk_editor` (`editorFk`),
|
||||
KEY `zone_address_FK` (`addressFk`),
|
||||
CONSTRAINT `fk_zone_2` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||
CONSTRAINT `zone_address_FK` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `zone_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
@ -41318,7 +41316,10 @@ CREATE TABLE `zoneConfig` (
|
|||
`id` int(10) unsigned NOT NULL,
|
||||
`scope` int(10) unsigned NOT NULL,
|
||||
`forwardDays` int(10) NOT NULL DEFAULT 7 COMMENT 'days forward to show zone_upcomingDeliveries',
|
||||
`defaultAddressFk` int(11) DEFAULT NULL COMMENT 'Punto de distribución por defecto',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `zoneConfig_address_FK` (`defaultAddressFk`),
|
||||
CONSTRAINT `zoneConfig_address_FK` FOREIGN KEY (`defaultAddressFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `zoneConfig_check` CHECK (`id` = 1)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
@ -43244,6 +43245,7 @@ BEGIN
|
|||
DECLARE vCurrentCommission INT;
|
||||
DECLARE vIsNotEUR INT;
|
||||
DECLARE vLastEntryFk INT;
|
||||
DECLARE vLanded INT;
|
||||
|
||||
SELECT count(*) INTO vIsNotEUR
|
||||
FROM currency c
|
||||
|
@ -43259,23 +43261,25 @@ BEGIN
|
|||
|
||||
RETURN IFNULL(vCommission, 0);
|
||||
ELSE
|
||||
SELECT landed INTO vLanded
|
||||
FROM travel
|
||||
WHERE id = vTravelFk;
|
||||
|
||||
SELECT e.id INTO vLastEntryFk
|
||||
FROM `entry` e
|
||||
JOIN travel tr ON tr.id = e.travelFk
|
||||
WHERE e.supplierFk = vSupplierFk
|
||||
ORDER BY tr.landed DESC
|
||||
LIMIT 1;
|
||||
WHERE e.supplierFk = vSupplierFk
|
||||
ORDER BY (vLanded <= tr.landed), tr.landed DESC
|
||||
LIMIT 1;
|
||||
|
||||
IF vLastEntryFk THEN
|
||||
SELECT commission INTO vCurrentCommission
|
||||
FROM `entry`
|
||||
WHERE id = vLastEntryFk;
|
||||
|
||||
ELSE
|
||||
SELECT commission INTO vCurrentCommission
|
||||
FROM supplier s
|
||||
WHERE s.id = vSupplierFk;
|
||||
|
||||
END IF;
|
||||
|
||||
RETURN vCurrentCommission;
|
||||
|
@ -49455,7 +49459,7 @@ BEGIN
|
|||
JOIN claimDestination cd ON cd.id = ce.claimDestinationFk
|
||||
JOIN claim c ON c.id = ce.claimFk
|
||||
JOIN claimState cs ON cs.id = c.claimStateFk
|
||||
WHERE cd.description NOT IN ('Bueno', 'Corregido')
|
||||
WHERE cd.code NOT IN ('good', 'corrected', 'supplierClaim')
|
||||
AND NOT ce.isGreuge
|
||||
AND cs.code = 'resolved';
|
||||
|
||||
|
@ -49480,7 +49484,7 @@ BEGIN
|
|||
JOIN claimDestination cd ON cd.id = ce.claimDestinationFk
|
||||
JOIN claim c ON c.id = ce.claimFk
|
||||
JOIN claimState cs ON cs.id = c.claimStateFk
|
||||
WHERE cd.description NOT IN ('Bueno', 'Corregido')
|
||||
WHERE cd.code NOT IN ('good', 'corrected', 'supplierClaim')
|
||||
AND NOT ce.isGreuge
|
||||
AND cs.code = 'resolved'
|
||||
AND c.isChargedToMana;
|
||||
|
@ -49491,7 +49495,7 @@ BEGIN
|
|||
JOIN claim c ON c.id = ce.claimFk
|
||||
JOIN claimState cs ON cs.id = c.claimStateFk
|
||||
SET ce.isGreuge = TRUE
|
||||
WHERE cd.description NOT IN ('Bueno', 'Corregido')
|
||||
WHERE cd.code NOT IN ('good', 'corrected', 'supplierClaim')
|
||||
AND NOT ce.isGreuge
|
||||
AND cs.code = 'resolved';
|
||||
|
||||
|
@ -49570,7 +49574,7 @@ BEGIN
|
|||
JOIN claimDestination cd ON cd.id = ce.claimDestinationFk
|
||||
JOIN claim c ON c.id = ce.claimFk
|
||||
JOIN claimState cs ON cs.id = c.claimStateFk
|
||||
WHERE cd.description NOT IN ('Bueno', 'Corregido')
|
||||
WHERE cd.code NOT IN ('good', 'corrected', 'supplierClaim')
|
||||
AND cs.code = 'resolved'
|
||||
AND c.ticketCreated >= util.VN_CURDATE() - INTERVAL 1 YEAR
|
||||
GROUP BY c.clientFk
|
||||
|
@ -56857,67 +56861,6 @@ BEGIN
|
|||
|
||||
UPDATE greugeConfig
|
||||
SET lastNotifyCheck = vTimeEnd;
|
||||
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 `inventoryFailureAdd` */;
|
||||
/*!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=`vn`@`localhost` PROCEDURE `inventoryFailureAdd`()
|
||||
BEGIN
|
||||
|
||||
DECLARE done BOOL DEFAULT FALSE;
|
||||
DECLARE vTicketFk INT;
|
||||
|
||||
DECLARE rs CURSOR FOR
|
||||
SELECT id FROM vn.ticket
|
||||
WHERE shipped = util.yesterday()
|
||||
AND clientFk = 400
|
||||
AND warehouseFk IN (1,44);
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
||||
|
||||
OPEN rs;
|
||||
|
||||
FETCH rs INTO vTicketFk;
|
||||
|
||||
WHILE NOT done DO
|
||||
|
||||
INSERT INTO vn.inventoryFailure(dated, itemFk, quantity, value, warehouseFk, throwerFk)
|
||||
SELECT t.shipped,
|
||||
s.itemFk,
|
||||
s.quantity,
|
||||
b.buyingValue + b.freightValue + b.packageValue + b.comissionValue,
|
||||
t.warehouseFk,
|
||||
w.id
|
||||
FROM vn.ticket t
|
||||
JOIN vn.sale s ON s.ticketFk = t.id
|
||||
LEFT JOIN cache.last_buy lb ON lb.warehouse_id = t.warehouseFk AND item_id = s.itemFk
|
||||
LEFT JOIN vn.buy b ON b.id = lb.buy_id
|
||||
LEFT JOIN vn.worker w ON w.code = LEFT(s.concept, 3)
|
||||
WHERE t.id = vTicketFk
|
||||
AND s.quantity > 0;
|
||||
|
||||
FETCH rs INTO vTicketFk;
|
||||
|
||||
END WHILE;
|
||||
|
||||
|
||||
CLOSE rs;
|
||||
|
||||
|
||||
|
||||
|
||||
END ;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -57927,7 +57870,7 @@ BEGIN
|
|||
ii.cplusTaxBreakFk,
|
||||
ii.cplusSubjectOpFk,
|
||||
ii.siiTypeInvoiceInFk,
|
||||
ii.cplusRectificationTypeFk,
|
||||
ic.cplusRectificationTypeFk,
|
||||
ii.booked,
|
||||
IFNULL(a.isUeeMember, c.isUeeMember) isUeeMember,
|
||||
(c.id = cc.id) isSameCountry,
|
||||
|
@ -57950,6 +57893,7 @@ BEGIN
|
|||
e.name expenseName
|
||||
FROM invoiceIn ii
|
||||
JOIN supplier s ON s.id = ii.supplierFk
|
||||
LEFT JOIN invoiceInCorrection ic ON ic.correctingFk = ii.id
|
||||
LEFT JOIN province p ON p.id = s.provinceFk
|
||||
LEFT JOIN autonomy a ON a.id = p.autonomyFk
|
||||
JOIN country c ON c.id = s.countryFk
|
||||
|
@ -62647,10 +62591,6 @@ BEGIN
|
|||
SET itemFk = vItemNew
|
||||
WHERE itemFk = vItemOld;
|
||||
|
||||
UPDATE inventoryFailure
|
||||
SET itemFk = vItemNew
|
||||
WHERE itemFk = vItemOld;
|
||||
|
||||
UPDATE genericAllocation
|
||||
SET itemFk = vItemNew
|
||||
WHERE itemFk = vItemOld;
|
||||
|
@ -73325,7 +73265,8 @@ BEGIN
|
|||
IFNULL(dest.nickname, origin.nickname) nickname,
|
||||
dest.landed,
|
||||
dest.preparation,
|
||||
origin.departmentFk
|
||||
origin.departmentFk,
|
||||
origin.saleClonedFk
|
||||
FROM (
|
||||
SELECT s.ticketFk,
|
||||
c.salesPersonFk workerFk,
|
||||
|
@ -73346,11 +73287,13 @@ BEGIN
|
|||
t.warehouseFk,
|
||||
t.companyFk,
|
||||
t.agencyModeFk,
|
||||
wd.departmentFk
|
||||
wd.departmentFk,
|
||||
sc.saleClonedFk
|
||||
FROM ticket t
|
||||
JOIN client c ON c.id = t.clientFk
|
||||
JOIN workerDepartment wd ON wd.workerFk = c.salesPersonFk
|
||||
JOIN sale s ON s.ticketFk = t.id
|
||||
LEFT JOIN saleCloned sc ON sc.saleClonedFk = s.id
|
||||
JOIN saleVolume sv ON sv.saleFk = s.id
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN ticketState ts ON ts.ticketFk = t.id
|
||||
|
@ -77747,8 +77690,8 @@ BEGIN
|
|||
* @param vIsRaid idRaid value
|
||||
* @param vDaysInForward daysInForward value
|
||||
*/
|
||||
IF (NOT vIsRaid AND vDaysInForward IS NOT NULL) OR (vIsRaid AND vDaysInForward IS NULL) THEN
|
||||
CALL util.throw('The raid information is not correct');
|
||||
IF NOT vIsRaid AND vDaysInForward THEN
|
||||
CALL util.throw('If daysInForward has a value, the raid cannot be unchecked');
|
||||
END IF;
|
||||
END ;;
|
||||
DELIMITER ;
|
||||
|
@ -78115,22 +78058,15 @@ BEGIN
|
|||
DECLARE vDone BOOL DEFAULT FALSE;
|
||||
DECLARE vBuyerEmail VARCHAR(40);
|
||||
DECLARE vTravelLink TEXT;
|
||||
DECLARE vMailBody TEXT DEFAULT '';
|
||||
DECLARE vMailBody TEXT;
|
||||
DECLARE vDaysBetweenDates INT;
|
||||
DECLARE vSubject VARCHAR(30);
|
||||
|
||||
DECLARE vCur CURSOR FOR
|
||||
SELECT GROUP_CONCAT(DISTINCT
|
||||
CONCAT('https://salix.verdnatura.es/#!/travel/',
|
||||
ttm.travelFk,
|
||||
'/summary ')
|
||||
ORDER BY ttm.travelFk SEPARATOR '\n\r') travelLink,
|
||||
CONCAT(u.name, '@verdnatura.es') buyerEmail
|
||||
FROM tTravelToMove ttm
|
||||
JOIN entry e ON e.travelFk = ttm.travelFk
|
||||
JOIN buy b ON b.entryFk = e.id
|
||||
JOIN item i ON i.id = b.itemFk
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
JOIN account.user u ON u.id = it.workerFk
|
||||
GROUP BY u.name;
|
||||
DECLARE vTravels CURSOR FOR
|
||||
SELECT GROUP_CONCAT(DISTINCT travelLink ORDER BY id SEPARATOR '\n\r'),
|
||||
buyerEmail
|
||||
FROM tTravelToMove
|
||||
GROUP BY buyerEmail;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
|
||||
|
@ -78141,35 +78077,50 @@ BEGIN
|
|||
END;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tTravelToMove
|
||||
SELECT id travelFk,
|
||||
util.VN_CURDATE() + INTERVAL daysInForward DAY newLanded
|
||||
FROM travel
|
||||
WITH travels AS (
|
||||
SELECT id,
|
||||
CONCAT('https://salix.verdnatura.es/#!/travel/', id,'/summary') travelLink,
|
||||
util.VN_CURDATE() + INTERVAL daysInForward DAY newLanded,
|
||||
util.VN_CURDATE() - INTERVAL DATEDIFF(landed, shipped) + daysInForward DAY newShipped
|
||||
FROM vn.travel
|
||||
WHERE isRaid
|
||||
AND daysInForward;
|
||||
AND daysInForward
|
||||
)SELECT t.id,
|
||||
t.travelLink,
|
||||
t.newLanded,
|
||||
t.newShipped,
|
||||
CONCAT(u.name, '@verdnatura.es') buyerEmail
|
||||
FROM travels t
|
||||
STRAIGHT_JOIN vn.entry e ON e.travelFk = t.id
|
||||
JOIN vn.buy b ON b.entryFk = e.id
|
||||
JOIN vn.item i ON i.id = b.itemFk
|
||||
JOIN vn.itemType it ON it.id = i.typeFk
|
||||
JOIN account.user u ON u.id = it.workerFk
|
||||
GROUP BY t.id;
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
UPDATE travel tr
|
||||
JOIN tTravelToMove ttm ON ttm.travelFk = tr.id
|
||||
SET tr.landed = ttm.newLanded;
|
||||
JOIN tTravelToMove ttm ON ttm.id = tr.id
|
||||
SET tr.landed = ttm.newLanded,
|
||||
tr.shipped = ttm.newShipped;
|
||||
|
||||
OPEN vCur;
|
||||
OPEN vTravels;
|
||||
|
||||
l: LOOP
|
||||
SET vDone = FALSE;
|
||||
FETCH vCur INTO vTravelLink, vBuyerEmail;
|
||||
FETCH vTravels INTO vTravelLink, vBuyerEmail;
|
||||
|
||||
IF vDone THEN
|
||||
LEAVE l;
|
||||
END IF;
|
||||
|
||||
CALL `vn`.`mail_insert`(
|
||||
vBuyerEmail,
|
||||
'noreply@verdnatura.es',
|
||||
'Cambio de fecha en Redadas',
|
||||
CONCAT('Se ha movido los siguientes travels: \n\r ', vTravelLink));
|
||||
SET vSubject = 'Cambio de fecha en Redadas',
|
||||
vMailBody = CONCAT('Se ha movido los siguientes travels: \n\r ', vTravelLink);
|
||||
|
||||
CALL mail_insert(vBuyerEmail, 'noreply@verdnatura.es', vSubject, vMailBody);
|
||||
END LOOP;
|
||||
CLOSE vCur;
|
||||
CLOSE vTravels;
|
||||
COMMIT;
|
||||
DROP TEMPORARY TABLE tTravelToMove;
|
||||
END ;;
|
||||
|
@ -85618,24 +85569,6 @@ USE `bi`;
|
|||
/*!50001 SET character_set_results = @saved_cs_results */;
|
||||
/*!50001 SET collation_connection = @saved_col_connection */;
|
||||
|
||||
--
|
||||
-- Final view structure for view `rotacion`
|
||||
--
|
||||
|
||||
/*!50001 DROP VIEW IF EXISTS `rotacion`*/;
|
||||
/*!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 `rotacion` AS select `ic`.`itemFk` AS `Id_Article`,`ic`.`warehouseFk` AS `warehouse_id`,`ic`.`quantity` AS `total`,`ic`.`rotation` AS `rotacion`,`ic`.`cm3` AS `cm3`,`ic`.`storage` AS `almacenaje`,`ic`.`handling` AS `manipulacion`,`ic`.`extraCharge` AS `auxiliar`,`ic`.`wasted` AS `mermas`,`ic`.`cm3delivery` AS `cm3reparto`,`ic`.`grams` AS `grams` from `vn`.`itemCost` `ic` */;
|
||||
/*!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 `tarifa_componentes`
|
||||
--
|
||||
|
@ -90949,4 +90882,4 @@ USE `vn2008`;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2024-12-10 8:17:51
|
||||
-- Dump completed on 2025-01-07 6:51:38
|
||||
|
|
|
@ -5701,7 +5701,7 @@ BEGIN
|
|||
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
IF (SELECT COUNT(*) FROM vn.invoiceIn
|
||||
IF (SELECT COUNT(*) FROM invoiceIn
|
||||
WHERE supplierRef = NEW.supplierRef
|
||||
AND supplierFk = NEW.supplierFk
|
||||
AND YEAR(issued) = YEAR(NEW.issued)
|
||||
|
@ -5713,7 +5713,7 @@ BEGIN
|
|||
IF NEW.supplierFk != OLD.supplierFk THEN
|
||||
CALL supplier_checkIsActive(NEW.supplierFk);
|
||||
SELECT withholdingSageFk INTO vWithholdingSageFk
|
||||
FROM vn.supplier
|
||||
FROM supplier
|
||||
WHERE id = NEW.supplierFk;
|
||||
SET NEW.withholdingSageFk = vWithholdingSageFk;
|
||||
END IF;
|
||||
|
@ -5737,25 +5737,31 @@ DELIMITER ;;
|
|||
AFTER UPDATE ON `invoiceIn`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
IF NEW.issued != OLD.issued
|
||||
OR NEW.currencyFk != OLD.currencyFk THEN
|
||||
DECLARE vIsEuro BOOL;
|
||||
|
||||
SELECT `code` = 'EUR' INTO vIsEuro
|
||||
FROM currency
|
||||
WHERE id = NEW.currencyFk;
|
||||
|
||||
IF (NOT NEW.issued <=> OLD.issued
|
||||
OR NEW.currencyFk <> OLD.currencyFk) THEN
|
||||
|
||||
UPDATE invoiceInTax iit
|
||||
JOIN invoiceIn ii ON ii.id = iit.invoiceInFk
|
||||
LEFT JOIN referenceRate rr ON rr.dated = ii.issued
|
||||
AND rr.currencyFk = ii.currencyFk
|
||||
SET iit.taxableBase = IF(iit.foreignValue IS NULL, iit.taxableBase, iit.foreignValue / rr.value)
|
||||
SET iit.taxableBase = IF(vIsEuro, iit.taxableBase, iit.foreignValue / rr.value),
|
||||
iit.foreignValue = IF(vIsEuro, NULL, iit.foreignValue)
|
||||
WHERE ii.id = NEW.id;
|
||||
|
||||
UPDATE invoiceInDueDay iidd
|
||||
JOIN invoiceIn ii ON ii.id = iidd.invoiceInFk
|
||||
LEFT JOIN referenceRate rr ON rr.dated = ii.issued
|
||||
AND rr.currencyFk = ii.currencyFk
|
||||
SET iidd.amount = IF(iidd.foreignValue IS NULL, iidd.amount, iidd.foreignValue / rr.value)
|
||||
SET iidd.amount = IF(vIsEuro, iidd.amount, iidd.foreignValue / rr.value),
|
||||
iidd.foreignValue = IF(vIsEuro, NULL, iidd.foreignValue)
|
||||
WHERE ii.id = NEW.id;
|
||||
|
||||
END IF;
|
||||
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -8161,6 +8167,7 @@ BEGIN
|
|||
OR !(NEW.workerFk <=> OLD.workerFk)
|
||||
OR !(NEW.m3 <=> OLD.m3)
|
||||
OR !(NEW.agencyModeFk <=> OLD.agencyModeFk)
|
||||
OR !(NEW.dated <=> OLD.dated)
|
||||
OR !(NEW.vehicleFk <=> OLD.vehicleFk)THEN
|
||||
CALL route_calcCommission(NEW.id);
|
||||
END IF;
|
||||
|
@ -10582,6 +10589,10 @@ BEGIN
|
|||
CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk);
|
||||
END IF;
|
||||
|
||||
IF NOT (NEW.isRaid <=> OLD.isRaid) OR NOT (NEW.daysInForward <=> OLD.daysInForward) THEN
|
||||
CALL travel_checkRaid(NEW.isRaid, NEW.daysInForward);
|
||||
END IF;
|
||||
|
||||
IF NOT (NEW.awbFk <=> OLD.awbFk)THEN
|
||||
SELECT COUNT(*) INTO vHasAnyInvoiceBooked
|
||||
FROM travel t
|
||||
|
@ -11488,4 +11499,4 @@ USE `vn2008`;
|
|||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2024-12-10 8:18:11
|
||||
-- Dump completed on 2025-01-07 6:51:57
|
||||
|
|
|
@ -426,50 +426,50 @@ INSERT INTO `vn`.`clientConfig`(`id`, `riskTolerance`, `maxCreditRows`, `maxPric
|
|||
(1, 200, 10, 0.25, 2, 4, 5, 300.00, 1, 1, 2);
|
||||
|
||||
|
||||
INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `phone`, `mobile`, `isActive`, `clientFk`, `agencyModeFk`, `longitude`, `latitude`, `isEqualizated`, `isDefaultAddress`)
|
||||
INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `phone`, `mobile`, `isActive`, `clientFk`, `agencyModeFk`, `longitude`, `latitude`, `isEqualizated`, `isDefaultAddress`, `customsAgentFk`)
|
||||
VALUES
|
||||
(1, 'Bruce Wayne', '1007 Mountain Drive, Gotham', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1101, 2, -74.1111111, 10.1111111, 0, 1),
|
||||
(2, 'Petter Parker', '20 Ingram Street', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1102, 2, -74.2222222, 10.2222222, 0, 1),
|
||||
(3, 'Clark Kent', '344 Clinton Street', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1103, 2, -74.3333333, 10.3333333, 0, 1),
|
||||
(4, 'Tony Stark', '10880 Malibu Point', 'Gotham', 46460, 1, 1111111111, 222222222, 1 , 1104, 2, -74.4444444, 10.4444444, 0, 1),
|
||||
(5, 'Max Eisenhardt', 'Unknown Whereabouts', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1105, 2, NULL, NULL, 0, 1),
|
||||
(6, 'DavidCharlesHaller', 'Evil hideout', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1106, 2, NULL, NULL, 0, 1),
|
||||
(7, 'Hank Pym', 'Anthill', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1107, 2, NULL, NULL, 0, 1),
|
||||
(8, 'Charles Xavier', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Gotham', 46460, 5, 1111111111, 222222222, 1, 1108, 2, NULL, NULL, 0, 1),
|
||||
(9, 'Bruce Banner', 'Somewhere in New York', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 1),
|
||||
(10, 'Jessica Jones', 'NYCC 2015 Poster', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1110, 2, NULL, NULL, 0, 1),
|
||||
(11, 'Missing', 'The space', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1111, 10, NULL, NULL, 0, 1),
|
||||
(12, 'Trash', 'New York city', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1112, 10, NULL, NULL, 0, 1),
|
||||
(101, 'Somewhere in Thailand', 'address 01', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0),
|
||||
(102, 'Somewhere in Poland', 'address 02', 'Gotham', 46460, 1, 3333333333, 444444444, 1, 1109, 2, NULL, NULL, 0, 0),
|
||||
(103, 'Somewhere in Japan', 'address 03', 'Gotham', 46460, 1, 3333333333, 444444444, 1, 1109, 2, NULL, NULL, 0, 0),
|
||||
(104, 'Somewhere in Spain', 'address 04', 'Gotham', 46460, 1, 3333333333, 444444444, 1, 1109, 2, NULL, NULL, 0, 0),
|
||||
(105, 'Somewhere in Potugal', 'address 05', 'Gotham', 46460, 1, 5555555555, 666666666, 1, 1109, 2, NULL, NULL, 0, 0),
|
||||
(106, 'Somewhere in UK', 'address 06', 'Gotham', 46460, 1, 5555555555, 666666666, 1, 1109, 2, NULL, NULL, 0, 0),
|
||||
(107, 'Somewhere in Valencia', 'address 07', 'Gotham', 46460, 1, 5555555555, 666666666, 1, 1109, 2, NULL, NULL, 0, 0),
|
||||
(108, 'Somewhere in Gotham', 'address 08', 'Gotham', 46460, 1, 5555555555, 666666666, 1, 1109, 2, NULL, NULL, 0, 0),
|
||||
(109, 'Somewhere in London', 'address 09', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0),
|
||||
(110, 'Somewhere in Algemesi', 'address 10', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0),
|
||||
(111, 'Somewhere in Carlet', 'address 11', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0),
|
||||
(112, 'Somewhere in Campanar', 'address 12', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0),
|
||||
(113, 'Somewhere in Malilla', 'address 13', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0),
|
||||
(114, 'Somewhere in France', 'address 14', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0),
|
||||
(115, 'Somewhere in Birmingham', 'address 15', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0),
|
||||
(116, 'Somewhere in Scotland', 'address 16', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0),
|
||||
(117, 'Somewhere in nowhere', 'address 17', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0),
|
||||
(118, 'Somewhere over the rainbow', 'address 18', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0),
|
||||
(119, 'Somewhere in Alberic', 'address 19', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0),
|
||||
(120, 'Somewhere in Montortal', 'address 20', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0),
|
||||
(121, 'the bat cave', 'address 21', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1101, 2, NULL, NULL, 0, 0),
|
||||
(122, 'NY roofs', 'address 22', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1102, 2, NULL, NULL, 0, 0),
|
||||
(123, 'The phone box', 'address 23', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1103, 2, -74.555555, 10.555555, 0, 0),
|
||||
(124, 'Stark tower Gotham', 'address 24', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1104, 2, NULL, NULL, 0, 0),
|
||||
(125, 'The plastic cell', 'address 25', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1105, 2, NULL, NULL, 0, 0),
|
||||
(126, 'Many places', 'address 26', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1106, 2, NULL, NULL, 0, 0),
|
||||
(127, 'Your pocket', 'address 27', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1107, 2, NULL, NULL, 0, 0),
|
||||
(128, 'Cerebro', 'address 28', 'Gotham', 46460, 5, 1111111111, 222222222, 1, 1108, 2, NULL, NULL, 0, 0),
|
||||
(129, 'Luke Cages Bar', 'address 29', 'Gotham', 'EC170150', 1, 1111111111, 222222222, 1, 1110, 2, NULL, NULL, 0, 0),
|
||||
(130, 'Non valid address', 'address 30', 'Gotham', 46460, 1, 1111111111, 222222222, 0, 1101, 2, NULL, NULL, 0, 0);
|
||||
(1, 'Bruce Wayne', '1007 Mountain Drive, Gotham', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1101, 2, -74.1111111, 10.1111111, 0, 1, 1),
|
||||
(2, 'Petter Parker', '20 Ingram Street', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1102, 2, -74.2222222, 10.2222222, 0, 1, NULL),
|
||||
(3, 'Clark Kent', '344 Clinton Street', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1103, 2, -74.3333333, 10.3333333, 0, 1, NULL),
|
||||
(4, 'Tony Stark', '10880 Malibu Point', 'Gotham', 46460, 1, 1111111111, 222222222, 1 , 1104, 2, -74.4444444, 10.4444444, 0, 1, NULL),
|
||||
(5, 'Max Eisenhardt', 'Unknown Whereabouts', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1105, 2, NULL, NULL, 0, 1, NULL),
|
||||
(6, 'DavidCharlesHaller', 'Evil hideout', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1106, 2, NULL, NULL, 0, 1, NULL),
|
||||
(7, 'Hank Pym', 'Anthill', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1107, 2, NULL, NULL, 0, 1, NULL),
|
||||
(8, 'Charles Xavier', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Gotham', 46460, 5, 1111111111, 222222222, 1, 1108, 2, NULL, NULL, 0, 1, NULL),
|
||||
(9, 'Bruce Banner', 'Somewhere in New York', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 1, NULL),
|
||||
(10, 'Jessica Jones', 'NYCC 2015 Poster', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1110, 2, NULL, NULL, 0, 1, NULL),
|
||||
(11, 'Missing', 'The space', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1111, 10, NULL, NULL, 0, 1, NULL),
|
||||
(12, 'Trash', 'New York city', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1112, 10, NULL, NULL, 0, 1, NULL),
|
||||
(101, 'Somewhere in Thailand', 'address 01', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0, NULL),
|
||||
(102, 'Somewhere in Poland', 'address 02', 'Gotham', 46460, 1, 3333333333, 444444444, 1, 1109, 2, NULL, NULL, 0, 0, NULL),
|
||||
(103, 'Somewhere in Japan', 'address 03', 'Gotham', 46460, 1, 3333333333, 444444444, 1, 1109, 2, NULL, NULL, 0, 0, NULL),
|
||||
(104, 'Somewhere in Spain', 'address 04', 'Gotham', 46460, 1, 3333333333, 444444444, 1, 1109, 2, NULL, NULL, 0, 0, NULL),
|
||||
(105, 'Somewhere in Potugal', 'address 05', 'Gotham', 46460, 1, 5555555555, 666666666, 1, 1109, 2, NULL, NULL, 0, 0, NULL),
|
||||
(106, 'Somewhere in UK', 'address 06', 'Gotham', 46460, 1, 5555555555, 666666666, 1, 1109, 2, NULL, NULL, 0, 0, NULL),
|
||||
(107, 'Somewhere in Valencia', 'address 07', 'Gotham', 46460, 1, 5555555555, 666666666, 1, 1109, 2, NULL, NULL, 0, 0, NULL),
|
||||
(108, 'Somewhere in Gotham', 'address 08', 'Gotham', 46460, 1, 5555555555, 666666666, 1, 1109, 2, NULL, NULL, 0, 0, NULL),
|
||||
(109, 'Somewhere in London', 'address 09', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0, NULL),
|
||||
(110, 'Somewhere in Algemesi', 'address 10', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0, NULL),
|
||||
(111, 'Somewhere in Carlet', 'address 11', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0, NULL),
|
||||
(112, 'Somewhere in Campanar', 'address 12', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0, NULL),
|
||||
(113, 'Somewhere in Malilla', 'address 13', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0, NULL),
|
||||
(114, 'Somewhere in France', 'address 14', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0, NULL),
|
||||
(115, 'Somewhere in Birmingham', 'address 15', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0, NULL),
|
||||
(116, 'Somewhere in Scotland', 'address 16', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0, NULL),
|
||||
(117, 'Somewhere in nowhere', 'address 17', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0, NULL),
|
||||
(118, 'Somewhere over the rainbow', 'address 18', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0, NULL),
|
||||
(119, 'Somewhere in Alberic', 'address 19', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0, NULL),
|
||||
(120, 'Somewhere in Montortal', 'address 20', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 0, NULL),
|
||||
(121, 'the bat cave', 'address 21', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1101, 2, NULL, NULL, 0, 0, NULL),
|
||||
(122, 'NY roofs', 'address 22', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1102, 2, NULL, NULL, 0, 0, NULL),
|
||||
(123, 'The phone box', 'address 23', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1103, 2, -74.555555, 10.555555, 0, 0, NULL),
|
||||
(124, 'Stark tower Gotham', 'address 24', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1104, 2, NULL, NULL, 0, 0, NULL),
|
||||
(125, 'The plastic cell', 'address 25', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1105, 2, NULL, NULL, 0, 0, NULL),
|
||||
(126, 'Many places', 'address 26', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1106, 2, NULL, NULL, 0, 0, NULL),
|
||||
(127, 'Your pocket', 'address 27', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1107, 2, NULL, NULL, 0, 0, NULL),
|
||||
(128, 'Cerebro', 'address 28', 'Gotham', 46460, 5, 1111111111, 222222222, 1, 1108, 2, NULL, NULL, 0, 0, NULL),
|
||||
(129, 'Luke Cages Bar', 'address 29', 'Gotham', 'EC170150', 1, 1111111111, 222222222, 1, 1110, 2, NULL, NULL, 0, 0, NULL),
|
||||
(130, 'Non valid address', 'address 30', 'Gotham', 46460, 1, 1111111111, 222222222, 0, 1101, 2, NULL, NULL, 0, 0, NULL);
|
||||
|
||||
INSERT INTO `vn`.`address`( `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `isActive`, `clientFk`, `agencyModeFk`, `isDefaultAddress`)
|
||||
SELECT name, CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, 1, id, 2, 1
|
||||
|
@ -648,13 +648,13 @@ INSERT INTO `vn`.`invoiceOutSerial`
|
|||
('X', 'Exportación global', 0, 'WORLD', 0, 'global'),
|
||||
('N', 'Múltiple Intracomunitaria', 0, 'CEE', 1, 'multiple');
|
||||
|
||||
INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`)
|
||||
INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`, `customsAgentFk`, `incotermsFk`)
|
||||
VALUES
|
||||
(1, 'T', 1026.24, util.VN_CURDATE(), 1101, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
|
||||
(2, 'T', 121.36, util.VN_CURDATE(), 1102, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
|
||||
(3, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
|
||||
(4, 'T', 8.88, util.VN_CURDATE(), 1104, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
|
||||
(5, 'A', 8.88, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1103, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 0);
|
||||
(1, 'E', 1026.24, util.VN_CURDATE(), 1101, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0, 1, 'FAS'),
|
||||
(2, 'T', 121.36, util.VN_CURDATE(), 1102, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0, NULL, NULL),
|
||||
(3, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0, NULL, NULL),
|
||||
(4, 'T', 8.88, util.VN_CURDATE(), 1104, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0, NULL, NULL),
|
||||
(5, 'A', 8.88, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1103, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 0, NULL, NULL);
|
||||
|
||||
UPDATE `vn`.`invoiceOut` SET ref = 'T1111111' WHERE id = 1;
|
||||
UPDATE `vn`.`invoiceOut` SET ref = 'T2222222' WHERE id = 2;
|
||||
|
@ -974,26 +974,30 @@ INSERT INTO `vn`.`itemFamily`(`code`, `description`)
|
|||
('SER', 'Services'),
|
||||
('VT', 'Sales');
|
||||
|
||||
INSERT INTO `vn`.`item`(`id`, `typeFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenseFk`,
|
||||
`comment`, `relevancy`, `image`, `subName`, `minPrice`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `weightByPiece`)
|
||||
VALUES
|
||||
(1, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 'EMB', 0, NULL, 'V', 0, 3),
|
||||
(2, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 'VT', 0, NULL, 'H', 0, 2),
|
||||
(3, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 'VT', 0, NULL, NULL, 0, 5),
|
||||
(4, 1, 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL),
|
||||
(5, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL),
|
||||
(6, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL),
|
||||
(7, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL),
|
||||
(8, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL),
|
||||
(9, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 'VT', 1, NULL, NULL, 0, NULL),
|
||||
(10, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL),
|
||||
(11, 1, 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL),
|
||||
(12, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL),
|
||||
(13, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 'VT', 1, NULL, NULL, 1, NULL),
|
||||
(14, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'VT', 1, NULL, NULL, 0, NULL),
|
||||
(15, 4, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'EMB', 0, NULL, NULL, 0, NULL),
|
||||
(16, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'EMB', 0, NULL, NULL, 0, NULL),
|
||||
(71, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL);
|
||||
INSERT INTO `vn`.`item`(
|
||||
`id`, `typeFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenseFk`,
|
||||
`comment`, `relevancy`, `image`, `subName`, `minPrice`, `family`, `isFloramondo`, `genericFk`,
|
||||
`itemPackingTypeFk`, `hasMinPrice`, `weightByPiece`, `isCustomInspectionRequired`
|
||||
)
|
||||
VALUES
|
||||
(1, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 'EMB', 0, NULL, 'V', 0, 3, 1),
|
||||
(2, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 'VT', 0, NULL, 'H', 0, 2, 1),
|
||||
(3, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 'VT', 0, NULL, NULL, 0, 5, 0),
|
||||
(4, 1, 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL, 0),
|
||||
(5, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL, 0),
|
||||
(6, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL, 0),
|
||||
(7, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL, 0),
|
||||
(8, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL, 0),
|
||||
(9, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 'VT', 1, NULL, NULL, 0, NULL, 0),
|
||||
(10, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL, 0),
|
||||
(11, 1, 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL, 0),
|
||||
(12, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL, 0),
|
||||
(13, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 'VT', 1, NULL, NULL, 1, NULL, 0),
|
||||
(14, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'VT', 1, NULL, NULL, 0, NULL, 0),
|
||||
(15, 4, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'EMB', 0, NULL, NULL, 0, NULL, 0),
|
||||
(16, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'EMB', 0, NULL, NULL, 0, NULL, 0),
|
||||
(71, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL, 0);
|
||||
|
||||
|
||||
-- Update the taxClass after insert of the items
|
||||
UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2
|
||||
|
@ -1517,7 +1521,7 @@ INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseO
|
|||
(10, DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), 5, 1, 1, 50.00, 500, 'nineth travel', 1, 2, 10, TRUE, 2),
|
||||
(11, util.VN_CURDATE() - INTERVAL 1 DAY , util.VN_CURDATE(), 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4, FALSE, NULL),
|
||||
(12, util.VN_CURDATE() , util.VN_CURDATE() + INTERVAL 1 DAY, 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4, FALSE, NULL),
|
||||
(13, util.VN_CURDATE() - INTERVAL 1 MONTH - INTERVAL 1 DAY, util.VN_CURDATE() - INTERVAL 1 MONTH, 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4, FALSE, NULL);
|
||||
(13, util.VN_CURDATE() - INTERVAL 1 MONTH - INTERVAL 1 DAY, util.VN_CURDATE() - INTERVAL 1 MONTH, 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4, FALSE, NULL);
|
||||
|
||||
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `evaNotes`, `typeFk`)
|
||||
VALUES
|
||||
|
@ -1575,7 +1579,7 @@ INSERT INTO `bs`.`waste`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `sal
|
|||
(15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()),
|
||||
(16, 99,1,50.0000, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.60, 99.40, 0, 1, 0, 1.00, '2024-07-30 08:13:51.000'),
|
||||
(17, 11, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 2 MONTH),
|
||||
(18, 12, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'grouping', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 2 MONTH);
|
||||
(18, 12, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'grouping', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 2 MONTH);
|
||||
|
||||
INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`,`total`, `date_make`, `first_row_stamp`, `confirm_date`)
|
||||
VALUES
|
||||
|
@ -3968,7 +3972,7 @@ VALUES(1, '');
|
|||
|
||||
INSERT INTO dipole.expedition_PrintOut (expeditionFk, ticketFk, addressFk, street, postalCode, city, shopName, isPrinted, created, printerFk, routeFk, parkingCode,
|
||||
truckName, clientFk, phone, province, agency, m3, workerCode, itemFk, quantity, longName, shelvingFk, comments)
|
||||
VALUES(1, 1, 0, ' ', ' ', ' ', ' ', 0, '2001-01-01 00:00:00', 1, 0, ' ', ' ', 0, NULL, '', NULL, 0.000, NULL, 10, NULL, NULL, 'NCC', NULL);
|
||||
VALUES(1, 1, 0, ' ', ' ', ' ', ' ', 0, '2001-01-01 00:00:00', 1, 0, ' ', ' ', 0, NULL, '', NULL, 0.000, NULL, 10, NULL, 'Ranged Reinforced weapon sniper rifle 700mm' , 'NCC', NULL);
|
||||
|
||||
INSERT INTO vn.accountDetail
|
||||
(id, value, accountDetailTypeFk, supplierAccountFk)
|
||||
|
@ -4041,7 +4045,7 @@ INSERT IGNORE INTO vn.saySimpleConfig (url, defaultChannel)
|
|||
INSERT INTO vn.workerIrpf (workerFk,spouseNif, geographicMobilityDate)
|
||||
VALUES (1106,'26493101E','2019-09-20');
|
||||
|
||||
INSERT INTO vn.referenceRate (currencyFk, dated, value)
|
||||
INSERT INTO vn.referenceRate (currencyFk, dated, value)
|
||||
VALUES (2, '2000-12-01', 1.0495),
|
||||
(2, '2001-01-01', 1.0531),
|
||||
(2, '2001-02-01', 7.6347);
|
||||
|
|
|
@ -107,7 +107,7 @@ BEGIN
|
|||
) INTO vHas0Amount;
|
||||
|
||||
IF vHas0Amount THEN
|
||||
CALL util.throw('Hay líneas vacías. Por favor, elimínelas');
|
||||
CALL util.throw('orderLinesWithZero');
|
||||
END IF;
|
||||
|
||||
START TRANSACTION;
|
||||
|
|
|
@ -34,6 +34,7 @@ BEGIN
|
|||
DECLARE vMaxShipped DATE;
|
||||
DECLARE vDone BOOL;
|
||||
DECLARE vTicketFk INT;
|
||||
DECLARE vAddressFk INT;
|
||||
DECLARE vCursor CURSOR FOR
|
||||
SELECT id
|
||||
FROM tmp.ticketToInvoice;
|
||||
|
@ -48,11 +49,13 @@ BEGIN
|
|||
DATE(vInvoiceDate) >= invoiceOut_getMaxIssued(
|
||||
vSerial,
|
||||
t.companyFk,
|
||||
YEAR(vInvoiceDate))
|
||||
YEAR(vInvoiceDate)),
|
||||
t.addressFk
|
||||
INTO vClientFk,
|
||||
vCompanyFk,
|
||||
vMaxShipped,
|
||||
vIsCorrectInvoiceDate
|
||||
vIsCorrectInvoiceDate,
|
||||
vAddressFk
|
||||
FROM tmp.ticketToInvoice tt
|
||||
JOIN ticket t ON t.id = tt.id;
|
||||
|
||||
|
@ -105,7 +108,9 @@ BEGIN
|
|||
clientFk,
|
||||
dued,
|
||||
companyFk,
|
||||
siiTypeInvoiceOutFk
|
||||
siiTypeInvoiceOutFk,
|
||||
customsAgentFk,
|
||||
incotermsFk
|
||||
)
|
||||
SELECT
|
||||
1,
|
||||
|
@ -118,9 +123,12 @@ BEGIN
|
|||
vCplusCorrectingInvoiceTypeFk,
|
||||
IF(vSerial = vSimplifiedSerial,
|
||||
vCplusSimplifiedInvoiceTypeFk,
|
||||
vCplusStandardInvoiceTypeFk))
|
||||
FROM client
|
||||
WHERE id = vClientFk;
|
||||
vCplusStandardInvoiceTypeFk)),
|
||||
a.customsAgentFk,
|
||||
a.incotermsFk
|
||||
FROM client c
|
||||
JOIN address a ON a.id = vAddressFk
|
||||
WHERE c.id = vClientFk;
|
||||
|
||||
SET vNewInvoiceId = LAST_INSERT_ID();
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerManaExcluded_beforeInsert`
|
||||
BEFORE INSERT ON `workerManaExcluded`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
DELETE FROM workerMana
|
||||
WHERE workerFk = NEW.workerFk;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,9 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerManaExcluded_beforeUpdate`
|
||||
BEFORE UPDATE ON `workerManaExcluded`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
DELETE FROM workerMana
|
||||
WHERE workerFk = NEW.workerFk;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,10 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerMana_beforeInsert`
|
||||
BEFORE INSERT ON `workerMana`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
IF (SELECT EXISTS(SELECT TRUE FROM workerManaExcluded WHERE workerFk = NEW.workerFk)) THEN
|
||||
CALL util.throw('Worker is excluded from mana');
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,10 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerMana_beforeUpdate`
|
||||
BEFORE UPDATE ON `workerMana`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
IF (SELECT EXISTS(SELECT TRUE FROM workerManaExcluded WHERE workerFk = NEW.workerFk)) THEN
|
||||
CALL util.throw('Worker is excluded from mana');
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,15 @@
|
|||
ALTER TABLE vn.invoiceOut ADD COLUMN IF NOT EXISTS customsAgentFk INT(11) DEFAULT NULL AFTER siiTrascendencyInvoiceOutFk;
|
||||
ALTER TABLE vn.invoiceOut ADD COLUMN IF NOT EXISTS incotermsFk varchar(3) DEFAULT NULL AFTER customsAgentFk;
|
||||
|
||||
ALTER TABLE vn.invoiceOut ADD CONSTRAINT invoiceOut_customsAgentFk FOREIGN KEY (customsAgentFk)
|
||||
REFERENCES vn.customsAgent (id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE vn.invoiceOut ADD CONSTRAINT invoiceOut_incotermsFk FOREIGN KEY (incotermsFk)
|
||||
REFERENCES vn.incoterms (`code`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
UPDATE vn.invoiceOut io
|
||||
JOIN vn.client c ON c.id = io.clientFk
|
||||
JOIN vn.ticket t ON t.clientFk = c.id
|
||||
JOIN vn.address a ON a.id = t.addressFk
|
||||
SET io.customsAgentFk = a.customsAgentFk,
|
||||
io.incotermsFk = a.incotermsFk;
|
|
@ -0,0 +1,11 @@
|
|||
INSERT INTO hedera.message (code, description)
|
||||
VALUES ('orderLinesWithZero','There are empty lines. Please delete them');
|
||||
|
||||
INSERT INTO hedera.messageI18n (code, lang, description)
|
||||
VALUES ('orderLinesWithZero','es','Hay líneas vacías. Por favor, elimínelas');
|
||||
|
||||
INSERT INTO hedera.messageI18n (code, lang, description)
|
||||
VALUES ('orderLinesWithZero','fr','Il y a des lignes vides. Veuillez les supprimer');
|
||||
|
||||
INSERT INTO hedera.messageI18n (code, lang, description)
|
||||
VALUES ('orderLinesWithZero','pt','Existem linhas vazias. Por favor, apague-os');
|
|
@ -0,0 +1,8 @@
|
|||
CREATE TABLE IF NOT EXISTS vn.productionCountry(
|
||||
countryFk MEDIUMINT(8) UNSIGNED NOT NULL,
|
||||
volumeGrowthEstimatePercent DECIMAL(6, 2) COMMENT 'Porcentaje estimado de crecimiento del volumen',
|
||||
PRIMARY KEY (countryFk),
|
||||
CONSTRAINT productionCountryVolume_countryFK
|
||||
FOREIGN KEY (countryFk) REFERENCES vn.country (id)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
) COMMENT = 'Datos de producción por país'
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
ALTER TABLE vn.country
|
||||
ADD CONSTRAINT country_unique_name UNIQUE KEY (name);
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE `vn`.`item`
|
||||
ADD COLUMN `isCustomInspectionRequired` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'Indicates if the item requires physical inspection at customs';
|
|
@ -0,0 +1,5 @@
|
|||
DELETE FROM vn.workerMana
|
||||
WHERE workerFk IN (
|
||||
SELECT workerFk
|
||||
FROM vn.workerManaExcluded
|
||||
);
|
|
@ -246,8 +246,9 @@
|
|||
"ticketLostExpedition": "The ticket [{{ticketId}}]({{{ticketUrl}}}) has the following lost expedition:{{ expeditionId }}",
|
||||
"The raid information is not correct": "The raid information is not correct",
|
||||
"Payment method is required": "Payment method is required",
|
||||
"Sales already moved": "Sales already moved",
|
||||
"Holidays to past days not available": "Holidays to past days not available",
|
||||
"Sales already moved": "Sales already moved",
|
||||
"Holidays to past days not available": "Holidays to past days not available",
|
||||
"Price cannot be blank": "Price cannot be blank",
|
||||
"There are tickets to be invoiced": "There are tickets to be invoiced"
|
||||
}
|
||||
"There are tickets to be invoiced": "There are tickets to be invoiced",
|
||||
"The address of the customer must have information about Incoterms and Customs Agent": "The address of the customer must have information about Incoterms and Customs Agent"
|
||||
}
|
|
@ -29,14 +29,14 @@ module.exports = Self => {
|
|||
const models = Self.app.models;
|
||||
const myOptions = {};
|
||||
let tx;
|
||||
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
if (!myOptions.transaction) {
|
||||
tx = await Self.beginTransaction({});
|
||||
myOptions.transaction = tx;
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
const user = await models.VnUser.findOne({
|
||||
|
|
|
@ -2,7 +2,7 @@ const UserError = require('vn-loopback/util/user-error');
|
|||
|
||||
module.exports = function(Self) {
|
||||
Self.remoteMethod('canBeInvoiced', {
|
||||
description: 'Change property isEqualizated in all client addresses',
|
||||
description: 'Check if a client can be invoiced',
|
||||
accessType: 'READ',
|
||||
accepts: [
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ module.exports = function(Self) {
|
|||
Object.assign(myOptions, options);
|
||||
|
||||
const client = await models.Client.findById(id, {
|
||||
fields: ['id', 'isTaxDataChecked', 'hasToInvoice', 'payMethodFk'],
|
||||
fields: ['id', 'isTaxDataChecked', 'hasToInvoice', 'payMethodFk', 'isActive'],
|
||||
include:
|
||||
{
|
||||
relation: 'payMethod',
|
||||
|
@ -53,9 +53,6 @@ module.exports = function(Self) {
|
|||
if (client.payMethod().code === 'wireTransfer' && !company.supplierAccountFk)
|
||||
throw new UserError('The company has not informed the supplier account for bank transfers');
|
||||
|
||||
if (client.isTaxDataChecked && client.hasToInvoice)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return client.isTaxDataChecked && client.hasToInvoice && client.isActive;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -8,6 +8,8 @@ describe('client canBeInvoiced()', () => {
|
|||
const activeCtx = {
|
||||
accessToken: {userId: userId}
|
||||
};
|
||||
let tx;
|
||||
let options;
|
||||
|
||||
beforeAll(async() => {
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
|
@ -15,60 +17,45 @@ describe('client canBeInvoiced()', () => {
|
|||
});
|
||||
});
|
||||
|
||||
beforeEach(async() => {
|
||||
tx = await models.Client.beginTransaction({});
|
||||
options = {transaction: tx};
|
||||
});
|
||||
|
||||
afterEach(async() => {
|
||||
await tx.rollback();
|
||||
});
|
||||
|
||||
it('should return falsy for a client without the data checked', async() => {
|
||||
const tx = await models.Client.beginTransaction({});
|
||||
const client = await models.Client.findById(clientId, null, options);
|
||||
await client.updateAttribute('isTaxDataChecked', false, options);
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
const canBeInvoiced = await models.Client.canBeInvoiced(clientId, companyId, options);
|
||||
|
||||
const client = await models.Client.findById(clientId, null, options);
|
||||
await client.updateAttribute('isTaxDataChecked', false, options);
|
||||
expect(canBeInvoiced).toEqual(false);
|
||||
});
|
||||
|
||||
const canBeInvoiced = await models.Client.canBeInvoiced(clientId, companyId, options);
|
||||
it('should return falsy for a client not active', async() => {
|
||||
const client = await models.Client.findById(clientId, null, options);
|
||||
await client.updateAttribute('isActive', false, options);
|
||||
|
||||
expect(canBeInvoiced).toEqual(false);
|
||||
const canBeInvoiced = await models.Client.canBeInvoiced(clientId, companyId, options);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
expect(canBeInvoiced).toEqual(false);
|
||||
});
|
||||
|
||||
it('should return falsy for a client with invoicing disabled', async() => {
|
||||
const tx = await models.Client.beginTransaction({});
|
||||
const client = await models.Client.findById(clientId, null, options);
|
||||
await client.updateAttribute('hasToInvoice', false, options);
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
const canBeInvoiced = await models.Client.canBeInvoiced(clientId, companyId, options);
|
||||
|
||||
const client = await models.Client.findById(clientId, null, options);
|
||||
await client.updateAttribute('hasToInvoice', false, options);
|
||||
|
||||
const canBeInvoiced = await models.Client.canBeInvoiced(clientId, companyId, options);
|
||||
|
||||
expect(canBeInvoiced).toEqual(false);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
expect(canBeInvoiced).toEqual(false);
|
||||
});
|
||||
|
||||
it('should return truthy for an invoiceable client', async() => {
|
||||
const tx = await models.Client.beginTransaction({});
|
||||
const canBeInvoiced = await models.Client.canBeInvoiced(clientId, companyId, options);
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const canBeInvoiced = await models.Client.canBeInvoiced(clientId, companyId, options);
|
||||
|
||||
expect(canBeInvoiced).toEqual(true);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
expect(canBeInvoiced).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
describe('Address updateAddress', () => {
|
||||
const clientId = 1101;
|
||||
const addressId = 1;
|
||||
const clientId = 1102;
|
||||
const addressId = 2;
|
||||
const provinceId = 5;
|
||||
const incotermsId = 'FAS';
|
||||
const customAgentOneId = 1;
|
||||
|
|
|
@ -84,6 +84,11 @@
|
|||
"type": "belongsTo",
|
||||
"model": "CustomsAgent",
|
||||
"foreignKey": "customsAgentFk"
|
||||
},
|
||||
"postcode": {
|
||||
"type": "belongsTo",
|
||||
"model": "Postcode",
|
||||
"foreignKey": "postalCode"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
const UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('clientsToInvoice', {
|
||||
description: 'Get the clients to make global invoicing',
|
||||
|
@ -47,7 +49,12 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
try {
|
||||
// Packaging liquidation
|
||||
const clientCanBeInvoiced =
|
||||
await Self.app.models.Client.canBeInvoiced(clientId, companyFk, myOptions);
|
||||
|
||||
if (!clientCanBeInvoiced)
|
||||
throw new UserError(`This client can't be invoiced`);
|
||||
|
||||
const vIsAllInvoiceable = false;
|
||||
await Self.rawSql('CALL ticketPackaging_add(?, ?, ?, ?)', [
|
||||
clientId,
|
||||
|
@ -71,9 +78,6 @@ module.exports = Self => {
|
|||
AND t.shipped BETWEEN ? AND util.dayEnd(?)
|
||||
AND (t.clientFk = ? OR ? IS NULL )
|
||||
AND t.companyFk = ?
|
||||
AND c.hasToInvoice
|
||||
AND c.isTaxDataChecked
|
||||
AND c.isActive
|
||||
AND NOT t.isDeleted
|
||||
GROUP BY IF(c.hasToInvoiceByAddress, a.id, c.id)
|
||||
HAVING SUM(t.totalWithVat) > 0;`;
|
||||
|
|
|
@ -79,6 +79,12 @@ module.exports = Self => {
|
|||
type: 'date',
|
||||
description: 'The due date filter',
|
||||
http: {source: 'query'}
|
||||
},
|
||||
{
|
||||
arg: 'customsAgentFk',
|
||||
type: 'integer',
|
||||
description: 'The customsAgent id',
|
||||
http: {source: 'query'}
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
|
@ -120,6 +126,7 @@ module.exports = Self => {
|
|||
case 'companyFk':
|
||||
case 'issued':
|
||||
case 'dued':
|
||||
case 'customsAgentFk':
|
||||
param = `i.${param}`;
|
||||
return {[param]: value};
|
||||
}
|
||||
|
@ -139,11 +146,14 @@ module.exports = Self => {
|
|||
i.dued,
|
||||
i.clientFk,
|
||||
i.hasPdf,
|
||||
i.customsAgentFk,
|
||||
c.socialName AS clientSocialName,
|
||||
co.code AS companyCode
|
||||
co.code AS companyCode,
|
||||
ca.fiscalName AS customsAgentName
|
||||
FROM invoiceOut i
|
||||
LEFT JOIN client c ON c.id = i.clientFk
|
||||
LEFT JOIN company co ON co.id = i.companyFk`
|
||||
LEFT JOIN company co ON co.id = i.companyFk
|
||||
LEFT JOIN customsAgent ca ON ca.id = i.customsAgentFk`
|
||||
);
|
||||
|
||||
stmt.merge(conn.makeSuffix(filter));
|
||||
|
|
|
@ -7,7 +7,12 @@ module.exports = Self => {
|
|||
arg: 'companyFk',
|
||||
type: 'number',
|
||||
required: true
|
||||
}
|
||||
},
|
||||
{
|
||||
arg: 'serialType',
|
||||
type: 'string',
|
||||
required: true
|
||||
},
|
||||
],
|
||||
returns: {
|
||||
type: ['object'],
|
||||
|
@ -19,16 +24,16 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
Self.getInvoiceDate = async companyFk => {
|
||||
Self.getInvoiceDate = async(companyFk, serialType) => {
|
||||
const models = Self.app.models;
|
||||
const [invoiceDate] = await models.InvoiceOut.rawSql(
|
||||
`SELECT MAX(io.issued) issued
|
||||
FROM invoiceOut io
|
||||
JOIN invoiceOutSerial ios ON ios.code = io.serial
|
||||
WHERE ios.type = 'global'
|
||||
AND io.issued
|
||||
WHERE ios.type = ?
|
||||
AND io.issued
|
||||
AND io.companyFk = ?`,
|
||||
[companyFk]
|
||||
[serialType, companyFk]
|
||||
);
|
||||
return invoiceDate;
|
||||
};
|
||||
|
|
|
@ -4,11 +4,11 @@ describe('InvoiceOut clientsToInvoice()', () => {
|
|||
const userId = 1;
|
||||
const clientId = 1101;
|
||||
const companyFk = 442;
|
||||
const maxShipped = new Date();
|
||||
const maxShipped = Date.vnNew();
|
||||
maxShipped.setMonth(11);
|
||||
maxShipped.setDate(31);
|
||||
maxShipped.setHours(23, 59, 59, 999);
|
||||
const invoiceDate = new Date();
|
||||
const invoiceDate = Date.vnNew();
|
||||
const activeCtx = {
|
||||
getLocale: () => {
|
||||
return 'en';
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const moment = require('moment');
|
||||
|
||||
describe('getInvoiceDate()', () => {
|
||||
const companyFk = 442;
|
||||
let tx;
|
||||
let options;
|
||||
|
||||
beforeEach(async() => {
|
||||
tx = await models.InvoiceOut.beginTransaction({});
|
||||
options = {transaction: tx};
|
||||
});
|
||||
|
||||
afterEach(async() => {
|
||||
await tx.rollback();
|
||||
});
|
||||
|
||||
it('should return a correct date for serialType "global"', async() => {
|
||||
const serialType = 'global';
|
||||
const result = await models.InvoiceOut.getInvoiceDate(companyFk, serialType, options);
|
||||
|
||||
expect(moment(result.issued).format('YYYY-MM-DD')).toEqual('2000-12-01');
|
||||
});
|
||||
|
||||
it('should return null for serialType "multiple"', async() => {
|
||||
const serialType = 'multiple';
|
||||
const result = await models.InvoiceOut.getInvoiceDate(companyFk, serialType, options);
|
||||
|
||||
expect(result.issued).toBeNull();
|
||||
});
|
||||
|
||||
it('should return correct date for serialType "quick"', async() => {
|
||||
const serialType = 'quick';
|
||||
const result = await models.InvoiceOut.getInvoiceDate(companyFk, serialType, options);
|
||||
|
||||
expect(moment(result.issued).format('YYYY-MM-DD')).toEqual('2001-01-01');
|
||||
});
|
||||
});
|
||||
|
|
@ -66,6 +66,11 @@
|
|||
"model": "Ticket",
|
||||
"foreignKey": "refFk",
|
||||
"primaryKey": "ref"
|
||||
},
|
||||
"customsAgentFk": {
|
||||
"type": "belongsTo",
|
||||
"model": "CustomsAgent",
|
||||
"foreignKey": "customsAgentFk"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,6 +154,9 @@
|
|||
},
|
||||
"photoMotivation": {
|
||||
"type": "string"
|
||||
},
|
||||
"isCustomInspectionRequired": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
@ -222,4 +225,4 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,8 @@ module.exports = Self => {
|
|||
su.name scannerUserName,
|
||||
es.scanned,
|
||||
est.description state,
|
||||
de.longName
|
||||
de.longName,
|
||||
de.itemFk
|
||||
FROM vn.expedition e
|
||||
LEFT JOIN vn.expeditionStateType est ON est.id = e.stateTypeFk
|
||||
INNER JOIN vn.item i1 ON i1.id = e.freightItemFk
|
||||
|
|
|
@ -77,6 +77,8 @@ describe('ticket makeInvoice()', () => {
|
|||
await tx.rollback();
|
||||
}
|
||||
|
||||
expect(error.message).toEqual(`The address of the customer must have information about Incoterms and Customs Agent`);
|
||||
expect(error.message).toEqual(
|
||||
`The address of the customer must have information about Incoterms and Customs Agent`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
const {models} = require('vn-loopback/server/server');
|
||||
|
||||
describe('ticketService model ', () => {
|
||||
const originalTicketFk = 1;
|
||||
const refundTicketFk = 11;
|
||||
|
||||
let tx;
|
||||
let opts;
|
||||
let ticketService;
|
||||
|
||||
beforeEach(async() => {
|
||||
tx = await models.Sale.beginTransaction({});
|
||||
opts = {transaction: tx};
|
||||
|
||||
ticketService = await models.TicketService.create({
|
||||
ticketFk: refundTicketFk,
|
||||
description: 'test',
|
||||
quantity: 1,
|
||||
price: 100,
|
||||
taxClassFk: 1,
|
||||
ticketServiceTypeFk: 1
|
||||
}, opts);
|
||||
});
|
||||
|
||||
afterEach(async() => {
|
||||
await tx.rollback();
|
||||
});
|
||||
|
||||
describe('TicketService', () => {
|
||||
it('should allow updating description and quantity for non-refund tickets', async() => {
|
||||
await ticketService.updateAttributes({
|
||||
ticketServiceTypeFk: 2,
|
||||
quantity: 5
|
||||
}, opts);
|
||||
|
||||
const updated = await models.TicketService.findById(ticketService.id, null, opts);
|
||||
|
||||
expect(updated.description).not.toBe('test');
|
||||
expect(updated.quantity).toBe(5);
|
||||
});
|
||||
|
||||
it('should only allow updating description for refund tickets', async() => {
|
||||
await models.TicketRefund.create({
|
||||
refundTicketFk,
|
||||
originalTicketFk
|
||||
}, opts);
|
||||
|
||||
await ticketService.updateAttributes({
|
||||
ticketServiceTypeFk: 2
|
||||
}, opts);
|
||||
|
||||
try {
|
||||
await ticketService.updateAttributes({
|
||||
ticketServiceTypeFk: 3,
|
||||
quantity: 5
|
||||
}, opts);
|
||||
|
||||
fail('Should have thrown error');
|
||||
} catch (e) {
|
||||
expect(e.message).toBe('Only description can be modified in refund tickets');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
|
@ -10,9 +10,18 @@ module.exports = Self => {
|
|||
const isLocked = await models.Ticket.isLocked(ticketId);
|
||||
if (isLocked)
|
||||
throw new UserError(`The current ticket can't be modified`);
|
||||
|
||||
const isRefund = await models.TicketRefund.findOne({
|
||||
where: {refundTicketFk: ticketId}
|
||||
}, {
|
||||
transaction: ctx.options.transaction
|
||||
});
|
||||
|
||||
if (isRefund && ctx.data && Object.keys(ctx.data).some(field => field !== 'ticketServiceTypeFk'))
|
||||
throw new UserError('Only description can be modified in refund tickets');
|
||||
}
|
||||
|
||||
if (changes && changes.ticketServiceTypeFk) {
|
||||
if (changes?.ticketServiceTypeFk) {
|
||||
const ticketServiceType = await models.TicketServiceType.findById(changes.ticketServiceTypeFk);
|
||||
changes.description = ticketServiceType.name;
|
||||
}
|
||||
|
|
|
@ -132,18 +132,18 @@ module.exports = Self => {
|
|||
CAST(SUM(b.weight * b.stickers) AS DECIMAL(10,0)) loadedKg,
|
||||
CAST(
|
||||
SUM(
|
||||
vc.aerealVolumetricDensity *
|
||||
b.stickers *
|
||||
vc.aerealVolumetricDensity *
|
||||
b.stickers *
|
||||
IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000
|
||||
) AS DECIMAL(10,0)
|
||||
) volumeKg,
|
||||
CAST(
|
||||
GREATEST(
|
||||
SUM(b.weight * b.stickers) ,
|
||||
SUM(vc.aerealVolumetricDensity *
|
||||
b.stickers *
|
||||
IF(pkg.volume,
|
||||
pkg.volume,
|
||||
SUM(vc.aerealVolumetricDensity *
|
||||
b.stickers *
|
||||
IF(pkg.volume,
|
||||
pkg.volume,
|
||||
pkg.width * pkg.depth * pkg.height) / 1000000)
|
||||
) / t.kg * 100 AS INT
|
||||
) percentageKg
|
||||
|
@ -185,11 +185,12 @@ module.exports = Self => {
|
|||
CAST(SUM(b.weight * b.stickers) AS DECIMAL(10,0)) as loadedkg,
|
||||
CAST(
|
||||
SUM(
|
||||
vc.aerealVolumetricDensity *
|
||||
b.stickers *
|
||||
vc.aerealVolumetricDensity *
|
||||
b.stickers *
|
||||
IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000
|
||||
) AS DECIMAL(10,0)
|
||||
) as volumeKg
|
||||
) as volumeKg,
|
||||
MAX(i.isCustomInspectionRequired) isCustomInspectionRequired
|
||||
FROM tmp.travel tr
|
||||
JOIN entry e ON e.travelFk = tr.id
|
||||
JOIN buy b ON b.entryFk = e.id
|
||||
|
|
|
@ -112,4 +112,17 @@ describe('Travel extraCommunityFilter()', () => {
|
|||
|
||||
expect(result.length).toEqual(2);
|
||||
});
|
||||
|
||||
it('should return field isCustomInspectionRequired true', async() => {
|
||||
const ctx = {
|
||||
args: {
|
||||
id: 2
|
||||
}
|
||||
};
|
||||
|
||||
const result = await app.models.Travel.extraCommunityFilter(ctx, filter);
|
||||
|
||||
expect(result[0].entries[0].isCustomInspectionRequired).toBeTruthy();
|
||||
expect(result[0].entries[1].isCustomInspectionRequired).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salix-back",
|
||||
"version": "24.52.0",
|
||||
"version": "25.04.0",
|
||||
"author": "Verdnatura Levante SL",
|
||||
"description": "Salix backend",
|
||||
"license": "GPL-3.0",
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
WITH tickets AS(
|
||||
SELECT id, packages, addressFk, weight
|
||||
FROM ticket
|
||||
WHERE refFk= ?
|
||||
SELECT id, addressFk, packages, refFk
|
||||
FROM vn.ticket
|
||||
WHERE refFk = ?
|
||||
), volume AS(
|
||||
SELECT SUM(volume) volume
|
||||
SELECT SUM(volume) volume, MAX(weight)weight
|
||||
FROM tickets t
|
||||
JOIN vn.saleVolume sv ON sv.ticketFk = t.id
|
||||
), intrastat AS(
|
||||
|
@ -12,10 +12,14 @@ SELECT GROUP_CONCAT(DISTINCT ir.description ORDER BY ir.description SEPARATOR '
|
|||
JOIN vn.sale s ON t.id = s.ticketFk
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
JOIN vn.intrastat ir ON ir.id = i.intrastatFk
|
||||
)SELECT SUM(t.packages) packages,
|
||||
a.incotermsFk,
|
||||
), totalPackages AS(
|
||||
SELECT SUM(packages)packages
|
||||
FROM tickets s
|
||||
)
|
||||
SELECT tp.packages,
|
||||
io.incotermsFk,
|
||||
ic.name incotermsName,
|
||||
MAX(t.weight) weight,
|
||||
v.weight weight,
|
||||
ca.fiscalName customsAgentName,
|
||||
ca.street customsAgentStreet,
|
||||
ca.nif customsAgentNif,
|
||||
|
@ -23,9 +27,10 @@ SELECT GROUP_CONCAT(DISTINCT ir.description ORDER BY ir.description SEPARATOR '
|
|||
ca.email customsAgentEmail,
|
||||
CAST(v.volume AS DECIMAL (10,2)) volume,
|
||||
i.intrastat
|
||||
FROM tickets t
|
||||
JOIN vn.address a ON a.id = t.addressFk
|
||||
JOIN vn.incoterms ic ON ic.code = a.incotermsFk
|
||||
LEFT JOIN vn.customsAgent ca ON ca.id = a.customsAgentFk
|
||||
FROM vn.invoiceOut io
|
||||
JOIN vn.incoterms ic ON ic.code = io.incotermsFk
|
||||
LEFT JOIN vn.customsAgent ca ON ca.id = io.customsAgentFk
|
||||
JOIN volume v
|
||||
JOIN intrastat i
|
||||
JOIN totalPackages tp
|
||||
WHERE `ref` = (SELECT DISTINCT refFk FROM tickets)
|
Loading…
Reference in New Issue