diff --git a/Jenkinsfile b/Jenkinsfile
index 2c04bcf16..d508da8bf 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -103,7 +103,7 @@ pipeline {
NODE_ENV = ''
}
steps {
- sh 'npm run test:back:ci'
+ sh 'node back/tests.js --ci --junit --network jenkins'
}
post {
always {
diff --git a/back/methods/image/download.js b/back/methods/image/download.js
index c4037b809..2b1a4b546 100644
--- a/back/methods/image/download.js
+++ b/back/methods/image/download.js
@@ -87,6 +87,6 @@ module.exports = Self => {
await fs.access(file.path);
const stream = fs.createReadStream(file.path);
- return [stream, file.contentType, `filename="${file.name}"`];
+ return [stream, file.contentType, `filename="${fileName}"`];
};
};
diff --git a/back/models/specs/mailAliasAccount.spec.js b/back/models/specs/mailAliasAccount.spec.js
index c13cc7ae8..8f0278a50 100644
--- a/back/models/specs/mailAliasAccount.spec.js
+++ b/back/models/specs/mailAliasAccount.spec.js
@@ -1,23 +1,6 @@
const models = require('vn-loopback/server/server').models;
describe('loopback model MailAliasAccount', () => {
- it('should fail to add a mail Alias if the worker doesnt have ACLs', async() => {
- const tx = await models.MailAliasAccount.beginTransaction({});
- let error;
-
- try {
- const options = {transaction: tx, accessToken: {userId: 57}};
- await models.MailAliasAccount.create({mailAlias: 2, account: 5}, options);
-
- await tx.rollback();
- } catch (e) {
- await tx.rollback();
- error = e;
- }
-
- expect(error.message).toEqual('The alias cant be modified');
- });
-
it('should add a mail Alias', async() => {
const tx = await models.MailAliasAccount.beginTransaction({});
let error;
diff --git a/back/tests.js b/back/tests.js
index 6c1b366e2..50698eb92 100644
--- a/back/tests.js
+++ b/back/tests.js
@@ -17,7 +17,8 @@ const opts = getopts(process.argv.slice(2), {
let server;
const PARALLEL = false;
-const TIMEOUT = 900000;
+const SETUP_TIMEOUT = 15 * 60 * 1000;
+const SPEC_TIMEOUT = 30 * 1000;
process.on('exit', teardown);
process.on('uncaughtException', onError);
@@ -74,9 +75,9 @@ async function test() {
let runner;
const config = {
globalSetup: setup,
- globalSetupTimeout: TIMEOUT,
+ globalSetupTimeout: SETUP_TIMEOUT,
globalTeardown: teardown,
- globalTeardownTimeout: TIMEOUT,
+ globalTeardownTimeout: SETUP_TIMEOUT,
spec_dir: '.',
spec_files: [
'back/**/*[sS]pec.js',
@@ -111,7 +112,7 @@ async function test() {
runner.addReporter(new JunitReporter.JUnitXmlReporter());
}
if (opts.ci)
- runner.jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT;
+ runner.jasmine.DEFAULT_TIMEOUT_INTERVAL = SPEC_TIMEOUT;
// runner.loadConfigFile('back/jasmine.json');
runner.loadConfig(config);
diff --git a/db/.pullinfo.json b/db/.pullinfo.json
new file mode 100644
index 000000000..f4afbc5fb
--- /dev/null
+++ b/db/.pullinfo.json
@@ -0,0 +1,16 @@
+{
+ "lastPull": "2024-02-15T08:58:24.000Z",
+ "shaSums": {
+ "srt": {
+ "view": {
+ "routePalletized": "765f8933a6a5a86dfe8f22825cc77351bc8620cdf1be9d3f25abb130460f3a61",
+ "ticketPalletized": "c327f3243e717cc607f01d3747967ba68158f90ef1038986b0aa6ae6d5ce7309"
+ }
+ },
+ "vn": {
+ "view": {
+ "expeditionPallet_Print": "288cbd6e8289df083ed5eb1a2c808f7a82ba4c90c8ad9781104808a7a54471fb"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/db/changes/240404/00-revokeMailAliasAccount.sql b/db/changes/240404/00-revokeMailAliasAccount.sql
new file mode 100644
index 000000000..a86de1f3c
--- /dev/null
+++ b/db/changes/240404/00-revokeMailAliasAccount.sql
@@ -0,0 +1,5 @@
+DELETE FROM salix.ACL
+ WHERE model = 'MailAliasAccount'
+ AND property = 'canEditAlias'
+ AND principalType = 'ROLE'
+ AND principalId = 'marketingBoss';
diff --git a/db/dump/.dump/data.sql b/db/dump/.dump/data.sql
index 8bbe54598..8367471bc 100644
--- a/db/dump/.dump/data.sql
+++ b/db/dump/.dump/data.sql
@@ -3,8 +3,7 @@ USE `util`;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-INSERT INTO `version` VALUES ('salix','10230','53f69ae8e526a4a5d827c237a5b076d38507b392','2020-11-09 11:06:43',NULL);
-INSERT INTO `version` VALUES ('vn-database','10818','b7edbbe12f35d0cbc3e6b83e54977ac1c8acfc74','2024-01-25 10:00:48','10831');
+INSERT INTO `version` VALUES ('vn-database','10861','6685a201143a320920bbe04db7f8d0d1bd32d415','2024-02-15 10:04:54','10886');
INSERT INTO `versionLog` VALUES ('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL);
@@ -539,6 +538,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10757','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','10758','00-sectorType.sql','jenkins@db-proxy1.static.verdnatura.es','2023-12-14 12:17:18',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10758','01-dipole.sql','jenkins@db-proxy1.static.verdnatura.es','2023-12-14 12:17:18',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10758','02-agencyMode.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:32',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10758','03-item.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:44',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10761','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-16 09:30:58',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10764','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2024-01-04 12:07:59',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10768','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-11-30 13:11:37',NULL,NULL);
@@ -546,6 +546,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10771','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','10773','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-11-30 13:11:38',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10775','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2024-01-03 10:18:16',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10778','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-11-30 13:11:38',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10781','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:54',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10782','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2024-01-03 10:18:16',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10783','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-24 14:49:17',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10784','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:32',NULL,NULL);
@@ -574,7 +575,45 @@ INSERT INTO `versionLog` VALUES ('vn-database','10815','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','10816','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:36',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10817','00-invoiceOutConfig_refLen.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-24 21:47:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10818','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:36',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10819','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:54',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10820','00-grants.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10825','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-01 10:24:54',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10827','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-23 12:32:13',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10828','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10828','01-RevokeClientes_regalos_lista.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10832','00-util_tx_commit.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10832','00-util_tx_rollback.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10832','00-util_tx_start.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10832','01-update_procedure_TravelCloneWithEntries.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10832','02-grant_privileges_util_tx.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10838','00-createInventoryConfig.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-07 22:36:27',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10845','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10848','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10849','00-roleLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10849','01-userLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10849','02-entryLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10849','03-clientLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10849','04-itemLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10849','05-shelvingLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10849','06-workerLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10849','07-deviceProductionLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10849','08-zoneLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10849','09-rateLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10849','10-ticketLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10849','11-userLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10849','12-routeLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10849','13-claimLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10849','14-supplierLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10849','15-invoiceInLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10849','16-travelLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10849','17-packingSiteDeviceLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10851','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-01-30 13:31:15',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10853','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:05',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10853','00-secondScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10854','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-30 16:20:34',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10855','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10858','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10861','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL);
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
@@ -631,7 +670,7 @@ INSERT INTO `role` VALUES (57,'deliveryBoss','Jefe de personal de reparto',1,'20
INSERT INTO `role` VALUES (58,'packager','Departamento encajadores',1,'2019-01-21 13:43:45','2019-01-21 13:43:45',NULL);
INSERT INTO `role` VALUES (59,'packagerBoss','Jefe departamento encajadores',1,'2019-01-21 13:44:10','2019-01-21 13:44:10',NULL);
INSERT INTO `role` VALUES (60,'productionAssi','Tareas relacionadas con producción y administración',1,'2019-01-29 14:29:01','2019-01-29 14:29:01',NULL);
-INSERT INTO `role` VALUES (61,'replenisherBos','Jefe de Complementos/Camara',1,'2019-07-01 08:44:07','2019-07-01 08:44:07',NULL);
+INSERT INTO `role` VALUES (61,'replenisherBoss','Jefe de Complementos/Camara',1,'2019-07-01 08:44:07','2024-02-01 12:07:29',19336);
INSERT INTO `role` VALUES (62,'noLogin','Role without login access to MySQL',0,'2019-07-01 08:50:19','2019-07-02 15:42:05',NULL);
INSERT INTO `role` VALUES (64,'balanceSheet','Consulta de Balance',0,'2019-07-16 14:12:08','2019-07-16 14:12:08',NULL);
INSERT INTO `role` VALUES (65,'officeBoss','Jefe de filial',1,'2019-08-02 08:54:26','2019-08-02 08:54:26',NULL);
@@ -669,6 +708,7 @@ INSERT INTO `role` VALUES (124,'hrBuyer','Recursos Humanos con Buyer',1,'2023-10
INSERT INTO `role` VALUES (125,'claimViewer','Trabajadores que consulta las reclamaciones ',1,'2023-11-16 09:14:46','2023-11-16 09:14:46',10578);
INSERT INTO `role` VALUES (126,'greenhouseBoss','Jefe de invernadero',1,'2023-11-16 14:32:13','2023-11-16 14:32:13',NULL);
INSERT INTO `role` VALUES (127,'timeControl','Tablet para fichar',1,'2024-01-09 16:36:56','2024-01-09 16:36:56',NULL);
+INSERT INTO `role` VALUES (129,'buyerAssistant','Comprador que tienes mas permisos para ayudar al buyerBoss en algunas tareas',1,'2024-02-06 06:59:12','2024-02-06 06:59:12',783);
INSERT INTO `roleInherit` VALUES (1,1,2,NULL);
INSERT INTO `roleInherit` VALUES (2,1,3,NULL);
@@ -932,6 +972,7 @@ INSERT INTO `roleInherit` VALUES (355,127,11,NULL);
INSERT INTO `roleInherit` VALUES (356,123,125,NULL);
INSERT INTO `roleInherit` VALUES (357,36,35,NULL);
INSERT INTO `roleInherit` VALUES (358,36,49,NULL);
+INSERT INTO `roleInherit` VALUES (359,129,35,NULL);
INSERT INTO `userPassword` VALUES (1,7,1,0,2,1);
@@ -1508,7 +1549,7 @@ INSERT INTO `ACL` VALUES (676,'Ticket','invoiceTickets','WRITE','ALLOW','ROLE','
INSERT INTO `ACL` VALUES (680,'MailAliasAccount','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (681,'MailAliasAccount','create','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (682,'MailAliasAccount','deleteById','WRITE','ALLOW','ROLE','employee');
-INSERT INTO `ACL` VALUES (683,'MailAliasAccount','canEditAlias','WRITE','ALLOW','ROLE','itManagement');
+INSERT INTO `ACL` VALUES (683,'MailAliasAccount','canEditAlias','WRITE','ALLOW','ROLE','developerBoss');
INSERT INTO `ACL` VALUES (684,'WorkerDisableExcluded','*','READ','ALLOW','ROLE','itManagement');
INSERT INTO `ACL` VALUES (685,'WorkerDisableExcluded','*','WRITE','ALLOW','ROLE','itManagement');
INSERT INTO `ACL` VALUES (686,'MailForward','*','*','ALLOW','ROLE','hr');
@@ -1519,7 +1560,6 @@ INSERT INTO `ACL` VALUES (690,'Roadmap','*','*','ALLOW','ROLE','palletizerBoss')
INSERT INTO `ACL` VALUES (691,'Roadmap','*','*','ALLOW','ROLE','productionBoss');
INSERT INTO `ACL` VALUES (692,'ExpeditionTruck','*','*','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (693,'ExpeditionTruck','*','*','ALLOW','ROLE','productionBoss');
-INSERT INTO `ACL` VALUES (694,'MailAliasAccount','canEditAlias','WRITE','ALLOW','ROLE','marketingBoss');
INSERT INTO `ACL` VALUES (695,'ViaexpressConfig','internationalExpedition','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (696,'ViaexpressConfig','renderer','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (697,'Ticket','transferClient','WRITE','ALLOW','ROLE','administrative');
@@ -1610,6 +1650,8 @@ INSERT INTO `ACL` VALUES (783,'WorkerTimeControl','resendWeeklyHourEmail','WRITE
INSERT INTO `ACL` VALUES (784,'VnRole','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (785,'VnRole','*','WRITE','ALLOW','ROLE','it');
INSERT INTO `ACL` VALUES (786,'State','isAllEditable','READ','ALLOW','ROLE','delivery');
+INSERT INTO `ACL` VALUES (787,'Ticket','makePdfList','*','ALLOW','ROLE','employee');
+INSERT INTO `ACL` VALUES (788,'Ticket','invoiceTicketsAndPdf','*','ALLOW','ROLE','employee');
INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee');
INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee');
@@ -1909,6 +1951,7 @@ INSERT INTO `component` VALUES (45,'maná reclamacion',7,4,NULL,0,'manaClaim',0)
INSERT INTO `component` VALUES (46,'recargo a particular',2,NULL,0.25,0,'individual',0);
INSERT INTO `component` VALUES (47,'promocion Italia',4,NULL,NULL,1,'italianOffer',0);
INSERT INTO `component` VALUES (48,'fusión de lineas',4,NULL,NULL,1,'lineFusion',0);
+INSERT INTO `component` VALUES (49,'sustitución',4,NULL,NULL,1,'substitution',0);
INSERT INTO `componentType` VALUES (1,'coste',1,0,'COST');
INSERT INTO `componentType` VALUES (2,'com ventas',1,1,NULL);
@@ -1929,59 +1972,61 @@ INSERT INTO `continent` VALUES (3,'África','AF');
INSERT INTO `continent` VALUES (4,'Europa','EU');
INSERT INTO `continent` VALUES (5,'Oceanía','OC');
-INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,106,763,0,0,0,0,28,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,110,763,0,0,0,0,28,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (22,'shopping','COMPRAS',2,3,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (23,'CMA','CAMARA',13,14,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL,NULL);
INSERT INTO `department` VALUES (31,'it','INFORMATICA',4,5,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (34,'accounting','CONTABILIDAD',6,7,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (35,'finance','FINANZAS',8,9,NULL,0,0,0,1,0,1,'/1/',NULL,1,'begonya@verdnatura.es',1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (36,'labor','LABORAL',10,11,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (37,'PROD','PRODUCCION',12,33,NULL,72,1,1,1,10,1,'/1/',NULL,0,NULL,0,1,1,1,NULL,NULL);
+INSERT INTO `department` VALUES (37,'PROD','PRODUCCION',12,35,NULL,72,1,1,1,11,1,'/1/',NULL,0,NULL,0,1,1,1,NULL,NULL);
INSERT INTO `department` VALUES (38,'picking','SACADO',15,16,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (39,'packing','ENCAJADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (41,'administration','ADMINISTRACION',34,35,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (43,'VT','VENTAS',36,61,NULL,0,0,0,1,12,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (44,'management','GERENCIA',62,63,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',64,65,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (46,'delivery','REPARTO',66,67,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',68,69,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',70,71,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',72,73,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',74,75,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',76,77,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (41,'administration','ADMINISTRACION',36,37,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (43,'VT','VENTAS',38,65,NULL,0,0,0,1,13,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (44,'management','GERENCIA',66,67,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',68,69,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (46,'delivery','REPARTO',70,71,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',72,73,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',74,75,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',76,77,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (55,NULL,'TALLER NATURAL',19,20,14548,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1118,NULL);
INSERT INTO `department` VALUES (56,NULL,'TALLER ARTIFICIAL',21,22,8470,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1927,NULL);
-INSERT INTO `department` VALUES (58,'CMP','CAMPOS',78,81,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',82,83,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',84,85,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,1,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (61,NULL,'VNH',86,89,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',90,91,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (58,'CMP','CAMPOS',82,85,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',86,87,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',88,89,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,1,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (61,NULL,'VNH',90,93,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',94,95,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (68,NULL,'COMPLEMENTOS',23,24,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',92,93,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (80,NULL,'EQUIPO J VALLES',37,38,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',94,95,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (89,NULL,'COORDINACION',96,97,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (90,NULL,'TRAILER',87,88,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',96,97,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (80,NULL,'EQUIPO J VALLES',39,40,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'equipojvalles@verdnatura.es',0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',98,99,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (89,NULL,'COORDINACION',100,101,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (90,NULL,'TRAILER',91,92,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (91,'artificial','ARTIFICIAL',25,26,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (92,NULL,'EQUIPO SILVERIO',39,40,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (94,NULL,'EQUIPO J BROCAL',41,42,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (95,NULL,'EQUIPO C ZAMBRANO',43,44,4667,0,0,0,2,0,43,'/1/43/','czg_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (96,NULL,'EQUIPO C LOPEZ',45,46,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (115,NULL,'EQUIPO CLAUDI',47,48,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (123,NULL,'EQUIPO ELENA BASCUÑANA',49,50,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',98,99,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (125,NULL,'EQUIPO MIRIAM MAR',51,52,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (92,NULL,'EQUIPO SILVERIO',41,42,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (94,NULL,'EQUIPO J BROCAL',43,44,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',1,'equipojbrocal@verdnatura.es',0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (95,NULL,'EQUIPO C ZAMBRANO',45,46,4667,0,0,0,2,0,43,'/1/43/','czg_equipo',1,'equipoczambrano@verdnatura.es',0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (96,NULL,'EQUIPO C LOPEZ',47,48,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (115,NULL,'EQUIPO CLAUDI',49,50,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (123,NULL,'EQUIPO ELENA BASCUÑANA',51,52,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',102,103,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (125,NULL,'EQUIPO MIRIAM MAR',53,54,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',1,'equipomirgir@verdnatura.es',0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (126,NULL,'PRESERVADO',27,28,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,NULL,NULL);
INSERT INTO `department` VALUES (128,NULL,'PALETIZADO',29,30,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (130,NULL,'REVISION',31,32,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',79,80,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',53,54,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',55,56,1731,72,0,0,2,0,43,'/1/43/','fra_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (134,NULL,'EQUIPO RODRI',57,58,6264,0,0,0,2,0,43,'/1/43/','rhr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (135,'routers','ENRUTADORES',100,101,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (136,'heavyVehicles','VEHICULOS PESADOS',102,103,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (137,'sorter','SORTER',104,105,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
-INSERT INTO `department` VALUES (139,NULL,'EQUIPO MIRIAM MAR 2',59,60,3803,0,0,0,2,0,43,'/1/43/','mir2_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',83,84,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',55,56,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',57,58,1731,72,0,0,2,0,43,'/1/43/','fr_equipo',1,'francia@verdnatura.es',0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (134,'portugalTeam','EQUIPO PORTUGAL',59,60,6264,0,0,0,2,0,43,'/1/43/','pt_equipo',1,'portugal@verdnatura.es',0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (135,'routers','ENRUTADORES',104,105,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (136,'heavyVehicles','VEHICULOS PESADOS',106,107,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (137,'sorter','SORTER',108,109,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (139,NULL,'EQUIPO J SORIA ',61,62,3803,0,0,0,2,0,43,'/1/43/','jss_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (140,'hollandTeam','EQUIPO HOLANDA',63,64,NULL,0,0,0,2,0,43,'/1/43/','nl_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL);
+INSERT INTO `department` VALUES (141,NULL,'PREVIA',33,34,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `docuware` VALUES (1,'deliveryNote','Albaranes cliente','find','find','N__ALBAR_N',NULL);
INSERT INTO `docuware` VALUES (2,'deliveryNote','Albaranes cliente','store','Archivar','N__ALBAR_N',NULL);
diff --git a/db/dump/.dump/privileges.sql b/db/dump/.dump/privileges.sql
index 290c8a2a3..4012a6406 100644
--- a/db/dump/.dump/privileges.sql
+++ b/db/dump/.dump/privileges.sql
@@ -108,7 +108,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','edi','buyer','item_feature','alexm
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','itemTag','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','itemCategoryL10n','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','guest','warehouse','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select','');
-INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Vistas','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','guest','Tipos','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','producer','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','mdbVersion','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
@@ -300,7 +299,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','manager','v_botanic_expor
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionPlus','v_Articles_botanical','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Colores','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Clientes','alexm@%','0000-00-00 00:00:00','Update','');
-INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','clientes_regalos_lista_enc','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','jerarquia','juan@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','warehouse','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerBusinessAgreement','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
@@ -335,7 +333,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','preservedBoss','travel','
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','travel','alexm@%','0000-00-00 00:00:00','Insert,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Cubos_Retorno','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','Cubos','alexm@%','0000-00-00 00:00:00','Select','');
-INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financialBoss','credit','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Cubos','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','Cubos','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','Cubos_Retorno','alexm@%','0000-00-00 00:00:00','Select','');
@@ -492,8 +489,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','Reservas
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','cmr','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Rutas','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','address','alexm@%','0000-00-00 00:00:00','Insert','');
-INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','Rutas_Master','alexm@%','0000-00-00 00:00:00','Select,Insert,Update','');
-INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Rutas_monitor','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','address','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','accountingType','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','itemShelvingStock_byWarehouse','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
@@ -588,7 +583,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','marketingBoss','saleGoal','al
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','saleGroup','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','saleGroupDetail','alexm@%','0000-00-00 00:00:00','Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','account_detail','alexm@%','0000-00-00 00:00:00','Select','');
-INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component_type','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Update','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component_type','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vncontrol','employee','accion','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','volumeConfig','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','currency','alexm@%','0000-00-00 00:00:00','Select','');
@@ -831,7 +826,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','printServerQueue__
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','artificialBoss','buy','alexm@%','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','Movimientos','alexm@%','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerAssist','buy','alexm@%','0000-00-00 00:00:00','Update','');
-INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','tarifas','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','receipt','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','producer','alexm@%','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','link','alexm@%','0000-00-00 00:00:00','Select','');
@@ -969,7 +963,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','travel','alexm@%',
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','travelClonedWeekly','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','bi','employee','facturacion_media_anual','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','travelObservation','alexm@%','0000-00-00 00:00:00','Select','');
-INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','tarifas','alexm@%','0000-00-00 00:00:00','Select,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','travelThermograph','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','tillConfig','juan@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','till','juan@%','0000-00-00 00:00:00','Select','');
@@ -1340,6 +1333,11 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','company','juan@db-p
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','grafana','buffer','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','greuge','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','item','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','','Select,Update');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerBoss','itemShelving','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','negativeOrigin','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryBoss','Vehiculos_consumo','carlosap@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBos','project','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','ink','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
/*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */;
/*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */;
@@ -1659,6 +1657,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','srt','production','expedition_scan'
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','historico_absoluto','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','historico_multiple','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','client_getDebt','PROCEDURE','guillermo@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
+INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','tx_commit','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','hrBoss','balance_create','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','cooler','buyultimate','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','grafana','firstdayofyear','FUNCTION','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
@@ -1812,7 +1811,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','account','guest','myuser_hasroutine
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','productionAssi','timebusiness_calculateall','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','timecontrol_geterror','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','logistic','travel_weeklyclone','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
-INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','workerTimeControl_add','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
+INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPricesByBuy','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','coolerAssist','itemproposal','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','company_getsuppliersdebt','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','agency','desglose_volume','PROCEDURE','juan@10.5.1.2','Execute','0000-00-00 00:00:00');
@@ -1827,7 +1826,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_UTC_TIMESTAMP','F
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_getsaledate','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','ticket_setState','PROCEDURE','guillermo@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','invoicing','invoiceout_new','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
-INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','sale_replaceItem','PROCEDURE','jgallego@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
+INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','sale_replaceItem','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','ledger_next','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','deliveryAssistant','workerjourney_replace','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','account','developerBoss','role_sync','PROCEDURE','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
@@ -1940,7 +1939,12 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemShelving_getinf
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','collection_get','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','item_comparative','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','sale_getBoxPickingList','PROCEDURE','guillermo@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
-INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','worker_isInDepartment','FUNCTION','jgallego@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
+INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','worker_isInDepartment','FUNCTION','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
+INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','tx_rollback','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
+INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','tx_start','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
+INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPrices','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
+INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPricesByAwb','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
+INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPricesByEntry','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
/*!40000 ALTER TABLE `procs_priv` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -1962,25 +1966,25 @@ INSERT IGNORE INTO `global_priv` VALUES ('','android','{\"access\":0,\"version_
INSERT IGNORE INTO `global_priv` VALUES ('','artificialBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','assetManager','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','buyer','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}');
-INSERT IGNORE INTO `global_priv` VALUES ('','buyerBoss','{\"access\": 0, \"version_id\": 100707, \"is_role\": true}');
+INSERT IGNORE INTO `global_priv` VALUES ('','buyerBoss','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}');
INSERT IGNORE INTO `global_priv` VALUES ('','claimManager','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','cooler','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','coolerAssist','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
-INSERT IGNORE INTO `global_priv` VALUES ('','coolerBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
+INSERT IGNORE INTO `global_priv` VALUES ('','coolerBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','customer','{\"access\": 0, \"max_questions\": 0, \"max_updates\": 30000, \"max_connections\": 300000, \"max_user_connections\": 400, \"max_statement_time\": 0.000000, \"is_role\": true,\"version_id\":100707}');
INSERT IGNORE INTO `global_priv` VALUES ('','delivery','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','deliveryAssistant','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
-INSERT IGNORE INTO `global_priv` VALUES ('','deliveryBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
+INSERT IGNORE INTO `global_priv` VALUES ('','deliveryBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','developer','{\"access\": 5909905728, \"is_role\": true, \"version_id\": 100707}');
INSERT IGNORE INTO `global_priv` VALUES ('','developerBoss','{\"access\":33554432,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','employee','{\"access\": 0, \"is_role\": true, \"version_id\": 101106}');
INSERT IGNORE INTO `global_priv` VALUES ('','entryEditor','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','ext','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}');
INSERT IGNORE INTO `global_priv` VALUES ('','financial','{\"access\": 0, \"version_id\": 100707, \"is_role\": true}');
-INSERT IGNORE INTO `global_priv` VALUES ('','financialBoss','{\"access\": 0, \"version_id\": 100707, \"is_role\": true}');
-INSERT IGNORE INTO `global_priv` VALUES ('','grafana','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
+INSERT IGNORE INTO `global_priv` VALUES ('','financialBoss','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}');
+INSERT IGNORE INTO `global_priv` VALUES ('','grafana','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','greenhouseBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
-INSERT IGNORE INTO `global_priv` VALUES ('','guest','{\"access\": 0, \"max_questions\": 40000, \"max_updates\": 1000, \"max_connections\": 150000, \"max_user_connections\": 200, \"max_statement_time\": 0.000000, \"is_role\": true, \"version_id\": 100707}');
+INSERT IGNORE INTO `global_priv` VALUES ('','guest','{\"access\": 0, \"max_questions\": 40000, \"max_updates\": 1000, \"max_connections\": 150000, \"max_user_connections\": 200, \"max_statement_time\": 0.000000, \"is_role\": true, \"version_id\": 101106}');
INSERT IGNORE INTO `global_priv` VALUES ('','handmadeBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','hedera-web','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','hr','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}');
@@ -1989,10 +1993,10 @@ INSERT IGNORE INTO `global_priv` VALUES ('','invoicing','{\"access\":0,\"versio
INSERT IGNORE INTO `global_priv` VALUES ('','itBoss','{\"access\": 541165846527, \"is_role\": true, \"version_id\": 100707}');
INSERT IGNORE INTO `global_priv` VALUES ('','itManagement','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','itemPicker','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
-INSERT IGNORE INTO `global_priv` VALUES ('','logistic','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}');
+INSERT IGNORE INTO `global_priv` VALUES ('','logistic','{\"access\": 0, \"is_role\": true, \"version_id\": 101106}');
INSERT IGNORE INTO `global_priv` VALUES ('','logisticBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','maintenance','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
-INSERT IGNORE INTO `global_priv` VALUES ('','maintenanceBos','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
+INSERT IGNORE INTO `global_priv` VALUES ('','maintenanceBos','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','maintenanceBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','manager','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','marketing','{\"access\": 0, \"is_role\": true}');
diff --git a/db/dump/.dump/structure.sql b/db/dump/.dump/structure.sql
index 0c7966b82..696cb8359 100644
--- a/db/dump/.dump/structure.sql
+++ b/db/dump/.dump/structure.sql
@@ -1,4 +1,4 @@
--- MariaDB dump 10.19 Distrib 10.5.21-MariaDB, for debian-linux-gnu (x86_64)
+-- MariaDB dump 10.19 Distrib 10.5.23-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: db.verdnatura.es Database: account
-- ------------------------------------------------------
@@ -361,7 +361,6 @@ CREATE TABLE `roleLog` (
KEY `userFk` (`userFk`),
KEY `roleLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `roleLog_originFk` (`originFk`,`creationDate`),
- CONSTRAINT `roleLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `roleLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -503,7 +502,6 @@ CREATE TABLE `userLog` (
KEY `userFk` (`userFk`),
KEY `userLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `userLog_originFk` (`originFk`,`creationDate`),
- CONSTRAINT `userLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `userLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -3210,7 +3208,7 @@ BEGIN
tm.year AS Año,
tm.month AS Mes,
tm.week AS Semana,
- v.vista AS Vista,
+ dm.description AS Vista,
bt.importe AS Importe
FROM bs.ventas bt
LEFT JOIN vn2008.Tipos tp ON tp.tipo_id = bt.tipo_id
@@ -3222,7 +3220,7 @@ BEGIN
JOIN vn2008.Movimientos m ON m.Id_Movimiento = bt.Id_Movimiento
LEFT JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket
JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia
- LEFT JOIN vn2008.Vistas v ON v.vista_id = a.Vista
+ LEFT JOIN vn.deliveryMethod dm ON dm.id = a.Vista
LEFT JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = t.Id_Consigna
LEFT JOIN vn2008.province p ON p.province_id = cs.province_id
LEFT JOIN vn2008.warehouse w ON w.id = t.warehouse_id
@@ -26171,6 +26169,84 @@ DELIMITER ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `tx_commit` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `tx_commit`(isTx BOOL)
+BEGIN
+/**
+ * Confirma los cambios asociados a una transacción.
+ *
+ * @param isTx es true si existe transacción asociada
+*/
+ IF isTx THEN
+ COMMIT;
+ END IF;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `tx_rollback` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `tx_rollback`(isTx BOOL)
+BEGIN
+/**
+ * Deshace los cambios asociados a una transacción.
+ *
+ * @param isTx es true si existe transacción asociada
+*/
+ IF isTx THEN
+ ROLLBACK;
+ END IF;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `tx_start` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `tx_start`(isTx BOOL)
+BEGIN
+/**
+ * Inicia una transacción.
+ *
+ * @param isTx es true si existe transacción asociada
+*/
+ IF isTx THEN
+ START TRANSACTION;
+ END IF;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `warn` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -26282,20 +26358,6 @@ CREATE TABLE `XDiario` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
---
--- Temporary table structure for view `__coolerPathDetail`
---
-
-DROP TABLE IF EXISTS `__coolerPathDetail`;
-/*!50001 DROP VIEW IF EXISTS `__coolerPathDetail`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `__coolerPathDetail` AS SELECT
- 1 AS `id`,
- 1 AS `coolerPathFk`,
- 1 AS `hallway` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Table structure for table `absenceType`
--
@@ -27450,6 +27512,7 @@ CREATE TABLE `calendar` (
`businessFk` int(11) NOT NULL,
`dayOffTypeFk` int(11) NOT NULL,
`dated` date NOT NULL,
+ `editorFk` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `calendar_UN` (`businessFk`,`dated`),
KEY `calendar_employee_business_labour_id_idx` (`businessFk`),
@@ -27819,7 +27882,6 @@ CREATE TABLE `claimLog` (
KEY `userFk` (`userFk`),
KEY `claimLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `claimLog_claimLog` (`originFk`,`creationDate`),
- CONSTRAINT `claimOriginFk` FOREIGN KEY (`originFk`) REFERENCES `claim` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `claimUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -28277,7 +28339,6 @@ CREATE TABLE `clientLog` (
KEY `userFk` (`userFk`),
KEY `clientLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `clientLog_clientLog` (`originFk`,`creationDate`),
- CONSTRAINT `clientLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `clientLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -28446,7 +28507,7 @@ CREATE TABLE `clientSms` (
KEY `clientSms_FK_2` (`ticketFk`),
CONSTRAINT `clientSms_FK` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE,
CONSTRAINT `clientSms_FK_1` FOREIGN KEY (`smsFk`) REFERENCES `sms` (`id`) ON UPDATE CASCADE,
- CONSTRAINT `clientSms_FK_2` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON UPDATE CASCADE
+ CONSTRAINT `clientSms_FK_2` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -29711,7 +29772,6 @@ CREATE TABLE `deviceProductionLog` (
KEY `userFk` (`userFk`),
KEY `deviceProductionLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `deviceProductionLog_deviceProductionLog` (`originFk`,`creationDate`),
- CONSTRAINT `deviceProductionOriginFk` FOREIGN KEY (`originFk`) REFERENCES `deviceProduction` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `deviceProductionUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -30279,7 +30339,6 @@ CREATE TABLE `entryLog` (
KEY `entryLog_ibfk_2` (`userFk`),
KEY `entryLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `entryLog_originFk` (`originFk`,`creationDate`),
- CONSTRAINT `entryLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `entryLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -31518,6 +31577,30 @@ CREATE TABLE `intrastat` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Table structure for table `inventoryConfig`
+--
+
+DROP TABLE IF EXISTS `inventoryConfig`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `inventoryConfig` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `maxRecentInventories` int(11) DEFAULT NULL COMMENT 'The maximum number of recent inventories to retain without deletion',
+ `daysInPastForInventory` int(11) DEFAULT NULL COMMENT 'The number of days in the past to consider for inventory calculations',
+ `warehouseOutFk` smallint(6) unsigned DEFAULT NULL COMMENT 'The identifier for the inventory output warehouse',
+ `agencyModeFk` int(11) DEFAULT NULL COMMENT 'The identifier for the default inventory agencyMode',
+ `supplierFk` int(10) unsigned DEFAULT NULL COMMENT 'The identifier for the default inventory supplier',
+ PRIMARY KEY (`id`),
+ KEY `inventoryConfig_supplier_FK` (`supplierFk`),
+ KEY `inventoryConfig_warehouse_FK` (`warehouseOutFk`),
+ KEY `inventoryConfig_agencyMode_FK` (`agencyModeFk`),
+ CONSTRAINT `inventoryConfig_agencyMode_FK` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`),
+ CONSTRAINT `inventoryConfig_supplier_FK` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`),
+ CONSTRAINT `inventoryConfig_warehouse_FK_1` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
--
-- Table structure for table `inventoryFailure`
--
@@ -31779,7 +31862,6 @@ CREATE TABLE `invoiceInLog` (
KEY `userFk` (`userFk`),
KEY `invoiceInLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `invoiceInLog_originFk` (`originFk`,`creationDate`),
- CONSTRAINT `invoiceInLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `invoiceInLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -32108,7 +32190,7 @@ CREATE TABLE `item` (
`itemPackingTypeFk` varchar(1) DEFAULT NULL,
`packingOut` decimal(10,2) DEFAULT NULL COMMENT 'cantidad que cabe en una caja de verdnatura',
`genericFk` int(11) DEFAULT NULL COMMENT 'Item genérico',
- `packingShelve` int(11) DEFAULT NULL COMMENT 'unidades que caben en una bandeja, en el caso de los sacadores',
+ `packingShelve__` int(11) DEFAULT NULL COMMENT '@deprecated 2024-31-01',
`isLaid` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Indica si el producto se puede tumbar a efectos del transporte desde Holanda',
`lastUsed` datetime DEFAULT current_timestamp(),
`weightByPiece` int(10) unsigned DEFAULT NULL COMMENT 'peso por defecto para un articulo por tallo/unidad',
@@ -32116,6 +32198,7 @@ CREATE TABLE `item` (
`recycledPlastic` int(11) DEFAULT NULL,
`nonRecycledPlastic` int(11) DEFAULT NULL,
`minQuantity` int(10) unsigned DEFAULT NULL COMMENT 'Cantidad mínima para una línea de venta',
+ `isBoxPickingMode` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'FALSE: using item.packingOut TRUE: boxPicking using itemShelving.packing',
PRIMARY KEY (`id`),
UNIQUE KEY `item_supplyResponseFk_idx` (`supplyResponseFk`),
KEY `Color` (`inkFk`),
@@ -32462,7 +32545,6 @@ CREATE TABLE `itemLog` (
KEY `itemLogUserFk_idx` (`userFk`),
KEY `itemLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `itemLog_originFk` (`originFk`,`creationDate`),
- CONSTRAINT `itemLogItemFk` FOREIGN KEY (`originFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `itemLogUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -33863,14 +33945,14 @@ DROP TABLE IF EXISTS `operator`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `operator` (
`workerFk` int(10) unsigned NOT NULL,
- `numberOfWagons` int(11) DEFAULT 1,
+ `numberOfWagons` int(11) DEFAULT 2,
`trainFk` int(11) NOT NULL DEFAULT 1,
`itemPackingTypeFk` varchar(1) NOT NULL DEFAULT 'H',
`warehouseFk` smallint(6) unsigned NOT NULL DEFAULT 60,
`sectorFk` int(11) DEFAULT NULL,
`labelerFk` tinyint(3) unsigned DEFAULT NULL,
- `linesLimit` int(11) DEFAULT NULL COMMENT 'Límite de lineas en una colección para la asignación de pedidos',
- `volumeLimit` decimal(10,6) DEFAULT NULL COMMENT 'Límite de volumen en una colección para la asignación de pedidos',
+ `linesLimit` int(11) DEFAULT 20 COMMENT 'Límite de lineas en una colección para la asignación de pedidos',
+ `volumeLimit` decimal(10,6) DEFAULT 0.500000 COMMENT 'Límite de volumen en una colección para la asignación de pedidos',
PRIMARY KEY (`workerFk`),
KEY `operator_FK` (`workerFk`),
KEY `operator_FK_1` (`trainFk`),
@@ -34278,7 +34360,6 @@ CREATE TABLE `packingSiteDeviceLog` (
KEY `userFk` (`userFk`),
KEY `packingSiteDeviceLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `packingSiteDeviceLog_packingSiteDeviceLog` (`originFk`,`creationDate`),
- CONSTRAINT `packingSiteDeviceLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `packingSiteDeviceLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -35080,11 +35161,14 @@ CREATE TABLE `productionConfig` (
`shortageAddressFk` int(11) DEFAULT NULL COMMENT 'Consignatario por defecto para añadir un item de alta',
`clientSelfConsumptionFk` int(11) DEFAULT NULL COMMENT 'Cliente para crear el ticket de autoconsumo',
`itemPreviousDefaultSize` int(11) DEFAULT NULL COMMENT 'Altura por defecto para los artículos de previa',
+ `addressSelfConsumptionFk` int(11) DEFAULT 2613 COMMENT 'Consignatario para crear el ticket de autoconsumo',
PRIMARY KEY (`id`),
KEY `productionConfig_FK` (`shortageAddressFk`),
KEY `productionConfig_FK_1` (`clientSelfConsumptionFk`),
+ KEY `productionConfig_FK_2` (`addressSelfConsumptionFk`),
CONSTRAINT `productionConfig_FK` FOREIGN KEY (`shortageAddressFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE,
- CONSTRAINT `productionConfig_FK_1` FOREIGN KEY (`clientSelfConsumptionFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ CONSTRAINT `productionConfig_FK_1` FOREIGN KEY (`clientSelfConsumptionFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `productionConfig_FK_2` FOREIGN KEY (`addressSelfConsumptionFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Recoge los parámetros que condicionan la producción';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -35487,7 +35571,6 @@ CREATE TABLE `rateLog` (
KEY `logRateuserFk` (`userFk`),
KEY `rateLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `rateLog_originFk` (`originFk`,`creationDate`),
- CONSTRAINT `rateOriginFk` FOREIGN KEY (`originFk`) REFERENCES `rate` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `rateUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -35962,7 +36045,6 @@ CREATE TABLE `routeLog` (
KEY `userFk` (`userFk`),
KEY `routeLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `routeLog_originFk` (`originFk`,`creationDate`),
- CONSTRAINT `routeLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `route` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `routeLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -36931,7 +37013,6 @@ CREATE TABLE `shelvingLog` (
KEY `userFk` (`userFk`),
KEY `shelvingLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `shelvingLog_originFk` (`originFk`,`creationDate`),
- CONSTRAINT `shelvingLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `shelving` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `shelvingLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -37636,8 +37717,7 @@ CREATE TABLE `supplierLog` (
KEY `supplierLog_ibfk_2` (`userFk`),
KEY `supplierLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `supplierLog_originFk` (`originFk`,`creationDate`),
- CONSTRAINT `supplierLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE,
- CONSTRAINT `supplierLog_supplierFk` FOREIGN KEY (`originFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ CONSTRAINT `supplierLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -38165,7 +38245,6 @@ CREATE TABLE `ticketLog` (
KEY `logTicketuserFk` (`userFk`),
KEY `ticketLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `ticketLog_originFk` (`originFk`,`creationDate`),
- CONSTRAINT `ticketLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `ticketLog_user` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -38542,11 +38621,11 @@ DROP TABLE IF EXISTS `ticketStateToday`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `ticketStateToday` AS SELECT
- 1 AS `ticket`,
+ 1 AS `ticketFk`,
1 AS `state`,
1 AS `productionOrder`,
1 AS `alertLevel`,
- 1 AS `worker`,
+ 1 AS `userFk`,
1 AS `code`,
1 AS `updated`,
1 AS `isPicked` */;
@@ -39102,7 +39181,6 @@ CREATE TABLE `travelLog` (
KEY `userFk` (`userFk`),
KEY `travelLog_changedModel` (`changedModel`,`changedModelId`,`originFk`),
KEY `travelLog_originFk` (`originFk`,`creationDate`),
- CONSTRAINT `travelLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `travel` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `travelLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -39299,7 +39377,6 @@ CREATE TABLE `userLog` (
PRIMARY KEY (`id`),
KEY `originFk` (`originFk`),
KEY `userFk` (`userFk`),
- CONSTRAINT `userLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `userLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -39790,7 +39867,7 @@ CREATE TABLE `worker` (
`lastName` varchar(50) DEFAULT NULL,
`sub` int(11) unsigned DEFAULT NULL,
`photo` blob DEFAULT NULL,
- `phone` varchar(9) DEFAULT NULL,
+ `phone` varchar(15) DEFAULT NULL,
`mobileExtension` int(4) DEFAULT NULL,
`bossFk` int(10) unsigned DEFAULT 103,
`fiDueDate` datetime DEFAULT NULL,
@@ -40176,7 +40253,7 @@ CREATE TABLE `workerLog` (
`action` set('insert','update','delete') NOT NULL,
`creationDate` timestamp NULL DEFAULT current_timestamp(),
`description` text DEFAULT NULL,
- `changedModel` enum('Worker','Calendar','WorkerTimeControlMail','Business','WorkerDms') NOT NULL DEFAULT 'Worker',
+ `changedModel` enum('Worker','Calendar','WorkerTimeControlMail','Business','WorkerDms','WorkerTimeControl') NOT NULL DEFAULT 'Worker',
`oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)),
`newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)),
`changedModelId` int(11) NOT NULL,
@@ -40185,8 +40262,7 @@ CREATE TABLE `workerLog` (
KEY `userFk_idx` (`userFk`),
KEY `workerLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `workerLog_originFk` (`originFk`,`creationDate`),
- CONSTRAINT `userFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- CONSTRAINT `workerFk` FOREIGN KEY (`originFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ CONSTRAINT `userFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -40419,11 +40495,14 @@ CREATE TABLE `workerTimeControl` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userFk` int(10) unsigned NOT NULL,
`timed` datetime NOT NULL,
+ `direction` enum('in','out','middle') DEFAULT 'middle',
`manual` tinyint(4) NOT NULL DEFAULT 0,
`order` int(11) DEFAULT NULL,
+ `device` varchar(255) DEFAULT NULL COMMENT 'Dispositivo en el que se ha fichado',
`warehouseFk` smallint(6) unsigned DEFAULT NULL,
- `direction` enum('in','out','middle') DEFAULT 'middle',
`isSendMail` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Fichadas generadas autómaticamente con el procedimiento vn.workerTimeControl_sendMail',
+ `logExclude` tinyint(1) GENERATED ALWAYS AS (if(`manual`,0,1)) VIRTUAL,
+ `editorFk` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `userFk_Timed_uniq` (`userFk`,`timed`),
KEY `warehouseFkfk1_idx` (`warehouseFk`),
@@ -40957,7 +41036,6 @@ CREATE TABLE `zoneLog` (
KEY `userFk` (`userFk`),
KEY `zoneLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `zoneLog_originFk` (`originFk`,`creationDate`),
- CONSTRAINT `zoneLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `zoneLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -45653,144 +45731,6 @@ DELIMITER ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-/*!50003 DROP FUNCTION IF EXISTS `workerTimeControl_add` */;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `workerTimeControl_add`(vUserFk INT, vWarehouseFk INT, vTimed DATETIME, vIsManual BOOL) RETURNS int(11)
- DETERMINISTIC
-BEGIN
- DECLARE vDirection VARCHAR(6);
- DECLARE vLastIn DATETIME;
- DECLARE vDayStayMax INT;
- DECLARE vHasDirectionOut INT;
- DECLARE vLastInsertedId INT;
-
- SELECT dayStayMax INTO vDayStayMax
- FROM workerTimeControlParams;
-
- SELECT timeWorkerControl_getDirection(vUserFk,vTimed) INTO vDirection;
-
- IF vDirection = 'out' THEN
-
- SELECT MAX(timed) INTO vLastIn
- FROM workerTimeControl
- WHERE userFk = vUserFk
- AND direction = 'in'
- AND timed < vTimed;
-
- UPDATE workerTimeControl wtc
- SET wtc.direction = 'middle'
- WHERE userFk = vUserFk
- AND direction = 'out'
- AND timed BETWEEN vLastIn AND vTimed;
-
- ELSE IF vDirection = 'in' THEN
-
- SELECT COUNT(*) INTO vHasDirectionOut
- FROM workerTimeControl wtc
- WHERE userFk = vUserFk
- AND direction = 'out'
- AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed);
-
- UPDATE workerTimeControl wtc
- SET wtc.direction = IF (vHasDirectionOut,'middle','out')
- WHERE userFk = vUserFk
- AND direction = 'in'
- AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed);
-
- END IF;
- END IF;
-
- INSERT INTO workerTimeControl(userFk, timed, warehouseFk, direction, manual)
- VALUES(vUserFk, vTimed, vWarehouseFk, vDirection, vIsManual);
-
- SET vLastInsertedId = LAST_INSERT_ID();
-
- CALL workerTimeControlSOWP(vUserFk, vTimed);
-
- RETURN vLastInsertedId;
-END ;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-/*!50003 DROP FUNCTION IF EXISTS `workerTimeControl_addDirection` */;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `workerTimeControl_addDirection`(vUserFk INT, vWarehouseFk INT, vTimed DATETIME, vIsManual BOOL) RETURNS int(11)
- DETERMINISTIC
-BEGIN
- DECLARE vDirection VARCHAR(6);
- DECLARE vLastIn DATETIME;
- DECLARE vDayStayMax INT;
- DECLARE vHasDirectionOut INT;
- DECLARE vLastInsertedId INT;
-
- SELECT dayStayMax INTO vDayStayMax
- FROM workerTimeControlParams;
-
- SELECT timeWorkerControl_getDirection(vUserFk,vTimed) INTO vDirection;
-
- IF vDirection = 'out' THEN
-
- SELECT MAX(timed) INTO vLastIn
- FROM workerTimeControl
- WHERE userFk = vUserFk
- AND direction = 'in'
- AND timed < vTimed;
-
- UPDATE workerTimeControl wtc
- SET wtc.direction = 'middle'
- WHERE userFk = vUserFk
- AND direction = 'out'
- AND timed BETWEEN vLastIn AND vTimed;
-
- ELSE IF vDirection = 'in' THEN
-
- SELECT COUNT(*) INTO vHasDirectionOut
- FROM workerTimeControl wtc
- WHERE userFk = vUserFk
- AND direction = 'out'
- AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed);
-
- UPDATE workerTimeControl wtc
- SET wtc.direction = IF (vHasDirectionOut,'middle','out')
- WHERE userFk = vUserFk
- AND direction = 'in'
- AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed);
-
- END IF;
- END IF;
-
- INSERT INTO workerTimeControl(userFk, timed, warehouseFk, direction, manual)
- VALUES(vUserFk, vTimed, vWarehouseFk, vDirection, vIsManual);
-
- SET vLastInsertedId = LAST_INSERT_ID();
-
- CALL workerTimeControlSOWP(vUserFk, vTimed);
-
- RETURN vLastInsertedId;
-END ;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP FUNCTION IF EXISTS `worker_getCode` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -45875,38 +45815,38 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP FUNCTION IF EXISTS `worker_isInDepartment` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `worker_isInDepartment`(vDepartmentCode VARCHAR(255)) RETURNS int(11)
DETERMINISTIC
-BEGIN
-/**
- * Devuelve booleano si el trabajador conectado pertenece
- * al departamento vDepartmentCode o a sus departamentos subordinados
- *
- * @param vDepartmentCode code del departamento que se desea comprobar.
- * @return Devuelve verdadero si es jefe del empleado por escala jerárquica.
- */
- DECLARE vIsInDepartment BOOLEAN;
- WITH RECURSIVE department AS (
- SELECT d.id FROM vn.department d WHERE code = vDepartmentCode
- UNION
- SELECT d.id
- FROM department ds
- JOIN vn.department d ON ds.id = d.parentFk
- )
- SELECT COUNT(*) INTO vIsInDepartment FROM department ds
- JOIN vn.workerDepartment wd ON wd.departmentFk = ds.id
- WHERE wd.workerFk = account.myUser_getId();
-
- RETURN vIsInDepartment;
+BEGIN
+/**
+ * Devuelve booleano si el trabajador conectado pertenece
+ * al departamento vDepartmentCode o a sus departamentos subordinados
+ *
+ * @param vDepartmentCode code del departamento que se desea comprobar.
+ * @return Devuelve verdadero si es jefe del empleado por escala jerárquica.
+ */
+ DECLARE vIsInDepartment BOOLEAN;
+ WITH RECURSIVE department AS (
+ SELECT d.id FROM vn.department d WHERE code = vDepartmentCode
+ UNION
+ SELECT d.id
+ FROM department ds
+ JOIN vn.department d ON ds.id = d.parentFk
+ )
+ SELECT COUNT(*) INTO vIsInDepartment FROM department ds
+ JOIN vn.workerDepartment wd ON wd.departmentFk = ds.id
+ WHERE wd.workerFk = account.myUser_getId();
+
+ RETURN vIsInDepartment;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -47949,6 +47889,7 @@ BEGIN
DECLARE v26Month DATE;
DECLARE v3Month DATE;
DECLARE vTrashId VARCHAR(15);
+ DECLARE v2Years DATE;
DECLARE v5Years DATE;
SET vDateShort = util.VN_CURDATE() - INTERVAL 2 MONTH;
@@ -47958,6 +47899,7 @@ BEGIN
SET v18Month = util.VN_CURDATE() - INTERVAL 18 MONTH;
SET v26Month = util.VN_CURDATE() - INTERVAL 26 MONTH;
SET v3Month = util.VN_CURDATE() - INTERVAL 3 MONTH;
+ SET v2Years = util.VN_CURDATE() - INTERVAL 2 YEAR;
SET v5Years = util.VN_CURDATE() - INTERVAL 5 YEAR;
DELETE FROM ticketParking WHERE created < vDateShort;
@@ -48102,7 +48044,11 @@ BEGIN
FROM tmp.duaToDelete tmp
JOIN vn.dua d ON d.id = tmp.id;
- DELETE FROM vn.awb WHERE created < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE());
+ DELETE a
+ FROM vn.awb a
+ LEFT JOIN vn.travel t ON t.awbFk = a.id
+ WHERE a.created < v2Years
+ AND t.id IS NULL;
-- Borra los registros de collection y ticketcollection
DELETE FROM vn.collection WHERE created < vDateShort;
@@ -51437,71 +51383,75 @@ DELIMITER ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `duaInvoiceInBooking`(vDuaFk INT)
BEGIN
-
+/**
+ * Genera el asiento de un DUA y marca las entradas como confirmadas
+ *
+ * @param vDuaFk Id del dua a recalcular
+ */
DECLARE done BOOL DEFAULT FALSE;
DECLARE vInvoiceFk INT;
- DECLARE vASIEN BIGINT DEFAULT 0;
- DECLARE vCounter INT DEFAULT 0;
-
+ DECLARE vASIEN BIGINT DEFAULT 0;
+ DECLARE vCounter INT DEFAULT 0;
+
DECLARE rs CURSOR FOR
- SELECT e.invoiceInFk
+ SELECT DISTINCT e.invoiceInFk
FROM entry e
JOIN duaEntry de ON de.entryFk = e.id
- JOIN invoiceIn ii ON ii.id = e.invoiceInFk
- WHERE de.duaFk = vDuaFk
+ JOIN invoiceIn ii ON ii.id = e.invoiceInFk
+ WHERE de.duaFk = vDuaFk
AND de.customsValue
AND ii.isBooked = FALSE;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
OPEN rs;
-
+
UPDATE invoiceIn ii
JOIN entry e ON e.invoiceInFk = ii.id
- JOIN duaEntry de ON de.entryFk = e.id
- JOIN dua d ON d.id = de.duaFk
+ JOIN duaEntry de ON de.entryFk = e.id
+ JOIN dua d ON d.id = de.duaFk
SET ii.isBooked = TRUE,
ii.booked = IFNULL(ii.booked,d.booked),
ii.operated = IFNULL(ii.operated,d.operated),
- ii.issued = IFNULL(ii.issued,d.issued),
- ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried),
- e.isConfirmed = TRUE
+ ii.issued = IFNULL(ii.issued,d.issued),
+ ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried),
+ e.isConfirmed = TRUE
WHERE d.id = vDuaFk;
-
- SELECT IFNULL(ASIEN,0) INTO vASIEN
+
+ SELECT IFNULL(ASIEN,0) INTO vASIEN
FROM dua
WHERE id = vDuaFk;
-
+
FETCH rs INTO vInvoiceFk;
-
+
WHILE NOT done DO
CALL invoiceIn_booking(vInvoiceFk);
-
- IF vCounter > 0 OR vASIEN > 0 THEN
-
+
+ IF vCounter > 0 OR vASIEN > 0 THEN
+
UPDATE vn2008.XDiario x
- JOIN vn.ledgerConfig lc ON lc.lastBookEntry = x.ASIEN
- SET x.ASIEN = vASIEN;
-
- ELSE
-
- SELECT lastBookEntry INTO vASIEN FROM vn.ledgerConfig;
-
+ JOIN ledgerConfig lc ON lc.lastBookEntry = x.ASIEN
+ SET x.ASIEN = vASIEN;
+
+ ELSE
+
+ SELECT lastBookEntry INTO vASIEN FROM ledgerConfig;
+
END IF;
-
- SET vCounter = vCounter + 1;
-
+
+ SET vCounter = vCounter + 1;
+
FETCH rs INTO vInvoiceFk;
END WHILE;
-
- CLOSE rs;
-
- UPDATE dua
- SET ASIEN = vASIEN
- WHERE id = vDuaFk;
-
+
+ CLOSE rs;
+
+ UPDATE dua
+ SET ASIEN = vASIEN
+ WHERE id = vDuaFk;
+
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -54397,184 +54347,177 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryMake`(vDate DATE, vWh INT)
-proc: BEGIN
+CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryMake`(vInventoryDate DATE)
+BEGIN
/**
-* Recalcula los inventarios de todos los almacenes, si vWh = 0
+* Recalculate the inventories
*
-* @param vDate Fecha de los nuevos inventarios
-* @param vWh almacen al cual hacer el inventario
+* @param vInventoryDate date for the new inventory
*/
-
DECLARE vDone BOOL;
DECLARE vEntryFk INT;
DECLARE vTravelFk INT;
DECLARE vDateLastInventory DATE;
- DECLARE vDateYesterday DATETIME DEFAULT vDate - INTERVAL 1 SECOND;
+ DECLARE vDateYesterday DATETIME DEFAULT vInventoryDate - INTERVAL 1 SECOND;
DECLARE vWarehouseOutFkInventory INT;
DECLARE vInventorySupplierFk INT;
DECLARE vAgencyModeFkInventory INT;
+ DECLARE vMaxRecentInventories INT;
+ DECLARE vWarehouseFk INT;
DECLARE cWarehouses CURSOR FOR
SELECT id
FROM warehouse
- WHERE isInventory
- AND vWh IN (0,id);
+ WHERE isInventory;
+
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
+ BEGIN
+ ROLLBACK;
+ RESIGNAL;
+ END;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
+ SELECT inventorySupplierFk INTO vInventorySupplierFk FROM entryConfig LIMIT 1;
+ SELECT inventoried INTO vDateLastInventory FROM config LIMIT 1;
+ SELECT maxRecentInventories,
+ warehouseOutFk,
+ agencyModeFk
+ INTO vMaxRecentInventories,
+ vWarehouseOutFkInventory,
+ vAgencyModeFkInventory
+ FROM inventoryConfig
+ LIMIT 1;
+
+ IF vDateLastInventory IS NULL
+ OR vInventorySupplierFk IS NULL
+ OR vMaxRecentInventories IS NULL
+ OR vInventoryDate IS NULL
+ OR vWarehouseOutFkInventory IS NULL
+ OR vAgencyModeFkInventory IS NULL THEN
+ CALL util.throw('Some config parameters are not set');
+ END IF;
+
+ START TRANSACTION;
+
OPEN cWarehouses;
+ -- Environment variable to disable the triggers of the affected tables
SET @isModeInventory := TRUE;
l: LOOP
-
SET vDone = FALSE;
- FETCH cWarehouses INTO vWh;
+ SET vEntryFk = NULL;
+ SET vTravelFk = NULL;
+
+ FETCH cWarehouses INTO vWarehouseFk;
IF vDone THEN
LEAVE l;
END IF;
- SELECT w.id INTO vWarehouseOutFkInventory
- FROM warehouse w
- WHERE w.code = 'inv';
-
- SELECT inventorySupplierFk INTO vInventorySupplierFk
- FROM entryConfig;
-
- SELECT am.id INTO vAgencyModeFkInventory
- FROM agencyMode am
- where code = 'inv';
-
- SELECT MAX(landed) INTO vDateLastInventory
- FROM travel tr
- JOIN entry e ON e.travelFk = tr.id
- JOIN buy b ON b.entryFk = e.id
- WHERE warehouseOutFk = vWarehouseOutFkInventory
- AND landed < vDate
- AND e.supplierFk = vInventorySupplierFk
- AND warehouseInFk = vWh
- AND NOT isRaid;
-
- IF vDateLastInventory IS NULL THEN
- SELECT inventoried INTO vDateLastInventory FROM config;
- END IF;
-
- -- Generamos travel, si no existe.
- SET vTravelFK = 0;
-
+ -- Generate travel, if it does not exist
SELECT id INTO vTravelFk
FROM travel
WHERE warehouseOutFk = vWarehouseOutFkInventory
- AND warehouseInFk = vWh
- AND landed = vDate
+ AND warehouseInFk = vWarehouseFk
+ AND landed = vInventoryDate
AND agencyModeFk = vAgencyModeFkInventory
AND ref = 'inventario'
LIMIT 1;
- IF NOT vTravelFK THEN
-
- INSERT INTO travel SET
- warehouseOutFk = vWarehouseOutFkInventory,
- warehouseInFk = vWh,
- shipped = vDate,
- landed = vDate,
- agencyModeFk = vAgencyModeFkInventory,
- ref = 'inventario',
- isDelivered = TRUE,
- isReceived = TRUE;
+ IF vTravelFk IS NULL THEN
+ INSERT INTO travel
+ SET warehouseOutFk = vWarehouseOutFkInventory,
+ warehouseInFk = vWarehouseFk,
+ shipped = vInventoryDate,
+ landed = vInventoryDate,
+ agencyModeFk = vAgencyModeFkInventory,
+ ref = 'inventario',
+ isDelivered = TRUE,
+ isReceived = TRUE;
SELECT LAST_INSERT_ID() INTO vTravelFk;
-
END IF;
- -- Generamos entrada si no existe, o la vaciamos.
- SET vEntryFk = 0;
-
+ -- Generate an entry if it does not exist, or we empty it
SELECT id INTO vEntryFk
FROM entry
WHERE supplierFk = vInventorySupplierFk
AND travelFk = vTravelFk;
- IF NOT vEntryFk THEN
-
- INSERT INTO entry SET
- supplierFk = vInventorySupplierFk,
- isConfirmed = TRUE,
- isOrdered = TRUE,
- travelFk = vTravelFk;
+ IF vEntryFk IS NULL THEN
+ INSERT INTO entry
+ SET supplierFk = vInventorySupplierFk,
+ isConfirmed = TRUE,
+ isOrdered = TRUE,
+ travelFk = vTravelFk;
SELECT LAST_INSERT_ID() INTO vEntryFk;
-
ELSE
-
DELETE FROM buy WHERE entryFk = vEntryFk;
-
END IF;
- -- Preparamos tabla auxilar
- CREATE OR REPLACE TEMPORARY TABLE tmp.inventory (
- itemFk INT(11) NOT NULL PRIMARY KEY,
- quantity int(11) DEFAULT '0',
- buyingValue decimal(10,4) DEFAULT '0.0000',
- freightValue decimal(10,3) DEFAULT '0.000',
- packing int(11) DEFAULT '0',
- `grouping` smallint(5) unsigned NOT NULL DEFAULT '1',
- groupingMode tinyint(4) NOT NULL DEFAULT 0 ,
- comissionValue decimal(10,3) DEFAULT '0.000',
- packageValue decimal(10,3) DEFAULT '0.000',
- packageFk varchar(10) COLLATE utf8_unicode_ci DEFAULT '--',
- price1 decimal(10,2) DEFAULT '0.00',
- price2 decimal(10,2) DEFAULT '0.00',
- price3 decimal(10,2) DEFAULT '0.00',
- minPrice decimal(10,2) DEFAULT '0.00',
- producer varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
- INDEX (itemFK)) ENGINE = MEMORY;
+ -- Prepare the auxiliary table
+ CREATE OR REPLACE TEMPORARY TABLE tInventory (
+ itemFk INT(11) NOT NULL PRIMARY KEY,
+ quantity int(11) DEFAULT '0',
+ buyingValue decimal(10,4) DEFAULT '0.0000',
+ freightValue decimal(10,3) DEFAULT '0.000',
+ packing int(11) DEFAULT '0',
+ `grouping` smallint(5) unsigned NOT NULL DEFAULT '1',
+ groupingMode tinyint(4) NOT NULL DEFAULT 0 ,
+ comissionValue decimal(10,3) DEFAULT '0.000',
+ packageValue decimal(10,3) DEFAULT '0.000',
+ packageFk varchar(10) COLLATE utf8_unicode_ci DEFAULT '--',
+ price1 decimal(10,2) DEFAULT '0.00',
+ price2 decimal(10,2) DEFAULT '0.00',
+ price3 decimal(10,2) DEFAULT '0.00',
+ minPrice decimal(10,2) DEFAULT '0.00',
+ producer varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
+ INDEX (itemFK)
+ ) ENGINE = MEMORY;
- -- Compras
- INSERT INTO tmp.inventory(itemFk,quantity)
+ -- Buys
+ INSERT INTO tInventory(itemFk, quantity)
SELECT b.itemFk, SUM(b.quantity)
FROM buy b
JOIN entry e ON e.id = b.entryFk
JOIN travel tr ON tr.id = e.travelFk
- WHERE tr.warehouseInFk = vWh
- AND tr.landed BETWEEN vDateLastInventory
- AND vDateYesterday
+ WHERE tr.warehouseInFk = vWarehouseFk
+ AND tr.landed BETWEEN vDateLastInventory AND vDateYesterday
AND NOT isRaid
GROUP BY b.itemFk;
- SELECT vDateLastInventory , vDateYesterday;
- -- Traslados
- INSERT INTO tmp.inventory(itemFk, quantity)
+ -- Transfers
+ INSERT INTO tInventory(itemFk, quantity)
SELECT itemFk, quantityOut
- FROM (
+ FROM (
SELECT b.itemFk,- SUM(b.quantity) quantityOut
FROM buy b
JOIN entry e ON e.id = b.entryFk
JOIN travel tr ON tr.id = e.travelFk
- WHERE tr.warehouseOutFk = vWh
- AND tr.shipped BETWEEN vDateLastInventory
- AND vDateYesterday
+ WHERE tr.warehouseOutFk = vWarehouseFk
+ AND tr.shipped BETWEEN vDateLastInventory AND vDateYesterday
AND NOT isRaid
GROUP BY b.itemFk
) sub
ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity, 0) + sub.quantityOut;
- -- Ventas
- INSERT INTO tmp.inventory(itemFk,quantity)
+ -- Sales
+ INSERT INTO tInventory(itemFk, quantity)
SELECT itemFk, saleOut
- FROM (
+ FROM (
SELECT s.itemFk, - SUM(s.quantity) saleOut
FROM sale s
JOIN ticket t ON t.id = s.ticketFk
- WHERE t.warehouseFk = vWh
+ WHERE t.warehouseFk = vWarehouseFk
AND t.shipped BETWEEN vDateLastInventory AND vDateYesterday
GROUP BY s.itemFk
) sub
ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity,0) + sub.saleOut;
- -- Actualiza valores de la ultima compra
- UPDATE tmp.inventory inv
- JOIN cache.last_buy lb ON lb.item_id = inv.itemFk AND lb.warehouse_id = vWh
+ -- Update values of the last purchase
+ UPDATE tInventory inv
+ JOIN cache.last_buy lb ON lb.item_id = inv.itemFk AND lb.warehouse_id = vWarehouseFk
JOIN buy b ON b.id = lb.buy_id
JOIN item i ON i.id = b.itemFk
LEFT JOIN producer p ON p.id = i.producerFk
@@ -54592,7 +54535,7 @@ proc: BEGIN
inv.minPrice = b.minPrice,
inv.producer = p.name;
- INSERT INTO buy( itemFk,
+ INSERT INTO buy(itemFk,
quantity,
buyingValue,
freightValue,
@@ -54622,43 +54565,54 @@ proc: BEGIN
price3,
minPrice,
vEntryFk
- FROM tmp.inventory;
+ FROM tInventory;
- SELECT vWh, COUNT(*), util.VN_NOW() FROM tmp.inventory;
-
- -- Actualizamos el campo lastUsed de item
- UPDATE item i
- JOIN tmp.inventory i2 ON i2.itemFk = i.id
- SET i.lastUsed = NOW()
- WHERE i2.quantity;
-
- -- DROP TEMPORARY TABLE tmp.inventory;
+ -- Update the 'lastUsed' field of the item
+ UPDATE item i
+ JOIN tInventory i2 ON i2.itemFk = i.id
+ SET i.lastUsed = NOW()
+ WHERE i2.quantity;
+
+ DROP TEMPORARY TABLE tInventory;
END LOOP;
-
+
CLOSE cWarehouses;
- UPDATE config SET inventoried = vDate;
- SET @isModeInventory := FALSE;
+ UPDATE config SET inventoried = vInventoryDate;
- DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete;
- CREATE TEMPORARY TABLE tmp.entryToDelete
- (INDEX(entryId) USING BTREE) ENGINE = MEMORY
- SELECT e.id as entryId,
- t.id as travelId
+ SET @isModeInventory := FALSE;
+
+ CREATE OR REPLACE TEMPORARY TABLE tEntryToDelete
+ (INDEX(entryId)) ENGINE = MEMORY
+ SELECT e.id entryId,
+ t.id travelId
FROM travel t
JOIN `entry` e ON e.travelFk = t.id
+ JOIN (
+ SELECT t.shipped
+ FROM travel t
+ JOIN `entry` e ON e.travelFk = t.id
+ WHERE e.supplierFk = vInventorySupplierFk
+ AND t.shipped <= vInventoryDate
+ GROUP BY t.shipped
+ ORDER BY t.shipped DESC
+ OFFSET vMaxRecentInventories ROWS
+ ) sub
WHERE e.supplierFk = vInventorySupplierFk
- AND t.shipped <= util.VN_CURDATE() - INTERVAL 12 DAY
- AND (DAY(t.shipped) <> 1 OR shipped < util.VN_CURDATE() - INTERVAL 12 DAY);
+ AND t.shipped IN (sub.shipped);
- DELETE e
+ DELETE e
FROM `entry` e
- JOIN tmp.entryToDelete tmp ON tmp.entryId = e.id;
+ JOIN tEntryToDelete tmp ON tmp.entryId = e.id;
DELETE IGNORE t
FROM travel t
- JOIN tmp.entryToDelete tmp ON tmp.travelId = t.id;
+ JOIN tEntryToDelete tmp ON tmp.travelId = t.id;
+
+ DROP TEMPORARY TABLE IF EXISTS tEntryToDelete;
+
+ COMMIT;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -54678,11 +54632,12 @@ DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryMakeLauncher`()
BEGIN
/**
- * Recalcula los inventarios de todos los almacenes.
+ * Recalculate the inventories of all warehouses
*/
-
- call vn.inventoryMake(TIMESTAMPADD(DAY, -10, util.VN_CURDATE()), 0);
-
+ CALL inventoryMake(
+ util.VN_CURDATE() -
+ INTERVAL (SELECT daysInPastForInventory FROM inventoryConfig LIMIT 1) DAY
+ );
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -55072,33 +55027,36 @@ DELIMITER ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTaxMakeByDua`(vDuaFk INT)
BEGIN
-
- DECLARE done BOOL DEFAULT FALSE;
+/**
+ * Borra los valores de duaTax y sus vctos. y los vuelve a crear en base a la tabla duaEntry
+ *
+ * @param vDuaFk Id del dua a recalcular
+ */
+ DECLARE vDone BOOL DEFAULT FALSE;
DECLARE vInvoiceInFk INT;
- DECLARE rs CURSOR FOR
- SELECT invoiceInFk
- FROM entry e
- JOIN duaEntry de ON de.entryFk = e.id
- WHERE de.duaFk = vDuaFk;
+ DECLARE vInvoices CURSOR FOR
+ SELECT DISTINCT invoiceInFk
+ FROM entry e
+ JOIN duaEntry de ON de.entryFk = e.id
+ WHERE de.duaFk = vDuaFk;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
- OPEN rs;
+ OPEN vInvoices;
+ l: LOOP
+ SET vDone = FALSE;
+ FETCH vInvoices INTO vInvoiceInFk;
- FETCH rs INTO vInvoiceInFk;
-
- WHILE NOT done DO
+ IF vDone THEN
+ LEAVE l;
+ END IF;
CALL vn2008.recibidaIvaInsert(vInvoiceInFk);
CALL invoiceInDueDay_recalc(vInvoiceInFk);
- FETCH rs INTO vInvoiceInFk;
-
- END WHILE;
-
- CLOSE rs;
-
+ END LOOP;
+ CLOSE vInvoices;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -55153,33 +55111,36 @@ DELIMITER ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromDua`(vDuaFk INT)
BEGIN
-
- DECLARE done BOOL DEFAULT FALSE;
+/**
+ * Borra los valores de duaTax y sus vctos. y los vuelve a crear en base a la tabla duaEntry
+ *
+ * @param vDuaFk Id del dua a recalcular
+ */
+ DECLARE vDone BOOL DEFAULT FALSE;
DECLARE vInvoiceInFk INT;
- DECLARE rs CURSOR FOR
- SELECT invoiceInFk
+ DECLARE vInvoices CURSOR FOR
+ SELECT DISTINCT invoiceInFk
FROM entry e
JOIN duaEntry de ON de.entryFk = e.id
WHERE de.duaFk = vDuaFk;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
- OPEN rs;
+ OPEN vInvoices;
+ l: LOOP
+ SET vDone = FALSE;
+ FETCH vInvoices INTO vInvoiceInFk;
- FETCH rs INTO vInvoiceInFk;
-
- WHILE NOT done DO
+ IF vDone THEN
+ LEAVE l;
+ END IF;
CALL invoiceInTax_getFromEntries(vInvoiceInFk);
CALL invoiceInDueDay_calculate(vInvoiceInFk);
-
- FETCH rs INTO vInvoiceInFk;
-
- END WHILE;
-
- CLOSE rs;
+ END LOOP;
+ CLOSE vInvoices;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -55196,15 +55157,24 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromEntries`(IN vId INT)
+CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromEntries`(IN vInvoiceInFk INT)
BEGIN
DECLARE vRate DOUBLE DEFAULT 1;
DECLARE vDated DATE;
DECLARE vExpenseFk VARCHAR(10);
+ DECLARE vIsBooked BOOLEAN DEFAULT FALSE;
+ SELECT isBooked INTO vIsBooked
+ FROM invoiceIn ii
+ WHERE id = vInvoiceInFk;
+
+ IF vIsBooked THEN
+ CALL util.throw('A booked invoice cannot be modified');
+ END IF;
+
SELECT MAX(rr.dated) INTO vDated
FROM referenceRate rr
- JOIN invoiceIn ii ON ii.id = vId
+ JOIN invoiceIn ii ON ii.id = vInvoiceInFk
WHERE rr.dated <= ii.issued
AND rr.currencyFk = ii.currencyFk ;
@@ -55221,7 +55191,7 @@ BEGIN
LIMIT 1;
DELETE FROM invoiceInTax
- WHERE invoiceInFk = vId;
+ WHERE invoiceInFk = vInvoiceInFk;
INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenseFk, foreignValue, taxTypeSageFk, transactionTypeSageFk)
SELECT ii.id,
@@ -55236,7 +55206,7 @@ BEGIN
JOIN buy b ON b.entryFk = e.id
LEFT JOIN referenceRate rr ON rr.currencyFk = ii.currencyFk
AND rr.dated = ii.issued
- WHERE ii.id = vId
+ WHERE ii.id = vInvoiceInFk
HAVING taxableBase IS NOT NULL;
END ;;
DELIMITER ;
@@ -57526,9 +57496,15 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar`(vSectorFk INT)
+CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar`(
+ vSectorFk INT
+)
proc:BEGIN
-
+/**
+ * Calcula la información detallada respecto un sector.
+ *
+ * @param vSectorFk Id de sector
+ */
DECLARE vCalcVisibleFk INT;
DECLARE vCalcAvailableFk INT;
DECLARE hasFatherSector BOOLEAN;
@@ -57617,7 +57593,7 @@ proc:BEGIN
JOIN vn.item i ON i.id = ishr.itemFk
LEFT JOIN (SELECT s.itemFk, sum(s.quantity) as notPickedYed
FROM vn.ticket t
- JOIN vn.ticketStateToday tst ON tst.ticket = t.id
+ JOIN vn.ticketStateToday tst ON tst.ticketFk = t.id
JOIN vn.sale s ON s.ticketFk = t.id
WHERE t.warehouseFk = vWarehouseFk
AND tst.alertLevel = 0
@@ -58917,20 +58893,23 @@ BEGIN
DECLARE vCompanyFk INT;
DECLARE vAgencyModeFk INT;
DECLARE vItemShelvingFk INT;
+ DECLARE vAddressFk INT;
SELECT c.id,
pc.clientSelfConsumptionFk,
- s.warehouseFk
+ s.warehouseFk,
+ pc.addressSelfConsumptionFk
INTO vCompanyFk,
vClientFk,
- vWarehouseFk
+ vWarehouseFk,
+ vAddressFk
FROM company c
JOIN address a ON a.clientFk = c.clientFk
JOIN warehouse w ON w.addressFk = a.id
JOIN sector s ON s.warehouseFk = w.id
JOIN parking p ON p.sectorFk = s.id
JOIN shelving s2 ON s2.parkingFk = p.id
- JOIN productionConfig pc ON TRUE
+ JOIN productionConfig pc
WHERE s2.code = vShelvingFk;
IF vClientFk IS NULL THEN
@@ -58962,7 +58941,7 @@ BEGIN
vClientFk,
vWarehouseFk,
CURDATE(),
- NULL,
+ vAddressFk,
vCompanyFk,
NULL,
vTicketFk
@@ -61214,36 +61193,6 @@ DELIMITER ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-/*!50003 DROP PROCEDURE IF EXISTS `item_updatePackingShelve` */;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_updatePackingShelve`(vSelf INT, vPacking INT)
-BEGIN
-
- /**
- * Actualiza el valor de item.packingShelve
- *
- * @param vSelf Identificador de vn.item
- * @param vPacking Cantidad de unidades de venta que caben en una bandeja
- */
-
- UPDATE vn.item i
- SET i.packingShelve = vPacking
- WHERE i.id = vSelf;
-
-END ;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `item_updatePackingType` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -63332,8 +63281,8 @@ proc: BEGIN
rm.bufferFk
FROM tmp.productionTicket tt
JOIN ticket t ON tt.ticketFk = t.id
- LEFT JOIN ticketStateToday tst ON tst.ticket = t.id
- LEFT JOIN state st ON st.id = tst.state
+ LEFT JOIN ticketStateToday tst ON tst.ticketFk = t.id
+ LEFT JOIN `state` st ON st.id = tst.state
LEFT JOIN client c ON c.id = t.clientFk
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
JOIN address a ON a.id = t.addressFk
@@ -65549,7 +65498,7 @@ BEGIN
CALL productionControl(vWarehouseFk, 0);
- -- Products without vn.item.packingOut, pay atention to vn.itemShelving.packing
+ -- Products with vn.item.isBoxPickingMode = TRUE, pay atention to vn.itemShelving.packing
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
(saleFk INT PRIMARY KEY)
SELECT
@@ -65585,7 +65534,7 @@ BEGIN
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk
LEFT JOIN buy b ON b.id = lb.buy_id
WHERE s.quantity BETWEEN ish.packing AND (ish.visible - IFNULL(tISS.reserve,0))
- AND i.packingOut IS NULL
+ AND i.isBoxPickingMode
AND NOT pb.problem
AND sgd.saleFk IS NULL
AND p.sectorFk = vSectorFk
@@ -65732,7 +65681,6 @@ DECLARE vIsCollection BOOL;
s.isAdded,
IF(c.workerFk IS NULL, getUser(), c.workerFk) workerFk,
IF(SUM(iss.quantity) IS NULL, 0, SUM(iss.quantity)) pickedQuantity,
- i.packingShelve,
MIN(iss.created) picked,
IF(sm.id, TRUE, FALSE) hasMistake,
sg.sectorFk
@@ -66287,148 +66235,148 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sale_replaceItem` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_replaceItem`(vSaleFk INT, vNewItemFk INT, vQuantity INT)
-BEGIN
-/**
- * Añade un nuevo articulo para sustituir a otro, y actualiza la memoria de sustituciones.
- *
- * @param vSaleFk id de la tabla sale
- * @param vNewItemFk articulo sustituto
- * @param vQuantity cantidad que se va a sustituir
- */
- DECLARE vTicketFk INT;
- DECLARE vItemFk INT;
- DECLARE vWarehouseFk SMALLINT;
- DECLARE vDate DATE;
- DECLARE vGrouping INT;
- DECLARE vGroupingModeFk INT;
- DECLARE vPacking INT;
- DECLARE vRoundQuantity INT DEFAULT 1;
- DECLARE vLanded DATE;
- DECLARE vAddressFk INT;
- DECLARE vAgencyModeFk INT;
- DECLARE vNewPrice DECIMAL(10,2);
- DECLARE vOldPrice DECIMAL(10,2);
- DECLARE vOption INT DEFAULT NULL;
- DECLARE vNewSaleFk INT;
- DECLARE vChangePrice INT DEFAULT 1;
- DECLARE vBuyerDiscount INT DEFAULT 4;
- DECLARE vManaDiscount INT DEFAULT 3;
- DECLARE vForceToGrouping INT DEFAULT 1;
- DECLARE vForceToPacking INT DEFAULT 2;
- DECLARE vFinalPrice DECIMAL(10,2);
-
- DECLARE EXIT HANDLER FOR SQLEXCEPTION
- BEGIN
- ROLLBACK;
- RESIGNAL;
- END;
-
- SELECT s.ticketFk,
- LEAST(s.quantity, vQuantity),
- s.itemFk,
- t.shipped,
- t.warehouseFk,
- t.landed,
- t.addressFk,
- t.agencyModeFk,
- s.price
- INTO vTicketFk,
- vQuantity,
- vItemFk,
- vDate,
- vWarehouseFk,
- vLanded,
- vAddressFk,
- vAgencyModeFk,
- vOldPrice
- FROM sale s
- JOIN ticket t ON t.id = s.ticketFk
- WHERE s.id = vSaleFk;
-
- CALL buyUltimate(vWarehouseFk, vDate);
-
- SELECT `grouping`, groupingMode, packing
- INTO vGrouping,vGroupingModeFk,vPacking
- FROM buy b
- JOIN tmp.buyUltimate tmp ON b.id = tmp.buyFk
- WHERE tmp.itemFk = vNewItemFk AND tmp.WarehouseFk = vWarehouseFk;
-
- IF vGroupingModeFk = vForceToPacking AND vPacking > 0 THEN
- SET vRoundQuantity = vPacking;
- END IF;
- IF vGroupingModeFk = vForceToGrouping AND vGrouping > 0 THEN
- SET vRoundQuantity = vGrouping;
- END IF;
-
- CALL catalog_calcFromItem(
- vLanded,
- vAddressFk,
- vAgencyModeFk,
- vNewItemFk);
-
- SELECT price INTO vNewPrice
- FROM tmp.ticketCalculateItem;
-
- IF vNewPrice IS NULL THEN
- CALL util.throw('price retrieval failed');
- END IF;
- IF vNewPrice > vOldPrice THEN
- SET vFinalPrice = vOldPrice;
- IF worker_isInDepartment('vt') THEN
- SET vOption = vManaDiscount;
- ELSE
- SET vOption = vBuyerDiscount;
- END IF;
- ELSE
- SET vFinalPrice = vNewPrice;
- SET vOption = vChangePrice;
- END IF;
-
- START TRANSACTION;
-
- UPDATE sale
- SET quantity = quantity - vQuantity
- WHERE id = vSaleFk;
-
- INSERT INTO vn.sale(ticketFk,
- itemFk,
- quantity,
- concept,
- price)
- SELECT vTicketFk,
- vNewItemFk,
- CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, CONCAT('+ ',i.longName),
- vFinalPrice
- FROM vn.item i
- WHERE id = vNewItemFk;
-
- SELECT LAST_INSERT_ID() INTO vNewSaleFk;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.sale;
- CREATE TEMPORARY TABLE tmp.sale
- (PRIMARY KEY (saleFk))
- ENGINE = MEMORY
- SELECT id saleFk, vWarehouseFk warehouseFk
- FROM sale s WHERE id = vNewSaleFk;
-
- CALL ticketComponentUpdateSale(vOption);
- CALL catalog_componentPurge();
-
- INSERT INTO itemProposal(itemFk, mateFk, counter)
- VALUES(vItemFk, vNewItemFk, 1)
- ON DUPLICATE KEY UPDATE counter = counter + 1;
-
- COMMIT;
+BEGIN
+/**
+ * Añade un nuevo articulo para sustituir a otro, y actualiza la memoria de sustituciones.
+ *
+ * @param vSaleFk id de la tabla sale
+ * @param vNewItemFk articulo sustituto
+ * @param vQuantity cantidad que se va a sustituir
+ */
+ DECLARE vTicketFk INT;
+ DECLARE vItemFk INT;
+ DECLARE vWarehouseFk SMALLINT;
+ DECLARE vDate DATE;
+ DECLARE vGrouping INT;
+ DECLARE vGroupingModeFk INT;
+ DECLARE vPacking INT;
+ DECLARE vRoundQuantity INT DEFAULT 1;
+ DECLARE vLanded DATE;
+ DECLARE vAddressFk INT;
+ DECLARE vAgencyModeFk INT;
+ DECLARE vNewPrice DECIMAL(10,2);
+ DECLARE vOldPrice DECIMAL(10,2);
+ DECLARE vOption INT DEFAULT NULL;
+ DECLARE vNewSaleFk INT;
+ DECLARE vChangePrice INT DEFAULT 1;
+ DECLARE vBuyerDiscount INT DEFAULT 4;
+ DECLARE vManaDiscount INT DEFAULT 3;
+ DECLARE vForceToGrouping INT DEFAULT 1;
+ DECLARE vForceToPacking INT DEFAULT 2;
+ DECLARE vFinalPrice DECIMAL(10,2);
+
+ DECLARE EXIT HANDLER FOR SQLEXCEPTION
+ BEGIN
+ ROLLBACK;
+ RESIGNAL;
+ END;
+
+ SELECT s.ticketFk,
+ LEAST(s.quantity, vQuantity),
+ s.itemFk,
+ t.shipped,
+ t.warehouseFk,
+ t.landed,
+ t.addressFk,
+ t.agencyModeFk,
+ s.price
+ INTO vTicketFk,
+ vQuantity,
+ vItemFk,
+ vDate,
+ vWarehouseFk,
+ vLanded,
+ vAddressFk,
+ vAgencyModeFk,
+ vOldPrice
+ FROM sale s
+ JOIN ticket t ON t.id = s.ticketFk
+ WHERE s.id = vSaleFk;
+
+ CALL buyUltimate(vWarehouseFk, vDate);
+
+ SELECT `grouping`, groupingMode, packing
+ INTO vGrouping,vGroupingModeFk,vPacking
+ FROM buy b
+ JOIN tmp.buyUltimate tmp ON b.id = tmp.buyFk
+ WHERE tmp.itemFk = vNewItemFk AND tmp.WarehouseFk = vWarehouseFk;
+
+ IF vGroupingModeFk = vForceToPacking AND vPacking > 0 THEN
+ SET vRoundQuantity = vPacking;
+ END IF;
+ IF vGroupingModeFk = vForceToGrouping AND vGrouping > 0 THEN
+ SET vRoundQuantity = vGrouping;
+ END IF;
+
+ CALL catalog_calcFromItem(
+ vLanded,
+ vAddressFk,
+ vAgencyModeFk,
+ vNewItemFk);
+
+ SELECT price INTO vNewPrice
+ FROM tmp.ticketCalculateItem;
+
+ IF vNewPrice IS NULL THEN
+ CALL util.throw('price retrieval failed');
+ END IF;
+ IF vNewPrice > vOldPrice THEN
+ SET vFinalPrice = vOldPrice;
+ IF worker_isInDepartment('vt') THEN
+ SET vOption = vManaDiscount;
+ ELSE
+ SET vOption = vBuyerDiscount;
+ END IF;
+ ELSE
+ SET vFinalPrice = vNewPrice;
+ SET vOption = vChangePrice;
+ END IF;
+
+ START TRANSACTION;
+
+ UPDATE sale
+ SET quantity = quantity - vQuantity
+ WHERE id = vSaleFk;
+
+ INSERT INTO vn.sale(ticketFk,
+ itemFk,
+ quantity,
+ concept,
+ price)
+ SELECT vTicketFk,
+ vNewItemFk,
+ CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, CONCAT('+ ',i.longName),
+ vFinalPrice
+ FROM vn.item i
+ WHERE id = vNewItemFk;
+
+ SELECT LAST_INSERT_ID() INTO vNewSaleFk;
+
+ DROP TEMPORARY TABLE IF EXISTS tmp.sale;
+ CREATE TEMPORARY TABLE tmp.sale
+ (PRIMARY KEY (saleFk))
+ ENGINE = MEMORY
+ SELECT id saleFk, vWarehouseFk warehouseFk
+ FROM sale s WHERE id = vNewSaleFk;
+
+ CALL ticketComponentUpdateSale(vOption);
+ CALL catalog_componentPurge();
+
+ INSERT INTO itemProposal(itemFk, mateFk, counter)
+ VALUES(vItemFk, vNewItemFk, 1)
+ ON DUPLICATE KEY UPDATE counter = counter + 1;
+
+ COMMIT;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -67801,25 +67749,6 @@ BEGIN
GROUP BY p.supplierFk) sdpmc ON sdpmc.supplierFk = s.id
SET s.isPayMethodChecked = FALSE;
-END ;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-/*!50003 DROP PROCEDURE IF EXISTS `test` */;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `test`()
-BEGIN
-select 'procedimiento ejecutado con éxito';
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -68653,7 +68582,7 @@ BEGIN
JOIN vn.parking p ON p.id = tp.parkingFk
JOIN vn.sector sc ON sc.id = p.sectorFk
LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = tp.ticketFk
- JOIN vn.ticketStateToday tst ON tst.ticket = tp.ticketFk
+ JOIN vn.ticketStateToday tst ON tst.ticketFk = tp.ticketFk
JOIN vn.ticket t ON t.id = tp.ticketFk
JOIN vn.zone z ON z.id = t.zoneFk
JOIN vn.agencyMode am ON am.id = z.agencyModeFk
@@ -68956,7 +68885,7 @@ BEGIN
JOIN vn.parking p ON p.id = tp.parkingFk
JOIN vn.sector sc ON sc.id = p.sectorFk
LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = tp.ticketFk
- JOIN vn.ticketStateToday tst ON tst.ticket = tp.ticketFk
+ JOIN vn.ticketStateToday tst ON tst.ticketFk = tp.ticketFk
JOIN vn.ticket t ON t.id = tp.ticketFk
JOIN vn.zone z ON z.id = t.zoneFk
JOIN vn.agencyMode am ON am.id = z.agencyModeFk
@@ -69073,7 +69002,7 @@ BEGIN
SELECT s.alertLevel INTO vAlertLevel
FROM state s
JOIN ticketStateToday tst ON tst.state = s.id
- WHERE tst.ticket = vTicketFk
+ WHERE tst.ticketFk = vTicketFk
LIMIT 1;
IF vAlertLevel < 2 THEN
@@ -70917,47 +70846,58 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getMovable`(vTicketFk INT, vDatedNew DATETIME, vWarehouseFk INT)
+CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getMovable`(
+ vTicketFk INT,
+ vNewShipped DATETIME,
+ vWarehouseFk INT
+)
BEGIN
/**
* Cálcula el stock movible para los artículos de un ticket
- * vDatedNew debe ser menor que vDatedOld, en los otros casos se
+ * vNewShipped debe ser menor que vOldShipped, en los otros casos se
* asume que siempre es posible
*
* @param vTicketFk -> Ticket
- * @param vDatedNew -> Nueva fecha
+ * @param vNewShipped -> Nueva fecha
* @return Sales con Movible
-*/
- DECLARE vDatedOld DATETIME;
- SET vDatedNew = DATE_ADD(vDatedNew, INTERVAL 1 DAY);
+*/
+ DECLARE vOldShipped DATETIME;
- SELECT t.shipped INTO vDatedOld
- FROM ticket t
+ SELECT t.shipped INTO vOldShipped
+ FROM ticket t
WHERE t.id = vTicketFk;
- CALL item_getStock(vWarehouseFk, vDatedNew, NULL);
- CALL item_getMinacum(vWarehouseFk, vDatedNew, DATEDIFF(DATE_SUB(vDatedOld, INTERVAL 1 DAY), vDatedNew), NULL);
-
- SELECT s.id,
- s.itemFk,
- s.quantity,
- s.concept,
- s.price,
+ -- Añadimos un dia más para calcular el stock hasta vNewShipped inclusive
+ CALL item_getStock(vWarehouseFk, DATE_ADD(vNewShipped, INTERVAL 1 DAY), NULL);
+ CALL item_getMinacum(
+ vWarehouseFk,
+ vNewShipped,
+ DATEDIFF(DATE_SUB(vOldShipped, INTERVAL 1 DAY), vNewShipped),
+ NULL
+ );
+
+ SELECT s.id,
+ s.itemFk,
+ s.quantity,
+ s.concept,
+ s.price,
s.reserved,
- s.discount,
- i.image,
- i.subName,
+ s.discount,
+ i.image,
+ i.subName,
il.stock + IFNULL(im.amount, 0) AS movable
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
- JOIN item i ON i.id = s.itemFk
- LEFT JOIN tmp.itemMinacum im ON im.itemFk = s.itemFk AND im.warehouseFk = vWarehouseFk
+ JOIN item i ON i.id = s.itemFk
+ LEFT JOIN tmp.itemMinacum im ON im.itemFk = s.itemFk
+ AND im.warehouseFk = vWarehouseFk
LEFT JOIN tmp.itemList il ON il.itemFk = s.itemFk
WHERE t.id = vTicketFk;
- DROP TEMPORARY TABLE IF EXISTS tmp.itemList;
- DROP TEMPORARY TABLE IF EXISTS tmp.itemMinacum;
-
+ DROP TEMPORARY TABLE IF EXISTS
+ tmp.itemList,
+ tmp.itemMinacum;
+
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -72880,29 +72820,6 @@ BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.timeControl;
DROP TEMPORARY TABLE IF EXISTS tmp.timeControlAux;
-END ;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-/*!50003 DROP PROCEDURE IF EXISTS `timeWorkerControl_check` */;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `timeWorkerControl_check`(vUserFk INT, vDated DATE,vTabletFk VARCHAR(100))
-proc: BEGIN
-/**
- * deprecated call workerTimeControl_check
- */
-CALL vn.workerTimeControl_check(vUserFk,vDated,vTabletFk);
-
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -73194,22 +73111,21 @@ DELIMITER ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_cloneWithEntries`(
- IN vTravelFk INT,
- IN vDateStart DATE,
+ IN vTravelFk INT,
+ IN vDateStart DATE,
IN vDateEnd DATE,
IN vWarehouseOutFk INT,
- IN vWarehouseInFk INT,
- IN vRef VARCHAR(255),
- IN vAgencyModeFk INT,
+ IN vWarehouseInFk INT,
+ IN vRef VARCHAR(255),
+ IN vAgencyModeFk INT,
OUT vNewTravelFk INT)
BEGIN
/**
* Clona un travel junto con sus entradas y compras
- *
* @param vTravelFk travel plantilla a clonar
* @param vDateStart fecha del shipment del nuevo travel
* @param vDateEnd fecha del landing del nuevo travel
- * @param vWarehouseOutFk fecha del salida del nuevo travel
+ * @param vWarehouseOutFk warehouse del salida del nuevo travel
* @param vWarehouseInFk warehouse de landing del nuevo travel
* @param vRef referencia del nuevo travel
* @param vAgencyModeFk del nuevo travel
@@ -73219,34 +73135,35 @@ BEGIN
DECLARE vEvaNotes VARCHAR(255);
DECLARE vDone BOOL;
DECLARE vAuxEntryFk INT;
+ DECLARE vTx BOOLEAN DEFAULT @@in_transaction;
DECLARE vRsEntry CURSOR FOR
SELECT e.id
FROM entry e
JOIN travel t ON t.id = e.travelFk
WHERE e.travelFk = vTravelFk;
-
+
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
- BEGIN
- ROLLBACK;
+ BEGIN
+ CALL util.tx_rollback(vTx);
RESIGNAL;
END;
-
- START TRANSACTION;
+
+ CALL util.tx_start(vTx);
INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, `ref`, isDelivered, isReceived, m3, cargoSupplierFk, kg,clonedFrom)
SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3,cargoSupplierFk, kg,vTravelFk
FROM travel
WHERE id = vTravelFk;
-
+
SET vNewTravelFk = LAST_INSERT_ID();
SET vDone = FALSE;
SET @isModeInventory = TRUE;
OPEN vRsEntry;
-
+
l: LOOP
SET vDone = FALSE;
FETCH vRsEntry INTO vAuxEntryFk;
@@ -73256,7 +73173,7 @@ BEGIN
END IF;
CALL entry_cloneHeader(vAuxEntryFk, vNewEntryFk, vNewTravelFk);
- CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk);
+ CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk);
SELECT evaNotes INTO vEvaNotes
FROM entry
@@ -73270,7 +73187,7 @@ BEGIN
SET @isModeInventory = FALSE;
CLOSE vRsEntry;
- COMMIT;
+ CALL util.tx_commit(vTx);
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -74778,88 +74695,6 @@ BEGIN
INSERT INTO vn.workerMistake(userFk, workerMistakeTypeFk)
VALUES(vWorkerFk, vWorkerMistakeTypeFk);
-END ;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlAdd` */;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlAdd`(IN vUserFk INT, IN vWarehouseFk INT, IN vDated DATETIME)
-BEGIN
-
- /*INSERT INTO workerTimeControl(userFk, timed, manual, warehouseFk)
- VALUES(vUserFk, vDated, FALSE, vWarehouseFk);
-
- CALL vn.workerTimeControlSOWP(vUserFk , vDated);*/
-
- CALL vn.workerTimeControl_add(vUserFk,vWarehouseFk,util.VN_NOW(),FALSE);
-
-
-END ;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlPinGenerate` */;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlPinGenerate`(
- vWorkerFk INT)
-BEGIN
-/**
- * Create new pin for workerFk or new pin for all workers if vWorkerFk is null
- *
- */
-
-
-
-END ;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlSetOrder` */;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlSetOrder`()
-BEGIN
-
- SET @order := 1;
- SET @userFk := 0;
- SET @day := 0;
-
- UPDATE tmp.workerTimeControl
- SET `order` = IF(userFk = @userFk AND day(timed) = @day, @order := @order + 1, @order := 1),
- userFk = @userFk := userFk,
- manual = manual + (0 * @day := day(timed))
- ORDER BY userFk, timed;
-
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -74894,27 +74729,6 @@ DELIMITER ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_add` */;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_add`(IN vUserFk INT, IN vWarehouseFk INT, IN vTimed DATETIME, IN vIsManual BOOL)
-BEGIN
-
-
- SELECT workerTimeControl_add(vUserFk,vWarehouseFk,vTimed,vIsManual);
-END ;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_calculateOddDays` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -75309,33 +75123,35 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_clockIn` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_clockIn`(
vWorkerFk INT,
vTimed DATETIME,
- vDirection VARCHAR(10)
+ vDirection VARCHAR(10),
+ vDevice VARCHAR(255)
)
BEGIN
/**
- * Verifica si el empleado puede fichar
- * @param vWorkerFk Identificador del trabajador
- * @param vTimed valor de la fichada, IF vTimed IS NULL vTimed = NOW
- * @param vDirection solo se pueden pasa los valores del campo
- * workerTimeControl.direction ENUM('in', 'out', 'middle')
- * @return Si todo es correcto, retorna el número de id la tabla workerTimeControl.
- * Si hay algún problema, devuelve el mesaje que se debe mostrar al usuario
- * Solo retorna el primer problema, en caso de no ocurrir ningún error se añadirá
- * fichada a la tabla vn.workerTimeControl
- */
-
+* Verifica si el empleado puede fichar
+* @param vWorkerFk Identificador del trabajador
+* @param vTimed Balor de la fichada, IF vTimed IS NULL vTimed = NOW
+* @param vDirection Solo se pueden pasa los valores del campo
+* workerTimeControl.direction ENUM('in', 'out', 'middle')
+* @param vDevice Dispositivo en el que se ha fichado
+* @return Si todo es correcto, retorna el número de id la tabla workerTimeControl.
+* Si hay algún problema, devuelve el mesaje que se debe mostrar al usuario
+* Solo retorna el primer problema, en caso de no ocurrir ningún error se añadirá
+* fichada a la tabla vn.workerTimeControl
+*/
+
DECLARE vLastIn DATETIME;
DECLARE vLastOut DATETIME;
DECLARE vNextIn DATETIME;
@@ -75588,16 +75404,16 @@ BEGIN
GROUP BY breakCounter
HAVING hasError
LIMIT 1;
-
+
IF vIsError THEN
SET vErrorCode = 'BREAK_WEEK';
CALL util.throw(vErrorCode);
END IF;
END IF;
-
- -- SE PERMITE FICHAR
- INSERT INTO workerTimeControl(userFk, timed, direction, `manual`)
- VALUES(vWorkerFk, vTimed, vDirection, vIsManual);
+
+ -- Se permite fichar
+ INSERT INTO workerTimeControl(userFk, timed, direction, device, `manual`)
+ VALUES(vWorkerFk, vTimed, vDirection, vDevice, vIsManual);
SELECT LAST_INSERT_ID() id;
@@ -75867,58 +75683,6 @@ BEGIN
CALL vn.workerTimeControlSOWP(vUserFk, vTimed);
-END ;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_repair` */;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_repair`()
-proc: BEGIN
-/**
- * Corrige las fichadas
- *
- */
-
-/*1- poner todos a middle*/
-UPDATE vn.workerTimeControl SET direction = 'middle';
-
-/*2- poner los out*/
-UPDATE vn.workerTimeControl wtc
- JOIN
- (SELECT userFk,MAX(timed) maxTimed FROM
- (SELECT id, userFk, timed, date(timed) dated
- FROM vn.workerTimeControl
- ) sub
- GROUP BY userFk,dated
- )sub
- SET direction = "out"
- WHERE wtc.userFk = sub.userFk
- AND wtc.timed = sub.maxTimed;
-
- /*3- poner los in*/
-UPDATE vn.workerTimeControl wtc
- JOIN
- (SELECT userFk,MIN(timed) maxTimed FROM
- (SELECT id, userFk, timed, date(timed) dated
- FROM vn.workerTimeControl
- ) sub
- GROUP BY userFk,dated
- )sub
- SET direction = "in"
- WHERE wtc.userFk = sub.userFk
- AND wtc.timed = sub.maxTimed ;
-
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -76094,34 +75858,6 @@ DELIMITER ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_setOrder` */;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_setOrder`(vUserFk INT, vStarted DATE, vFinished DATE)
-BEGIN
-
- SET @order := 0;
- SET @day := '2000-01-01';
-
- UPDATE vn.workerTimeControl w
- SET w.`order` = @order := IF(@day = @day := date(timed), @order, 0) + 1
- WHERE w.userFk = vUserFk
- AND w.timed BETWEEN vStarted AND util.dayend(vFinished)
- ORDER BY w.timed;
-
-END ;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_weekCheckBreak` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -79800,60 +79536,6 @@ SET character_set_client = utf8;
1 AS `description` */;
SET character_set_client = @saved_cs_client;
---
--- Temporary table structure for view `Rutas_Master`
---
-
-DROP TABLE IF EXISTS `Rutas_Master`;
-/*!50001 DROP VIEW IF EXISTS `Rutas_Master`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `Rutas_Master` AS SELECT
- 1 AS `id`,
- 1 AS `warehouse_id`,
- 1 AS `km`,
- 1 AS `bultos`,
- 1 AS `vehiculos_coste`,
- 1 AS `personal_coste`,
- 1 AS `vehiculos_numero`,
- 1 AS `personal_numero`,
- 1 AS `gasoil`,
- 1 AS `autonomos`,
- 1 AS `año`,
- 1 AS `mes`,
- 1 AS `gastos`,
- 1 AS `bultos_autonomos`,
- 1 AS `coste_km`,
- 1 AS `coste_bulto`,
- 1 AS `coste_bulto_autonomo`,
- 1 AS `odbc_date` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `Rutas_monitor`
---
-
-DROP TABLE IF EXISTS `Rutas_monitor`;
-/*!50001 DROP VIEW IF EXISTS `Rutas_monitor`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `Rutas_monitor` AS SELECT
- 1 AS `Id_Ruta`,
- 1 AS `name`,
- 1 AS `Ubicacion`,
- 1 AS `pedidosEncajados`,
- 1 AS `pedidosLibres`,
- 1 AS `pedidosProduccion`,
- 1 AS `bultos`,
- 1 AS `notas`,
- 1 AS `fecha`,
- 1 AS `dockFk`,
- 1 AS `m3`,
- 1 AS `priority`,
- 1 AS `etd`,
- 1 AS `expeditionTruckFk` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Table structure for table `Saldos_Prevision`
--
@@ -80193,37 +79875,6 @@ CREATE TABLE `Vehiculos_consumo` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='En esta tabla apuntan el importe de los tickets de la gasolinera solred, con quien tenemos un contrato y nos facturan mensualmente';
/*!40101 SET character_set_client = @saved_cs_client */;
---
--- Temporary table structure for view `VerEspionaje`
---
-
-DROP TABLE IF EXISTS `VerEspionaje`;
-/*!50001 DROP VIEW IF EXISTS `VerEspionaje`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `VerEspionaje` AS SELECT
- 1 AS `CodigoTrabajador`,
- 1 AS `Fecha`,
- 1 AS `HoraEntrada`,
- 1 AS `HoraSalida`,
- 1 AS `Id_Equipo`,
- 1 AS `Id_Trabajador` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `Vistas`
---
-
-DROP TABLE IF EXISTS `Vistas`;
-/*!50001 DROP VIEW IF EXISTS `Vistas`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `Vistas` AS SELECT
- 1 AS `vista_id`,
- 1 AS `code`,
- 1 AS `vista` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Temporary table structure for view `XDiario`
--
@@ -80603,7 +80254,7 @@ CREATE TABLE `awb_component` (
`Id_Moneda` tinyint(3) unsigned NOT NULL DEFAULT 2,
`recibida_id` mediumint(8) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
- UNIQUE KEY `unique_idx` (`awb_id`,`Id_Proveedor`,`awb_component_type_id`,`Fecha`),
+ UNIQUE KEY `unique_idx` (`awb_id`,`Id_Proveedor`,`awb_component_type_id`),
KEY `Id_Moneda` (`Id_Moneda`),
KEY `awb_component_fk` (`awb_component_type_id`),
KEY `awb_role_fk` (`awb_role_id`),
@@ -81212,84 +80863,6 @@ SET character_set_client = utf8;
1 AS `addressFk` */;
SET character_set_client = @saved_cs_client;
---
--- Temporary table structure for view `client_observation`
---
-
-DROP TABLE IF EXISTS `client_observation`;
-/*!50001 DROP VIEW IF EXISTS `client_observation`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `client_observation` AS SELECT
- 1 AS `client_observation_id`,
- 1 AS `Id_Cliente`,
- 1 AS `Id_Trabajador`,
- 1 AS `text`,
- 1 AS `odbc_date` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `clientes_gestdoc`
---
-
-DROP TABLE IF EXISTS `clientes_gestdoc`;
-/*!50001 DROP VIEW IF EXISTS `clientes_gestdoc`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `clientes_gestdoc` AS SELECT
- 1 AS `Id_Cliente`,
- 1 AS `gest_doc_id` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `clientes_regalos_enc`
---
-
-DROP TABLE IF EXISTS `clientes_regalos_enc`;
-/*!50001 DROP VIEW IF EXISTS `clientes_regalos_enc`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `clientes_regalos_enc` AS SELECT
- 1 AS `Id_Cliente`,
- 1 AS `Id_Regalo`,
- 1 AS `odbc_date` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `clientes_regalos_lista_enc`
---
-
-DROP TABLE IF EXISTS `clientes_regalos_lista_enc`;
-/*!50001 DROP VIEW IF EXISTS `clientes_regalos_lista_enc`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `clientes_regalos_lista_enc` AS SELECT
- 1 AS `Id_Regalo`,
- 1 AS `Descripcion`,
- 1 AS `foto`,
- 1 AS `activo`,
- 1 AS `datstart`,
- 1 AS `datend`,
- 1 AS `warehouse_id`,
- 1 AS `province_id`,
- 1 AS `countryFk` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `clientes_tipo`
---
-
-DROP TABLE IF EXISTS `clientes_tipo`;
-/*!50001 DROP VIEW IF EXISTS `clientes_tipo`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `clientes_tipo` AS SELECT
- 1 AS `clientes_tipo_id`,
- 1 AS `code`,
- 1 AS `tipo`,
- 1 AS `isCreatedAsServed` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Table structure for table `commission`
--
@@ -81404,20 +80977,6 @@ CREATE TABLE `cooler_path` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Define el orden en que se imprimen los F5';
/*!40101 SET character_set_client = @saved_cs_client */;
---
--- Temporary table structure for view `cooler_path_detail`
---
-
-DROP TABLE IF EXISTS `cooler_path_detail`;
-/*!50001 DROP VIEW IF EXISTS `cooler_path_detail`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `cooler_path_detail` AS SELECT
- 1 AS `cooler_path_detail_id`,
- 1 AS `cooler_path_id`,
- 1 AS `pasillo` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Table structure for table `cp`
--
@@ -81435,22 +80994,6 @@ CREATE TABLE `cp` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Relacio de codis postals i el municipi al qual se asigna';
/*!40101 SET character_set_client = @saved_cs_client */;
---
--- Temporary table structure for view `credit`
---
-
-DROP TABLE IF EXISTS `credit`;
-/*!50001 DROP VIEW IF EXISTS `credit`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `credit` AS SELECT
- 1 AS `id`,
- 1 AS `Id_Cliente`,
- 1 AS `Id_Trabajador`,
- 1 AS `amount`,
- 1 AS `odbc_date` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Table structure for table `credit_card`
--
@@ -81900,25 +81443,6 @@ SET character_set_client = utf8;
1 AS `hasCompany` */;
SET character_set_client = @saved_cs_client;
---
--- Temporary table structure for view `escritos_det`
---
-
-DROP TABLE IF EXISTS `escritos_det`;
-/*!50001 DROP VIEW IF EXISTS `escritos_det`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `escritos_det` AS SELECT
- 1 AS `id`,
- 1 AS `Id_Cliente`,
- 1 AS `escritos_id`,
- 1 AS `fecha`,
- 1 AS `Id_Trabajador`,
- 1 AS `userFk`,
- 1 AS `empresa_id`,
- 1 AS `saldo` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Temporary table structure for view `expeditions`
--
@@ -82327,74 +81851,6 @@ SET character_set_client = utf8;
1 AS `ticketFk` */;
SET character_set_client = @saved_cs_client;
---
--- Temporary table structure for view `iva_codigo`
---
-
-DROP TABLE IF EXISTS `iva_codigo`;
-/*!50001 DROP VIEW IF EXISTS `iva_codigo`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `iva_codigo` AS SELECT
- 1 AS `id`,
- 1 AS `fecha`,
- 1 AS `codigo`,
- 1 AS `iva_tipo_id`,
- 1 AS `iva`,
- 1 AS `recargo`,
- 1 AS `tipo`,
- 1 AS `link`,
- 1 AS `isActive`,
- 1 AS `updated`,
- 1 AS `transactionCode` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `iva_group`
---
-
-DROP TABLE IF EXISTS `iva_group`;
-/*!50001 DROP VIEW IF EXISTS `iva_group`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `iva_group` AS SELECT
- 1 AS `iva_group_id`,
- 1 AS `description`,
- 1 AS `code` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `iva_group_codigo`
---
-
-DROP TABLE IF EXISTS `iva_group_codigo`;
-/*!50001 DROP VIEW IF EXISTS `iva_group_codigo`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `iva_group_codigo` AS SELECT
- 1 AS `iva_group_id`,
- 1 AS `date`,
- 1 AS `iva_codigo_id` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `iva_tipo`
---
-
-DROP TABLE IF EXISTS `iva_tipo`;
-/*!50001 DROP VIEW IF EXISTS `iva_tipo`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `iva_tipo` AS SELECT
- 1 AS `id`,
- 1 AS `alias`,
- 1 AS `isAccrued`,
- 1 AS `serie_id`,
- 1 AS `TIPOOPE`,
- 1 AS `descripcion`,
- 1 AS `Id_Pais` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Table structure for table `jerarquia`
--
@@ -82545,89 +82001,6 @@ CREATE TABLE `nichos` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
---
--- Temporary table structure for view `observation_type`
---
-
-DROP TABLE IF EXISTS `observation_type`;
-/*!50001 DROP VIEW IF EXISTS `observation_type`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `observation_type` AS SELECT
- 1 AS `observation_type_id`,
- 1 AS `description` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `order`
---
-
-DROP TABLE IF EXISTS `order`;
-/*!50001 DROP VIEW IF EXISTS `order`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `order` AS SELECT
- 1 AS `id`,
- 1 AS `date_make`,
- 1 AS `date_send`,
- 1 AS `customer_id`,
- 1 AS `delivery_method_id`,
- 1 AS `agency_id`,
- 1 AS `address_id`,
- 1 AS `note`,
- 1 AS `confirmed`,
- 1 AS `is_bionic`,
- 1 AS `source_app` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `order_Tickets`
---
-
-DROP TABLE IF EXISTS `order_Tickets`;
-/*!50001 DROP VIEW IF EXISTS `order_Tickets`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `order_Tickets` AS SELECT
- 1 AS `order_id`,
- 1 AS `Id_Ticket` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `order_component`
---
-
-DROP TABLE IF EXISTS `order_component`;
-/*!50001 DROP VIEW IF EXISTS `order_component`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `order_component` AS SELECT
- 1 AS `order_row_id`,
- 1 AS `component_id`,
- 1 AS `price` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `order_row`
---
-
-DROP TABLE IF EXISTS `order_row`;
-/*!50001 DROP VIEW IF EXISTS `order_row`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `order_row` AS SELECT
- 1 AS `id`,
- 1 AS `order_id`,
- 1 AS `item_id`,
- 1 AS `warehouse_id`,
- 1 AS `shipment`,
- 1 AS `amount`,
- 1 AS `price`,
- 1 AS `rate`,
- 1 AS `created`,
- 1 AS `Id_Movimiento` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Temporary table structure for view `pago`
--
@@ -83335,58 +82708,6 @@ CREATE TABLE `scan_line` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
---
--- Temporary table structure for view `sharingcart`
---
-
-DROP TABLE IF EXISTS `sharingcart`;
-/*!50001 DROP VIEW IF EXISTS `sharingcart`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `sharingcart` AS SELECT
- 1 AS `id`,
- 1 AS `Id_Trabajador`,
- 1 AS `datSTART`,
- 1 AS `datEND`,
- 1 AS `Id_Suplente`,
- 1 AS `odbc_date` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `sharingclient`
---
-
-DROP TABLE IF EXISTS `sharingclient`;
-/*!50001 DROP VIEW IF EXISTS `sharingclient`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `sharingclient` AS SELECT
- 1 AS `id`,
- 1 AS `Id_Trabajador`,
- 1 AS `datSTART`,
- 1 AS `datEND`,
- 1 AS `Id_Cliente` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `sms`
---
-
-DROP TABLE IF EXISTS `sms`;
-/*!50001 DROP VIEW IF EXISTS `sms`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `sms` AS SELECT
- 1 AS `id`,
- 1 AS `Id_trabajador`,
- 1 AS `from`,
- 1 AS `to`,
- 1 AS `text`,
- 1 AS `sent`,
- 1 AS `response`,
- 1 AS `DATE_ODBC` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Table structure for table `sort_merge_results_ernesto`
--
@@ -83510,24 +82831,6 @@ SET character_set_client = utf8;
1 AS `base` */;
SET character_set_client = @saved_cs_client;
---
--- Temporary table structure for view `tarifas`
---
-
-DROP TABLE IF EXISTS `tarifas`;
-/*!50001 DROP VIEW IF EXISTS `tarifas`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `tarifas` AS SELECT
- 1 AS `tarifa_id`,
- 1 AS `fecha`,
- 1 AS `warehouse_id`,
- 1 AS `t0`,
- 1 AS `t1`,
- 1 AS `t2`,
- 1 AS `t3` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Temporary table structure for view `tblContadores`
--
@@ -83659,48 +82962,6 @@ SET character_set_client = utf8;
1 AS `model` */;
SET character_set_client = @saved_cs_client;
---
--- Temporary table structure for view `ticketCreationData`
---
-
-DROP TABLE IF EXISTS `ticketCreationData`;
-/*!50001 DROP VIEW IF EXISTS `ticketCreationData`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `ticketCreationData` AS SELECT
- 1 AS `DiadelaSemana`,
- 1 AS `Hora`,
- 1 AS `Fecha`,
- 1 AS `Dispositivo` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `ticketMRW`
---
-
-DROP TABLE IF EXISTS `ticketMRW`;
-/*!50001 DROP VIEW IF EXISTS `ticketMRW`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `ticketMRW` AS SELECT
- 1 AS `id_Agencia`,
- 1 AS `empresa_id`,
- 1 AS `Consignatario`,
- 1 AS `DOMICILIO`,
- 1 AS `POBLACION`,
- 1 AS `CODPOSTAL`,
- 1 AS `telefono`,
- 1 AS `movil`,
- 1 AS `IF`,
- 1 AS `Id_Ticket`,
- 1 AS `warehouse_id`,
- 1 AS `Id_Consigna`,
- 1 AS `CodigoPais`,
- 1 AS `Fecha`,
- 1 AS `province_id`,
- 1 AS `landing` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Table structure for table `ticket_location__`
--
@@ -83796,32 +83057,6 @@ CREATE TABLE `tmpNEWTARIFAS` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
---
--- Temporary table structure for view `tr2`
---
-
-DROP TABLE IF EXISTS `tr2`;
-/*!50001 DROP VIEW IF EXISTS `tr2`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `tr2` AS SELECT
- 1 AS `id`,
- 1 AS `shipped`,
- 1 AS `shipmentHour`,
- 1 AS `landed`,
- 1 AS `landingHour`,
- 1 AS `warehouseInFk`,
- 1 AS `warehouseOutFk`,
- 1 AS `agencyFk`,
- 1 AS `ref`,
- 1 AS `isDelivered`,
- 1 AS `isReceived`,
- 1 AS `m3`,
- 1 AS `kg`,
- 1 AS `cargoSupplierFk`,
- 1 AS `totalEntries` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Table structure for table `transport`
--
@@ -83921,24 +83156,6 @@ CREATE TABLE `travel_reserve` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='En esta tabla almacenamos los m3 que cada comprador tiene asignados, por travel.';
/*!40101 SET character_set_client = @saved_cs_client */;
---
--- Temporary table structure for view `travel_thermograph`
---
-
-DROP TABLE IF EXISTS `travel_thermograph`;
-/*!50001 DROP VIEW IF EXISTS `travel_thermograph`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `travel_thermograph` AS SELECT
- 1 AS `thermograph_id`,
- 1 AS `odbc_date`,
- 1 AS `warehouse_id`,
- 1 AS `travel_id`,
- 1 AS `temperature`,
- 1 AS `result`,
- 1 AS `gestdoc_id` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Table structure for table `trolley`
--
@@ -84098,53 +83315,6 @@ SET character_set_client = utf8;
1 AS `ediBotanic` */;
SET character_set_client = @saved_cs_client;
---
--- Temporary table structure for view `v_account`
---
-
-DROP TABLE IF EXISTS `v_account`;
-/*!50001 DROP VIEW IF EXISTS `v_account`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `v_account` AS SELECT
- 1 AS `user_id` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `v_analisis_ventas`
---
-
-DROP TABLE IF EXISTS `v_analisis_ventas`;
-/*!50001 DROP VIEW IF EXISTS `v_analisis_ventas`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `v_analisis_ventas` AS SELECT
- 1 AS `Familia`,
- 1 AS `Reino`,
- 1 AS `Comercial`,
- 1 AS `Comprador`,
- 1 AS `Provincia`,
- 1 AS `almacen`,
- 1 AS `Año`,
- 1 AS `Mes`,
- 1 AS `Semana`,
- 1 AS `Vista`,
- 1 AS `Importe` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `v_barcodes`
---
-
-DROP TABLE IF EXISTS `v_barcodes`;
-/*!50001 DROP VIEW IF EXISTS `v_barcodes`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `v_barcodes` AS SELECT
- 1 AS `code`,
- 1 AS `Id_Article` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Temporary table structure for view `v_compres`
--
@@ -84211,41 +83381,6 @@ SET character_set_client = utf8;
1 AS `producer_id` */;
SET character_set_client = @saved_cs_client;
---
--- Temporary table structure for view `v_departure_limit`
---
-
-DROP TABLE IF EXISTS `v_departure_limit`;
-/*!50001 DROP VIEW IF EXISTS `v_departure_limit`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `v_departure_limit` AS SELECT
- 1 AS `warehouse_id`,
- 1 AS `fecha`,
- 1 AS `hora`,
- 1 AS `minSpeed` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `v_descuadre_bionic`
---
-
-DROP TABLE IF EXISTS `v_descuadre_bionic`;
-/*!50001 DROP VIEW IF EXISTS `v_descuadre_bionic`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `v_descuadre_bionic` AS SELECT
- 1 AS `Id_Ticket`,
- 1 AS `Alias`,
- 1 AS `Concepte`,
- 1 AS `suma_componente`,
- 1 AS `Preu`,
- 1 AS `Descuento`,
- 1 AS `diferencia`,
- 1 AS `Fecha`,
- 1 AS `benvenut` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Temporary table structure for view `v_empresa`
--
@@ -84272,24 +83407,6 @@ SET character_set_client = utf8;
1 AS `abbreviation` */;
SET character_set_client = @saved_cs_client;
---
--- Temporary table structure for view `v_inter`
---
-
-DROP TABLE IF EXISTS `v_inter`;
-/*!50001 DROP VIEW IF EXISTS `v_inter`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `v_inter` AS SELECT
- 1 AS `inter_id`,
- 1 AS `state_id`,
- 1 AS `nota`,
- 1 AS `odbc_date`,
- 1 AS `Id_Ticket`,
- 1 AS `Id_Trabajador`,
- 1 AS `Id_supervisor` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Temporary table structure for view `v_jerarquia`
--
@@ -84303,84 +83420,6 @@ SET character_set_client = utf8;
1 AS `boss_id` */;
SET character_set_client = @saved_cs_client;
---
--- Temporary table structure for view `v_miriam`
---
-
-DROP TABLE IF EXISTS `v_miriam`;
-/*!50001 DROP VIEW IF EXISTS `v_miriam`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `v_miriam` AS SELECT
- 1 AS `Id_Article`,
- 1 AS `Concepte`,
- 1 AS `Cantidad`,
- 1 AS `Preu`,
- 1 AS `Descuento`,
- 1 AS `Fecha`,
- 1 AS `Id_Cliente`,
- 1 AS `Importe` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `v_price_fixed`
---
-
-DROP TABLE IF EXISTS `v_price_fixed`;
-/*!50001 DROP VIEW IF EXISTS `v_price_fixed`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `v_price_fixed` AS SELECT
- 1 AS `warehouse_id`,
- 1 AS `item_id`,
- 1 AS `rate_0`,
- 1 AS `rate_1`,
- 1 AS `rate_2`,
- 1 AS `rate_3`,
- 1 AS `date_start`,
- 1 AS `date_end`,
- 1 AS `bonus`,
- 1 AS `grouping`,
- 1 AS `Packing`,
- 1 AS `caja` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `v_price_fixed_group`
---
-
-DROP TABLE IF EXISTS `v_price_fixed_group`;
-/*!50001 DROP VIEW IF EXISTS `v_price_fixed_group`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `v_price_fixed_group` AS SELECT
- 1 AS `warehouse_id`,
- 1 AS `item_id`,
- 1 AS `rate_0`,
- 1 AS `rate_1`,
- 1 AS `rate_2`,
- 1 AS `rate_3`,
- 1 AS `date_start`,
- 1 AS `date_end`,
- 1 AS `bonus`,
- 1 AS `grouping`,
- 1 AS `Packing`,
- 1 AS `caja` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `v_ticket_amount`
---
-
-DROP TABLE IF EXISTS `v_ticket_amount`;
-/*!50001 DROP VIEW IF EXISTS `v_ticket_amount`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `v_ticket_amount` AS SELECT
- 1 AS `Id_Ticket`,
- 1 AS `amount` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Temporary table structure for view `v_ventes`
--
@@ -84425,32 +83464,6 @@ SET character_set_client = utf8;
1 AS `producer_id` */;
SET character_set_client = @saved_cs_client;
---
--- Temporary table structure for view `v_warehouse`
---
-
-DROP TABLE IF EXISTS `v_warehouse`;
-/*!50001 DROP VIEW IF EXISTS `v_warehouse`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `v_warehouse` AS SELECT
- 1 AS `id`,
- 1 AS `almacen` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `v_xsubclien`
---
-
-DROP TABLE IF EXISTS `v_xsubclien`;
-/*!50001 DROP VIEW IF EXISTS `v_xsubclien`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `v_xsubclien` AS SELECT
- 1 AS `Id_Cliente`,
- 1 AS `empresa_id` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Temporary table structure for view `v_xsubcuentas`
--
@@ -84473,19 +83486,6 @@ SET character_set_client = utf8;
1 AS `IDNIF` */;
SET character_set_client = @saved_cs_client;
---
--- Temporary table structure for view `v_xsubprov`
---
-
-DROP TABLE IF EXISTS `v_xsubprov`;
-/*!50001 DROP VIEW IF EXISTS `v_xsubprov`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `v_xsubprov` AS SELECT
- 1 AS `proveedor_id`,
- 1 AS `empresa_id` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Temporary table structure for view `versiones`
--
@@ -84517,52 +83517,6 @@ CREATE TABLE `viaxpress` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
---
--- Temporary table structure for view `vnCreditClassification`
---
-
-DROP TABLE IF EXISTS `vnCreditClassification`;
-/*!50001 DROP VIEW IF EXISTS `vnCreditClassification`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `vnCreditClassification` AS SELECT
- 1 AS `id`,
- 1 AS `client`,
- 1 AS `dateStart`,
- 1 AS `dateEnd` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `vnCreditInsurance`
---
-
-DROP TABLE IF EXISTS `vnCreditInsurance`;
-/*!50001 DROP VIEW IF EXISTS `vnCreditInsurance`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `vnCreditInsurance` AS SELECT
- 1 AS `id`,
- 1 AS `creditClassification`,
- 1 AS `credit`,
- 1 AS `creationDate`,
- 1 AS `grade` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `vnSolunionCAP`
---
-
-DROP TABLE IF EXISTS `vnSolunionCAP`;
-/*!50001 DROP VIEW IF EXISTS `vnSolunionCAP`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `vnSolunionCAP` AS SELECT
- 1 AS `creditInsurance`,
- 1 AS `dateStart`,
- 1 AS `dateEnd`,
- 1 AS `dateLeaving` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Temporary table structure for view `warehouse`
--
@@ -84591,19 +83545,6 @@ SET character_set_client = utf8;
1 AS `hasConfectionTeam` */;
SET character_set_client = @saved_cs_client;
---
--- Temporary table structure for view `warehouse_alias`
---
-
-DROP TABLE IF EXISTS `warehouse_alias`;
-/*!50001 DROP VIEW IF EXISTS `warehouse_alias`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `warehouse_alias` AS SELECT
- 1 AS `warehouse_alias_id`,
- 1 AS `alias` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Table structure for table `warehouse_filtro`
--
@@ -84738,20 +83679,6 @@ CREATE TABLE `wks` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
---
--- Temporary table structure for view `workcenter_holiday`
---
-
-DROP TABLE IF EXISTS `workcenter_holiday`;
-/*!50001 DROP VIEW IF EXISTS `workcenter_holiday`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `workcenter_holiday` AS SELECT
- 1 AS `workcenter_id`,
- 1 AS `day`,
- 1 AS `year` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Temporary table structure for view `workerDocument`
--
@@ -84781,21 +83708,6 @@ SET character_set_client = utf8;
1 AS `user` */;
SET character_set_client = @saved_cs_client;
---
--- Temporary table structure for view `zoneNickname`
---
-
-DROP TABLE IF EXISTS `zoneNickname`;
-/*!50001 DROP VIEW IF EXISTS `zoneNickname`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `zoneNickname` AS SELECT
- 1 AS `warehouse_id`,
- 1 AS `agency_id`,
- 1 AS `zona`,
- 1 AS `alias` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Table structure for table `zones`
--
@@ -85865,14 +84777,12 @@ proc: BEGIN
SET vDate2000 = util.VN_CURDATE() + INTERVAL (2000 - YEAR(util.VN_CURDATE())) YEAR;
SET vRangeDeleteTicket = 60;
- DELETE FROM Rutas_monitor WHERE fecha < vDate;
DELETE FROM cdr WHERE calldate < vDate18;
DELETE FROM Monitoring WHERE ODBC_TIME < vDate;
DELETE FROM Conteo WHERE Fecha < vDate;
DELETE FROM XDiario WHERE FECHA < vDate3 OR FECHA IS NULL;
DELETE FROM mail WHERE DATE_ODBC < vDate;
DELETE FROM expeditions_deleted WHERE odbc_date < vDate26;
- DELETE FROM sms WHERE DATE_ODBC < vDate18;
DELETE FROM Movimientos_mark WHERE odbc_date < vDate;
DELETE FROM Splits WHERE Fecha < vDate18;
@@ -85892,8 +84802,6 @@ proc: BEGIN
JOIN Tickets t ON m.Id_Ticket = t.Id_Ticket WHERE t.Fecha < vDate;
DELETE FROM Remesas WHERE `Fecha Remesa` < vDate18;
- DELETE FROM sharingcart where datEND < vDate;
- DELETE FROM sharingclient where datEND < vDate;
DELETE tt.*
FROM Tickets_turno tt
@@ -86366,7 +85274,20 @@ BEGIN
SELECT t.Id_Ticket, Alias, cast(amount as decimal(10,2)) Importe, Domicilio, POBLACION
FROM Tickets t
JOIN Consignatarios cs ON t.Id_Consigna = cs.Id_Consigna
- JOIN v_ticket_amount v ON v.Id_Ticket = t.Id_Ticket
+ JOIN (
+ SELECT `Movimientos`.`Id_Ticket` AS `Id_Ticket`,
+ sum(
+ `Movimientos`.`Cantidad` * `Movimientos`.`Preu` * (100 - `Movimientos`.`Descuento`) / 100
+ ) AS `amount`
+ FROM (
+ `vn2008`.`Movimientos`
+ JOIN `vn2008`.`Tickets` ON(
+ `Movimientos`.`Id_Ticket` = `Tickets`.`Id_Ticket`
+ )
+ )
+ WHERE `Tickets`.`Fecha` >= `util`.`VN_CURDATE`() + INTERVAL -6 MONTH
+ GROUP BY `Movimientos`.`Id_Ticket`
+ ) v ON v.Id_Ticket = t.Id_Ticket
WHERE t.Fecha BETWEEN v_Date AND util.dayEnd(v_Date)
AND t.Id_Cliente = v_Client_Id;
@@ -89675,24 +88596,6 @@ USE `vn`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `__coolerPathDetail`
---
-
-/*!50001 DROP VIEW IF EXISTS `__coolerPathDetail`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `__coolerPathDetail` AS select `c`.`cooler_path_detail_id` AS `id`,`c`.`cooler_path_id` AS `coolerPathFk`,`c`.`pasillo` AS `hallway` from `vn2008`.`cooler_path_detail` `c` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
--
-- Final view structure for view `agencyTerm`
--
@@ -90228,7 +89131,7 @@ USE `vn`;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `expeditionPallet_Print` AS select `et2`.`description` AS `truck`,`t`.`routeFk` AS `routeFk`,`r`.`description` AS `zone`,count(`es`.`id`) AS `eti`,`ep`.`id` AS `palletFk`,`et`.`id` <=> `rm`.`expeditionTruckFk` AS `isMatch`,`t`.`warehouseFk` AS `warehouseFk`,if(`r`.`created` > `util`.`VN_CURDATE`() + interval 1 day,ucase(dayname(`r`.`created`)),NULL) AS `nombreDia` from (((((((`vn`.`expeditionTruck` `et` join `vn`.`expeditionPallet` `ep` on(`ep`.`truckFk` = `et`.`id`)) join `vn`.`expeditionScan` `es` on(`es`.`palletFk` = `ep`.`id`)) join `vn`.`expedition` `e` on(`e`.`id` = `es`.`expeditionFk`)) join `vn`.`ticket` `t` on(`t`.`id` = `e`.`ticketFk`)) join `vn`.`route` `r` on(`r`.`id` = `t`.`routeFk`)) left join `vn2008`.`Rutas_monitor` `rm` on(`rm`.`Id_Ruta` = `r`.`id`)) left join `vn`.`expeditionTruck` `et2` on(`et2`.`id` = `rm`.`expeditionTruckFk`)) group by `ep`.`id`,`t`.`routeFk` */;
+/*!50001 VIEW `expeditionPallet_Print` AS select `et2`.`description` AS `truck`,`t`.`routeFk` AS `routeFk`,`r`.`description` AS `zone`,count(`es`.`id`) AS `eti`,`ep`.`id` AS `palletFk`,`et`.`id` <=> `rm`.`expeditionTruckFk` AS `isMatch`,`t`.`warehouseFk` AS `warehouseFk`,if(`r`.`created` > `util`.`VN_CURDATE`() + interval 1 day,ucase(dayname(`r`.`created`)),NULL) AS `nombreDia` from (((((((`expeditionTruck` `et` join `expeditionPallet` `ep` on(`ep`.`truckFk` = `et`.`id`)) join `expeditionScan` `es` on(`es`.`palletFk` = `ep`.`id`)) join `expedition` `e` on(`e`.`id` = `es`.`expeditionFk`)) join `ticket` `t` on(`t`.`id` = `e`.`ticketFk`)) join `route` `r` on(`r`.`id` = `t`.`routeFk`)) left join `routesMonitor` `rm` on(`rm`.`routeFk` = `r`.`id`)) left join `expeditionTruck` `et2` on(`et2`.`id` = `rm`.`expeditionTruckFk`)) group by `ep`.`id`,`t`.`routeFk` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
@@ -90660,7 +89563,7 @@ USE `vn`;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `itemShelvingAvailable` AS select `s`.`id` AS `saleFk`,`tst`.`updated` AS `Modificado`,`s`.`ticketFk` AS `ticketFk`,0 AS `isPicked`,`s`.`itemFk` AS `itemFk`,`s`.`quantity` AS `quantity`,`s`.`concept` AS `concept`,`i`.`size` AS `size`,`st`.`name` AS `Estado`,`st`.`sectorProdPriority` AS `sectorProdPriority`,`stock`.`visible` AS `available`,`stock`.`sectorFk` AS `sectorFk`,`stock`.`shelvingFk` AS `matricula`,`stock`.`parkingFk` AS `parking`,`stock`.`itemShelvingFk` AS `itemShelving`,`am`.`name` AS `Agency`,`t`.`shipped` AS `shipped`,`stock`.`grouping` AS `grouping`,`stock`.`packing` AS `packing`,`z`.`hour` AS `hour`,`st`.`isPreviousPreparable` AS `isPreviousPreparable`,`sv`.`physicalVolume` AS `physicalVolume`,`t`.`warehouseFk` AS `warehouseFk` from (((((((((`sale` `s` join `ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `agencyMode` `am` on(`am`.`id` = `t`.`agencyModeFk`)) join `ticketStateToday` `tst` on(`tst`.`ticket` = `t`.`id`)) join `state` `st` on(`st`.`id` = `tst`.`state`)) join `item` `i` on(`i`.`id` = `s`.`itemFk`)) join `itemShelvingStock` `stock` on(`stock`.`itemFk` = `i`.`id`)) left join `saleTracking` `stk` on(`stk`.`saleFk` = `s`.`id`)) left join `zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `saleVolume` `sv` on(`sv`.`saleFk` = `s`.`id`)) where `t`.`shipped` between `util`.`yesterday`() and `util`.`dayend`(`util`.`VN_CURDATE`()) and `stk`.`id` is null and `stock`.`visible` > 0 and `stk`.`saleFk` is null and `st`.`isPreviousPreparable` <> 0 */;
+/*!50001 VIEW `itemShelvingAvailable` AS select `s`.`id` AS `saleFk`,`tst`.`updated` AS `Modificado`,`s`.`ticketFk` AS `ticketFk`,0 AS `isPicked`,`s`.`itemFk` AS `itemFk`,`s`.`quantity` AS `quantity`,`s`.`concept` AS `concept`,`i`.`size` AS `size`,`st`.`name` AS `Estado`,`st`.`sectorProdPriority` AS `sectorProdPriority`,`stock`.`visible` AS `available`,`stock`.`sectorFk` AS `sectorFk`,`stock`.`shelvingFk` AS `matricula`,`stock`.`parkingFk` AS `parking`,`stock`.`itemShelvingFk` AS `itemShelving`,`am`.`name` AS `Agency`,`t`.`shipped` AS `shipped`,`stock`.`grouping` AS `grouping`,`stock`.`packing` AS `packing`,`z`.`hour` AS `hour`,`st`.`isPreviousPreparable` AS `isPreviousPreparable`,`sv`.`physicalVolume` AS `physicalVolume`,`t`.`warehouseFk` AS `warehouseFk` from (((((((((`sale` `s` join `ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `agencyMode` `am` on(`am`.`id` = `t`.`agencyModeFk`)) join `ticketStateToday` `tst` on(`tst`.`ticketFk` = `t`.`id`)) join `state` `st` on(`st`.`id` = `tst`.`state`)) join `item` `i` on(`i`.`id` = `s`.`itemFk`)) join `itemShelvingStock` `stock` on(`stock`.`itemFk` = `i`.`id`)) left join `saleTracking` `stk` on(`stk`.`saleFk` = `s`.`id`)) left join `zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `saleVolume` `sv` on(`sv`.`saleFk` = `s`.`id`)) where `t`.`shipped` between `util`.`yesterday`() and `util`.`dayend`(`util`.`VN_CURDATE`()) and `stk`.`id` is null and `stock`.`visible` > 0 and `stk`.`saleFk` is null and `st`.`isPreviousPreparable` <> 0 */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
@@ -91488,7 +90391,7 @@ USE `vn`;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `ticketDownBuffer` AS select `td`.`ticketFk` AS `ticketFk`,`td`.`created` AS `created`,`td`.`selected` AS `selected`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `sacador`,`pk`.`code` AS `parking` from ((((`ticketDown` `td` join `ticketParking` `tp` on(`tp`.`ticketFk` = `td`.`ticketFk`)) join `parking` `pk` on(`pk`.`id` = `tp`.`parkingFk`)) join `ticketStateToday` `tst` on(`tst`.`ticket` = `td`.`ticketFk`)) join `worker` `w` on(`w`.`id` = `tst`.`worker`)) where `td`.`selected` = 2 */;
+/*!50001 VIEW `ticketDownBuffer` AS select `td`.`ticketFk` AS `ticketFk`,`td`.`created` AS `created`,`td`.`selected` AS `selected`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `sacador`,`pk`.`code` AS `parking` from ((((`ticketDown` `td` join `ticketParking` `tp` on(`tp`.`ticketFk` = `td`.`ticketFk`)) join `parking` `pk` on(`pk`.`id` = `tp`.`parkingFk`)) join `ticketStateToday` `tst` on(`tst`.`ticketFk` = `td`.`ticketFk`)) join `worker` `w` on(`w`.`id` = `tst`.`userFk`)) where `td`.`selected` = 2 */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
@@ -91632,7 +90535,7 @@ USE `vn`;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `ticketStateToday` AS select `ts`.`ticketFk` AS `ticket`,`ts`.`state` AS `state`,`ts`.`productionOrder` AS `productionOrder`,`ts`.`alertLevel` AS `alertLevel`,`ts`.`userFk` AS `worker`,`ts`.`code` AS `code`,`ts`.`updated` AS `updated`,`ts`.`isPicked` AS `isPicked` from (`ticketState` `ts` join `ticket` `t` on(`t`.`id` = `ts`.`ticketFk`)) where `t`.`shipped` between `util`.`VN_CURDATE`() and `MIDNIGHT`(`util`.`VN_CURDATE`()) */;
+/*!50001 VIEW `ticketStateToday` AS select `ts`.`ticketFk` AS `ticketFk`,`ts`.`state` AS `state`,`ts`.`productionOrder` AS `productionOrder`,`ts`.`alertLevel` AS `alertLevel`,`ts`.`userFk` AS `userFk`,`ts`.`code` AS `code`,`ts`.`updated` AS `updated`,`ts`.`isPicked` AS `isPicked` from (`ticketState` `ts` join `ticket` `t` on(`t`.`id` = `ts`.`ticketFk`)) where `t`.`shipped` between `util`.`VN_CURDATE`() and `MIDNIGHT`(`util`.`VN_CURDATE`()) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
@@ -92028,7 +90931,7 @@ USE `vn`;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `zoneEstimatedDelivery` AS select `t`.`zoneFk` AS `zoneFk`,`zc`.`hour` AS `zoneClosureHour`,`z`.`hour` AS `zoneHour`,`sv`.`volume` AS `volume`,`al`.`hasToRecalcPrice` AS `hasToRecalcPrice`,`lhp`.`m3` AS `m3`,`dl`.`minSpeed` AS `minSpeed` from ((((((((((`vn`.`ticket` `t` join `vn`.`ticketStateToday` `tst` on(`tst`.`ticket` = `t`.`id`)) join `vn`.`state` `s` on(`s`.`id` = `tst`.`state`)) join `vn`.`saleVolume` `sv` on(`sv`.`ticketFk` = `t`.`id`)) left join `vn`.`lastHourProduction` `lhp` on(`lhp`.`warehouseFk` = `t`.`warehouseFk`)) join `vn`.`warehouse` `w` on(`w`.`id` = `t`.`warehouseFk`)) join `vn`.`warehouseAlias` `wa` on(`wa`.`id` = `w`.`aliasFk`)) straight_join `vn`.`zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `vn`.`zoneClosure` `zc` on(`zc`.`zoneFk` = `t`.`zoneFk` and `zc`.`dated` = `util`.`VN_CURDATE`())) left join `cache`.`departure_limit` `dl` on(`dl`.`warehouse_id` = `t`.`warehouseFk` and `dl`.`fecha` = `util`.`VN_CURDATE`())) join `vn`.`alertLevel` `al` on(`al`.`id` = `s`.`alertLevel`)) where `w`.`hasProduction` <> 0 and cast(`t`.`shipped` as date) = `util`.`VN_CURDATE`() */;
+/*!50001 VIEW `zoneEstimatedDelivery` AS select `t`.`zoneFk` AS `zoneFk`,`zc`.`hour` AS `zoneClosureHour`,`z`.`hour` AS `zoneHour`,`sv`.`volume` AS `volume`,`al`.`hasToRecalcPrice` AS `hasToRecalcPrice`,`lhp`.`m3` AS `m3`,`dl`.`minSpeed` AS `minSpeed` from ((((((((((`vn`.`ticket` `t` join `vn`.`ticketStateToday` `tst` on(`tst`.`ticketFk` = `t`.`id`)) join `vn`.`state` `s` on(`s`.`id` = `tst`.`state`)) join `vn`.`saleVolume` `sv` on(`sv`.`ticketFk` = `t`.`id`)) left join `vn`.`lastHourProduction` `lhp` on(`lhp`.`warehouseFk` = `t`.`warehouseFk`)) join `vn`.`warehouse` `w` on(`w`.`id` = `t`.`warehouseFk`)) join `vn`.`warehouseAlias` `wa` on(`wa`.`id` = `w`.`aliasFk`)) straight_join `vn`.`zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `vn`.`zoneClosure` `zc` on(`zc`.`zoneFk` = `t`.`zoneFk` and `zc`.`dated` = `util`.`VN_CURDATE`())) left join `cache`.`departure_limit` `dl` on(`dl`.`warehouse_id` = `t`.`warehouseFk` and `dl`.`fecha` = `util`.`VN_CURDATE`())) join `vn`.`alertLevel` `al` on(`al`.`id` = `s`.`alertLevel`)) where `w`.`hasProduction` <> 0 and cast(`t`.`shipped` as date) = `util`.`VN_CURDATE`() */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
@@ -92633,42 +91536,6 @@ USE `vn2008`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `Rutas_Master`
---
-
-/*!50001 DROP VIEW IF EXISTS `Rutas_Master`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `Rutas_Master` AS select `rm`.`id` AS `id`,`rm`.`warehouseFk` AS `warehouse_id`,`rm`.`km` AS `km`,`rm`.`packages` AS `bultos`,`rm`.`vehicleCost` AS `vehiculos_coste`,`rm`.`staffCost` AS `personal_coste`,`rm`.`vehicle` AS `vehiculos_numero`,`rm`.`staff` AS `personal_numero`,`rm`.`fuel` AS `gasoil`,`rm`.`freelancers` AS `autonomos`,`rm`.`year` AS `año`,`rm`.`month` AS `mes`,`rm`.`expense` AS `gastos`,`rm`.`freelancersPackages` AS `bultos_autonomos`,`rm`.`kmCost` AS `coste_km`,`rm`.`packageCost` AS `coste_bulto`,`rm`.`freelancerPackageCost` AS `coste_bulto_autonomo`,`rm`.`created` AS `odbc_date` from `vn`.`routeMaster` `rm` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `Rutas_monitor`
---
-
-/*!50001 DROP VIEW IF EXISTS `Rutas_monitor`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `Rutas_monitor` AS select `vn`.`routesMonitor`.`routeFk` AS `Id_Ruta`,`vn`.`routesMonitor`.`name` AS `name`,`vn`.`routesMonitor`.`beachFk` AS `Ubicacion`,`vn`.`routesMonitor`.`ticketPacked` AS `pedidosEncajados`,`vn`.`routesMonitor`.`ticketFree` AS `pedidosLibres`,`vn`.`routesMonitor`.`ticketProduction` AS `pedidosProduccion`,`vn`.`routesMonitor`.`packages` AS `bultos`,`vn`.`routesMonitor`.`note` AS `notas`,`vn`.`routesMonitor`.`dated` AS `fecha`,`vn`.`routesMonitor`.`dockFk` AS `dockFk`,`vn`.`routesMonitor`.`m3` AS `m3`,`vn`.`routesMonitor`.`priority` AS `priority`,`vn`.`routesMonitor`.`etd` AS `etd`,`vn`.`routesMonitor`.`expeditionTruckFk` AS `expeditionTruckFk` from `vn`.`routesMonitor` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
--
-- Final view structure for view `Tickets`
--
@@ -92813,42 +91680,6 @@ USE `vn2008`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `VerEspionaje`
---
-
-/*!50001 DROP VIEW IF EXISTS `VerEspionaje`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `VerEspionaje` AS select `Trabajadores`.`CodigoTrabajador` AS `CodigoTrabajador`,`vn2008`.`Espionajes`.`Fecha` AS `Fecha`,`vn2008`.`Espionajes`.`HoraEntrada` AS `HoraEntrada`,`vn2008`.`Espionajes`.`HoraSalida` AS `HoraSalida`,`vn2008`.`Espionajes`.`Id_Equipo` AS `Id_Equipo`,`Trabajadores`.`Id_Trabajador` AS `Id_Trabajador` from (`vn2008`.`Espionajes` join `vn2008`.`Trabajadores` on(`vn2008`.`Espionajes`.`Id_Trabajador` = `Trabajadores`.`Id_Trabajador`)) order by `Trabajadores`.`CodigoTrabajador`,`vn2008`.`Espionajes`.`Fecha` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `Vistas`
---
-
-/*!50001 DROP VIEW IF EXISTS `Vistas`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `Vistas` AS select `dm`.`id` AS `vista_id`,`dm`.`code` AS `code`,`dm`.`description` AS `vista` from `vn`.`deliveryMethod` `dm` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
--
-- Final view structure for view `XDiario`
--
@@ -93209,96 +92040,6 @@ USE `vn2008`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `client_observation`
---
-
-/*!50001 DROP VIEW IF EXISTS `client_observation`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `client_observation` AS select `co`.`id` AS `client_observation_id`,`co`.`clientFk` AS `Id_Cliente`,`co`.`workerFk` AS `Id_Trabajador`,`co`.`text` AS `text`,`co`.`created` AS `odbc_date` from `vn`.`clientObservation` `co` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `clientes_gestdoc`
---
-
-/*!50001 DROP VIEW IF EXISTS `clientes_gestdoc`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `clientes_gestdoc` AS select `cd`.`clientFk` AS `Id_Cliente`,`cd`.`dmsFk` AS `gest_doc_id` from `vn`.`clientDms` `cd` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `clientes_regalos_enc`
---
-
-/*!50001 DROP VIEW IF EXISTS `clientes_regalos_enc`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_general_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `clientes_regalos_enc` AS select `cpg`.`clientFk` AS `Id_Cliente`,`cpg`.`giftFk` AS `Id_Regalo`,`cpg`.`added` AS `odbc_date` from `vn`.`clientPackagingGifts` `cpg` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `clientes_regalos_lista_enc`
---
-
-/*!50001 DROP VIEW IF EXISTS `clientes_regalos_lista_enc`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `clientes_regalos_lista_enc` AS select `pg`.`id` AS `Id_Regalo`,`pg`.`description` AS `Descripcion`,`pg`.`photo` AS `foto`,if(`util`.`VN_CURDATE`() between `pg`.`started` and `pg`.`ended`,1,0) AS `activo`,`pg`.`started` AS `datstart`,`pg`.`ended` AS `datend`,ifnull(`pg`.`warehouseFk`,0) AS `warehouse_id`,ifnull(`pg`.`provinceFk`,0) AS `province_id`,ifnull(`pg`.`countryFk`,0) AS `countryFk` from `vn`.`packagingGifts` `pg` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `clientes_tipo`
---
-
-/*!50001 DROP VIEW IF EXISTS `clientes_tipo`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `clientes_tipo` AS select `ct`.`id` AS `clientes_tipo_id`,`ct`.`code` AS `code`,`ct`.`type` AS `tipo`,`ct`.`isCreatedAsServed` AS `isCreatedAsServed` from `vn`.`clientType` `ct` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
--
-- Final view structure for view `config_host`
--
@@ -93335,42 +92076,6 @@ USE `vn2008`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `cooler_path_detail`
---
-
-/*!50001 DROP VIEW IF EXISTS `cooler_path_detail`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `cooler_path_detail` AS select `cpd`.`id` AS `cooler_path_detail_id`,`cpd`.`coolerPathFk` AS `cooler_path_id`,`cpd`.`hallway` AS `pasillo` from `vn`.`coolerPathDetail` `cpd` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `credit`
---
-
-/*!50001 DROP VIEW IF EXISTS `credit`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `credit` AS select `c`.`id` AS `id`,`c`.`clientFk` AS `Id_Cliente`,`c`.`workerFk` AS `Id_Trabajador`,`c`.`amount` AS `amount`,`c`.`created` AS `odbc_date` from `vn`.`clientCredit` `c` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
--
-- Final view structure for view `deliveryPoint`
--
@@ -93677,24 +92382,6 @@ USE `vn2008`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `escritos_det`
---
-
-/*!50001 DROP VIEW IF EXISTS `escritos_det`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `escritos_det` AS select `cs`.`id` AS `id`,`cs`.`clientFk` AS `Id_Cliente`,`cs`.`typeFk` AS `escritos_id`,`cs`.`created` AS `fecha`,`cs`.`workerFk` AS `Id_Trabajador`,`cs`.`userFk` AS `userFk`,`cs`.`companyFk` AS `empresa_id`,`cs`.`balance` AS `saldo` from `vn`.`clientSample` `cs` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
--
-- Final view structure for view `expeditions`
--
@@ -93857,78 +92544,6 @@ USE `vn2008`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `iva_codigo`
---
-
-/*!50001 DROP VIEW IF EXISTS `iva_codigo`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `iva_codigo` AS select `tc`.`id` AS `id`,`tc`.`dated` AS `fecha`,`tc`.`code` AS `codigo`,`tc`.`taxTypeFk` AS `iva_tipo_id`,`tc`.`rate` AS `iva`,`tc`.`equalizationTax` AS `recargo`,`tc`.`type` AS `tipo`,`tc`.`link` AS `link`,`tc`.`isActive` AS `isActive`,`tc`.`updated` AS `updated`,`tc`.`transactionCode` AS `transactionCode` from `vn`.`taxCode` `tc` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `iva_group`
---
-
-/*!50001 DROP VIEW IF EXISTS `iva_group`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `iva_group` AS select `tc`.`id` AS `iva_group_id`,`tc`.`description` AS `description`,`tc`.`code` AS `code` from `vn`.`taxClass` `tc` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `iva_group_codigo`
---
-
-/*!50001 DROP VIEW IF EXISTS `iva_group_codigo`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `iva_group_codigo` AS select `tcc`.`taxClassFk` AS `iva_group_id`,`tcc`.`effectived` AS `date`,`tcc`.`taxCodeFk` AS `iva_codigo_id` from `vn`.`taxClassCode` `tcc` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `iva_tipo`
---
-
-/*!50001 DROP VIEW IF EXISTS `iva_tipo`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `iva_tipo` AS select `tt`.`id` AS `id`,`tt`.`nickname` AS `alias`,`tt`.`isAccrued` AS `isAccrued`,`tt`.`serial` AS `serie_id`,`tt`.`TIPOOPE` AS `TIPOOPE`,`tt`.`description` AS `descripcion`,`tt`.`countryFk` AS `Id_Pais` from `vn`.`taxType` `tt` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
--
-- Final view structure for view `mail`
--
@@ -93983,96 +92598,6 @@ USE `vn2008`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `observation_type`
---
-
-/*!50001 DROP VIEW IF EXISTS `observation_type`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `observation_type` AS select `co`.`id` AS `observation_type_id`,`co`.`description` AS `description` from `vn`.`observationType` `co` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `order`
---
-
-/*!50001 DROP VIEW IF EXISTS `order`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `order` AS select `hedera`.`order`.`id` AS `id`,`hedera`.`order`.`date_make` AS `date_make`,`hedera`.`order`.`date_send` AS `date_send`,`hedera`.`order`.`customer_id` AS `customer_id`,`hedera`.`order`.`delivery_method_id` AS `delivery_method_id`,`hedera`.`order`.`agency_id` AS `agency_id`,`hedera`.`order`.`address_id` AS `address_id`,`hedera`.`order`.`note` AS `note`,`hedera`.`order`.`confirmed` AS `confirmed`,`hedera`.`order`.`is_bionic` AS `is_bionic`,`hedera`.`order`.`source_app` AS `source_app` from `hedera`.`order` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `order_Tickets`
---
-
-/*!50001 DROP VIEW IF EXISTS `order_Tickets`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `order_Tickets` AS select `ot`.`orderFk` AS `order_id`,`ot`.`ticketFk` AS `Id_Ticket` from `vn`.`orderTicket` `ot` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `order_component`
---
-
-/*!50001 DROP VIEW IF EXISTS `order_component`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `order_component` AS select `c`.`order_row_id` AS `order_row_id`,`c`.`component_id` AS `component_id`,`c`.`price` AS `price` from `hedera`.`order_component` `c` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `order_row`
---
-
-/*!50001 DROP VIEW IF EXISTS `order_row`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `order_row` AS select `order_row`.`id` AS `id`,`order_row`.`order_id` AS `order_id`,`order_row`.`item_id` AS `item_id`,`order_row`.`warehouse_id` AS `warehouse_id`,`order_row`.`shipment` AS `shipment`,`order_row`.`amount` AS `amount`,`order_row`.`price` AS `price`,`order_row`.`rate` AS `rate`,`order_row`.`created` AS `created`,`order_row`.`Id_Movimiento` AS `Id_Movimiento` from `hedera`.`order_row` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
--
-- Final view structure for view `pago`
--
@@ -94451,60 +92976,6 @@ USE `vn2008`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `sharingcart`
---
-
-/*!50001 DROP VIEW IF EXISTS `sharingcart`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `sharingcart` AS select `sc`.`id` AS `id`,`sc`.`workerFk` AS `Id_Trabajador`,`sc`.`started` AS `datSTART`,`sc`.`ended` AS `datEND`,`sc`.`workerSubstitute` AS `Id_Suplente`,`sc`.`created` AS `odbc_date` from `vn`.`sharingCart` `sc` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `sharingclient`
---
-
-/*!50001 DROP VIEW IF EXISTS `sharingclient`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `sharingclient` AS select `sc`.`id` AS `id`,`sc`.`workerFk` AS `Id_Trabajador`,`sc`.`started` AS `datSTART`,`sc`.`ended` AS `datEND`,`sc`.`clientFk` AS `Id_Cliente` from `vn`.`sharingClient` `sc` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `sms`
---
-
-/*!50001 DROP VIEW IF EXISTS `sms`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `sms` AS select `t`.`id` AS `id`,`t`.`senderFk` AS `Id_trabajador`,`t`.`sender` AS `from`,`t`.`destination` AS `to`,`t`.`message` AS `text`,`t`.`statusCode` AS `sent`,`t`.`status` AS `response`,`t`.`created` AS `DATE_ODBC` from `vn`.`sms` `t` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
--
-- Final view structure for view `state`
--
@@ -94577,24 +93048,6 @@ USE `vn2008`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `tarifas`
---
-
-/*!50001 DROP VIEW IF EXISTS `tarifas`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `tarifas` AS select `r`.`id` AS `tarifa_id`,`r`.`dated` AS `fecha`,`r`.`warehouseFk` AS `warehouse_id`,`r`.`rate0` AS `t0`,`r`.`rate1` AS `t1`,`r`.`rate2` AS `t2`,`r`.`rate3` AS `t3` from `vn`.`rate` `r` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
--
-- Final view structure for view `tblContadores`
--
@@ -94631,42 +93084,6 @@ USE `vn2008`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `ticketCreationData`
---
-
-/*!50001 DROP VIEW IF EXISTS `ticketCreationData`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `ticketCreationData` AS select dayname(`h`.`confirm_date`) AS `DiadelaSemana`,hour(`h`.`confirm_date`) AS `Hora`,cast(`h`.`confirm_date` as date) AS `Fecha`,`h`.`source_app` AS `Dispositivo` from `hedera`.`order` `h` where `h`.`confirm_date` <> 0 */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `ticketMRW`
---
-
-/*!50001 DROP VIEW IF EXISTS `ticketMRW`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `ticketMRW` AS select `Tickets`.`Id_Agencia` AS `id_Agencia`,`Tickets`.`empresa_id` AS `empresa_id`,`Consignatarios`.`consignatario` AS `Consignatario`,`Consignatarios`.`domicilio` AS `DOMICILIO`,`Consignatarios`.`poblacion` AS `POBLACION`,`Consignatarios`.`codPostal` AS `CODPOSTAL`,`Consignatarios`.`telefono` AS `telefono`,`Consignatarios`.`movil` AS `movil`,`Clientes`.`if` AS `IF`,`Tickets`.`Id_Ticket` AS `Id_Ticket`,`Tickets`.`warehouse_id` AS `warehouse_id`,`Consignatarios`.`id_consigna` AS `Id_Consigna`,`Paises`.`Codigo` AS `CodigoPais`,`Tickets`.`Fecha` AS `Fecha`,`province`.`province_id` AS `province_id`,`Tickets`.`landing` AS `landing` from ((((`vn2008`.`Clientes` join `vn2008`.`Consignatarios` on(`Clientes`.`id_cliente` = `Consignatarios`.`Id_cliente`)) join `vn2008`.`Tickets` on(`Consignatarios`.`id_consigna` = `Tickets`.`Id_Consigna`)) join `vn2008`.`province` on(`Consignatarios`.`province_id` = `province`.`province_id`)) join `vn2008`.`Paises` on(`province`.`Paises_Id` = `Paises`.`Id`)) */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
--
-- Final view structure for view `ticket_observation`
--
@@ -94721,24 +93138,6 @@ USE `vn2008`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `tr2`
---
-
-/*!50001 DROP VIEW IF EXISTS `tr2`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `tr2` AS select `vn`.`travel`.`id` AS `id`,`vn`.`travel`.`shipped` AS `shipped`,`vn`.`travel`.`shipmentHour` AS `shipmentHour`,`vn`.`travel`.`landed` AS `landed`,`vn`.`travel`.`landingHour` AS `landingHour`,`vn`.`travel`.`warehouseInFk` AS `warehouseInFk`,`vn`.`travel`.`warehouseOutFk` AS `warehouseOutFk`,`vn`.`travel`.`agencyModeFk` AS `agencyFk`,`vn`.`travel`.`ref` AS `ref`,`vn`.`travel`.`isDelivered` AS `isDelivered`,`vn`.`travel`.`isReceived` AS `isReceived`,`vn`.`travel`.`m3` AS `m3`,`vn`.`travel`.`kg` AS `kg`,`vn`.`travel`.`cargoSupplierFk` AS `cargoSupplierFk`,`vn`.`travel`.`totalEntries` AS `totalEntries` from `vn`.`travel` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
--
-- Final view structure for view `travel`
--
@@ -94757,24 +93156,6 @@ USE `vn2008`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `travel_thermograph`
---
-
-/*!50001 DROP VIEW IF EXISTS `travel_thermograph`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `travel_thermograph` AS select `tt`.`thermographFk` AS `thermograph_id`,`tt`.`created` AS `odbc_date`,`tt`.`warehouseFk` AS `warehouse_id`,`tt`.`travelFk` AS `travel_id`,`tt`.`temperatureFk` AS `temperature`,`tt`.`result` AS `result`,`tt`.`dmsFk` AS `gestdoc_id` from `vn`.`travelThermograph` `tt` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
--
-- Final view structure for view `v_Articles_botanical`
--
@@ -94793,60 +93174,6 @@ USE `vn2008`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `v_account`
---
-
-/*!50001 DROP VIEW IF EXISTS `v_account`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `v_account` AS select `a`.`id` AS `user_id` from `account`.`account` `a` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `v_analisis_ventas`
---
-
-/*!50001 DROP VIEW IF EXISTS `v_analisis_ventas`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `v_analisis_ventas` AS select `bi`.`analisis_ventas`.`Familia` AS `Familia`,`bi`.`analisis_ventas`.`Reino` AS `Reino`,`bi`.`analisis_ventas`.`Comercial` AS `Comercial`,`bi`.`analisis_ventas`.`Comprador` AS `Comprador`,`bi`.`analisis_ventas`.`Provincia` AS `Provincia`,`bi`.`analisis_ventas`.`almacen` AS `almacen`,`bi`.`analisis_ventas`.`Año` AS `Año`,`bi`.`analisis_ventas`.`Mes` AS `Mes`,`bi`.`analisis_ventas`.`Semana` AS `Semana`,`bi`.`analisis_ventas`.`Vista` AS `Vista`,`bi`.`analisis_ventas`.`Importe` AS `Importe` from `bi`.`analisis_ventas` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `v_barcodes`
---
-
-/*!50001 DROP VIEW IF EXISTS `v_barcodes`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `v_barcodes` AS select `Articles`.`Id_Article` AS `code`,`Articles`.`Id_Article` AS `Id_Article` from `vn2008`.`Articles` union all select `barcodes`.`code` AS `code`,`barcodes`.`Id_Article` AS `Id_Article` from `vn2008`.`barcodes` union all select `c`.`Id_Compra` AS `Id_Compra`,`c`.`Id_Article` AS `Id_Article` from ((`vn2008`.`Compres` `c` join `vn2008`.`Entradas` `e` on(`c`.`Id_Entrada` = `e`.`Id_Entrada`)) join `vn2008`.`travel` `tr` on(`tr`.`id` = `e`.`travel_id`)) where `tr`.`landing` >= `util`.`VN_CURDATE`() + interval -15 day */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
--
-- Final view structure for view `v_compres`
--
@@ -94865,42 +93192,6 @@ USE `vn2008`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `v_departure_limit`
---
-
-/*!50001 DROP VIEW IF EXISTS `v_departure_limit`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `v_departure_limit` AS select `cache`.`departure_limit`.`warehouse_id` AS `warehouse_id`,`cache`.`departure_limit`.`fecha` AS `fecha`,`cache`.`departure_limit`.`hora` AS `hora`,`cache`.`departure_limit`.`minSpeed` AS `minSpeed` from `cache`.`departure_limit` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `v_descuadre_bionic`
---
-
-/*!50001 DROP VIEW IF EXISTS `v_descuadre_bionic`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `v_descuadre_bionic` AS select `t`.`Id_Ticket` AS `Id_Ticket`,`t`.`Alias` AS `Alias`,`m`.`Concepte` AS `Concepte`,sum(`mc`.`Valor`) AS `suma_componente`,`m`.`Preu` AS `Preu`,`m`.`Descuento` AS `Descuento`,`m`.`Preu` * (100 - `m`.`Descuento`) / 100 - sum(`mc`.`Valor`) AS `diferencia`,`t`.`Fecha` AS `Fecha`,`m`.`Preu` > 0 and `tp`.`reino_id` <> 6 and `a`.`tipo_id` not in (7,115) AS `benvenut` from ((((((`vn2008`.`Movimientos` `m` join `vn2008`.`Tickets` `t` on(`m`.`Id_Ticket` = `t`.`Id_Ticket`)) join `vn2008`.`Clientes` `c` on(`t`.`Id_Cliente` = `c`.`id_cliente`)) join `vn2008`.`warehouse` `w` on(`w`.`id` = `t`.`warehouse_id`)) join `vn2008`.`Articles` `a` on(`m`.`Id_Article` = `a`.`Id_Article`)) join `vn2008`.`Tipos` `tp` on(`a`.`tipo_id` = `tp`.`tipo_id`)) left join `vn2008`.`Movimientos_componentes` `mc` on(`m`.`Id_Movimiento` = `mc`.`Id_Movimiento`)) where `t`.`Fecha` >= '2015-09-01' and `t`.`empresa_id` in (442,791,567) and `w`.`reserve` <> 0 and `c`.`real` <> 0 and `tp`.`reino_id` <> 6 group by `m`.`Id_Movimiento` having abs(`diferencia`) > 0.01 or `diferencia` is null */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
--
-- Final view structure for view `v_empresa`
--
@@ -94919,24 +93210,6 @@ USE `vn2008`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `v_inter`
---
-
-/*!50001 DROP VIEW IF EXISTS `v_inter`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb3 */;
-/*!50001 SET character_set_results = utf8mb3 */;
-/*!50001 SET collation_connection = utf8mb3_general_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `v_inter` AS select `tt`.`id` AS `inter_id`,`tt`.`stateFk` AS `state_id`,`tt`.`notes` AS `nota`,`tt`.`created` AS `odbc_date`,`tt`.`ticketFk` AS `Id_Ticket`,`tt`.`userFk` AS `Id_Trabajador`,`tt`.`supervisorFk` AS `Id_supervisor` from `vn`.`ticketTracking` `tt` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
--
-- Final view structure for view `v_jerarquia`
--
@@ -94955,78 +93228,6 @@ USE `vn2008`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `v_miriam`
---
-
-/*!50001 DROP VIEW IF EXISTS `v_miriam`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `v_miriam` AS select `M`.`Id_Article` AS `Id_Article`,`M`.`Concepte` AS `Concepte`,`M`.`Cantidad` AS `Cantidad`,`M`.`Preu` AS `Preu`,`M`.`Descuento` AS `Descuento`,`T`.`Fecha` AS `Fecha`,`T`.`Id_Cliente` AS `Id_Cliente`,`M`.`Cantidad` * `M`.`Preu` * (100 - `M`.`Descuento`) / 100 AS `Importe` from (((`vn2008`.`Tickets` `T` join `vn2008`.`Movimientos` `M` on(`T`.`Id_Ticket` = `M`.`Id_Ticket`)) join `vn2008`.`Articles` `A` on(`M`.`Id_Article` = `A`.`Id_Article`)) join `vn2008`.`Tipos` `TP` on(`A`.`tipo_id` = `TP`.`tipo_id`)) where `T`.`Fecha` >= '2011-01-01' and `A`.`tipo_id` = 7 */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `v_price_fixed`
---
-
-/*!50001 DROP VIEW IF EXISTS `v_price_fixed`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `v_price_fixed` AS select `pf`.`warehouse_id` AS `warehouse_id`,`pf`.`item_id` AS `item_id`,`pf`.`rate_0` AS `rate_0`,`pf`.`rate_1` AS `rate_1`,`pf`.`rate_2` AS `rate_2`,`pf`.`rate_3` AS `rate_3`,`pf`.`date_start` AS `date_start`,`pf`.`date_end` AS `date_end`,`pf`.`bonus` AS `bonus`,`pf`.`grouping` AS `grouping`,`pf`.`Packing` AS `Packing`,`pf`.`caja` AS `caja` from `vn2008`.`price_fixed` `pf` where `pf`.`warehouse_id` < 1000 union all select `wg`.`warehouse_id` AS `warehouse_id`,`pf`.`item_id` AS `item_id`,`pf`.`rate_0` AS `rate_0`,`pf`.`rate_1` AS `rate_1`,`pf`.`rate_2` AS `rate_2`,`pf`.`rate_3` AS `rate_3`,`pf`.`date_start` AS `date_start`,`pf`.`date_end` AS `date_end`,`pf`.`bonus` AS `bonus`,`pf`.`grouping` AS `grouping`,`pf`.`Packing` AS `Packing`,`pf`.`caja` AS `caja` from (`vn2008`.`price_fixed` `pf` join `vn2008`.`warehouse_group` `wg`) where `wg`.`warehouse_alias_id` + 1000 = `pf`.`warehouse_id` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `v_price_fixed_group`
---
-
-/*!50001 DROP VIEW IF EXISTS `v_price_fixed_group`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `v_price_fixed_group` AS select `pf`.`warehouse_id` AS `warehouse_id`,`pf`.`item_id` AS `item_id`,`pf`.`rate_0` AS `rate_0`,`pf`.`rate_1` AS `rate_1`,`pf`.`rate_2` AS `rate_2`,`pf`.`rate_3` AS `rate_3`,`pf`.`date_start` AS `date_start`,`pf`.`date_end` AS `date_end`,`pf`.`bonus` AS `bonus`,`pf`.`grouping` AS `grouping`,`pf`.`Packing` AS `Packing`,`pf`.`caja` AS `caja` from `vn2008`.`v_price_fixed` `pf` group by `pf`.`warehouse_id`,`pf`.`item_id`,`pf`.`date_start`,`pf`.`date_end` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `v_ticket_amount`
---
-
-/*!50001 DROP VIEW IF EXISTS `v_ticket_amount`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `v_ticket_amount` AS select `Movimientos`.`Id_Ticket` AS `Id_Ticket`,sum(`Movimientos`.`Cantidad` * `Movimientos`.`Preu` * (100 - `Movimientos`.`Descuento`) / 100) AS `amount` from (`vn2008`.`Movimientos` join `vn2008`.`Tickets` on(`Movimientos`.`Id_Ticket` = `Tickets`.`Id_Ticket`)) where `Tickets`.`Fecha` >= `util`.`VN_CURDATE`() + interval -6 month group by `Movimientos`.`Id_Ticket` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
--
-- Final view structure for view `v_ventes`
--
@@ -95045,42 +93246,6 @@ USE `vn2008`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `v_warehouse`
---
-
-/*!50001 DROP VIEW IF EXISTS `v_warehouse`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `v_warehouse` AS select `warehouse`.`id` AS `id`,`warehouse`.`name` AS `almacen` from `vn2008`.`warehouse` union all select 1000 + `warehouse_alias`.`warehouse_alias_id` AS `warehouse_alias_id`,concat(`warehouse_alias`.`alias`,'(G)') AS `concat(alias, '(G)')` from `vn2008`.`warehouse_alias` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `v_xsubclien`
---
-
-/*!50001 DROP VIEW IF EXISTS `v_xsubclien`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `v_xsubclien` AS select distinct `Facturas`.`Id_Cliente` AS `Id_Cliente`,`Facturas`.`empresa_id` AS `empresa_id` from `vn2008`.`Facturas` where `Facturas`.`Fecha` > `util`.`VN_CURDATE`() + interval -2 month union select `Recibos`.`Id_Cliente` AS `Id_Cliente`,`Recibos`.`empresa_id` AS `empresa_id` from `vn2008`.`Recibos` where `Recibos`.`Fechacobro` > `util`.`VN_CURDATE`() + interval -2 month */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
--
-- Final view structure for view `v_xsubcuentas`
--
@@ -95094,25 +93259,7 @@ USE `vn2008`;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `v_xsubcuentas` AS select `Clientes`.`Cuenta` AS `COD`,`Clientes`.`razonSocial` AS `TITULO`,concat(if(`p`.`CEE` = 1 and ascii(left(`Clientes`.`if`,1)) < 58,`p`.`Codigo`,''),`Clientes`.`if`) AS `NIF`,`Clientes`.`domicilio` AS `DOMICILIO`,`Clientes`.`poblacion` AS `POBLACION`,`province`.`name` AS `PROVINCIA`,`Clientes`.`codPostal` AS `CODPOSTAL`,`p`.`Codigo` AS `country_code`,`v_xsubclien`.`empresa_id` AS `empresa_id`,substr(`Clientes`.`e-mail`,1,coalesce(nullif(locate(',',`Clientes`.`e-mail`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0 or `p`.`CEE` = 1 and `Clientes`.`vies` = 0,1,if(`p`.`CEE` = 1 and `Clientes`.`vies` <> 0,2,4)) AS `IDNIF` from (((`vn2008`.`Clientes` join `vn2008`.`v_xsubclien` on(`Clientes`.`id_cliente` = `v_xsubclien`.`Id_Cliente`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Clientes`.`Id_Pais`)) join `vn2008`.`province` on(`Clientes`.`province_id` = `province`.`province_id`)) group by `Clientes`.`id_cliente`,`v_xsubclien`.`empresa_id` union all select `Proveedores`.`cuenta` AS `Cuenta`,`Proveedores`.`Proveedor` AS `Proveedor`,concat(if(`p`.`CEE` = 1 and ascii(left(`Proveedores`.`NIF`,1)) < 58,`p`.`Codigo`,''),`Proveedores`.`NIF`) AS `NIF`,`Proveedores`.`Domicilio` AS `Domicilio`,`Proveedores`.`Localidad` AS `Localidad`,`prov`.`name` AS `Provincia`,`Proveedores`.`codpos` AS `CP`,`p`.`Codigo` AS `country_code`,`v_xsubprov`.`empresa_id` AS `empresa_id`,substr(`c`.`email`,1,coalesce(nullif(locate(',',`c`.`email`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0,1,if(`p`.`CEE` = 1,2,4)) AS `IDNIF` from ((((`vn2008`.`Proveedores` join `vn2008`.`v_xsubprov` on(`Proveedores`.`Id_Proveedor` = `v_xsubprov`.`proveedor_id`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Proveedores`.`pais_id`)) left join `vn2008`.`province` `prov` on(`prov`.`province_id` = `Proveedores`.`province_id`)) left join `vn`.`supplierContact` `c` on(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`)) where `Proveedores`.`oficial` <> 0 group by `v_xsubprov`.`proveedor_id`,`v_xsubprov`.`empresa_id` union all select `Gastos`.`Id_Gasto` collate utf8mb3_unicode_ci AS `Id_Gasto`,`Gastos`.`Gasto` collate utf8mb3_unicode_ci AS `Gasto`,NULL AS `NULL`,NULL AS `My_exp_NULL`,NULL AS `My_exp_1_NULL`,NULL AS `My_exp_2_NULL`,NULL AS `My_exp_3_NULL`,NULL AS `country_code`,`e`.`id` AS `id`,NULL AS `EMAIL`,1 AS `IDNIF` from (`vn2008`.`Gastos` join `vn2008`.`empresa` `e` on(`e`.`id` = 442)) union all select `Bancos`.`Cuenta` AS `Cuenta`,`Bancos`.`Banco` AS `Banco`,NULL AS `NULL`,NULL AS `My_exp_NULL`,NULL AS `My_exp_1_NULL`,NULL AS `My_exp_2_NULL`,NULL AS `My_exp_3_NULL`,NULL AS `country_code`,`e`.`id` AS `id`,NULL AS `EMAIL`,1 AS `IDNIF` from (`vn2008`.`Bancos` join `vn2008`.`empresa` `e` on(`e`.`id` = 442)) union all select lpad(right(`Proveedores`.`cuenta`,5),10,'47510000') AS `Cuenta`,`Proveedores`.`Proveedor` AS `Proveedor`,`Proveedores`.`NIF` AS `NIF`,`Proveedores`.`Domicilio` AS `Domicilio`,`Proveedores`.`Localidad` AS `Localidad`,`prov`.`name` AS `Provincia`,`Proveedores`.`codpos` AS `CP`,`p`.`Codigo` AS `country_code`,`v_xsubprov`.`empresa_id` AS `empresa_id`,substr(`c`.`email`,1,coalesce(nullif(locate(',',`c`.`email`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0,1,if(`p`.`CEE` = 1,2,4)) AS `IDNIF` from ((((`vn2008`.`Proveedores` join `vn2008`.`v_xsubprov` on(`Proveedores`.`Id_Proveedor` = `v_xsubprov`.`proveedor_id`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Proveedores`.`pais_id`)) left join `vn2008`.`province` `prov` on(`prov`.`province_id` = `Proveedores`.`province_id`)) left join `vn`.`supplierContact` `c` on(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`)) where (`Proveedores`.`cuenta` like '_____3____' or `Proveedores`.`cuenta` like '_____2____') and `Proveedores`.`oficial` = 1 group by `v_xsubprov`.`proveedor_id`,`v_xsubprov`.`empresa_id` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `v_xsubprov`
---
-
-/*!50001 DROP VIEW IF EXISTS `v_xsubprov`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `v_xsubprov` AS select `recibida`.`proveedor_id` AS `proveedor_id`,`recibida`.`empresa_id` AS `empresa_id` from `vn2008`.`recibida` where `recibida`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `recibida`.`proveedor_id`,`recibida`.`empresa_id` union all select `pago`.`id_proveedor` AS `id_proveedor`,`pago`.`empresa_id` AS `empresa_id` from `vn2008`.`pago` where `pago`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `pago`.`id_proveedor`,`pago`.`empresa_id` */;
+/*!50001 VIEW `v_xsubcuentas` AS select `Clientes`.`Cuenta` AS `COD`,`Clientes`.`razonSocial` AS `TITULO`,concat(if(`p`.`CEE` = 1 and ascii(left(`Clientes`.`if`,1)) < 58,`p`.`Codigo`,''),`Clientes`.`if`) AS `NIF`,`Clientes`.`domicilio` AS `DOMICILIO`,`Clientes`.`poblacion` AS `POBLACION`,`province`.`name` AS `PROVINCIA`,`Clientes`.`codPostal` AS `CODPOSTAL`,`p`.`Codigo` AS `country_code`,`sub`.`empresa_id` AS `empresa_id`,substr(`Clientes`.`e-mail`,1,coalesce(nullif(locate(',',`Clientes`.`e-mail`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0 or `p`.`CEE` = 1 and `Clientes`.`vies` = 0,1,if(`p`.`CEE` = 1 and `Clientes`.`vies` <> 0,2,4)) AS `IDNIF` from (((`vn2008`.`Clientes` join (select distinct `Facturas`.`Id_Cliente` AS `Id_Cliente`,`Facturas`.`empresa_id` AS `empresa_id` from `vn2008`.`Facturas` where `Facturas`.`Fecha` > `util`.`VN_CURDATE`() + interval -2 month union select `Recibos`.`Id_Cliente` AS `Id_Cliente`,`Recibos`.`empresa_id` AS `empresa_id` from `vn2008`.`Recibos` where `Recibos`.`Fechacobro` > `util`.`VN_CURDATE`() + interval -2 month) `sub` on(`Clientes`.`id_cliente` = `sub`.`Id_Cliente`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Clientes`.`Id_Pais`)) join `vn2008`.`province` on(`Clientes`.`province_id` = `province`.`province_id`)) group by `Clientes`.`id_cliente`,`sub`.`empresa_id` union all select `Proveedores`.`cuenta` AS `Cuenta`,`Proveedores`.`Proveedor` AS `Proveedor`,concat(if(`p`.`CEE` = 1 and ascii(left(`Proveedores`.`NIF`,1)) < 58,`p`.`Codigo`,''),`Proveedores`.`NIF`) AS `NIF`,`Proveedores`.`Domicilio` AS `Domicilio`,`Proveedores`.`Localidad` AS `Localidad`,`prov`.`name` AS `Provincia`,`Proveedores`.`codpos` AS `CP`,`p`.`Codigo` AS `country_code`,`sub`.`empresa_id` AS `empresa_id`,substr(`c`.`email`,1,coalesce(nullif(locate(',',`c`.`email`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0,1,if(`p`.`CEE` = 1,2,4)) AS `IDNIF` from ((((`vn2008`.`Proveedores` join (select `recibida`.`proveedor_id` AS `proveedor_id`,`recibida`.`empresa_id` AS `empresa_id` from `vn2008`.`recibida` where `recibida`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `recibida`.`proveedor_id`,`recibida`.`empresa_id` union all select `pago`.`id_proveedor` AS `id_proveedor`,`pago`.`empresa_id` AS `empresa_id` from `vn2008`.`pago` where `pago`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `pago`.`id_proveedor`,`pago`.`empresa_id`) `sub` on(`Proveedores`.`Id_Proveedor` = `sub`.`proveedor_id`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Proveedores`.`pais_id`)) left join `vn2008`.`province` `prov` on(`prov`.`province_id` = `Proveedores`.`province_id`)) left join `vn`.`supplierContact` `c` on(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`)) where `Proveedores`.`oficial` <> 0 group by `sub`.`proveedor_id`,`sub`.`empresa_id` union all select `Gastos`.`Id_Gasto` collate utf8mb3_unicode_ci AS `Id_Gasto`,`Gastos`.`Gasto` collate utf8mb3_unicode_ci AS `Gasto`,NULL AS `NULL`,NULL AS `My_exp_NULL`,NULL AS `My_exp_1_NULL`,NULL AS `My_exp_2_NULL`,NULL AS `My_exp_3_NULL`,NULL AS `country_code`,`e`.`id` AS `id`,NULL AS `EMAIL`,1 AS `IDNIF` from (`vn2008`.`Gastos` join `vn2008`.`empresa` `e` on(`e`.`id` = 442)) union all select `Bancos`.`Cuenta` AS `Cuenta`,`Bancos`.`Banco` AS `Banco`,NULL AS `NULL`,NULL AS `My_exp_NULL`,NULL AS `My_exp_1_NULL`,NULL AS `My_exp_2_NULL`,NULL AS `My_exp_3_NULL`,NULL AS `country_code`,`e`.`id` AS `id`,NULL AS `EMAIL`,1 AS `IDNIF` from (`vn2008`.`Bancos` join `vn2008`.`empresa` `e` on(`e`.`id` = 442)) union all select lpad(right(`Proveedores`.`cuenta`,5),10,'47510000') AS `Cuenta`,`Proveedores`.`Proveedor` AS `Proveedor`,`Proveedores`.`NIF` AS `NIF`,`Proveedores`.`Domicilio` AS `Domicilio`,`Proveedores`.`Localidad` AS `Localidad`,`prov`.`name` AS `Provincia`,`Proveedores`.`codpos` AS `CP`,`p`.`Codigo` AS `country_code`,`sub`.`empresa_id` AS `empresa_id`,substr(`c`.`email`,1,coalesce(nullif(locate(',',`c`.`email`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0,1,if(`p`.`CEE` = 1,2,4)) AS `IDNIF` from ((((`vn2008`.`Proveedores` join (select `recibida`.`proveedor_id` AS `proveedor_id`,`recibida`.`empresa_id` AS `empresa_id` from `vn2008`.`recibida` where `recibida`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `recibida`.`proveedor_id`,`recibida`.`empresa_id` union all select `pago`.`id_proveedor` AS `id_proveedor`,`pago`.`empresa_id` AS `empresa_id` from `vn2008`.`pago` where `pago`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `pago`.`id_proveedor`,`pago`.`empresa_id`) `sub` on(`Proveedores`.`Id_Proveedor` = `sub`.`proveedor_id`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Proveedores`.`pais_id`)) left join `vn2008`.`province` `prov` on(`prov`.`province_id` = `Proveedores`.`province_id`)) left join `vn`.`supplierContact` `c` on(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`)) where (`Proveedores`.`cuenta` like '_____3____' or `Proveedores`.`cuenta` like '_____2____') and `Proveedores`.`oficial` = 1 group by `sub`.`proveedor_id`,`sub`.`empresa_id` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
@@ -95135,60 +93282,6 @@ USE `vn2008`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `vnCreditClassification`
---
-
-/*!50001 DROP VIEW IF EXISTS `vnCreditClassification`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `vnCreditClassification` AS select `vn`.`creditClassification`.`id` AS `id`,`vn`.`creditClassification`.`client` AS `client`,`vn`.`creditClassification`.`dateStart` AS `dateStart`,`vn`.`creditClassification`.`dateEnd` AS `dateEnd` from `vn`.`creditClassification` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `vnCreditInsurance`
---
-
-/*!50001 DROP VIEW IF EXISTS `vnCreditInsurance`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `vnCreditInsurance` AS select `vn`.`creditInsurance`.`id` AS `id`,`vn`.`creditInsurance`.`creditClassification` AS `creditClassification`,`vn`.`creditInsurance`.`credit` AS `credit`,`vn`.`creditInsurance`.`creationDate` AS `creationDate`,`vn`.`creditInsurance`.`grade` AS `grade` from `vn`.`creditInsurance` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `vnSolunionCAP`
---
-
-/*!50001 DROP VIEW IF EXISTS `vnSolunionCAP`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `vnSolunionCAP` AS select `vn`.`solunionCAP`.`creditInsurance` AS `creditInsurance`,`vn`.`solunionCAP`.`dateStart` AS `dateStart`,`vn`.`solunionCAP`.`dateEnd` AS `dateEnd`,`vn`.`solunionCAP`.`dateLeaving` AS `dateLeaving` from `vn`.`solunionCAP` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
--
-- Final view structure for view `warehouse`
--
@@ -95207,42 +93300,6 @@ USE `vn2008`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `warehouse_alias`
---
-
-/*!50001 DROP VIEW IF EXISTS `warehouse_alias`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `warehouse_alias` AS select `wa`.`id` AS `warehouse_alias_id`,`wa`.`name` AS `alias` from `vn`.`warehouseAlias` `wa` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `workcenter_holiday`
---
-
-/*!50001 DROP VIEW IF EXISTS `workcenter_holiday`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `workcenter_holiday` AS select `wh`.`workCenterFk` AS `workcenter_id`,`wh`.`days` AS `day`,`wh`.`year` AS `year` from `vn`.`workCenterHoliday` `wh` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
-
--
-- Final view structure for view `workerDocument`
--
@@ -95278,24 +93335,6 @@ USE `vn2008`;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
-
---
--- Final view structure for view `zoneNickname`
---
-
-/*!50001 DROP VIEW IF EXISTS `zoneNickname`*/;
-/*!50001 SET @saved_cs_client = @@character_set_client */;
-/*!50001 SET @saved_cs_results = @@character_set_results */;
-/*!50001 SET @saved_col_connection = @@collation_connection */;
-/*!50001 SET character_set_client = utf8mb4 */;
-/*!50001 SET character_set_results = utf8mb4 */;
-/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
-/*!50001 CREATE ALGORITHM=UNDEFINED */
-/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `zoneNickname` AS select `ap`.`warehouse_id` AS `warehouse_id`,`ap`.`agency_id` AS `agency_id`,`ap`.`zona` AS `zona`,concat('ZONA ',`ap`.`zona`,' ',if(`ap`.`zona` = 20,'Madrid',`p`.`name`)) AS `alias` from (`vn2008`.`Agencias_province` `ap` join `vn2008`.`province` `p` on(`p`.`province_id` = `ap`.`province_id`)) group by `ap`.`zona`,`ap`.`warehouse_id`,`ap`.`agency_id` */;
-/*!50001 SET character_set_client = @saved_cs_client */;
-/*!50001 SET character_set_results = @saved_cs_results */;
-/*!50001 SET collation_connection = @saved_col_connection */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -95306,4 +93345,4 @@ USE `vn2008`;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2024-01-25 16:24:11
+-- Dump completed on 2024-02-15 10:21:18
diff --git a/db/dump/.dump/triggers.sql b/db/dump/.dump/triggers.sql
index f68b463d2..2da83db43 100644
--- a/db/dump/.dump/triggers.sql
+++ b/db/dump/.dump/triggers.sql
@@ -1,4 +1,4 @@
--- MariaDB dump 10.19 Distrib 10.5.21-MariaDB, for debian-linux-gnu (x86_64)
+-- MariaDB dump 10.19 Distrib 10.5.23-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: db.verdnatura.es Database: account
-- ------------------------------------------------------
@@ -517,7 +517,7 @@ USE `bs`;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `bs`.`clientNewBorn_BEFORE_UPDATE`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `bs`.`clientNewBorn_beforeUpdate`
BEFORE UPDATE ON `clientNewBorn`
FOR EACH ROW
BEGIN
@@ -540,7 +540,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `bs`.`nightTaskBeforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `bs`.`nightTask_beforeInsert`
BEFORE INSERT ON `nightTask`
FOR EACH ROW
BEGIN
@@ -566,7 +566,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `bs`.`nightTaskBeforeUpdate`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `bs`.`nightTask_beforeUpdate`
BEFORE UPDATE ON `nightTask`
FOR EACH ROW
BEGIN
@@ -610,7 +610,7 @@ USE `edi`;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`item_feature_bi`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`item_feature_beforeInsert`
BEFORE INSERT ON `item_feature`
FOR EACH ROW
BEGIN
@@ -632,7 +632,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`putOrder_BEFORE_INSERT`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`putOrder_beforeInsert`
BEFORE INSERT ON `putOrder`
FOR EACH ROW
BEGIN
@@ -658,7 +658,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`BEFORE UPDATE`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`putOrder_beforeUpdate`
BEFORE UPDATE ON `putOrder`
FOR EACH ROW
BEGIN
@@ -708,7 +708,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`putOrder_AFTER_UPDATE`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`putOrder_afterUpdate`
AFTER UPDATE ON `putOrder`
FOR EACH ROW
BEGIN
@@ -795,7 +795,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`supplyResponse_AFTER_UPDATE`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`supplyResponse_afterUpdate`
AFTER UPDATE ON `supplyResponse`
FOR EACH ROW
BEGIN
@@ -1412,7 +1412,7 @@ USE `sage`;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `sage`.`movConta_BEFORE_UPDATE`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `sage`.`movConta_beforeUpdate`
BEFORE UPDATE ON `movConta`
FOR EACH ROW
BEGIN
@@ -1446,7 +1446,7 @@ USE `srt`;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `srt`.`expedition_BU`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `srt`.`expedition_beforeUpdate`
BEFORE UPDATE ON `expedition`
FOR EACH ROW
BEGIN
@@ -1464,11 +1464,11 @@ DELIMITER ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `srt`.`moving_AI`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `srt`.`moving_afterInsert`
AFTER INSERT ON `moving`
FOR EACH ROW
BEGIN
@@ -1924,7 +1924,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_BI`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_beforeInsert`
BEFORE INSERT ON `autonomy`
FOR EACH ROW
BEGIN
@@ -1946,7 +1946,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_BU`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_beforeUpdate`
BEFORE UPDATE ON `autonomy`
FOR EACH ROW
BEGIN
@@ -1974,7 +1974,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_AD`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_afterDelete`
AFTER DELETE ON `autonomy`
FOR EACH ROW
BEGIN
@@ -1994,7 +1994,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`awb_bi`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`awb_beforeInsert`
BEFORE INSERT ON `awb`
FOR EACH ROW
BEGIN
@@ -2059,7 +2059,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`budgetNotes_BeforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`budgetNotes_beforeInsert`
BEFORE INSERT ON `budgetNotes`
FOR EACH ROW
BEGIN
@@ -2551,6 +2551,70 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`calendar_beforeInsert`
+ BEFORE INSERT ON `calendar`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`calendar_beforeUpdate`
+ BEFORE UPDATE ON `calendar`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`calendar_afterDelete`
+ AFTER DELETE ON `calendar`
+ FOR EACH ROW
+BEGIN
+ INSERT INTO workerLog
+ SET `action` = 'delete',
+ `changedModel` = 'Calendar',
+ `changedModelId` = OLD.id,
+ `userFk` = account.myUser_getId();
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claim_beforeInsert`
BEFORE INSERT ON `claim`
FOR EACH ROW
@@ -3026,13 +3090,13 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`client_AfterInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`client_afterInsert`
AFTER INSERT ON `client`
FOR EACH ROW
BEGIN
@@ -3246,15 +3310,15 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER clientCredit_AfterInsert
-AFTER INSERT
-ON clientCredit FOR EACH ROW
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientCredit_afterInsert`
+ AFTER INSERT ON `clientCredit`
+ FOR EACH ROW
BEGIN
DECLARE vSender VARCHAR(50);
@@ -3501,39 +3565,39 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`collection_BEFORE_UPDATE`
- BEFORE UPDATE ON `collection`
- FOR EACH ROW
-BEGIN
-
- DECLARE vStateFk INT;
- DECLARE vTotalLines INT;
- DECLARE vPickedLines INT;
-
- IF NEW.saleTotalCount <= NEW.salePickedCount
- AND (NEW.saleTotalCount != OLD.saleTotalCount
- OR NEW.salePickedCount != OLD.salePickedCount)
- THEN
-
- SELECT id INTO vStateFk
- FROM vn.state
- WHERE code = 'PREPARED';
-
- SET NEW.stateFk = vStateFk;
-
- END IF;
-
- IF NEW.saleTotalCount > NEW.salePickedCount
- AND (NEW.saleTotalCount != OLD.saleTotalCount OR NEW.salePickedCount != OLD.salePickedCount) THEN
-
- SELECT id INTO vStateFk
- FROM vn.state
- WHERE code = 'ON_PREPARATION';
-
- SET NEW.stateFk = vStateFk;
-
- END IF;
-
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`collection_beforeUpdate`
+ BEFORE UPDATE ON `collection`
+ FOR EACH ROW
+BEGIN
+
+ DECLARE vStateFk INT;
+ DECLARE vTotalLines INT;
+ DECLARE vPickedLines INT;
+
+ IF NEW.saleTotalCount <= NEW.salePickedCount
+ AND (NEW.saleTotalCount != OLD.saleTotalCount
+ OR NEW.salePickedCount != OLD.salePickedCount)
+ THEN
+
+ SELECT id INTO vStateFk
+ FROM vn.state
+ WHERE code = 'PREPARED';
+
+ SET NEW.stateFk = vStateFk;
+
+ END IF;
+
+ IF NEW.saleTotalCount > NEW.salePickedCount
+ AND (NEW.saleTotalCount != OLD.saleTotalCount OR NEW.salePickedCount != OLD.salePickedCount) THEN
+
+ SELECT id INTO vStateFk
+ FROM vn.state
+ WHERE code = 'ON_PREPARATION';
+
+ SET NEW.stateFk = vStateFk;
+
+ END IF;
+
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -3743,7 +3807,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`country_AFTER_INSERT`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`country_afterInsert`
AFTER INSERT ON `country`
FOR EACH ROW
BEGIN
@@ -4414,7 +4478,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`duaTax_BEFORE_INSERT`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`duaTax_beforeInsert`
BEFORE INSERT ON `duaTax`
FOR EACH ROW
BEGIN
@@ -4435,7 +4499,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`duaTax_BEFORE_UPDATE`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`duaTax_beforeUpdate`
BEFORE UPDATE ON `duaTax`
FOR EACH ROW
BEGIN
@@ -4858,7 +4922,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionPallet_BEFORE_INSERT`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionPallet_beforeInsert`
BEFORE INSERT ON `expeditionPallet`
FOR EACH ROW
BEGIN
@@ -4886,7 +4950,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionScan_BEFORE_INSERT`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionScan_beforeInsert`
BEFORE INSERT ON `expeditionScan`
FOR EACH ROW
BEGIN
@@ -4908,7 +4972,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionState_BeforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionState_beforeInsert`
BEFORE INSERT ON `expeditionState`
FOR EACH ROW
BEGIN
@@ -4922,15 +4986,15 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER expeditionState_AfterInsert
-AFTER INSERT
-ON expeditionState FOR EACH ROW
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionState_afterInsert`
+ AFTER INSERT ON `expeditionState`
+ FOR EACH ROW
BEGIN
UPDATE vn.expedition e
@@ -4952,7 +5016,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionTruck_BEFORE_INSERT`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionTruck_beforeInsert`
BEFORE INSERT ON `expeditionTruck`
FOR EACH ROW
BEGIN
@@ -4974,7 +5038,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionTruck_BEFORE_UPDATE`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionTruck_beforeUpdate`
BEFORE UPDATE ON `expeditionTruck`
FOR EACH ROW
BEGIN
@@ -4996,7 +5060,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`floramondoConfig_AFTER_INSERT`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`floramondoConfig_afterInsert`
AFTER INSERT ON `floramondoConfig`
FOR EACH ROW
BEGIN
@@ -5122,7 +5186,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_bi`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_beforeInsert`
BEFORE INSERT ON `invoiceIn`
FOR EACH ROW
BEGIN
@@ -5186,7 +5250,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_bu`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_beforeUpdate`
BEFORE UPDATE ON `invoiceIn`
FOR EACH ROW
BEGIN
@@ -5227,7 +5291,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_au`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_afterUpdate`
AFTER UPDATE ON `invoiceIn`
FOR EACH ROW
BEGIN
@@ -5664,15 +5728,7 @@ BEGIN
DECLARE vNewPackingShelve INT;
SET NEW.editorFk = account.myUser_getId();
-
- IF ISNULL(NEW.packingShelve) AND NOT ISNULL(NEW.packingOut) THEN
- SELECT NEW.packingOut * vc.shelveVolume / vc.standardFlowerBox
- INTO vNewPackingShelve
- FROM vn.volumeConfig vc;
-
- SET NEW.packingShelve = vNewPackingShelve;
- END IF;
-
+
IF NEW.itemPackingTypeFk = '' THEN
SET NEW.itemPackingTypeFk = NULL;
END IF;
@@ -5867,7 +5923,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemCategory_AFTER_INSERT`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemCategory_afterInsert`
AFTER INSERT ON `itemCategory`
FOR EACH ROW
BEGIN
@@ -5955,7 +6011,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_BEFORE_INSERT`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_beforeInsert`
BEFORE INSERT ON `itemShelving`
FOR EACH ROW
BEGIN
@@ -5977,7 +6033,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_AFTER_INSERT`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_afterInsert`
AFTER INSERT ON `itemShelving`
FOR EACH ROW
INSERT INTO vn.itemShelvingLog( itemShelvingFk,
@@ -6011,7 +6067,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_BEFORE_UPDATE`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_beforeUpdate`
BEFORE UPDATE ON `itemShelving`
FOR EACH ROW
BEGIN
@@ -6034,11 +6090,10 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_AFTER_UPDATE`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_afterUpdate`
AFTER UPDATE ON `itemShelving`
FOR EACH ROW
-
- INSERT INTO itemShelvingLog
+INSERT INTO itemShelvingLog
SET itemShelvingFk = NEW.id,
workerFk = account.myUser_getId(),
accion = 'CAMBIO',
@@ -6061,7 +6116,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_BEFORE_DELETE`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_beforeDelete`
BEFORE DELETE ON `itemShelving`
FOR EACH ROW
INSERT INTO vn.itemShelvingLog(itemShelvingFk,
@@ -6106,13 +6161,13 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb3 */ ;
-/*!50003 SET character_set_results = utf8mb3 */ ;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelvingSale_AFTER_INSERT`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelvingSale_afterInsert`
AFTER INSERT ON `itemShelvingSale`
FOR EACH ROW
BEGIN
@@ -6366,7 +6421,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`machine_BI`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`machine_beforeInsert`
BEFORE INSERT ON `machine`
FOR EACH ROW
BEGIN
@@ -6584,7 +6639,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_BEFORE_INSERT`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_beforeInsert`
BEFORE INSERT ON `parking`
FOR EACH ROW
BEGIN
@@ -6606,7 +6661,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_BEFORE_UPDATE`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_beforeUpdate`
BEFORE UPDATE ON `parking`
FOR EACH ROW
BEGIN
@@ -6935,13 +6990,13 @@ DELIMITER ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER projectNotes_BeforeInsert
-BEFORE INSERT
-ON projectNotes FOR EACH ROW
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`projectNotes_beforeInsert`
+ BEFORE INSERT ON `projectNotes`
+ FOR EACH ROW
BEGIN
IF ISNULL(NEW.userFk) THEN
@@ -7742,7 +7797,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_BEFORE_DELETE`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_beforeDelete`
BEFORE DELETE ON `sale`
FOR EACH ROW
BEGIN
@@ -7832,7 +7887,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`BEFORE_INSERT`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleBuy_beforeInsert`
BEFORE INSERT ON `saleBuy`
FOR EACH ROW
BEGIN
@@ -7854,31 +7909,6 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleBuy_AI`
- AFTER INSERT ON `saleBuy`
- FOR EACH ROW
-BEGIN
-/* Activar de nuevo cuando volvamos a vender fruta y verdura
- *
- UPDATE vn.sale s
- SET s.concept = CONCAT(s.concept, ' Lote: ', NEW.buyFk)
- WHERE s.id = NEW.saleFk;
-*/
-END */;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleGroup_beforeInsert`
BEFORE INSERT ON `saleGroup`
FOR EACH ROW
@@ -7943,7 +7973,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleTracking_After_Insert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleTracking_afterInsert`
AFTER INSERT ON `saleTracking`
FOR EACH ROW
BEGIN
@@ -8122,7 +8152,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`shelving_BEFORE_UPDATE`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`shelving_beforeUpdate`
BEFORE UPDATE ON `shelving`
FOR EACH ROW
BEGIN
@@ -8174,7 +8204,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_AFTER_INSERT`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_afterInsert`
AFTER INSERT ON `solunionCAP`
FOR EACH ROW
BEGIN
@@ -8197,7 +8227,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_AFTER_UPDATE`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_afterUpdate`
AFTER UPDATE ON `solunionCAP`
FOR EACH ROW
BEGIN
@@ -8227,7 +8257,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_BEFORE_DELETE`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_beforeDelete`
BEFORE DELETE ON `solunionCAP`
FOR EACH ROW
BEGIN
@@ -8250,7 +8280,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`specie_BEFORE_INSERT`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`specie_beforeInsert`
BEFORE INSERT ON `specie`
FOR EACH ROW
BEGIN
@@ -8270,7 +8300,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`specie_BEFORE_UPDATE`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`specie_beforeUpdate`
BEFORE UPDATE ON `specie`
FOR EACH ROW
BEGIN
@@ -8582,7 +8612,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`tag_BEFORE_INSERT`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`tag_beforeInsert`
BEFORE INSERT ON `tag`
FOR EACH ROW
BEGIN
@@ -9051,7 +9081,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketPackaging_BEFORE_INSERT`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketPackaging_beforeInsert`
BEFORE INSERT ON `ticketPackaging`
FOR EACH ROW
BEGIN
@@ -9117,7 +9147,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketParking_BEFORE_INSERT`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketParking_beforeInsert`
BEFORE INSERT ON `ticketParking`
FOR EACH ROW
BEGIN
@@ -9313,7 +9343,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_ai`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_afterInsert`
AFTER INSERT ON `ticketService`
FOR EACH ROW
BEGIN
@@ -9355,7 +9385,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_au`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_afterUpdate`
AFTER UPDATE ON `ticketService`
FOR EACH ROW
BEGIN
@@ -9380,7 +9410,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_ad`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_afterDelete`
AFTER DELETE ON `ticketService`
FOR EACH ROW
BEGIN
@@ -9450,7 +9480,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketTracking_beforeUpdate`
BEFORE UPDATE ON `ticketTracking`
@@ -9632,7 +9662,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`time_AFTER_UPDATE`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`time_afterUpdate`
AFTER UPDATE ON `time`
FOR EACH ROW
BEGIN
@@ -10203,13 +10233,11 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_AI`
- AFTER INSERT ON `workerTimeControl`
- FOR EACH ROW
-BEGIN
- IF NEW.timed > DATE_ADD(util.VN_NOW(), INTERVAL 1 DAY) THEN
- CALL util.throw('date in the future');
- END IF;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_beforeInsert`
+ BEFORE INSERT ON `workerTimeControl`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -10225,7 +10253,73 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workingHoursBeforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_afterInsert`
+ AFTER INSERT ON `workerTimeControl`
+ FOR EACH ROW
+BEGIN
+ IF NEW.timed > (util.VN_NOW() + INTERVAL 1 DAY) THEN
+ CALL util.throw('date in the future');
+ END IF;
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_beforeUpdate`
+ BEFORE UPDATE ON `workerTimeControl`
+ FOR EACH ROW
+BEGIN
+ SET NEW.editorFk = account.myUser_getId();
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_afterDelete`
+ AFTER DELETE ON `workerTimeControl`
+ FOR EACH ROW
+BEGIN
+ INSERT INTO workerLog
+ SET `action` = 'delete',
+ `changedModel` = 'WorkerTimeControl',
+ `changedModelId` = OLD.id,
+ `userFk` = account.myUser_getId();
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workingHours_beforeInsert`
BEFORE INSERT ON `workingHours`
FOR EACH ROW
BEGIN
@@ -10375,7 +10469,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_BI`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_beforeInsert`
BEFORE INSERT ON `zoneExclusion`
FOR EACH ROW
BEGIN
@@ -10397,7 +10491,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_BU`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_beforeUpdate`
BEFORE UPDATE ON `zoneExclusion`
FOR EACH ROW
BEGIN
@@ -10619,7 +10713,7 @@ USE `vn2008`;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`Conteo_ai`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`Conteo_afterInsert`
AFTER INSERT ON `Conteo`
FOR EACH ROW
BEGIN
@@ -10645,7 +10739,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`account_conciliacion_BEFORE_INSERT`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`account_conciliacion_beforeInsert`
BEFORE INSERT ON `account_conciliacion`
FOR EACH ROW
set new.id_calculated = replace(
@@ -10671,7 +10765,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`agency_hourBeforeInsert`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`agency_hour_beforeInsert`
BEFORE INSERT ON `agency_hour`
FOR EACH ROW
BEGIN
@@ -10704,7 +10798,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`agency_hour_AFTER_UPDATE`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`agency_hour_afterUpdate`
AFTER UPDATE ON `agency_hour`
FOR EACH ROW
BEGIN
@@ -10734,7 +10828,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`awb_recibida_ad`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`awb_recibida_afterDelete`
AFTER DELETE ON `awb_recibida`
FOR EACH ROW
IF (SELECT COUNT(*) FROM recibida_iva where recibida_id = OLD.recibida_id) = 0
@@ -10759,10 +10853,9 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`movement_label_au`
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`movement_label_afterUpdate`
AFTER UPDATE ON `movement_label`
FOR EACH ROW
--- Edit trigger body code below this line. Do not edit lines above this one
IF NEW.stem >= (SELECT Cantidad FROM Movimientos WHERE Id_Movimiento = NEW.Id_Movimiento) THEN
UPDATE Movimientos SET OK = 1 WHERE Id_Movimiento = NEW.Id_Movimiento;
END IF */;;
@@ -10777,4 +10870,4 @@ DELIMITER ;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2024-01-25 16:24:46
+-- Dump completed on 2024-02-15 10:21:45
diff --git a/db/routines/bi/procedures/Greuge_Evolution_Add.sql b/db/routines/bi/procedures/Greuge_Evolution_Add.sql
index 83033cbf8..1d4bf4355 100644
--- a/db/routines/bi/procedures/Greuge_Evolution_Add.sql
+++ b/db/routines/bi/procedures/Greuge_Evolution_Add.sql
@@ -42,9 +42,9 @@ BEGIN
CREATE TEMPORARY TABLE maxInvoice
(PRIMARY KEY (Id_Cliente))
ENGINE = MEMORY
- SELECT DISTINCT Id_Cliente, max(Fecha) as maxFecha
- FROM vn2008.Facturas
- GROUP BY Id_Cliente
+ SELECT DISTINCT clientFk Id_Cliente, max(issued) as maxFecha
+ FROM vn.invoiceOut
+ GROUP BY clientFk
HAVING maxFecha < timestampadd(month,-2,datFEC);
WHILE datFEC < util.VN_CURDATE() DO
@@ -53,10 +53,10 @@ BEGIN
SELECT Id_Cliente, datFEC as Fecha, Greuge, Ventas, 0
FROM (
- SELECT Id_Cliente, sum(Importe) as Greuge
- FROM vn2008.Greuges
- where Fecha <= datFEC
- group by Id_Cliente
+ SELECT clientFk Id_Cliente, sum(amount) as Greuge
+ FROM vn.greuge
+ where shipped <= datFEC
+ group by clientFk
) sub
RIGHT JOIN
diff --git a/db/routines/bi/procedures/analisis_ventas_update.sql b/db/routines/bi/procedures/analisis_ventas_update.sql
index 4f6a448ed..6d357275a 100644
--- a/db/routines/bi/procedures/analisis_ventas_update.sql
+++ b/db/routines/bi/procedures/analisis_ventas_update.sql
@@ -1,5 +1,5 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`analisis_ventas_update`()
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`analisis_ventas_update`()
BEGIN
DECLARE vLastMonth DATE;
@@ -49,5 +49,5 @@ BEGIN
LEFT JOIN vn2008.province p ON p.province_id = cs.province_id
LEFT JOIN vn.warehouse w ON w.id = t.warehouse_id
WHERE bt.fecha >= vLastMonth AND r.mercancia;
-END$$
-DELIMITER ;
+END$$
+DELIMITER ;
diff --git a/db/routines/bi/procedures/claim_ratio_routine.sql b/db/routines/bi/procedures/claim_ratio_routine.sql
index e5a5310b4..10cb717cf 100644
--- a/db/routines/bi/procedures/claim_ratio_routine.sql
+++ b/db/routines/bi/procedures/claim_ratio_routine.sql
@@ -11,8 +11,8 @@ BEGIN
-- Reclamaciones demasiado sensibles
- INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario,
- Importe, Greuges_type_id,Id_Ticket)
+ INSERT INTO vn.greuge(shipped, clientFk, description,
+ amount, greugeTypeFk, ticketFk)
SELECT cm.Fecha
, cm.Id_Cliente
, concat('Claim ',cm.id,' : ', m.Concepte)
@@ -29,8 +29,8 @@ BEGIN
-- Reclamaciones que pasan a Maná
- INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario,
- Importe , Greuges_type_id,Id_Ticket)
+ INSERT INTO vn.greuge(shipped, clientFk, description,
+ amount, greugeTypeFk, ticketFk)
SELECT cm.Fecha
, cm.Id_Cliente
, concat('Claim_mana ',cm.id,' : ', m.Concepte)
@@ -73,12 +73,12 @@ BEGIN
AND s.alert_level >= 3;
DELETE g.*
- FROM vn2008.Greuges g
- JOIN tmp.ticket_list t ON g.Id_Ticket = t.Id_Ticket
- WHERE Greuges_type_id = 2;
+ FROM vn.greuge g
+ JOIN tmp.ticket_list t ON g.ticketFk = t.Id_Ticket
+ WHERE g.greugeTypeFk = 2;
- INSERT INTO vn2008.Greuges (Id_Cliente,Comentario,Importe,Fecha,
- Greuges_type_id, Id_Ticket)
+ INSERT INTO vn.greuge(clientFk, description, amount,shipped,
+ greugeTypeFk, ticketFk)
SELECT Id_Cliente
,concat('recobro ', m.Id_Ticket), - round(SUM(mc.Valor*Cantidad),2)
AS dif
@@ -130,10 +130,10 @@ BEGIN
-- Calculamos el porcentaje del recobro para añadirlo al precio de venta
UPDATE bi.claims_ratio cr
JOIN (
- SELECT Id_Cliente, IFNULL(SUM(Importe), 0) AS Greuge
- FROM vn2008.Greuges
- WHERE Fecha <= util.VN_CURDATE()
- GROUP BY Id_Cliente
+ SELECT clientFk Id_Cliente, IFNULL(SUM(amount), 0) AS Greuge
+ FROM vn.greuge
+ WHERE shipped <= util.VN_CURDATE()
+ GROUP BY clientFk
) g ON g.Id_Cliente = cr.Id_Cliente
SET recobro = GREATEST(0,round(IFNULL(Greuge, 0) /
(IFNULL(Consumo, 0) * vMonthToRefund / 12 ) ,3));
diff --git a/db/routines/bi/procedures/defaulting.sql b/db/routines/bi/procedures/defaulting.sql
index 50600e554..e8ba5e682 100644
--- a/db/routines/bi/procedures/defaulting.sql
+++ b/db/routines/bi/procedures/defaulting.sql
@@ -14,8 +14,8 @@ BEGIN
WHERE hasChanged AND date = vDate;
DECLARE invoices CURSOR FOR
- SELECT Vencimiento, importe FROM vn2008.Facturas f
- WHERE f.Fecha >= '2016-01-01' AND f.Id_Cliente = vClient ORDER BY f.Fecha DESC;
+ SELECT dued Vencimiento, amount importe FROM vn.invoiceOut
+ WHERE issued >= '2016-01-01' AND clientFk = vClient ORDER BY issued DESC;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
diff --git a/db/routines/bi/procedures/greuge_dif_porte_add.sql b/db/routines/bi/procedures/greuge_dif_porte_add.sql
index c81e41661..02bd9eae4 100644
--- a/db/routines/bi/procedures/greuge_dif_porte_add.sql
+++ b/db/routines/bi/procedures/greuge_dif_porte_add.sql
@@ -19,8 +19,8 @@ BEGIN
FROM
vn.ticket t
JOIN vn2008.Clientes cli ON cli.Id_cliente = t.clientFk
- LEFT JOIN vn2008.expeditions e ON e.ticket_id = t.id
- JOIN vn.expeditionBoxVol ebv ON ebv.boxFk = e.EsBulto
+ LEFT JOIN vn.expedition e ON e.ticketFk = t.id
+ JOIN vn.expeditionBoxVol ebv ON ebv.boxFk = e.freightItemFk
JOIN vn.zone z ON t.zoneFk = z.id
WHERE
t.shipped between datSTART AND datEND
@@ -64,17 +64,17 @@ BEGIN
CREATE TEMPORARY TABLE tmp.dp_aux
(PRIMARY KEY (ticketFk))
ENGINE = MEMORY
- SELECT dp.ticketFk, sum(Importe) Importe
+ SELECT dp.ticketFk, sum(g.amount) Importe
FROM tmp.dp
- JOIN vn2008.Greuges g ON g.Id_Ticket = dp.ticketFk
- WHERE Greuges_type_id = 1 -- dif_porte
+ JOIN vn.greuge g ON g.ticketFk = dp.ticketFk
+ WHERE g.greugeTypeFk = 1 -- dif_porte
GROUP BY dp.ticketFk;
UPDATE tmp.dp
JOIN tmp.dp_aux USING(ticketFk)
SET greuge = IFNULL(Importe,0);
- INSERT INTO vn2008.Greuges (Id_Cliente,Comentario,Importe,Fecha, Greuges_type_id, Id_Ticket)
+ INSERT INTO vn.greuge (clientFk,description,amount,shipped,greugeTypeFk,ticketFk)
SELECT dp.clientFk
, concat('dif_porte ', dp.ticketFk)
, round(IFNULL(dp.teorico,0) - IFNULL(dp.practico,0) - IFNULL(dp.greuge,0),2) as Importe
diff --git a/db/routines/bs/procedures/comercialesCompleto.sql b/db/routines/bs/procedures/comercialesCompleto.sql
index 2b8019175..101173740 100644
--- a/db/routines/bs/procedures/comercialesCompleto.sql
+++ b/db/routines/bs/procedures/comercialesCompleto.sql
@@ -37,9 +37,9 @@ BEGIN
FROM
vn2008.Clientes c
LEFT JOIN
- (SELECT g.Id_Cliente, CAST( SUM(Importe) as DECIMAL(12,2)) AS Greuge
- FROM vn2008.Greuges g
- JOIN vn.`client` c ON c.id = g.Id_Cliente
+ (SELECT g.clientFk Id_Cliente, CAST( SUM(g.amount) as DECIMAL(12,2)) AS Greuge
+ FROM vn.greuge g
+ JOIN vn.`client` c ON c.id = g.clientFk
LEFT JOIN vn.worker w ON c.salesPersonFk = w.id
WHERE (c.salesPersonFk = vWorker OR w.bossFk = vWorker)
GROUP BY Id_Cliente
@@ -98,9 +98,9 @@ BEGIN
GROUP BY c.Id_Cliente) CmLy ON CmLy.Id_Cliente = c.Id_Cliente
LEFT JOIN
(SELECT c.Id_Cliente,
- IF(MAX(Fecha) < DATE_FORMAT(TIMESTAMPADD(MONTH, - 1, vDate), '%Y- %m-01'), TRUE, FALSE) muerto
- FROM vn2008.Facturas f
- JOIN vn2008.Clientes c ON c.Id_cliente = f.Id_Cliente
+ IF(MAX(io.issued) < DATE_FORMAT(TIMESTAMPADD(MONTH, - 1, vDate), '%Y- %m-01'), TRUE, FALSE) muerto
+ FROM vn.invoiceOut io
+ JOIN vn2008.Clientes c ON c.Id_cliente = io.clientFk
LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador
WHERE (c.Id_Trabajador = vWorker OR tr.boss = vWorker)
GROUP BY Id_Cliente) dead ON dead.Id_Cliente = c.Id_Cliente
diff --git a/db/routines/bs/procedures/manaCustomerUpdate.sql b/db/routines/bs/procedures/manaCustomerUpdate.sql
index 1e9cb8429..2cb25d135 100644
--- a/db/routines/bs/procedures/manaCustomerUpdate.sql
+++ b/db/routines/bs/procedures/manaCustomerUpdate.sql
@@ -82,11 +82,11 @@ BEGIN
AND Fechacobro > vFromDated
AND Fechacobro <= vToDated
UNION ALL
- SELECT g.Id_Cliente, g.Importe
- FROM vn2008.Greuges g
- WHERE Greuges_type_id = vManaGreugeTypeId
- AND Fecha > vFromDated
- AND Fecha <= vToDated
+ SELECT clientFk, amount
+ FROM vn.greuge
+ WHERE greugeTypeFk = vManaGreugeTypeId
+ AND shipped > vFromDated
+ AND shipped <= vToDated
UNION ALL
SELECT clientFk, mana
FROM vn.clientManaCache
diff --git a/db/routines/bs/procedures/ventas_contables_add.sql b/db/routines/bs/procedures/ventas_contables_add.sql
index d8e963e3e..9988c8b29 100644
--- a/db/routines/bs/procedures/ventas_contables_add.sql
+++ b/db/routines/bs/procedures/ventas_contables_add.sql
@@ -23,9 +23,9 @@ BEGIN
ENGINE = MEMORY
SELECT Id_Ticket
FROM vn2008.Tickets t
- JOIN vn2008.Facturas f ON f.Id_Factura = t.Factura
- WHERE year(f.Fecha) = vYear
- AND month(f.Fecha) = vMonth;
+ JOIN vn.invoiceOut io ON io.id = t.Factura
+ WHERE year(io.issued) = vYear
+ AND month(io.issued) = vMonth;
INSERT INTO bs.ventas_contables(year
, month
diff --git a/db/routines/bs/procedures/ventas_contables_por_cliente.sql b/db/routines/bs/procedures/ventas_contables_por_cliente.sql
index 9f1399025..931653e6e 100644
--- a/db/routines/bs/procedures/ventas_contables_por_cliente.sql
+++ b/db/routines/bs/procedures/ventas_contables_por_cliente.sql
@@ -13,9 +13,9 @@ BEGIN
(PRIMARY KEY (Id_Ticket))
SELECT Id_Ticket
FROM vn2008.Tickets t
- JOIN vn2008.Facturas f ON f.Id_Factura = t.Factura
- WHERE year(f.Fecha) = vYear
- AND month(f.Fecha) = vMonth;
+ JOIN vn.invoiceOut io ON io.id = t.Factura
+ WHERE year(io.issued) = vYear
+ AND month(io.issued) = vMonth;
SELECT vYear Año,
vMonth Mes,
diff --git a/db/routines/bs/procedures/vivosMuertos.sql b/db/routines/bs/procedures/vivosMuertos.sql
index 1743eda64..c07570603 100644
--- a/db/routines/bs/procedures/vivosMuertos.sql
+++ b/db/routines/bs/procedures/vivosMuertos.sql
@@ -24,20 +24,20 @@ BEGIN
WHERE date BETWEEN @datSTART
AND @datEND ) tm
LEFT JOIN
- (SELECT DISTINCT tm.yearMonth, f.Id_Cliente , 1 as Compra
- FROM vn2008.Facturas f
- JOIN vn2008.time tm ON tm.date = f.Fecha
- WHERE Fecha BETWEEN @datSTART
+ (SELECT DISTINCT tm.yearMonth, io.clientFk Id_Cliente , 1 as Compra
+ FROM vn.invoiceOut io
+ JOIN vn2008.time tm ON tm.date = io.issued
+ WHERE io.issued BETWEEN @datSTART
AND @datEND) f ON f.yearMonth = tm.yearMonth
AND f.Id_Cliente = c.Id_Cliente;
UPDATE tmp.VivosMuertos vm
JOIN
- (SELECT MIN(tm.yearMonth) firstMonth, f.Id_Cliente
- FROM vn2008.Facturas f
- JOIN vn2008.time tm ON tm.date = f.Fecha
- WHERE Fecha BETWEEN @datSTART AND @datEND
- GROUP BY f.Id_Cliente ) fm ON fm.firstMonth = vm.yearMonth
+ (SELECT MIN(tm.yearMonth) firstMonth, io.clientFk Id_Cliente
+ FROM vn.invoiceOut io
+ JOIN vn2008.time tm ON tm.date = io.issued
+ WHERE io.issued BETWEEN @datSTART AND @datEND
+ GROUP BY io.clientFk) fm ON fm.firstMonth = vm.yearMonth
AND fm.Id_Cliente = vm.Id_Cliente
SET Nuevo = 1;
@@ -46,11 +46,11 @@ BEGIN
UPDATE tmp.VivosMuertos vm
JOIN (
- SELECT MAX(tm.yearMonth) firstMonth, f.Id_Cliente
- FROM vn2008.Facturas f
- JOIN vn2008.time tm ON tm.date = f.Fecha
- WHERE Fecha BETWEEN @datSTART AND @datEND
- GROUP BY f.Id_Cliente ) fm ON fm.firstMonth = vm.yearMonth
+ SELECT MAX(tm.yearMonth) firstMonth, io.clientFk Id_Cliente
+ FROM vn.invoiceOut io
+ JOIN vn2008.time tm ON tm.date = io.issued
+ WHERE io.issued BETWEEN @datSTART AND @datEND
+ GROUP BY io.clientFk) fm ON fm.firstMonth = vm.yearMonth
AND fm.Id_Cliente = vm.Id_Cliente
SET Muerto = 1
diff --git a/db/routines/util/procedures/tx_commit.sql b/db/routines/util/procedures/tx_commit.sql
new file mode 100644
index 000000000..fdf2f3ddb
--- /dev/null
+++ b/db/routines/util/procedures/tx_commit.sql
@@ -0,0 +1,13 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_commit`(isTx BOOL)
+BEGIN
+/**
+ * Confirma los cambios asociados a una transacción.
+ *
+ * @param isTx es true si existe transacción asociada
+*/
+ IF isTx THEN
+ COMMIT;
+ END IF;
+END$$
+DELIMITER ;
diff --git a/db/routines/util/procedures/tx_rollback.sql b/db/routines/util/procedures/tx_rollback.sql
new file mode 100644
index 000000000..96571af2c
--- /dev/null
+++ b/db/routines/util/procedures/tx_rollback.sql
@@ -0,0 +1,13 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_rollback`(isTx BOOL)
+BEGIN
+/**
+ * Deshace los cambios asociados a una transacción.
+ *
+ * @param isTx es true si existe transacción asociada
+*/
+ IF isTx THEN
+ ROLLBACK;
+ END IF;
+END$$
+DELIMITER ;
diff --git a/db/routines/util/procedures/tx_start.sql b/db/routines/util/procedures/tx_start.sql
new file mode 100644
index 000000000..9d9f16bb7
--- /dev/null
+++ b/db/routines/util/procedures/tx_start.sql
@@ -0,0 +1,13 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_start`(isTx BOOL)
+BEGIN
+/**
+ * Inicia una transacción.
+ *
+ * @param isTx es true si existe transacción asociada
+*/
+ IF isTx THEN
+ START TRANSACTION;
+ END IF;
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/functions/hasAnyNegativeBase.sql b/db/routines/vn/functions/hasAnyNegativeBase.sql
index 3b96a3d22..97d1e7328 100644
--- a/db/routines/vn/functions/hasAnyNegativeBase.sql
+++ b/db/routines/vn/functions/hasAnyNegativeBase.sql
@@ -4,32 +4,25 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`hasAnyNegativeBase`(
DETERMINISTIC
BEGIN
-/* Calcula si existe alguna base imponible negativa
-* Requiere la tabla temporal tmp.ticketToInvoice(id)
+/**
+* Calcula si existe alguna base imponible negativa
+* Requiere la tabla temporal tmp.ticketToInvoice(id) para getTaxBases()
*
* returns BOOLEAN
*/
+
DECLARE hasAnyNegativeBase BOOLEAN;
- DROP TEMPORARY TABLE IF EXISTS tmp.ticket;
- CREATE TEMPORARY TABLE tmp.ticket
- (KEY (ticketFk))
- ENGINE = MEMORY
- SELECT id ticketFk
- FROM tmp.ticketToInvoice;
+ CALL getTaxBases();
- CALL ticket_getTax(NULL);
+ SELECT negative INTO hasAnyNegativeBase
+ FROM tmp.taxBases
+ LIMIT 1;
- SELECT COUNT(*) INTO hasAnyNegativeBase
- FROM(
- SELECT SUM(taxableBase) as taxableBase
- FROM tmp.ticketTax
- GROUP BY pgcFk
- HAVING taxableBase < 0
- ) t;
-
- DROP TEMPORARY TABLE tmp.ticketTax;
- DROP TEMPORARY TABLE tmp.ticket;
+ DROP TEMPORARY TABLE
+ tmp.ticketTax,
+ tmp.ticket,
+ tmp.taxBases;
RETURN hasAnyNegativeBase;
diff --git a/db/routines/vn/functions/hasAnyPositiveBase.sql b/db/routines/vn/functions/hasAnyPositiveBase.sql
new file mode 100644
index 000000000..7222c3b2a
--- /dev/null
+++ b/db/routines/vn/functions/hasAnyPositiveBase.sql
@@ -0,0 +1,30 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`hasAnyPositiveBase`()
+ RETURNS tinyint(1)
+ DETERMINISTIC
+BEGIN
+
+/**
+* Calcula si existe alguna base imponible positiva
+* Requiere la tabla temporal tmp.ticketToInvoice(id) para getTaxBases()
+*
+* returns BOOLEAN
+*/
+
+ DECLARE hasAnyPositiveBase BOOLEAN;
+
+ CALL getTaxBases();
+
+ SELECT positive INTO hasAnyPositiveBase
+ FROM tmp.taxBases
+ LIMIT 1;
+
+ DROP TEMPORARY TABLE
+ tmp.ticketTax,
+ tmp.ticket,
+ tmp.taxBases;
+
+ RETURN hasAnyPositiveBase;
+
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/functions/isPalletHomogeneus.sql b/db/routines/vn/functions/isPalletHomogeneus.sql
index 39c6461ae..b38fdcc5e 100644
--- a/db/routines/vn/functions/isPalletHomogeneus.sql
+++ b/db/routines/vn/functions/isPalletHomogeneus.sql
@@ -16,8 +16,8 @@ BEGIN
FROM (
SELECT DISTINCT t.Id_Ruta
FROM vn2008.scan_line sl
- JOIN vn2008.expeditions e ON e.expeditions_id = sl.code
- JOIN vn2008.Tickets t ON t.Id_Ticket = e.ticket_id
+ JOIN expedition e ON e.id = sl.code
+ JOIN vn2008.Tickets t ON t.Id_Ticket = e.ticketFk
WHERE sl.scan_id = vScanId
AND t.Id_Ruta
) t1;
diff --git a/db/routines/vn/procedures/XDiario_check.sql b/db/routines/vn/procedures/XDiario_check.sql
new file mode 100644
index 000000000..0fb1c410d
--- /dev/null
+++ b/db/routines/vn/procedures/XDiario_check.sql
@@ -0,0 +1,41 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`XDiario_check`()
+BEGIN
+/**
+ * Realiza la revisión diaria de los asientos contables,
+ * identificando y notificando los asientos descuadrados
+ * y ajustando los saldos en caso necesario.
+ */
+ INSERT INTO mail (receiver, subject, body)
+ SELECT 'cau@verdnatura.es',
+ 'Asientos descuadrados',
+ GROUP_CONCAT(CONCAT(' Asiento: ', ASIEN, ' - Importe:', recon) SEPARATOR ' | \n')
+ FROM (
+ SELECT ASIEN,
+ SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) recon
+ FROM XDiario
+ WHERE NOT enlazado
+ GROUP BY ASIEN
+ HAVING ABS(SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0))) > 0.01
+ ) sub
+ HAVING COUNT(*);
+
+ UPDATE XDiario xd
+ JOIN (
+ SELECT xd.id, SUBCTA, recon
+ FROM XDiario xd
+ JOIN (
+ SELECT ASIEN,
+ SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) recon
+ FROM XDiario
+ WHERE NOT enlazado
+ GROUP BY ASIEN
+ HAVING recon
+ ) sub ON sub.ASIEN = xd.ASIEN
+ WHERE xd.SUBCTA > '5999999999'
+ GROUP BY xd.ASIEN
+ ) sub ON sub.id = xd.id
+ SET xd.Eurohaber = IF(IFNULL(xd.Eurohaber, 0) = 0, xd.Eurohaber, xd.Eurohaber + sub.recon),
+ xd.Eurodebe = IF(IFNULL(xd.Eurodebe, 0) = 0, xd.Eurodebe, xd.Eurodebe - sub.recon);
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/procedures/clean.sql b/db/routines/vn/procedures/clean.sql
index 0e60fad1d..7b561cfe0 100644
--- a/db/routines/vn/procedures/clean.sql
+++ b/db/routines/vn/procedures/clean.sql
@@ -9,6 +9,7 @@ BEGIN
DECLARE v26Month DATE;
DECLARE v3Month DATE;
DECLARE vTrashId VARCHAR(15);
+ DECLARE v2Years DATE;
DECLARE v5Years DATE;
SET vDateShort = util.VN_CURDATE() - INTERVAL 2 MONTH;
@@ -18,6 +19,7 @@ BEGIN
SET v18Month = util.VN_CURDATE() - INTERVAL 18 MONTH;
SET v26Month = util.VN_CURDATE() - INTERVAL 26 MONTH;
SET v3Month = util.VN_CURDATE() - INTERVAL 3 MONTH;
+ SET v2Years = util.VN_CURDATE() - INTERVAL 2 YEAR;
SET v5Years = util.VN_CURDATE() - INTERVAL 5 YEAR;
DELETE FROM ticketParking WHERE created < vDateShort;
@@ -163,7 +165,11 @@ BEGIN
FROM tmp.duaToDelete tmp
JOIN vn.dua d ON d.id = tmp.id;
- DELETE FROM vn.awb WHERE created < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE());
+ DELETE a
+ FROM vn.awb a
+ LEFT JOIN vn.travel t ON t.awbFk = a.id
+ WHERE a.created < v2Years
+ AND t.id IS NULL;
-- Borra los registros de collection y ticketcollection
DELETE FROM vn.collection WHERE created < vDateShort;
diff --git a/db/routines/vn/procedures/collection_assign.sql b/db/routines/vn/procedures/collection_assign.sql
index 0918bf1da..6d31fbc8f 100644
--- a/db/routines/vn/procedures/collection_assign.sql
+++ b/db/routines/vn/procedures/collection_assign.sql
@@ -1,8 +1,8 @@
-DELIMITER $$
+DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_assign`(
vUserFk INT,
OUT vCollectionFk INT
-)
+)
proc:BEGIN
/**
* Comprueba si existen colecciones libres que se ajustan
@@ -84,5 +84,5 @@ proc:BEGIN
WHERE id = vCollectionFk;
DO RELEASE_LOCK('collection_assign');
-END$$
-DELIMITER ;
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/procedures/duaInvoiceInBooking.sql b/db/routines/vn/procedures/duaInvoiceInBooking.sql
index 77924938b..b68d23f9d 100644
--- a/db/routines/vn/procedures/duaInvoiceInBooking.sql
+++ b/db/routines/vn/procedures/duaInvoiceInBooking.sql
@@ -1,70 +1,74 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`duaInvoiceInBooking`(vDuaFk INT)
BEGIN
-
+/**
+ * Genera el asiento de un DUA y marca las entradas como confirmadas
+ *
+ * @param vDuaFk Id del dua a recalcular
+ */
DECLARE done BOOL DEFAULT FALSE;
DECLARE vInvoiceFk INT;
- DECLARE vASIEN BIGINT DEFAULT 0;
- DECLARE vCounter INT DEFAULT 0;
-
+ DECLARE vASIEN BIGINT DEFAULT 0;
+ DECLARE vCounter INT DEFAULT 0;
+
DECLARE rs CURSOR FOR
- SELECT e.invoiceInFk
+ SELECT DISTINCT e.invoiceInFk
FROM entry e
JOIN duaEntry de ON de.entryFk = e.id
- JOIN invoiceIn ii ON ii.id = e.invoiceInFk
- WHERE de.duaFk = vDuaFk
+ JOIN invoiceIn ii ON ii.id = e.invoiceInFk
+ WHERE de.duaFk = vDuaFk
AND de.customsValue
AND ii.isBooked = FALSE;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
OPEN rs;
-
+
UPDATE invoiceIn ii
JOIN entry e ON e.invoiceInFk = ii.id
- JOIN duaEntry de ON de.entryFk = e.id
- JOIN dua d ON d.id = de.duaFk
+ JOIN duaEntry de ON de.entryFk = e.id
+ JOIN dua d ON d.id = de.duaFk
SET ii.isBooked = TRUE,
ii.booked = IFNULL(ii.booked,d.booked),
ii.operated = IFNULL(ii.operated,d.operated),
- ii.issued = IFNULL(ii.issued,d.issued),
- ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried),
- e.isConfirmed = TRUE
+ ii.issued = IFNULL(ii.issued,d.issued),
+ ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried),
+ e.isConfirmed = TRUE
WHERE d.id = vDuaFk;
-
- SELECT IFNULL(ASIEN,0) INTO vASIEN
+
+ SELECT IFNULL(ASIEN,0) INTO vASIEN
FROM dua
WHERE id = vDuaFk;
-
+
FETCH rs INTO vInvoiceFk;
-
+
WHILE NOT done DO
CALL invoiceIn_booking(vInvoiceFk);
-
- IF vCounter > 0 OR vASIEN > 0 THEN
-
- UPDATE vn.XDiario x
- JOIN vn.ledgerConfig lc ON lc.lastBookEntry = x.ASIEN
- SET x.ASIEN = vASIEN;
-
- ELSE
-
- SELECT lastBookEntry INTO vASIEN FROM vn.ledgerConfig;
-
+
+ IF vCounter > 0 OR vASIEN > 0 THEN
+
+ UPDATE vn2008.XDiario x
+ JOIN ledgerConfig lc ON lc.lastBookEntry = x.ASIEN
+ SET x.ASIEN = vASIEN;
+
+ ELSE
+
+ SELECT lastBookEntry INTO vASIEN FROM ledgerConfig;
+
END IF;
-
- SET vCounter = vCounter + 1;
-
+
+ SET vCounter = vCounter + 1;
+
FETCH rs INTO vInvoiceFk;
END WHILE;
-
- CLOSE rs;
-
- UPDATE dua
- SET ASIEN = vASIEN
- WHERE id = vDuaFk;
-
+
+ CLOSE rs;
+
+ UPDATE dua
+ SET ASIEN = vASIEN
+ WHERE id = vDuaFk;
+
END$$
DELIMITER ;
diff --git a/db/routines/vn/procedures/entry_getTransfer.sql b/db/routines/vn/procedures/entry_getTransfer.sql
new file mode 100644
index 000000000..151bebd4d
--- /dev/null
+++ b/db/routines/vn/procedures/entry_getTransfer.sql
@@ -0,0 +1,211 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_getTransfer`(
+ vSelf INT
+)
+BEGIN
+/**
+ * Retorna los artículos trasladables a partir de una entrada.
+ *
+ * @param vSelf Id de entrada
+ */
+ DECLARE vDateShipped DATE;
+ DECLARE vDateLanded DATE;
+ DECLARE vWarehouseIn INT;
+ DECLARE vWarehouseOut INT;
+ DECLARE vCalcVisible INT;
+ DECLARE vInventoryDate DATE DEFAULT vn.getInventoryDate();
+
+ SELECT shipped, landed, warehouseInFk, warehouseOutFk
+ INTO vDateShipped, vDateLanded, vWarehouseIn, vWarehouseOut
+ FROM vn.travel t
+ JOIN vn.entry e ON e.travelFk = t.id
+ WHERE e.id = vSelf;
+
+ CALL vn.rate_getPrices(vDateShipped, vWarehouseIn);
+
+ -- Traslado en almacen origen
+ CREATE OR REPLACE TEMPORARY TABLE tBuy
+ (PRIMARY KEY (itemFk), INDEX(buyFk))
+ ENGINE = MEMORY
+ SELECT *
+ FROM (
+ SELECT b.itemFk, b.id buyFk
+ FROM buy b
+ JOIN entry e ON e.id = b.entryFk
+ JOIN travel t ON t.id = e.travelFk
+ WHERE t.landed BETWEEN vInventoryDate AND vDateShipped
+ AND NOT b.isIgnored
+ AND b.price2 >= 0
+ ORDER BY (vWarehouseOut = t.warehouseInFk) DESC, t.landed DESC
+ LIMIT 10000000000000000000
+ ) sub
+ GROUP BY itemFk;
+
+ IF vDateShipped >= util.VN_CURDATE() THEN
+ CALL `cache`.visible_refresh(vCalcVisible, TRUE, vWarehouseOut);
+
+ CREATE OR REPLACE TEMPORARY TABLE tItem (
+ `itemFk` int(10) unsigned NOT NULL,
+ `visible` int(11) NOT NULL DEFAULT 0,
+ `available` int(11) NOT NULL DEFAULT 0,
+ `visibleLanding` int(11) NOT NULL DEFAULT 0,
+ `availableLanding` int(11) NOT NULL DEFAULT 0,
+ UNIQUE INDEX i USING HASH (itemFk)
+ ) ENGINE = MEMORY;
+
+ INSERT INTO tItem(itemFk, visible)
+ SELECT item_id itemFk, visible
+ FROM `cache`.visible
+ WHERE calc_id = vCalcVisible
+ AND visible;
+
+ CALL `cache`.visible_refresh(vCalcVisible, TRUE, vWarehouseIn);
+
+ INSERT INTO tItem(itemFk, visibleLanding)
+ SELECT item_id, `visible`
+ FROM `cache`.`visible` v
+ WHERE v.calc_id = vCalcVisible
+ AND v.`visible`
+ ON DUPLICATE KEY UPDATE visibleLanding = v.`visible`;
+
+ CALL vn2008.availableTraslate(vWarehouseOut, vDateShipped, NULL);
+
+ INSERT INTO tItem(itemFk, available)
+ SELECT a.item_id, a.available
+ FROM vn2008.availableTraslate a
+ WHERE a.available
+ ON DUPLICATE KEY UPDATE available = a.available;
+
+ CALL vn2008.availableTraslate(vWarehouseIn, vDateLanded, vWarehouseOut);
+
+ INSERT INTO tItem(itemFk, availableLanding)
+ SELECT a.item_id, a.available
+ FROM vn2008.availableTraslate a
+ WHERE a.available
+ ON DUPLICATE KEY UPDATE availableLanding = a.available;
+ ELSE
+ CALL vn.item_getStock(vWarehouseOut, vDateShipped, NULL);
+
+ CREATE OR REPLACE TEMPORARY TABLE tItem
+ (UNIQUE INDEX i USING HASH (itemFk))
+ ENGINE = MEMORY
+ SELECT itemFk,
+ `visible`,
+ available,
+ 0 visibleLanding,
+ 0 availableLanding
+ FROM tmp.itemList;
+ END IF;
+
+ CALL vn.buyUltimateFromInterval(vWarehouseIn,vInventoryDate, vDateLanded);
+
+ CREATE OR REPLACE TEMPORARY TABLE tTransfer
+ ENGINE = MEMORY
+ SELECT it.code `type`,
+ it.categoryFk,
+ i.typeFk,
+ i.id itemFk,
+ i.name item,
+ i.`size`,
+ i.category,
+ i.inkFk,
+ o.code originCode,
+ b2.quantity,
+ i.stems,
+ CAST(ti.visible AS DECIMAL(10,0)) vis1,
+ CAST(ti.available AS DECIMAL(10,0)) ava1,
+ CAST(ti.visibleLanding AS DECIMAL(10,0)) vis2,
+ CAST(ti.availableLanding AS DECIMAL(10,0)) ava2,
+ COALESCE(b2.`grouping`, b.`grouping`) `grouping`,
+ COALESCE(b2.packing, b.packing) packing,
+ COALESCE(b3.groupingMode, b2.groupingMode, b.groupingMode) package,
+ IFNULL(p.name, s.nickname) productor,
+ TRUE tinta,
+ b.packagingFk,
+ b2.id buyFk,
+ b2.stickers,
+ b.ektFk,
+ it.workerFk,
+ pa.volume,
+ IFNULL(pa.width, 0) width,
+ IFNULL(pa.`depth`, 0) `depth`,
+ IFNULL(pa.height, 0) height,
+ IFNULL(b.buyingValue, 0) buyingValue,
+ IFNULL(b.comissionValue, 0) comissionValue,
+ IFNULL(b.freightValue, 0) freightValue,
+ am.m3,
+ e.commission,
+ pa.isPackageReturnable,
+ IFNULL(pa2.value, pa.value) `value`,
+ r.rate3 r3,
+ r.rate2 r2,
+ it.promo,
+ b.`grouping` groupingOrigin,
+ b.packing packingOrigin,
+ b.id buyFkOrigin,
+ pa.returnCost,
+ b.weight
+ FROM vn.item i
+ JOIN tItem ti ON ti.itemFk = i.id
+ LEFT JOIN vn.producer p ON p.id = i.producerFk
+ LEFT JOIN vn.itemType it ON it.id = i.typeFk
+ JOIN vn.itemCategory ic ON ic.id = it.categoryFk
+ LEFT JOIN vn.origin o ON o.id = i.originFk
+ LEFT JOIN tBuy lb ON lb.itemFk = i.id
+ LEFT JOIN vn.buy b ON b.id = lb.buyFk
+ LEFT JOIN vn.packaging pa ON pa.id = b.packagingFk
+ LEFT JOIN vn.entry e2 ON e2.id = b.entryFk
+ LEFT JOIN vn.supplier s ON s.id = e2.supplierFk
+ LEFT JOIN vn.entry e ON e.id = vSelf
+ LEFT JOIN vn.travel tr ON tr.id = e.travelFk
+ LEFT JOIN vn.agencyMode am ON am.id = tr.agencyModeFk
+ LEFT JOIN vn.buy b2 ON b2.itemFk = i.id
+ AND b2.entryFk = vSelf
+ LEFT JOIN vn.packaging pa2 ON pa2.id = b.packagingFk
+ LEFT JOIN tmp.rate r ON TRUE
+ LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = i.id
+ LEFT JOIN vn.buy b3 ON b3.id = bufi.buyFk
+ WHERE ic.display
+ AND NOT e.isRaid
+ AND (ti.visible OR ti.available)
+ ORDER BY i.typeFk, i.name, i.id, i.size, i.category, o.name;
+
+ CREATE INDEX tIndex USING HASH ON tTransfer (itemFk);
+
+ SET @carriage := 0;
+ SET @comission := 0;
+ SET @packaging := 0;
+ SET @rate3 := 0;
+ SET @cost := 0;
+ SELECT *,
+ quantity - MOD(quantity , `grouping`) subQuantity,
+ MOD(quantity, `grouping`) soll,
+ ROUND((IF(volume > 0,volume, width * `depth` *
+ IF(height = 0, `size` + 10, height))) /
+ packing, 0) cm3,
+ buyingValue + comissionValue + freightValue cost,
+ @carriage := ROUND((IF(volume > 0, volume, width * `depth` *
+ IF(height = 0, `size` + 10, height))) *
+ m3 / 1000000 / Packing, 3) carriage,
+ @comission := ROUND((buyingValue + comissionValue + freightValue) *
+ commission / 100, 3) commission,
+ ROUND(@packaging := (returnCost + IF(isPackageReturnable, 0, value))
+ / packing, 3) packaging,
+ @cost := IFNULL((buyingValue + comissionValue + freightValue), 0) +
+ IFNULL(@packaging, 0) +
+ IFNULL(@carriage, 0) +
+ IFNULL(@comission, 0) expense,
+ @rate3 := ROUND(@cost / ( (100 - r3 - promo) / 100), 2) rate3,
+ ROUND(@rate3 * (1 + ((r2 - r3)/100)), 2) rate2,
+ FALSE selected
+ FROM tTransfer;
+
+ DROP TEMPORARY TABLE IF EXISTS
+ tTransfer,
+ tItem,
+ tBuy,
+ tmp.buyUltimateFromInterval,
+ tmp.rate,
+ tmp.itemList;
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/procedures/getDayExpeditions.sql b/db/routines/vn/procedures/getDayExpeditions.sql
index 949cf4e5b..b708c8b0e 100644
--- a/db/routines/vn/procedures/getDayExpeditions.sql
+++ b/db/routines/vn/procedures/getDayExpeditions.sql
@@ -3,13 +3,13 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`getDayExpeditions`(
BEGIN
SELECT
- e.expeditions_id as expeditionFk,
- date_format(e.odbc_date,'%Y-%m-%d') as expeditionDate,
- e.ticket_id as ticketFk,
+ e.id as expeditionFk,
+ date_format(e.created,'%Y-%m-%d') as expeditionDate,
+ e.ticketFk,
t.routeFk as routeFk
- FROM vn2008.expeditions e
- INNER JOIN vn.ticket t ON t.id = e.ticket_id
- WHERE DATE(odbc_date) = util.VN_CURDATE();
+ FROM expedition e
+ INNER JOIN ticket t ON t.id = e.ticketFk
+ WHERE DATE(e.created) = util.VN_CURDATE();
END$$
DELIMITER ;
diff --git a/db/routines/vn/procedures/getTaxBases.sql b/db/routines/vn/procedures/getTaxBases.sql
new file mode 100644
index 000000000..54932aa4f
--- /dev/null
+++ b/db/routines/vn/procedures/getTaxBases.sql
@@ -0,0 +1,32 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`getTaxBases`()
+BEGIN
+/**
+* Calcula y devuelve en número de bases imponibles postivas y negativas
+* Requiere la tabla temporal tmp.ticketToInvoice(id)
+*
+* returns tmp.taxBases
+*/
+
+ CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
+ (KEY (ticketFk))
+ ENGINE = MEMORY
+ SELECT id ticketFk
+ FROM tmp.ticketToInvoice;
+
+ CALL ticket_getTax(NULL);
+
+ DROP TEMPORARY TABLE IF EXISTS tmp.taxBases;
+ CREATE TEMPORARY TABLE tmp.taxBases
+ ENGINE = MEMORY
+ SELECT
+ SUM(taxableBase > 0) as positive,
+ SUM(taxableBase < 0) as negative
+ FROM(
+ SELECT SUM(taxableBase) taxableBase
+ FROM tmp.ticketTax
+ GROUP BY pgcFk
+ ) t;
+
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/procedures/inventoryMake.sql b/db/routines/vn/procedures/inventoryMake.sql
index 0def763dc..ed6a7fa43 100644
--- a/db/routines/vn/procedures/inventoryMake.sql
+++ b/db/routines/vn/procedures/inventoryMake.sql
@@ -1,182 +1,175 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`inventoryMake`(vDate DATE, vWh INT)
-proc: BEGIN
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`inventoryMake`(vInventoryDate DATE)
+BEGIN
/**
-* Recalcula los inventarios de todos los almacenes, si vWh = 0
+* Recalculate the inventories
*
-* @param vDate Fecha de los nuevos inventarios
-* @param vWh almacen al cual hacer el inventario
+* @param vInventoryDate date for the new inventory
*/
-
DECLARE vDone BOOL;
DECLARE vEntryFk INT;
DECLARE vTravelFk INT;
DECLARE vDateLastInventory DATE;
- DECLARE vDateYesterday DATETIME DEFAULT vDate - INTERVAL 1 SECOND;
+ DECLARE vDateYesterday DATETIME DEFAULT vInventoryDate - INTERVAL 1 SECOND;
DECLARE vWarehouseOutFkInventory INT;
DECLARE vInventorySupplierFk INT;
DECLARE vAgencyModeFkInventory INT;
+ DECLARE vMaxRecentInventories INT;
+ DECLARE vWarehouseFk INT;
DECLARE cWarehouses CURSOR FOR
SELECT id
FROM warehouse
- WHERE isInventory
- AND vWh IN (0,id);
+ WHERE isInventory;
+
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
+ BEGIN
+ ROLLBACK;
+ RESIGNAL;
+ END;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
+ SELECT inventorySupplierFk INTO vInventorySupplierFk FROM entryConfig LIMIT 1;
+ SELECT inventoried INTO vDateLastInventory FROM config LIMIT 1;
+ SELECT maxRecentInventories,
+ warehouseOutFk,
+ agencyModeFk
+ INTO vMaxRecentInventories,
+ vWarehouseOutFkInventory,
+ vAgencyModeFkInventory
+ FROM inventoryConfig
+ LIMIT 1;
+
+ IF vDateLastInventory IS NULL
+ OR vInventorySupplierFk IS NULL
+ OR vMaxRecentInventories IS NULL
+ OR vInventoryDate IS NULL
+ OR vWarehouseOutFkInventory IS NULL
+ OR vAgencyModeFkInventory IS NULL THEN
+ CALL util.throw('Some config parameters are not set');
+ END IF;
+
+ START TRANSACTION;
+
OPEN cWarehouses;
+ -- Environment variable to disable the triggers of the affected tables
SET @isModeInventory := TRUE;
l: LOOP
-
SET vDone = FALSE;
- FETCH cWarehouses INTO vWh;
+ SET vEntryFk = NULL;
+ SET vTravelFk = NULL;
+
+ FETCH cWarehouses INTO vWarehouseFk;
IF vDone THEN
LEAVE l;
END IF;
- SELECT w.id INTO vWarehouseOutFkInventory
- FROM warehouse w
- WHERE w.code = 'inv';
-
- SELECT inventorySupplierFk INTO vInventorySupplierFk
- FROM entryConfig;
-
- SELECT am.id INTO vAgencyModeFkInventory
- FROM agencyMode am
- where code = 'inv';
-
- SELECT MAX(landed) INTO vDateLastInventory
- FROM travel tr
- JOIN entry e ON e.travelFk = tr.id
- JOIN buy b ON b.entryFk = e.id
- WHERE warehouseOutFk = vWarehouseOutFkInventory
- AND landed < vDate
- AND e.supplierFk = vInventorySupplierFk
- AND warehouseInFk = vWh
- AND NOT isRaid;
-
- IF vDateLastInventory IS NULL THEN
- SELECT inventoried INTO vDateLastInventory FROM config;
- END IF;
-
- -- Generamos travel, si no existe.
- SET vTravelFK = 0;
-
+ -- Generate travel, if it does not exist
SELECT id INTO vTravelFk
FROM travel
WHERE warehouseOutFk = vWarehouseOutFkInventory
- AND warehouseInFk = vWh
- AND landed = vDate
+ AND warehouseInFk = vWarehouseFk
+ AND landed = vInventoryDate
AND agencyModeFk = vAgencyModeFkInventory
AND ref = 'inventario'
LIMIT 1;
- IF NOT vTravelFK THEN
-
- INSERT INTO travel SET
- warehouseOutFk = vWarehouseOutFkInventory,
- warehouseInFk = vWh,
- shipped = vDate,
- landed = vDate,
- agencyModeFk = vAgencyModeFkInventory,
- ref = 'inventario',
- isDelivered = TRUE,
- isReceived = TRUE;
+ IF vTravelFk IS NULL THEN
+ INSERT INTO travel
+ SET warehouseOutFk = vWarehouseOutFkInventory,
+ warehouseInFk = vWarehouseFk,
+ shipped = vInventoryDate,
+ landed = vInventoryDate,
+ agencyModeFk = vAgencyModeFkInventory,
+ ref = 'inventario',
+ isDelivered = TRUE,
+ isReceived = TRUE;
SELECT LAST_INSERT_ID() INTO vTravelFk;
-
END IF;
- -- Generamos entrada si no existe, o la vaciamos.
- SET vEntryFk = 0;
-
+ -- Generate an entry if it does not exist, or we empty it
SELECT id INTO vEntryFk
FROM entry
WHERE supplierFk = vInventorySupplierFk
AND travelFk = vTravelFk;
- IF NOT vEntryFk THEN
-
- INSERT INTO entry SET
- supplierFk = vInventorySupplierFk,
- isConfirmed = TRUE,
- isOrdered = TRUE,
- travelFk = vTravelFk;
+ IF vEntryFk IS NULL THEN
+ INSERT INTO entry
+ SET supplierFk = vInventorySupplierFk,
+ isConfirmed = TRUE,
+ isOrdered = TRUE,
+ travelFk = vTravelFk;
SELECT LAST_INSERT_ID() INTO vEntryFk;
-
ELSE
-
DELETE FROM buy WHERE entryFk = vEntryFk;
-
END IF;
- -- Preparamos tabla auxilar
- CREATE OR REPLACE TEMPORARY TABLE tmp.inventory (
- itemFk INT(11) NOT NULL PRIMARY KEY,
- quantity int(11) DEFAULT '0',
- buyingValue decimal(10,4) DEFAULT '0.0000',
- freightValue decimal(10,3) DEFAULT '0.000',
- packing int(11) DEFAULT '0',
- `grouping` smallint(5) unsigned NOT NULL DEFAULT '1',
- groupingMode tinyint(4) NOT NULL DEFAULT 0 ,
- comissionValue decimal(10,3) DEFAULT '0.000',
- packageValue decimal(10,3) DEFAULT '0.000',
- packageFk varchar(10) COLLATE utf8_unicode_ci DEFAULT '--',
- price1 decimal(10,2) DEFAULT '0.00',
- price2 decimal(10,2) DEFAULT '0.00',
- price3 decimal(10,2) DEFAULT '0.00',
- minPrice decimal(10,2) DEFAULT '0.00',
- producer varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
- INDEX (itemFK)) ENGINE = MEMORY;
+ -- Prepare the auxiliary table
+ CREATE OR REPLACE TEMPORARY TABLE tInventory (
+ itemFk INT(11) NOT NULL PRIMARY KEY,
+ quantity int(11) DEFAULT '0',
+ buyingValue decimal(10,4) DEFAULT '0.0000',
+ freightValue decimal(10,3) DEFAULT '0.000',
+ packing int(11) DEFAULT '0',
+ `grouping` smallint(5) unsigned NOT NULL DEFAULT '1',
+ groupingMode tinyint(4) NOT NULL DEFAULT 0 ,
+ comissionValue decimal(10,3) DEFAULT '0.000',
+ packageValue decimal(10,3) DEFAULT '0.000',
+ packageFk varchar(10) COLLATE utf8_unicode_ci DEFAULT '--',
+ price1 decimal(10,2) DEFAULT '0.00',
+ price2 decimal(10,2) DEFAULT '0.00',
+ price3 decimal(10,2) DEFAULT '0.00',
+ minPrice decimal(10,2) DEFAULT '0.00',
+ producer varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
+ INDEX (itemFK)
+ ) ENGINE = MEMORY;
- -- Compras
- INSERT INTO tmp.inventory(itemFk,quantity)
+ -- Buys
+ INSERT INTO tInventory(itemFk, quantity)
SELECT b.itemFk, SUM(b.quantity)
FROM buy b
JOIN entry e ON e.id = b.entryFk
JOIN travel tr ON tr.id = e.travelFk
- WHERE tr.warehouseInFk = vWh
- AND tr.landed BETWEEN vDateLastInventory
- AND vDateYesterday
+ WHERE tr.warehouseInFk = vWarehouseFk
+ AND tr.landed BETWEEN vDateLastInventory AND vDateYesterday
AND NOT isRaid
GROUP BY b.itemFk;
- SELECT vDateLastInventory , vDateYesterday;
- -- Traslados
- INSERT INTO tmp.inventory(itemFk, quantity)
+ -- Transfers
+ INSERT INTO tInventory(itemFk, quantity)
SELECT itemFk, quantityOut
- FROM (
+ FROM (
SELECT b.itemFk,- SUM(b.quantity) quantityOut
FROM buy b
JOIN entry e ON e.id = b.entryFk
JOIN travel tr ON tr.id = e.travelFk
- WHERE tr.warehouseOutFk = vWh
- AND tr.shipped BETWEEN vDateLastInventory
- AND vDateYesterday
+ WHERE tr.warehouseOutFk = vWarehouseFk
+ AND tr.shipped BETWEEN vDateLastInventory AND vDateYesterday
AND NOT isRaid
GROUP BY b.itemFk
) sub
ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity, 0) + sub.quantityOut;
- -- Ventas
- INSERT INTO tmp.inventory(itemFk,quantity)
+ -- Sales
+ INSERT INTO tInventory(itemFk, quantity)
SELECT itemFk, saleOut
- FROM (
+ FROM (
SELECT s.itemFk, - SUM(s.quantity) saleOut
FROM sale s
JOIN ticket t ON t.id = s.ticketFk
- WHERE t.warehouseFk = vWh
+ WHERE t.warehouseFk = vWarehouseFk
AND t.shipped BETWEEN vDateLastInventory AND vDateYesterday
GROUP BY s.itemFk
) sub
ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity,0) + sub.saleOut;
- -- Actualiza valores de la ultima compra
- UPDATE tmp.inventory inv
- JOIN cache.last_buy lb ON lb.item_id = inv.itemFk AND lb.warehouse_id = vWh
+ -- Update values of the last purchase
+ UPDATE tInventory inv
+ JOIN cache.last_buy lb ON lb.item_id = inv.itemFk AND lb.warehouse_id = vWarehouseFk
JOIN buy b ON b.id = lb.buy_id
JOIN item i ON i.id = b.itemFk
LEFT JOIN producer p ON p.id = i.producerFk
@@ -194,7 +187,7 @@ proc: BEGIN
inv.minPrice = b.minPrice,
inv.producer = p.name;
- INSERT INTO buy( itemFk,
+ INSERT INTO buy(itemFk,
quantity,
buyingValue,
freightValue,
@@ -224,42 +217,53 @@ proc: BEGIN
price3,
minPrice,
vEntryFk
- FROM tmp.inventory;
+ FROM tInventory;
- SELECT vWh, COUNT(*), util.VN_NOW() FROM tmp.inventory;
-
- -- Actualizamos el campo lastUsed de item
- UPDATE item i
- JOIN tmp.inventory i2 ON i2.itemFk = i.id
- SET i.lastUsed = NOW()
- WHERE i2.quantity;
-
- -- DROP TEMPORARY TABLE tmp.inventory;
+ -- Update the 'lastUsed' field of the item
+ UPDATE item i
+ JOIN tInventory i2 ON i2.itemFk = i.id
+ SET i.lastUsed = NOW()
+ WHERE i2.quantity;
+
+ DROP TEMPORARY TABLE tInventory;
END LOOP;
-
+
CLOSE cWarehouses;
- UPDATE config SET inventoried = vDate;
- SET @isModeInventory := FALSE;
+ UPDATE config SET inventoried = vInventoryDate;
- DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete;
- CREATE TEMPORARY TABLE tmp.entryToDelete
- (INDEX(entryId) USING BTREE) ENGINE = MEMORY
- SELECT e.id as entryId,
- t.id as travelId
+ SET @isModeInventory := FALSE;
+
+ CREATE OR REPLACE TEMPORARY TABLE tEntryToDelete
+ (INDEX(entryId)) ENGINE = MEMORY
+ SELECT e.id entryId,
+ t.id travelId
FROM travel t
JOIN `entry` e ON e.travelFk = t.id
+ JOIN (
+ SELECT t.shipped
+ FROM travel t
+ JOIN `entry` e ON e.travelFk = t.id
+ WHERE e.supplierFk = vInventorySupplierFk
+ AND t.shipped <= vInventoryDate
+ GROUP BY t.shipped
+ ORDER BY t.shipped DESC
+ OFFSET vMaxRecentInventories ROWS
+ ) sub
WHERE e.supplierFk = vInventorySupplierFk
- AND t.shipped <= util.VN_CURDATE() - INTERVAL 12 DAY
- AND (DAY(t.shipped) <> 1 OR shipped < util.VN_CURDATE() - INTERVAL 12 DAY);
+ AND t.shipped IN (sub.shipped);
- DELETE e
+ DELETE e
FROM `entry` e
- JOIN tmp.entryToDelete tmp ON tmp.entryId = e.id;
+ JOIN tEntryToDelete tmp ON tmp.entryId = e.id;
DELETE IGNORE t
FROM travel t
- JOIN tmp.entryToDelete tmp ON tmp.travelId = t.id;
+ JOIN tEntryToDelete tmp ON tmp.travelId = t.id;
+
+ DROP TEMPORARY TABLE IF EXISTS tEntryToDelete;
+
+ COMMIT;
END$$
DELIMITER ;
diff --git a/db/routines/vn/procedures/inventoryMakeLauncher.sql b/db/routines/vn/procedures/inventoryMakeLauncher.sql
index 6f362f70e..717e3c163 100644
--- a/db/routines/vn/procedures/inventoryMakeLauncher.sql
+++ b/db/routines/vn/procedures/inventoryMakeLauncher.sql
@@ -2,10 +2,11 @@ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`inventoryMakeLauncher`()
BEGIN
/**
- * Recalcula los inventarios de todos los almacenes.
+ * Recalculate the inventories of all warehouses
*/
-
- call vn.inventoryMake(TIMESTAMPADD(DAY, -10, util.VN_CURDATE()), 0);
-
+ CALL inventoryMake(
+ util.VN_CURDATE() -
+ INTERVAL (SELECT daysInPastForInventory FROM inventoryConfig LIMIT 1) DAY
+ );
END$$
DELIMITER ;
diff --git a/db/routines/vn/procedures/invoiceInTaxMakeByDua.sql b/db/routines/vn/procedures/invoiceInTaxMakeByDua.sql
index f41504669..2ff478d6b 100644
--- a/db/routines/vn/procedures/invoiceInTaxMakeByDua.sql
+++ b/db/routines/vn/procedures/invoiceInTaxMakeByDua.sql
@@ -1,32 +1,35 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInTaxMakeByDua`(vDuaFk INT)
BEGIN
-
- DECLARE done BOOL DEFAULT FALSE;
+/**
+ * Borra los valores de duaTax y sus vctos. y los vuelve a crear en base a la tabla duaEntry
+ *
+ * @param vDuaFk Id del dua a recalcular
+ */
+ DECLARE vDone BOOL DEFAULT FALSE;
DECLARE vInvoiceInFk INT;
- DECLARE rs CURSOR FOR
- SELECT invoiceInFk
- FROM entry e
- JOIN duaEntry de ON de.entryFk = e.id
- WHERE de.duaFk = vDuaFk;
+ DECLARE vInvoices CURSOR FOR
+ SELECT DISTINCT invoiceInFk
+ FROM entry e
+ JOIN duaEntry de ON de.entryFk = e.id
+ WHERE de.duaFk = vDuaFk;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
- OPEN rs;
+ OPEN vInvoices;
+ l: LOOP
+ SET vDone = FALSE;
+ FETCH vInvoices INTO vInvoiceInFk;
- FETCH rs INTO vInvoiceInFk;
-
- WHILE NOT done DO
+ IF vDone THEN
+ LEAVE l;
+ END IF;
CALL vn2008.recibidaIvaInsert(vInvoiceInFk);
CALL invoiceInDueDay_recalc(vInvoiceInFk);
- FETCH rs INTO vInvoiceInFk;
-
- END WHILE;
-
- CLOSE rs;
-
+ END LOOP;
+ CLOSE vInvoices;
END$$
DELIMITER ;
diff --git a/db/routines/vn/procedures/invoiceInTax_getFromDua.sql b/db/routines/vn/procedures/invoiceInTax_getFromDua.sql
index c7574f72f..bf2cbe61e 100644
--- a/db/routines/vn/procedures/invoiceInTax_getFromDua.sql
+++ b/db/routines/vn/procedures/invoiceInTax_getFromDua.sql
@@ -1,32 +1,35 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInTax_getFromDua`(vDuaFk INT)
BEGIN
-
- DECLARE done BOOL DEFAULT FALSE;
+/**
+ * Borra los valores de duaTax y sus vctos. y los vuelve a crear en base a la tabla duaEntry
+ *
+ * @param vDuaFk Id del dua a recalcular
+ */
+ DECLARE vDone BOOL DEFAULT FALSE;
DECLARE vInvoiceInFk INT;
- DECLARE rs CURSOR FOR
- SELECT invoiceInFk
+ DECLARE vInvoices CURSOR FOR
+ SELECT DISTINCT invoiceInFk
FROM entry e
JOIN duaEntry de ON de.entryFk = e.id
WHERE de.duaFk = vDuaFk;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
- OPEN rs;
+ OPEN vInvoices;
+ l: LOOP
+ SET vDone = FALSE;
+ FETCH vInvoices INTO vInvoiceInFk;
- FETCH rs INTO vInvoiceInFk;
-
- WHILE NOT done DO
+ IF vDone THEN
+ LEAVE l;
+ END IF;
CALL invoiceInTax_getFromEntries(vInvoiceInFk);
CALL invoiceInDueDay_calculate(vInvoiceInFk);
-
- FETCH rs INTO vInvoiceInFk;
-
- END WHILE;
-
- CLOSE rs;
+ END LOOP;
+ CLOSE vInvoices;
END$$
DELIMITER ;
diff --git a/db/routines/vn/procedures/invoiceInTax_getFromEntries.sql b/db/routines/vn/procedures/invoiceInTax_getFromEntries.sql
index 14cc43e15..5a53b7543 100644
--- a/db/routines/vn/procedures/invoiceInTax_getFromEntries.sql
+++ b/db/routines/vn/procedures/invoiceInTax_getFromEntries.sql
@@ -1,13 +1,22 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInTax_getFromEntries`(IN vId INT)
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInTax_getFromEntries`(IN vInvoiceInFk INT)
BEGIN
DECLARE vRate DOUBLE DEFAULT 1;
DECLARE vDated DATE;
DECLARE vExpenseFk VARCHAR(10);
+ DECLARE vIsBooked BOOLEAN DEFAULT FALSE;
+ SELECT isBooked INTO vIsBooked
+ FROM invoiceIn ii
+ WHERE id = vInvoiceInFk;
+
+ IF vIsBooked THEN
+ CALL util.throw('A booked invoice cannot be modified');
+ END IF;
+
SELECT MAX(rr.dated) INTO vDated
FROM referenceRate rr
- JOIN invoiceIn ii ON ii.id = vId
+ JOIN invoiceIn ii ON ii.id = vInvoiceInFk
WHERE rr.dated <= ii.issued
AND rr.currencyFk = ii.currencyFk ;
@@ -24,7 +33,7 @@ BEGIN
LIMIT 1;
DELETE FROM invoiceInTax
- WHERE invoiceInFk = vId;
+ WHERE invoiceInFk = vInvoiceInFk;
INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenseFk, foreignValue, taxTypeSageFk, transactionTypeSageFk)
SELECT ii.id,
@@ -39,7 +48,7 @@ BEGIN
JOIN buy b ON b.entryFk = e.id
LEFT JOIN referenceRate rr ON rr.currencyFk = ii.currencyFk
AND rr.dated = ii.issued
- WHERE ii.id = vId
+ WHERE ii.id = vInvoiceInFk
HAVING taxableBase IS NOT NULL;
END$$
DELIMITER ;
diff --git a/db/routines/vn/procedures/itemFuentesBalance.sql b/db/routines/vn/procedures/itemFuentesBalance.sql
index d793841ee..e60273340 100644
--- a/db/routines/vn/procedures/itemFuentesBalance.sql
+++ b/db/routines/vn/procedures/itemFuentesBalance.sql
@@ -50,31 +50,30 @@ BEGIN
) alb ON alb.itemFk = i.id
LEFT JOIN cache.stock v ON i.id = v.item_id AND v.warehouse_id = vWarehouseFk
LEFT JOIN (
- SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as venta
- FROM vn2008.item_out
- WHERE dat BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE()))
- AND warehouse_id = vWarehouseFk
- GROUP BY item_id
+ SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as venta
+ FROM itemTicketOut
+ WHERE shipped BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE()))
+ AND warehouseFk = vWarehouseFk
+ GROUP BY itemFk
) sale ON sale.item_id = i.id
LEFT JOIN (
- SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as compra
- FROM vn2008.item_entry_in
- WHERE dat BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE()))
- AND warehouse_id = vWarehouseFk
+ SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as compra
+ FROM itemEntryIn
+ WHERE landed BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE()))
+ AND warehouseInFk = vWarehouseFk
AND isVirtualStock = FALSE
- GROUP BY item_id
+ GROUP BY itemFk
) buy ON buy.item_id = i.id
LEFT JOIN (
- SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as traslado
- FROM vn2008.item_entry_out
- WHERE dat BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE()))
- AND warehouse_id = vWarehouseFk
- GROUP BY item_id
+ SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as traslado
+ FROM itemEntryOut
+ WHERE shipped BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE()))
+ AND warehouseOutFk = vWarehouseFk
+ GROUP BY itemFk
) mov ON mov.item_id = i.id
WHERE (v.amount OR fue.Fuentes OR alb.Albenfruit)
AND i.itemPackingTypeFk = 'H'
- AND ic.shortLife
- ;
+ AND ic.shortLife;
END$$
DELIMITER ;
diff --git a/db/routines/vn/procedures/itemProposal_Add.sql b/db/routines/vn/procedures/itemProposal_Add.sql
deleted file mode 100644
index 5a01cb67a..000000000
--- a/db/routines/vn/procedures/itemProposal_Add.sql
+++ /dev/null
@@ -1,70 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemProposal_Add`(vSaleFk INT, vMateFk INT, vQuantity INT)
-BEGIN
-/**
- * Añade un nuevo articulo para sustituir a otro, y actualiza la memoria de sustituciones.
- *
- * @param vSaleFk id de la tabla sale
- * @param vMateFk articulo sustituto
- * @ param vQuantity cantidad que se va a sustituir
- */
- DECLARE vTicketFk INT;
- DECLARE vItemFk INT;
- DECLARE vWarehouseFk SMALLINT;
- DECLARE vDate DATE;
- DECLARE vGrouping INT;
- DECLARE vBox INT;
- DECLARE vPacking INT;
- DECLARE vRoundQuantity INT DEFAULT 1;
-
- DECLARE EXIT HANDLER FOR SQLEXCEPTION
- BEGIN
- ROLLBACK;
- RESIGNAL;
- END;
-
- SELECT s.ticketFk, LEAST(s.quantity, vQuantity), s.itemFk,t.shipped,t.warehouseFk
- INTO vTicketFk, vQuantity, vItemFk,vDate,vWarehouseFk
- FROM sale s
- JOIN ticket t ON t.id = s.ticketFk
- WHERE s.id = vSaleFk;
-
- CALL buyUltimate(vWarehouseFk, vDate);
-
- SELECT `grouping`, groupingMode, packing INTO vGrouping, vBox, vPacking
- FROM buy b
- JOIN tmp.buyUltimate tmp ON b.id = tmp.buyFk
- WHERE tmp.itemFk = vMateFk AND tmp.WarehouseFk = vWarehouseFk;
-
- IF vBox = 2 AND vPacking > 0 THEN
- SET vRoundQuantity = vPacking;
- END IF;
- IF vBox = 1 AND vGrouping > 0 THEN
- SET vRoundQuantity = vGrouping;
- END IF;
-
- START TRANSACTION;
-
- UPDATE sale
- SET quantity = quantity - vQuantity
- WHERE id = vSaleFk;
-
- INSERT INTO sale(ticketFk, itemFk, quantity, concept)
- SELECT vTicketFk,
- vMateFk,
- CEIL(vQuantity / vRoundQuantity) * vRoundQuantity,
- CONCAT('+ ',i.longName)
- FROM item i
- WHERE id = vMateFk;
-
- SELECT LAST_INSERT_ID() INTO vSaleFk;
-
- CALL sale_calculateComponent(vSaleFk, NULL);
-
- INSERT INTO itemProposal(itemFk, mateFk, counter)
- VALUES(vItemFk, vMateFk, 1)
- ON DUPLICATE KEY UPDATE counter = counter + 1;
-
- COMMIT;
-END$$
-DELIMITER ;
\ No newline at end of file
diff --git a/db/routines/vn/procedures/itemShelvingRadar.sql b/db/routines/vn/procedures/itemShelvingRadar.sql
index c860d239e..c89a190ae 100644
--- a/db/routines/vn/procedures/itemShelvingRadar.sql
+++ b/db/routines/vn/procedures/itemShelvingRadar.sql
@@ -143,12 +143,12 @@ proc:BEGIN
CREATE TEMPORARY TABLE tmp.itemOutTime
SELECT *,SUM(amount) quantity
FROM
- (SELECT item_id itemFk,
- amount,
+ (SELECT io.itemFk,
+ io.quantity amount,
IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) as hours,
IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) as minutes
- FROM vn2008.item_out io
- JOIN tmp.itemShelvingRadar isr ON isr.itemFk = io.item_id
+ FROM itemTicketOut io
+ JOIN tmp.itemShelvingRadar isr ON isr.itemFk = io.itemFk
JOIN vn.ticket t on t.id= io.ticketFk
JOIN vn.ticketState ts on ts.ticketFk = io.ticketFk
JOIN vn.state s ON s.id = ts.stateFk
@@ -160,10 +160,10 @@ proc:BEGIN
) stPrevious ON `stPrevious`.`saleFk` = io.saleFk
WHERE t.warehouseFk = vWarehouseFk
AND s.isPicked = 0
- AND NOT io.Reservado
+ AND NOT io.reserved
AND stPrevious.saleFk IS NULL
- AND io.dat >= util.VN_CURDATE()
- AND io.dat < util.VN_CURDATE() + INTERVAL 1 DAY
+ AND io.shipped >= util.VN_CURDATE()
+ AND io.shipped < util.VN_CURDATE() + INTERVAL 1 DAY
) sub
GROUP BY itemFk, hours, minutes;
diff --git a/db/routines/vn/procedures/itemShelving_selfConsumption.sql b/db/routines/vn/procedures/itemShelving_selfConsumption.sql
index aa6c34199..c974d9903 100644
--- a/db/routines/vn/procedures/itemShelving_selfConsumption.sql
+++ b/db/routines/vn/procedures/itemShelving_selfConsumption.sql
@@ -20,20 +20,23 @@ BEGIN
DECLARE vCompanyFk INT;
DECLARE vAgencyModeFk INT;
DECLARE vItemShelvingFk INT;
+ DECLARE vAddressFk INT;
SELECT c.id,
pc.clientSelfConsumptionFk,
- s.warehouseFk
+ s.warehouseFk,
+ pc.addressSelfConsumptionFk
INTO vCompanyFk,
vClientFk,
- vWarehouseFk
+ vWarehouseFk,
+ vAddressFk
FROM company c
JOIN address a ON a.clientFk = c.clientFk
JOIN warehouse w ON w.addressFk = a.id
JOIN sector s ON s.warehouseFk = w.id
JOIN parking p ON p.sectorFk = s.id
JOIN shelving s2 ON s2.parkingFk = p.id
- JOIN productionConfig pc ON TRUE
+ JOIN productionConfig pc
WHERE s2.code = vShelvingFk;
IF vClientFk IS NULL THEN
@@ -65,7 +68,7 @@ BEGIN
vClientFk,
vWarehouseFk,
CURDATE(),
- NULL,
+ vAddressFk,
vCompanyFk,
NULL,
vTicketFk
diff --git a/db/routines/vn/procedures/item_getLack.sql b/db/routines/vn/procedures/item_getLack.sql
index b2e3e425c..e0531e2ac 100644
--- a/db/routines/vn/procedures/item_getLack.sql
+++ b/db/routines/vn/procedures/item_getLack.sql
@@ -23,7 +23,8 @@ BEGIN
SUM(IFNULL(sub.amount,0)) lack,
i.inkFk,
IFNULL(im.timed, util.midnight()) timed,
- IFNULL(izc.timed, util.midnight()) minTimed
+ IFNULL(izc.timed, util.midnight()) minTimed,
+ o.name originFk
FROM (SELECT item_id,
warehouse_id,
amount
@@ -42,6 +43,7 @@ BEGIN
JOIN itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN tmp.itemMinETD im ON im.itemFk = i.id
LEFT JOIN tmp.itemZoneClosure izc ON izc.itemFk = i.id
+ JOIN origin o ON o.id = i.originFk
WHERE w.isForTicket
AND ic.display
AND it.code != 'GEN'
diff --git a/db/routines/vn/procedures/sale_getBoxPickingList.sql b/db/routines/vn/procedures/sale_getBoxPickingList.sql
index 0f2b2bc71..84ae45614 100644
--- a/db/routines/vn/procedures/sale_getBoxPickingList.sql
+++ b/db/routines/vn/procedures/sale_getBoxPickingList.sql
@@ -17,7 +17,6 @@ BEGIN
CALL productionControl(vWarehouseFk, 0);
- -- Products with vn.item.isBoxPickingMode = TRUE, pay atention to vn.itemShelving.packing
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
(saleFk INT PRIMARY KEY)
SELECT
@@ -52,8 +51,8 @@ BEGIN
LEFT JOIN ticketState ts ON ts.ticketFk = s.ticketFk
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk
LEFT JOIN buy b ON b.id = lb.buy_id
- WHERE s.quantity BETWEEN ish.packing AND (ish.visible - IFNULL(tISS.reserve,0))
- AND i.isBoxPickingMode
+ WHERE IF(i.isBoxPickingMode, ish.packing, i.packingOut)
+ <= LEAST(s.quantity, ish.visible - IFNULL(tISS.reserve,0))
AND NOT pb.problem
AND sgd.saleFk IS NULL
AND p.sectorFk = vSectorFk
@@ -64,47 +63,13 @@ BEGIN
GROUP BY s.id
ORDER BY etd;
- -- Remaining products, vn.item.packingOut
- INSERT IGNORE INTO tmp.sale
- SELECT
- s.ticketFk,
- s.id saleFk,
- s.itemFk,
- s.concept,
- s.quantity,
- MAKETIME(pb.HH,pb.mm,0) etd,
- pb.routeFk,
- s.quantity / i.packingOut stickers,
- i.packingOut,
- pc.defaultBigPackageFk
- FROM sale s
- JOIN item i ON i.id = s.itemFk
- JOIN itemShelving ish ON ish.itemFk = s.itemFk
- JOIN shelving sh ON sh.code = ish.shelvingFk
- JOIN parking p ON p.id = sh.parkingFk
- JOIN tmp.productionBuffer pb ON pb.ticketFk = s.ticketFk
- JOIN agencyMode am ON am.id = pb.agencyModeFk
- JOIN packagingConfig pc
- LEFT JOIN routesMonitor rm ON rm.routeFk = pb.routeFk
- LEFT JOIN itemShelvingStock iss ON iss.itemFk = s.itemFk AND iss.sectorFk = p.sectorFk
- LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = s.id
- LEFT JOIN ticketState ts ON ts.ticketFk = s.ticketFk
- WHERE s.quantity >= i.packingOut
- AND NOT pb.problem
- AND s.quantity > 0
- AND sgd.saleFk IS NULL
- AND p.sectorFk = vSectorFk
- AND ts.isPreviousPreparable
- AND iss.visible >= s.quantity
- AND ((rm.bufferFk AND rm.isPickingAllowed)
- OR am.code = 'REC_ALG')
- AND pb.shipped = vDated
- GROUP BY s.id
- ORDER BY etd;
-
- SELECT * FROM tmp.sale;
+ SELECT *
+ FROM tmp.sale
+ WHERE stickers;
DROP TEMPORARY TABLE tmp.productionBuffer;
DROP TEMPORARY TABLE tmp.sale;
END$$
DELIMITER ;
+
+CALL `vn`.`sale_getBoxPickingList`(1, curdate());
\ No newline at end of file
diff --git a/db/routines/vn/procedures/shelving_getSpam.sql b/db/routines/vn/procedures/shelving_getSpam.sql
index eccbfb9a4..2895470ad 100644
--- a/db/routines/vn/procedures/shelving_getSpam.sql
+++ b/db/routines/vn/procedures/shelving_getSpam.sql
@@ -34,26 +34,26 @@ BEGIN
) fue ON fue.itemFk = i.id
LEFT JOIN cache.stock v ON i.id = v.item_id AND v.warehouse_id = vWarehouseFk
LEFT JOIN (
- SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as venta
- FROM vn2008.item_out
- WHERE dat BETWEEN util.VN_CURDATE() AND util.dayend(vDated)
- AND warehouse_id = vWarehouseFk
- GROUP BY item_id
+ SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as venta
+ FROM itemTicketOut
+ WHERE shipped BETWEEN util.VN_CURDATE() AND util.dayend(vDated)
+ AND warehouseFk = vWarehouseFk
+ GROUP BY itemFk
) sale ON sale.item_id = i.id
LEFT JOIN (
- SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as compra
- FROM vn2008.item_entry_in
- WHERE dat BETWEEN util.VN_CURDATE() AND util.dayend(vDated)
- AND warehouse_id = vWarehouseFk
+ SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as compra
+ FROM itemEntryIn
+ WHERE landed BETWEEN util.VN_CURDATE() AND util.dayend(vDated)
+ AND warehouseInFk = vWarehouseFk
AND isVirtualStock = FALSE
- GROUP BY item_id
+ GROUP BY itemFk
) buy ON buy.item_id = i.id
LEFT JOIN (
- SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as traslado
- FROM vn2008.item_entry_out
- WHERE dat BETWEEN util.VN_CURDATE() AND util.dayend(vDated)
- AND warehouse_id = vWarehouseFk
- GROUP BY item_id
+ SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as traslado
+ FROM itemEntryOut
+ WHERE shipped BETWEEN util.VN_CURDATE() AND util.dayend(vDated)
+ AND warehouseOutFk = vWarehouseFk
+ GROUP BY itemFk
) mov ON mov.item_id = i.id
WHERE v.amount;
diff --git a/db/routines/vn/procedures/supplier_statement.sql b/db/routines/vn/procedures/supplier_statement.sql
new file mode 100644
index 000000000..406286e9d
--- /dev/null
+++ b/db/routines/vn/procedures/supplier_statement.sql
@@ -0,0 +1,139 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`supplier_statement`(
+ vSupplierFk INT,
+ vCurrencyFk INT,
+ vCompanyFk INT,
+ vOrderBy VARCHAR(15),
+ vIsConciliated BOOL
+)
+BEGIN
+/**
+ * Crea un estado de cuenta de proveedores calculando
+ * los saldos en euros y en la moneda especificada.
+ *
+ * @param vSupplierFk Id del proveedor
+ * @param vCurrencyFk Id de la moneda
+ * @param vCompanyFk Id de la empresa
+ * @param vOrderBy Criterio de ordenación
+ * @param vIsConciliated Indica si está conciliado o no
+ * @return tmp.supplierStatement
+ */
+ SET @euroBalance:= 0;
+ SET @currencyBalance:= 0;
+
+ CREATE OR REPLACE TEMPORARY TABLE tmp.supplierStatement
+ ENGINE = MEMORY
+ SELECT *,
+ @euroBalance:= ROUND(
+ @euroBalance + IFNULL(paymentEuros, 0) -
+ IFNULL(invoiceEuros, 0), 2
+ ) euroBalance,
+ @currencyBalance:= ROUND(
+ @currencyBalance + IFNULL(paymentCurrency, 0) -
+ IFNULL(invoiceCurrency, 0), 2
+ ) currencyBalance
+ FROM (
+ SELECT * FROM
+ (
+ SELECT NULL bankFk,
+ ii.companyFk,
+ ii.serial,
+ ii.id,
+ CASE
+ WHEN vOrderBy = 'issued' THEN ii.issued
+ WHEN vOrderBy = 'bookEntried' THEN ii.bookEntried
+ WHEN vOrderBy = 'booked' THEN ii.booked
+ WHEN vOrderBy = 'dueDate' THEN iid.dueDated
+ END dated,
+ CONCAT('S/Fra ', ii.supplierRef) sref,
+ IF(ii.currencyFk > 1,
+ ROUND(SUM(iid.foreignValue) / SUM(iid.amount), 3),
+ NULL
+ ) changeValue,
+ CAST(SUM(iid.amount) AS DECIMAL(10,2)) invoiceEuros,
+ CAST(SUM(iid.foreignValue) AS DECIMAL(10,2)) invoiceCurrency,
+ NULL paymentEuros,
+ NULL paymentCurrency,
+ ii.currencyFk,
+ ii.isBooked,
+ c.code,
+ 'invoiceIn' statementType
+ FROM invoiceIn ii
+ JOIN invoiceInDueDay iid ON iid.invoiceInFk = ii.id
+ JOIN currency c ON c.id = ii.currencyFk
+ WHERE ii.issued > '2014-12-31'
+ AND ii.supplierFk = vSupplierFk
+ AND vCurrencyFk IN (ii.currencyFk, 0)
+ AND vCompanyFk IN (ii.companyFk, 0)
+ AND (vIsConciliated = ii.isBooked OR NOT vIsConciliated)
+ GROUP BY iid.id
+ UNION ALL
+ SELECT p.bankFk,
+ p.companyFk,
+ NULL,
+ p.id,
+ CASE
+ WHEN vOrderBy = 'issued' THEN p.received
+ WHEN vOrderBy = 'bookEntried' THEN p.received
+ WHEN vOrderBy = 'booked' THEN p.received
+ WHEN vOrderBy = 'dueDate' THEN p.dueDated
+ END,
+ CONCAT(IFNULL(pm.name, ''),
+ IF(pn.concept <> '',
+ CONCAT(' : ', pn.concept),
+ '')
+ ),
+ IF(p.currencyFk > 1, p.divisa / p.amount, NULL),
+ NULL,
+ NULL,
+ p.amount,
+ p.divisa,
+ p.currencyFk,
+ p.isConciliated,
+ c.code,
+ 'payment'
+ FROM payment p
+ LEFT JOIN currency c ON c.id = p.currencyFk
+ LEFT JOIN bank b ON b.id = p.bankFk
+ LEFT JOIN payMethod pm ON pm.id = p.payMethodFk
+ LEFT JOIN promissoryNote pn ON pn.paymentFk = p.id
+ WHERE p.received > '2014-12-31'
+ AND p.supplierFk = vSupplierFk
+ AND vCurrencyFk IN (p.currencyFk, 0)
+ AND vCompanyFk IN (p.companyFk, 0)
+ AND (vIsConciliated = p.isConciliated OR NOT vIsConciliated)
+ UNION ALL
+ SELECT NULL,
+ companyFk,
+ NULL,
+ se.id,
+ CASE
+ WHEN vOrderBy = 'issued' THEN se.dated
+ WHEN vOrderBy = 'bookEntried' THEN se.dated
+ WHEN vOrderBy = 'booked' THEN se.dated
+ WHEN vOrderBy = 'dueDate' THEN se.dueDated
+ END,
+ se.description,
+ 1,
+ amount,
+ NULL,
+ NULL,
+ NULL,
+ currencyFk,
+ isConciliated,
+ c.`code`,
+ 'expense'
+ FROM supplierExpense se
+ JOIN currency c ON c.id = se.currencyFk
+ WHERE se.supplierFk = vSupplierFk
+ AND vCurrencyFk IN (se.currencyFk,0)
+ AND vCompanyFk IN (se.companyFk,0)
+ AND (vIsConciliated = se.isConciliated OR NOT vIsConciliated)
+ ) sub
+ ORDER BY (dated IS NULL AND NOT isBooked),
+ dated,
+ IF(vOrderBy = 'dueDate', id, NULL)
+ LIMIT 10000000000000000000
+ ) t;
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/procedures/test.sql b/db/routines/vn/procedures/test.sql
deleted file mode 100644
index 69340291d..000000000
--- a/db/routines/vn/procedures/test.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`test`()
-BEGIN
-select 'procedimiento ejecutado con éxito';
-END$$
-DELIMITER ;
diff --git a/db/routines/vn/procedures/ticket_getMovable.sql b/db/routines/vn/procedures/ticket_getMovable.sql
index b69fa220a..eee165538 100644
--- a/db/routines/vn/procedures/ticket_getMovable.sql
+++ b/db/routines/vn/procedures/ticket_getMovable.sql
@@ -1,44 +1,55 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getMovable`(vTicketFk INT, vDatedNew DATETIME, vWarehouseFk INT)
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getMovable`(
+ vTicketFk INT,
+ vNewShipped DATETIME,
+ vWarehouseFk INT
+)
BEGIN
/**
* Cálcula el stock movible para los artículos de un ticket
- * vDatedNew debe ser menor que vDatedOld, en los otros casos se
+ * vNewShipped debe ser menor que vOldShipped, en los otros casos se
* asume que siempre es posible
*
* @param vTicketFk -> Ticket
- * @param vDatedNew -> Nueva fecha
+ * @param vNewShipped -> Nueva fecha
* @return Sales con Movible
-*/
- DECLARE vDatedOld DATETIME;
- SET vDatedNew = DATE_ADD(vDatedNew, INTERVAL 1 DAY);
+*/
+ DECLARE vOldShipped DATETIME;
- SELECT t.shipped INTO vDatedOld
- FROM ticket t
+ SELECT t.shipped INTO vOldShipped
+ FROM ticket t
WHERE t.id = vTicketFk;
- CALL item_getStock(vWarehouseFk, vDatedNew, NULL);
- CALL item_getMinacum(vWarehouseFk, vDatedNew, DATEDIFF(DATE_SUB(vDatedOld, INTERVAL 1 DAY), vDatedNew), NULL);
-
- SELECT s.id,
- s.itemFk,
- s.quantity,
- s.concept,
- s.price,
+ -- Añadimos un dia más para calcular el stock hasta vNewShipped inclusive
+ CALL item_getStock(vWarehouseFk, DATE_ADD(vNewShipped, INTERVAL 1 DAY), NULL);
+ CALL item_getMinacum(
+ vWarehouseFk,
+ vNewShipped,
+ DATEDIFF(DATE_SUB(vOldShipped, INTERVAL 1 DAY), vNewShipped),
+ NULL
+ );
+
+ SELECT s.id,
+ s.itemFk,
+ s.quantity,
+ s.concept,
+ s.price,
s.reserved,
- s.discount,
- i.image,
- i.subName,
+ s.discount,
+ i.image,
+ i.subName,
il.stock + IFNULL(im.amount, 0) AS movable
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
- JOIN item i ON i.id = s.itemFk
- LEFT JOIN tmp.itemMinacum im ON im.itemFk = s.itemFk AND im.warehouseFk = vWarehouseFk
+ JOIN item i ON i.id = s.itemFk
+ LEFT JOIN tmp.itemMinacum im ON im.itemFk = s.itemFk
+ AND im.warehouseFk = vWarehouseFk
LEFT JOIN tmp.itemList il ON il.itemFk = s.itemFk
WHERE t.id = vTicketFk;
- DROP TEMPORARY TABLE IF EXISTS tmp.itemList;
- DROP TEMPORARY TABLE IF EXISTS tmp.itemMinacum;
-
+ DROP TEMPORARY TABLE IF EXISTS
+ tmp.itemList,
+ tmp.itemMinacum;
+
END$$
DELIMITER ;
diff --git a/db/routines/vn/procedures/travel_cloneWithEntries.sql b/db/routines/vn/procedures/travel_cloneWithEntries.sql
index 840152c44..7cf9ee5ef 100644
--- a/db/routines/vn/procedures/travel_cloneWithEntries.sql
+++ b/db/routines/vn/procedures/travel_cloneWithEntries.sql
@@ -1,21 +1,20 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_cloneWithEntries`(
- IN vTravelFk INT,
- IN vDateStart DATE,
+ IN vTravelFk INT,
+ IN vDateStart DATE,
IN vDateEnd DATE,
IN vWarehouseOutFk INT,
- IN vWarehouseInFk INT,
- IN vRef VARCHAR(255),
- IN vAgencyModeFk INT,
+ IN vWarehouseInFk INT,
+ IN vRef VARCHAR(255),
+ IN vAgencyModeFk INT,
OUT vNewTravelFk INT)
BEGIN
/**
* Clona un travel junto con sus entradas y compras
- *
* @param vTravelFk travel plantilla a clonar
* @param vDateStart fecha del shipment del nuevo travel
* @param vDateEnd fecha del landing del nuevo travel
- * @param vWarehouseOutFk fecha del salida del nuevo travel
+ * @param vWarehouseOutFk warehouse del salida del nuevo travel
* @param vWarehouseInFk warehouse de landing del nuevo travel
* @param vRef referencia del nuevo travel
* @param vAgencyModeFk del nuevo travel
@@ -25,34 +24,35 @@ BEGIN
DECLARE vEvaNotes VARCHAR(255);
DECLARE vDone BOOL;
DECLARE vAuxEntryFk INT;
+ DECLARE vTx BOOLEAN DEFAULT @@in_transaction;
DECLARE vRsEntry CURSOR FOR
SELECT e.id
FROM entry e
JOIN travel t ON t.id = e.travelFk
WHERE e.travelFk = vTravelFk;
-
+
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
- BEGIN
- ROLLBACK;
+ BEGIN
+ CALL util.tx_rollback(vTx);
RESIGNAL;
END;
-
- START TRANSACTION;
+
+ CALL util.tx_start(vTx);
INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, `ref`, isDelivered, isReceived, m3, cargoSupplierFk, kg,clonedFrom)
SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3,cargoSupplierFk, kg,vTravelFk
FROM travel
WHERE id = vTravelFk;
-
+
SET vNewTravelFk = LAST_INSERT_ID();
SET vDone = FALSE;
SET @isModeInventory = TRUE;
OPEN vRsEntry;
-
+
l: LOOP
SET vDone = FALSE;
FETCH vRsEntry INTO vAuxEntryFk;
@@ -62,7 +62,7 @@ BEGIN
END IF;
CALL entry_cloneHeader(vAuxEntryFk, vNewEntryFk, vNewTravelFk);
- CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk);
+ CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk);
SELECT evaNotes INTO vEvaNotes
FROM entry
@@ -76,6 +76,6 @@ BEGIN
SET @isModeInventory = FALSE;
CLOSE vRsEntry;
- COMMIT;
+ CALL util.tx_commit(vTx);
END$$
DELIMITER ;
diff --git a/db/routines/vn/procedures/travel_getDetailFromContinent.sql b/db/routines/vn/procedures/travel_getDetailFromContinent.sql
new file mode 100644
index 000000000..e81e648b3
--- /dev/null
+++ b/db/routines/vn/procedures/travel_getDetailFromContinent.sql
@@ -0,0 +1,109 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_getDetailFromContinent`(
+ vContinentFk INT
+)
+BEGIN
+/**
+ * Devuelve los detalles de los vuelos que tienen
+ * un almacén de salida de un continente.
+ *
+ * @param vContinentFk Id de continente
+ */
+ DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL 12 WEEK;
+ SELECT IFNULL(CONCAT(" ", entryFk), travelFk) travelAndEntry,
+ sub.*
+ FROM (
+ SELECT tr.id travelFk,
+ NULL entryFk,
+ TRUE isTravel,
+ am.name agency,
+ tr.ref,
+ tr.shipped,
+ wOut.name originBoxes,
+ tr.landed,
+ wIn.name destination,
+ SUM(b.stickers) stickers,
+ NULL evaNotes,
+ tr.kg,
+ CAST(SUM(b.weight * b.stickers) AS INT) loadedkg,
+ CAST(
+ SUM(vc.aerealVolumetricDensity *
+ b.stickers *
+ IF(p.volume,
+ p.volume,
+ p.width * p.depth * p.height
+ ) / 1000000
+ ) AS INT
+ ) volumeKg,
+ NULL loadPriority,
+ NULL invoiceAmount,
+ s.nickname freighter,
+ NULL reference
+ FROM travel tr
+ LEFT JOIN supplier s ON s.id = tr.cargoSupplierFk
+ LEFT JOIN entry e ON e.travelFk = tr.id
+ LEFT JOIN buy b ON b.entryFk = e.id
+ LEFT JOIN packaging p ON p.id = b.packagingFk
+ LEFT JOIN item i ON i.id = b.itemFk
+ LEFT JOIN itemType it ON it.id = i.typeFk
+ JOIN warehouse wIn ON wIn.id = tr.warehouseInFk
+ JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk
+ JOIN country co ON co.id = wOut.countryFk
+ JOIN agencyMode am ON am.id = tr.agencyModeFk
+ JOIN volumeConfig vc
+ WHERE tr.landed >= vDateFrom
+ AND co.continentFk = vContinentFk
+ GROUP BY tr.id
+ UNION ALL
+ SELECT e.travelFk,
+ e.id,
+ FALSE,
+ s.name,
+ e.invoiceNumber,
+ tr.shipped,
+ wOut.name,
+ tr.landed,
+ wIn.name,
+ SUM(b.stickers),
+ e.evaNotes,
+ NULL,
+ CAST(SUM(b.weight * b.stickers) AS INT),
+ CAST(
+ SUM(vc.aerealVolumetricDensity *
+ b.stickers *
+ IF(p.volume,
+ p.volume,
+ p.width * p.depth * p.height
+ ) / 1000000
+ ) AS INT
+ ),
+ loadPriority,
+ e.invoiceAmount,
+ s2.nickname,
+ e.reference
+ FROM entry e
+ JOIN buy b ON b.entryFk = e.id
+ JOIN packaging p ON p.id = b.packagingFk
+ JOIN item i ON i.id = b.itemFk
+ JOIN itemType it ON it.id = i.typeFk
+ JOIN supplier s ON s.id = e.supplierFk
+ JOIN travel tr ON tr.id = e.travelFk
+ LEFT JOIN supplier s2 ON s2.id = tr.cargoSupplierFk
+ JOIN warehouse wIn ON wIn.id = tr.warehouseInFk
+ JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk
+ JOIN country co ON co.id = wOut.countryFk
+ JOIN volumeConfig vc
+ WHERE tr.landed >= vDateFrom
+ AND co.continentFk = vContinentFk
+ GROUP BY e.id
+ ) sub
+ ORDER BY landed ASC,
+ shipped ASC,
+ travelFk,
+ isTravel DESC,
+ (loadPriority > 0) DESC,
+ loadPriority,
+ agency,
+ evaNotes;
+END$$
+DELIMITER ;
\ No newline at end of file
diff --git a/db/routines/vn/triggers/budgetNotes_BeforeInsert.sql b/db/routines/vn/triggers/budgetNotes_beforeInsert.sql
similarity index 91%
rename from db/routines/vn/triggers/budgetNotes_BeforeInsert.sql
rename to db/routines/vn/triggers/budgetNotes_beforeInsert.sql
index f75b7a01e..6ea5ad5eb 100644
--- a/db/routines/vn/triggers/budgetNotes_BeforeInsert.sql
+++ b/db/routines/vn/triggers/budgetNotes_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`budgetNotes_BeforeInsert`
+CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`budgetNotes_beforeInsert`
BEFORE INSERT ON `budgetNotes`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/calendar_afterDelete.sql b/db/routines/vn/triggers/calendar_afterDelete.sql
index acd2c55b7..5d0114ea8 100644
--- a/db/routines/vn/triggers/calendar_afterDelete.sql
+++ b/db/routines/vn/triggers/calendar_afterDelete.sql
@@ -1,12 +1,12 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`calendar_afterDelete`
- AFTER DELETE ON `calendar`
- FOR EACH ROW
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`calendar_afterDelete`
+ AFTER DELETE ON `calendar`
+ FOR EACH ROW
BEGIN
INSERT INTO workerLog
SET `action` = 'delete',
`changedModel` = 'Calendar',
`changedModelId` = OLD.id,
`userFk` = account.myUser_getId();
-END$$
-DELIMITER ;
\ No newline at end of file
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/calendar_beforeInsert.sql b/db/routines/vn/triggers/calendar_beforeInsert.sql
index 9e51e6d18..3e265a099 100644
--- a/db/routines/vn/triggers/calendar_beforeInsert.sql
+++ b/db/routines/vn/triggers/calendar_beforeInsert.sql
@@ -5,4 +5,4 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`calendar_beforeInsert
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
-DELIMITER ;
\ No newline at end of file
+DELIMITER ;
diff --git a/db/routines/vn/triggers/calendar_beforeUpdate.sql b/db/routines/vn/triggers/calendar_beforeUpdate.sql
index bb1ba53c3..f015dc29a 100644
--- a/db/routines/vn/triggers/calendar_beforeUpdate.sql
+++ b/db/routines/vn/triggers/calendar_beforeUpdate.sql
@@ -1,8 +1,8 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`calendar_beforeUpdate`
- BEFORE UPDATE ON `calendar`
- FOR EACH ROW
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`calendar_beforeUpdate`
+ BEFORE UPDATE ON `calendar`
+ FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
-END$$
-DELIMITER ;
\ No newline at end of file
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/clientCredit_AfterInsert.sql b/db/routines/vn/triggers/clientCredit_afterInsert.sql
similarity index 100%
rename from db/routines/vn/triggers/clientCredit_AfterInsert.sql
rename to db/routines/vn/triggers/clientCredit_afterInsert.sql
diff --git a/db/routines/vn/triggers/client_AfterInsert.sql b/db/routines/vn/triggers/client_afterInsert.sql
similarity index 100%
rename from db/routines/vn/triggers/client_AfterInsert.sql
rename to db/routines/vn/triggers/client_afterInsert.sql
diff --git a/db/routines/vn/triggers/expeditionState_AfterInsert.sql b/db/routines/vn/triggers/expeditionState_afterInsert.sql
similarity index 100%
rename from db/routines/vn/triggers/expeditionState_AfterInsert.sql
rename to db/routines/vn/triggers/expeditionState_afterInsert.sql
diff --git a/db/routines/vn/triggers/expeditionState_BeforeInsert.sql b/db/routines/vn/triggers/expeditionState_beforeInsert.sql
similarity index 100%
rename from db/routines/vn/triggers/expeditionState_BeforeInsert.sql
rename to db/routines/vn/triggers/expeditionState_beforeInsert.sql
diff --git a/db/routines/vn/triggers/projectNotes_BeforeInsert.sql b/db/routines/vn/triggers/projectNotes_beforeInsert.sql
similarity index 100%
rename from db/routines/vn/triggers/projectNotes_BeforeInsert.sql
rename to db/routines/vn/triggers/projectNotes_beforeInsert.sql
diff --git a/db/routines/vn/triggers/saleGroup_beforeInser.sql b/db/routines/vn/triggers/saleGroup_beforeInsert.sql
similarity index 100%
rename from db/routines/vn/triggers/saleGroup_beforeInser.sql
rename to db/routines/vn/triggers/saleGroup_beforeInsert.sql
diff --git a/db/routines/vn/triggers/ticket_beforeUpdate.sql b/db/routines/vn/triggers/ticket_beforeUpdate.sql
index 0836b2486..72831bc3d 100644
--- a/db/routines/vn/triggers/ticket_beforeUpdate.sql
+++ b/db/routines/vn/triggers/ticket_beforeUpdate.sql
@@ -4,7 +4,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticket_beforeUpdate`
FOR EACH ROW
BEGIN
DECLARE vNewTime TIME;
- DECLARE vHasTicketRefund BOOL;
SET NEW.editorFk = account.myUser_getId();
@@ -64,14 +63,5 @@ BEGIN
CALL vn.routeUpdateM3(NEW.routeFk);
END IF;
-
- SELECT COUNT(*) INTO vHasTicketRefund
- FROM ticketRefund
- WHERE originalTicketFk = NEW.id
- OR refundTicketFk = NEW.id;
-
- IF vHasTicketRefund AND NEW.clientFk <> OLD.clientFk THEN
- CALL util.throw('The ticket has a refund associated');
- END IF;
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/workerTimeControl_afterDelete.sql b/db/routines/vn/triggers/workerTimeControl_afterDelete.sql
index 6f0f00dbf..19653c913 100644
--- a/db/routines/vn/triggers/workerTimeControl_afterDelete.sql
+++ b/db/routines/vn/triggers/workerTimeControl_afterDelete.sql
@@ -1,12 +1,12 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerTimeControl_afterDelete`
- AFTER DELETE ON `workerTimeControl`
- FOR EACH ROW
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerTimeControl_afterDelete`
+ AFTER DELETE ON `workerTimeControl`
+ FOR EACH ROW
BEGIN
INSERT INTO workerLog
SET `action` = 'delete',
`changedModel` = 'WorkerTimeControl',
`changedModelId` = OLD.id,
`userFk` = account.myUser_getId();
-END$$
-DELIMITER ;
\ No newline at end of file
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/workerTimeControl_beforeInsert.sql b/db/routines/vn/triggers/workerTimeControl_beforeInsert.sql
index a899b879a..ad7acb784 100644
--- a/db/routines/vn/triggers/workerTimeControl_beforeInsert.sql
+++ b/db/routines/vn/triggers/workerTimeControl_beforeInsert.sql
@@ -1,8 +1,8 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerTimeControl_beforeInsert`
- BEFORE INSERT ON `workerTimeControl`
- FOR EACH ROW
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerTimeControl_beforeInsert`
+ BEFORE INSERT ON `workerTimeControl`
+ FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
-END$$
-DELIMITER ;
\ No newline at end of file
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/workerTimeControl_beforeUpdate.sql b/db/routines/vn/triggers/workerTimeControl_beforeUpdate.sql
index 969e08711..bb391ad61 100644
--- a/db/routines/vn/triggers/workerTimeControl_beforeUpdate.sql
+++ b/db/routines/vn/triggers/workerTimeControl_beforeUpdate.sql
@@ -1,8 +1,8 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerTimeControl_beforeUpdate`
- BEFORE UPDATE ON `workerTimeControl`
- FOR EACH ROW
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerTimeControl_beforeUpdate`
+ BEFORE UPDATE ON `workerTimeControl`
+ FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
-END$$
-DELIMITER ;
\ No newline at end of file
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/views/__coolerPathDetail.sql b/db/routines/vn/views/__coolerPathDetail.sql
deleted file mode 100644
index 375d9e2d0..000000000
--- a/db/routines/vn/views/__coolerPathDetail.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn`.`__coolerPathDetail`
-AS SELECT `c`.`cooler_path_detail_id` AS `id`,
- `c`.`cooler_path_id` AS `coolerPathFk`,
- `c`.`pasillo` AS `hallway`
-FROM `vn2008`.`cooler_path_detail` `c`
diff --git a/db/routines/vn/views/agencyWarehouse.sql b/db/routines/vn/views/agencyWarehouse.sql
deleted file mode 100644
index 6cb174544..000000000
--- a/db/routines/vn/views/agencyWarehouse.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn`.`agencyWarehouse`
-AS SELECT `a`.`agency_id` AS `agencyFk`,
- `a`.`warehouse_id` AS `warehouseFk`,
- `a`.`Vista` AS `agencyType`
-FROM `vn2008`.`agency_warehouse` `a`
diff --git a/db/routines/vn/views/awbVolume.sql b/db/routines/vn/views/awbVolume.sql
index 2c77973ca..df3b1ed1a 100644
--- a/db/routines/vn/views/awbVolume.sql
+++ b/db/routines/vn/views/awbVolume.sql
@@ -28,4 +28,4 @@ FROM (
JOIN `vn`.`volumeConfig` `vc`
)
WHERE `t`.`shipped` > makedate(year(`util`.`VN_CURDATE`()) - 1, 1)
- AND t.awbFk
\ No newline at end of file
+ AND `t`.`awbFk` <> 0
diff --git a/db/routines/vn/views/clientDefaultCompany.sql b/db/routines/vn/views/clientDefaultCompany.sql
deleted file mode 100644
index 6af418a1a..000000000
--- a/db/routines/vn/views/clientDefaultCompany.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn`.`clientDefaultCompany`
-AS SELECT `t`.`Id_Clientes_empresa` AS `id`,
- `t`.`Id_Cliente` AS `clientFk`,
- `t`.`empresa_id` AS `companyFk`,
- `t`.`fecha_ini` AS `started`,
- `t`.`fecha_fin` AS `finished`
-FROM `vn2008`.`Clientes_empresa` `t`
diff --git a/db/routines/vn/views/coolerPath.sql b/db/routines/vn/views/coolerPath.sql
deleted file mode 100644
index 6be11e557..000000000
--- a/db/routines/vn/views/coolerPath.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn`.`coolerPath`
-AS SELECT `c`.`cooler_path_id` AS `id`,
- `c`.`description` AS `description`
-FROM `vn2008`.`cooler_path` `c`
diff --git a/db/routines/vn/views/expeditionPallet_Print.sql b/db/routines/vn/views/expeditionPallet_Print.sql
index 4e9e8cb0e..07627e817 100644
--- a/db/routines/vn/views/expeditionPallet_Print.sql
+++ b/db/routines/vn/views/expeditionPallet_Print.sql
@@ -9,7 +9,7 @@ AS SELECT `et2`.`description` AS `truck`,
`et`.`id` <=> `rm`.`expeditionTruckFk` AS `isMatch`,
`t`.`warehouseFk` AS `warehouseFk`,
IF(
- `r`.`created` > util.VN_CURDATE() + INTERVAL 1 DAY,
+ `r`.`created` > `util`.`VN_CURDATE`() + INTERVAL 1 DAY,
ucase(dayname(`r`.`created`)),
NULL
) AS `nombreDia`
diff --git a/db/routines/vn/views/grantGroup.sql b/db/routines/vn/views/grantGroup.sql
deleted file mode 100644
index 267c3154e..000000000
--- a/db/routines/vn/views/grantGroup.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn`.`grantGroup`
-AS SELECT `vn2008`.`Grupos`.`id` AS `id`,
- `vn2008`.`Grupos`.`Grupo` AS `description`,
- `vn2008`.`Grupos`.`observation_type_id` AS `observationTypeFk`
-FROM `vn2008`.`Grupos`
diff --git a/db/routines/vn/views/itemShelvingAvailable.sql b/db/routines/vn/views/itemShelvingAvailable.sql
index ee4ef62b6..868d6a963 100644
--- a/db/routines/vn/views/itemShelvingAvailable.sql
+++ b/db/routines/vn/views/itemShelvingAvailable.sql
@@ -1,7 +1,7 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`itemShelvingAvailable`
-AS SELECT `s`.`id` `saleFk`,
+AS SELECT `s`.`id` AS `saleFk`,
`tst`.`updated` AS `Modificado`,
`s`.`ticketFk` AS `ticketFk`,
0 AS `isPicked`,
diff --git a/db/routines/vn/views/ticketStateToday.sql b/db/routines/vn/views/ticketStateToday.sql
index 2ee65b7c2..1f10aceb1 100644
--- a/db/routines/vn/views/ticketStateToday.sql
+++ b/db/routines/vn/views/ticketStateToday.sql
@@ -1,8 +1,7 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`ticketStateToday`
-AS SELECT
- `ts`.`ticketFk` AS `ticketFk`,
+AS SELECT `ts`.`ticketFk` AS `ticketFk`,
`ts`.`state` AS `state`,
`ts`.`productionOrder` AS `productionOrder`,
`ts`.`alertLevel` AS `alertLevel`,
@@ -10,6 +9,8 @@ AS SELECT
`ts`.`code` AS `code`,
`ts`.`updated` AS `updated`,
`ts`.`isPicked` AS `isPicked`
-FROM `ticketState` `ts`
- JOIN `ticket` `t` ON `t`.`id` = `ts`.`ticketFk`
-WHERE `t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `MIDNIGHT`(`util`.`VN_CURDATE`());
+FROM (
+ `vn`.`ticketState` `ts`
+ JOIN `vn`.`ticket` `t` ON(`t`.`id` = `ts`.`ticketFk`)
+ )
+WHERE `t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `MIDNIGHT`(`util`.`VN_CURDATE`())
diff --git a/db/routines/vn/views/zoneEstimatedDelivery.sql b/db/routines/vn/views/zoneEstimatedDelivery.sql
index c04f3fbd5..90c7381d8 100644
--- a/db/routines/vn/views/zoneEstimatedDelivery.sql
+++ b/db/routines/vn/views/zoneEstimatedDelivery.sql
@@ -1,24 +1,45 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`zoneEstimatedDelivery`
- AS SELECT t.zoneFk,
- zc.`hour` zoneClosureHour,
- z.`hour` zoneHour,
- sv.volume volume,
- al.hasToRecalcPrice,
- lhp.m3,
- dl.minSpeed
- FROM ticket t
- JOIN ticketStateToday tst ON tst.ticketFk = t.id
- JOIN state s ON s.id = tst.state
- JOIN saleVolume sv ON sv.ticketFk = t.id
- LEFT JOIN lastHourProduction lhp ON lhp.warehouseFk = t.warehouseFk
- JOIN warehouse w ON w.id = t.warehouseFk
- STRAIGHT_JOIN `zone` z ON z.id = t.zoneFk
- LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
- AND zc.dated = util.VN_CURDATE()
- LEFT JOIN cache.departure_limit dl ON dl.warehouse_id = t.warehouseFk
- AND dl.fecha = util.VN_CURDATE()
- JOIN alertLevel al ON al.id = s.alertLevel
- WHERE w.hasProduction
- AND DATE(t.shipped) = util.VN_CURDATE()
+AS SELECT `t`.`zoneFk` AS `zoneFk`,
+ `zc`.`hour` AS `zoneClosureHour`,
+ `z`.`hour` AS `zoneHour`,
+ `sv`.`volume` AS `volume`,
+ `al`.`hasToRecalcPrice` AS `hasToRecalcPrice`,
+ `lhp`.`m3` AS `m3`,
+ `dl`.`minSpeed` AS `minSpeed`
+FROM (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ `vn`.`ticket` `t`
+ JOIN `vn`.`ticketStateToday` `tst` ON(`tst`.`ticketFk` = `t`.`id`)
+ )
+ JOIN `vn`.`state` `s` ON(`s`.`id` = `tst`.`state`)
+ )
+ JOIN `vn`.`saleVolume` `sv` ON(`sv`.`ticketFk` = `t`.`id`)
+ )
+ LEFT JOIN `vn`.`lastHourProduction` `lhp` ON(`lhp`.`warehouseFk` = `t`.`warehouseFk`)
+ )
+ JOIN `vn`.`warehouse` `w` ON(`w`.`id` = `t`.`warehouseFk`)
+ )
+ ) STRAIGHT_JOIN `vn`.`zone` `z` ON(`z`.`id` = `t`.`zoneFk`)
+ )
+ LEFT JOIN `vn`.`zoneClosure` `zc` ON(
+ `zc`.`zoneFk` = `t`.`zoneFk`
+ AND `zc`.`dated` = `util`.`VN_CURDATE`()
+ )
+ )
+ LEFT JOIN `cache`.`departure_limit` `dl` ON(
+ `dl`.`warehouse_id` = `t`.`warehouseFk`
+ AND `dl`.`fecha` = `util`.`VN_CURDATE`()
+ )
+ )
+ JOIN `vn`.`alertLevel` `al` ON(`al`.`id` = `s`.`alertLevel`)
+WHERE `w`.`hasProduction` <> 0
+ AND cast(`t`.`shipped` AS date) = `util`.`VN_CURDATE`()
\ No newline at end of file
diff --git a/db/routines/vn2008/procedures/CalculoRemesas.sql b/db/routines/vn2008/procedures/CalculoRemesas.sql
index 17a2e7fdd..a4c191a80 100644
--- a/db/routines/vn2008/procedures/CalculoRemesas.sql
+++ b/db/routines/vn2008/procedures/CalculoRemesas.sql
@@ -47,13 +47,13 @@ BEGIN
UNION ALL
- SELECT empresa_id, Id_Cliente, - Importe
- FROM Facturas f
- JOIN Clientes c using(Id_Cliente)
+ SELECT io.companyFk, io.clientFk Id_Cliente, - io.amount
+ FROM vn.invoiceOut io
+ JOIN Clientes c ON c.Id_Cliente = io.clientFk
JOIN pay_met pm on pm.id = pay_met_id
- WHERE f.Vencimiento > vFechaRemesa
+ WHERE io.dued > vFechaRemesa
AND pay_met_id = 4 AND pm.deudaviva
- AND Importe > 0
+ AND io.amount > 0
) risk ON c.Id_Cliente = risk.clientFk
GROUP BY risk.companyFk, Id_Cliente
diff --git a/db/routines/vn2008/procedures/ListaTicketsEncajados.sql b/db/routines/vn2008/procedures/ListaTicketsEncajados.sql
index 3d3318c63..ce99916ee 100644
--- a/db/routines/vn2008/procedures/ListaTicketsEncajados.sql
+++ b/db/routines/vn2008/procedures/ListaTicketsEncajados.sql
@@ -13,9 +13,9 @@ SELECT Agencia,
FROM Tickets ti
INNER JOIN Consignatarios ON ti.Id_Consigna = Consignatarios.Id_consigna
INNER JOIN Agencias ON ti.Id_Agencia = Agencias.Id_Agencia
- LEFT JOIN (SELECT Ticket_Id,count(*) AS ncajas FROM expeditions WHERE Id_Article=94 GROUP BY ticket_id) sub1 ON ti.Id_Ticket=sub1.Ticket_Id
- LEFT JOIN (SELECT Ticket_Id,count(*) AS nbultos FROM expeditions WHERE Id_Article IS NULL GROUP BY ticket_id) sub2 ON ti.Id_Ticket=sub2.Ticket_Id
- LEFT JOIN (SELECT Ticket_Id,count(*) AS notros FROM expeditions WHERE Id_Article >0 GROUP BY ticket_id) sub3 ON ti.Id_Ticket=sub3.Ticket_Id
+ LEFT JOIN (SELECT ticketFk,count(*) AS ncajas FROM vn.expedition WHERE packagingFk=94 GROUP BY ticketFk) sub1 ON ti.Id_Ticket=sub1.ticketFk
+ LEFT JOIN (SELECT ticketFk,count(*) AS nbultos FROM vn.expedition WHERE packagingFk IS NULL GROUP BY ticketFk) sub2 ON ti.Id_Ticket=sub2.ticketFk
+ LEFT JOIN (SELECT ticketFk,count(*) AS notros FROM vn.expedition WHERE packagingFk >0 GROUP BY ticketFk) sub3 ON ti.Id_Ticket=sub3.ticketFk
INNER JOIN vn.ticketState ts ON ti.Id_ticket = ts.ticketFk
WHERE ti.Fecha=util.VN_CURDATE() AND
ts.userFk=intId_Trabajador
diff --git a/db/routines/vn2008/procedures/XDiario_Quadrator.sql b/db/routines/vn2008/procedures/XDiario_Quadrator.sql
deleted file mode 100644
index 93ddc231d..000000000
--- a/db/routines/vn2008/procedures/XDiario_Quadrator.sql
+++ /dev/null
@@ -1,34 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`XDiario_Quadrator`()
-BEGIN
- INSERT INTO vn.mail (receiver, subject, body)
- SELECT 'cau@verdnatura.es',
- 'asientos descuadrados',
- group_concat(CONCAT(' Asiento: ', ASIEN, '- importe:', quadre) SEPARATOR ' \r\n ')
- FROM (
- SELECT ASIEN, SUM(IFNULL(ROUND(Eurodebe,2),0))- SUM(IFNULL(ROUND(EUROHABER,2),0)) quadre
- FROM vn.XDiario
- WHERE enlazado = FALSE
- GROUP BY ASIEN
- HAVING ABS(SUM(IFNULL(ROUND(Eurodebe,2),0))- SUM(IFNULL(ROUND(EUROHABER,2),0))) > 0.01
- ) t
- HAVING count(*) > 0;
-
- UPDATE vn.XDiario XD
- INNER JOIN(
- SELECT XD.id, SUBCTA, Quadre FROM vn.XDiario XD
- INNER JOIN (
- SELECT ASIEN, SUM(IFNULL(ROUND(Eurodebe,2),0))- SUM(IFNULL(ROUND(EUROHABER,2),0)) as Quadre
- FROM vn.XDiario
- WHERE enlazado = FALSE
- GROUP BY ASIEN
- HAVING Quadre != 0
- ) sub USING(ASIEN)
- WHERE SUBCTA > '5999999999'
- GROUP BY ASIEN
- ) sub2 USING(id)
- SET Eurohaber = IF(IFNULL(Eurohaber,0) = 0, Eurohaber, Eurohaber + Quadre),
- Eurodebe = IF(IFNULL(Eurodebe,0) = 0, Eurodebe, Eurodebe - Quadre);
-
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/availableTraslate.sql b/db/routines/vn2008/procedures/availableTraslate.sql
index 6328560c8..a3d2c8bea 100644
--- a/db/routines/vn2008/procedures/availableTraslate.sql
+++ b/db/routines/vn2008/procedures/availableTraslate.sql
@@ -67,12 +67,12 @@ proc: BEGIN
CREATE TEMPORARY TABLE tmp.itemCalc
(INDEX (itemFk,warehouseFk))
ENGINE = MEMORY
- SELECT i.item_id itemFk, vWarehouseLanding warehouseFk, i.dat dated, i.amount quantity
- FROM item_out i
- JOIN itemRangeLive ir ON ir.itemFK = i.item_id
- WHERE i.dat >= vDatedFrom
- AND (ir.dated IS NULL OR i.dat <= ir.dated)
- AND i.warehouse_id = vWarehouseLanding
+ SELECT i.itemFk, vWarehouseLanding warehouseFk, i.shipped dated, i.quantity
+ FROM vn.itemTicketOut i
+ JOIN itemRangeLive ir ON ir.itemFK = i.itemFk
+ WHERE i.shipped >= vDatedFrom
+ AND (ir.dated IS NULL OR i.shipped <= ir.dated)
+ AND i.warehouseFk = vWarehouseLanding
UNION ALL
SELECT b.itemFk, vWarehouseLanding, t.landed, b.quantity
FROM vn.buy b
@@ -86,12 +86,12 @@ proc: BEGIN
AND t.landed >= vDatedFrom
AND (ir.dated IS NULL OR t.landed <= ir.dated)
UNION ALL
- SELECT i.item_id, vWarehouseLanding, i.dat, i.amount
- FROM item_entry_out i
- JOIN itemRangeLive ir ON ir.itemFk = i.item_id
- WHERE i.dat >= vDatedFrom
- AND (ir.dated IS NULL OR i.dat <= ir.dated)
- AND i.warehouse_id = vWarehouseLanding
+ SELECT i.itemFk, vWarehouseLanding, i.shipped, i.quantity
+ FROM vn.itemEntryOut i
+ JOIN itemRangeLive ir ON ir.itemFk = i.itemFk
+ WHERE i.shipped >= vDatedFrom
+ AND (ir.dated IS NULL OR i.shipped <= ir.dated)
+ AND i.warehouseOutFk = vWarehouseLanding
UNION ALL
SELECT r.item_id, vWarehouseLanding, r.shipment, -r.amount
FROM hedera.order_row r
diff --git a/db/routines/vn2008/procedures/balance_create.sql b/db/routines/vn2008/procedures/balance_create.sql
index 978dae720..2acd26834 100644
--- a/db/routines/vn2008/procedures/balance_create.sql
+++ b/db/routines/vn2008/procedures/balance_create.sql
@@ -122,9 +122,9 @@ BEGIN
-- Añadimos los gastos, para facilitar el formulario
UPDATE tmp.balance b
JOIN vn2008.balance_nest_tree bnt on bnt.id = b.id
- JOIN (SELECT Id_Gasto, Gasto
- FROM vn2008.Gastos
- GROUP BY Id_Gasto) g ON g.Id_Gasto = bnt.Id_Gasto COLLATE utf8_general_ci
+ JOIN (SELECT id Id_Gasto, name Gasto
+ FROM vn.expense
+ GROUP BY id) g ON g.Id_Gasto = bnt.Id_Gasto COLLATE utf8_general_ci
SET b.Id_Gasto = g.Id_Gasto COLLATE utf8_general_ci
, b.Gasto = g.Gasto COLLATE utf8_general_ci ;
diff --git a/db/routines/vn2008/procedures/clean.sql b/db/routines/vn2008/procedures/clean.sql
index bd8a324c6..0ff185c46 100644
--- a/db/routines/vn2008/procedures/clean.sql
+++ b/db/routines/vn2008/procedures/clean.sql
@@ -21,18 +21,10 @@ proc: BEGIN
SET vRangeDeleteTicket = 60;
DELETE FROM cdr WHERE calldate < vDate18;
- DELETE FROM Monitoring WHERE ODBC_TIME < vDate;
- DELETE FROM Conteo WHERE Fecha < vDate;
DELETE FROM mail WHERE DATE_ODBC < vDate;
- DELETE FROM expeditions_deleted WHERE odbc_date < vDate26;
DELETE FROM Movimientos_mark WHERE odbc_date < vDate;
DELETE FROM Splits WHERE Fecha < vDate18;
- DELETE ts
- FROM Tickets_stack ts
- JOIN Tickets t ON ts.Id_Ticket = t.Id_Ticket
- WHERE t.Fecha < vDate;
-
DELETE tobs
FROM ticket_observation tobs
JOIN Tickets t ON tobs.Id_Ticket = t.Id_Ticket
@@ -64,13 +56,6 @@ proc: BEGIN
JOIN travel t ON t.id = e.travel_id
WHERE t.landing <= vDate;
- DELETE co
- FROM Compres_ok co JOIN Compres c ON c.Id_Compra = co.Id_Compra
- JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada
- JOIN travel t ON t.id = e.travel_id
- WHERE t.landing <= vDate;
- DELETE FROM scan WHERE odbc_date < vDate6 AND id <> 1;
-
IF v_full THEN
CREATE OR REPLACE TEMPORARY TABLE tTicketDelete
SELECT DISTINCT tl.originFk ticketFk
diff --git a/db/routines/vn2008/procedures/customerDebtEvolution.sql b/db/routines/vn2008/procedures/customerDebtEvolution.sql
index e5d23f0ef..b9763b985 100644
--- a/db/routines/vn2008/procedures/customerDebtEvolution.sql
+++ b/db/routines/vn2008/procedures/customerDebtEvolution.sql
@@ -18,11 +18,11 @@ SELECT * FROM
WHERE Id_Cliente = vCustomer
AND Fechacobro >= '2017-01-01'
UNION ALL
- SELECT vn.getDueDate(f.Fecha,c.Vencimiento), - Importe
- FROM Facturas f
- JOIN Clientes c ON f.Id_Cliente = c.Id_Cliente
- WHERE f.Id_Cliente = vCustomer
- AND Fecha >= '2017-01-01'
+ SELECT vn.getDueDate(io.issued,c.Vencimiento), - io.amount
+ FROM vn.invoiceOut io
+ JOIN Clientes c ON io.clientFk = c.Id_Cliente
+ WHERE io.clientFk = vCustomer
+ AND io.issued >= '2017-01-01'
UNION ALL
SELECT '2016-12-31', Debt
FROM bi.customerDebtInventory
diff --git a/db/routines/vn2008/procedures/recobro_credito.sql b/db/routines/vn2008/procedures/recobro_credito.sql
index ca5304b6c..3657f2b9b 100644
--- a/db/routines/vn2008/procedures/recobro_credito.sql
+++ b/db/routines/vn2008/procedures/recobro_credito.sql
@@ -8,16 +8,10 @@ BEGIN
END;
START TRANSACTION;
- INSERT INTO vn.clientCredit(clientFk, amount)
- SELECT c.id, 0
- FROM vn.`client` c
- JOIN vn.payMethod pm ON pm.id = c.payMethodFk
- WHERE c.credit <> 0 AND pm.`code` = 'card';
-
UPDATE vn.`client` c
- JOIN vn.payMethod pm ON pm.id = c.payMethodFk
+ JOIN vn.payMethod pm ON pm.id = c.payMethodFk
SET credit = 0
- WHERE pm.`code` = 'card';
+ WHERE pm.`code` = 'card';
DROP TEMPORARY TABLE IF EXISTS clientes_credit;
CREATE TEMPORARY TABLE clientes_credit
@@ -44,12 +38,8 @@ BEGIN
UPDATE Clientes
JOIN clientes_credit USING(Id_Cliente)
SET Clientes.Credito = newCredit;
-
- INSERT INTO credit(Id_Cliente, amount, Id_Trabajador)
- SELECT Id_Cliente, newCredit, NULL
- FROM clientes_credit;
DROP TEMPORARY TABLE clientes_credit;
COMMIT;
END$$
-DELIMITER ;
\ No newline at end of file
+DELIMITER ;
diff --git a/db/routines/vn2008/procedures/supplierStatement.sql b/db/routines/vn2008/procedures/supplierStatement.sql
deleted file mode 100644
index 4701e3e21..000000000
--- a/db/routines/vn2008/procedures/supplierStatement.sql
+++ /dev/null
@@ -1,117 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`supplierStatement`(vSupplierFk INT, vCurrencyFk INT, vCompanyFk INT, vOrderBy VARCHAR(15), vOnlyConciliated BIT)
-BEGIN
- SET @saldo_eur:= 0;
- SET @saldo_div:= 0;
-select vOnlyConciliated;
- DROP TEMPORARY TABLE IF EXISTS tmp.supplierStatement;
-
- CREATE TEMPORARY TABLE tmp.supplierStatement ENGINE = MEMORY
- SELECT
- *,
- @saldo_eur:= round(@saldo_eur + IFNULL(Pago_Euros, 0) - IFNULL(Fac_Euros, 0) ,2 ) AS saldo_eur,
- @saldo_div:= round(@saldo_div + IFNULL(Pago_Divisas, 0) - IFNULL(Fac_Divisas, 0) ,2 ) AS saldo_div
- FROM
- (SELECT * FROM
- (SELECT
- NULL as banco_id,
- r.empresa_id,
- r.serie,
- r.id,
- CASE
- WHEN vOrderBy = 'issued' THEN r.fecha
- WHEN vOrderBy = 'bookEntried' THEN r.bookEntried
- WHEN vOrderBy = 'booked' THEN r.dateBooking
- WHEN vOrderBy = 'dueDate' THEN rv.fecha
- END AS fecha,
- CONCAT('S/Fra ', r.sref) sref,
- if(r.moneda_id > 1,round(sum(divisa) / sum(cantidad),3),NULL) val_cambio,
- CAST(sum(cantidad) as DECIMAL(10,2)) as Fac_Euros,
- CAST(sum(divisa) as DECIMAL(10,2)) as Fac_Divisas,
- NULL AS Pago_Euros,
- NULL AS Pago_Divisas,
- r.moneda_id,
- r.contabilizada,
- Moneda,
- NULL as pago_sdc_id,
- 'invoiceIn' statementType
- FROM
- recibida r
- JOIN recibida_vencimiento rv on rv.recibida_id = r.id
- JOIN Monedas m on m.Id_Moneda = r.moneda_id
- WHERE
- r.fecha > '2014-12-31'
- AND r.proveedor_id = vSupplierFk
- AND vCurrencyFk IN (r.moneda_id, 0)
- AND vCompanyFk IN (r.empresa_id,0)
- AND (vOnlyConciliated = r.contabilizada OR NOT vOnlyConciliated)
- GROUP BY rv.id
-
- UNION ALL
- SELECT
- p.id_banco,
- p.empresa_id,
- NULL,
- p.id,
- CASE
- WHEN vOrderBy = 'issued' THEN p.Fecha
- WHEN vOrderBy = 'bookEntried' THEN p.Fecha
- WHEN vOrderBy = 'booked' THEN p.Fecha
- WHEN vOrderBy = 'dueDate' THEN p.dueDated
- END AS fecha,
- CONCAT(IFNULL(name, ''), IF(pre.concepto <> '', CONCAT(' : ', pre.concepto), '')),
- if(p.id_moneda > 1, p.divisa / importe, NULL) tip_cambio,
- NULL,
- NULL,
- p.importe,
- p.divisa,
- p.id_moneda,
- p.conciliado,
- Moneda,
- NULL as pago_sdc_id,
- 'payment' statementType
- FROM
- pago p
- LEFT JOIN Monedas ON Monedas.Id_Moneda = p.id_moneda
- LEFT JOIN Bancos ON p.id_banco = Bancos.Id_banco
- LEFT JOIN pay_met pm ON p.pay_met_id = pm.id
- LEFT JOIN Pagares pre ON pre.pago_id = p.id
- WHERE
- Fecha > '2014-12-31'
- AND p.Id_Proveedor = vSupplierFk
- AND vCurrencyFk IN (p.id_moneda,0)
- AND vCompanyFk IN (p.empresa_id,0)
- AND (vOnlyConciliated = p.conciliado OR NOT vOnlyConciliated)
- UNION ALL
- SELECT
- NULL,
- companyFk,
- NULL,
- se.id,
- CASE
- WHEN vOrderBy = 'issued' THEN se.dated
- WHEN vOrderBy = 'bookEntried' THEN se.dated
- WHEN vOrderBy = 'booked' THEN se.dated
- WHEN vOrderBy = 'dueDate' THEN se.dueDated
- END AS fecha,
- se.description,
- 1 tip_cambio,
- amount,
- NULL,
- NULL,
- NULL,
- currencyFk,
- isConciliated,
- c.`code`,
- NULL,
- 'expense' statementType
- FROM vn.supplierExpense se
- JOIN vn.currency c on c.id= se.currencyFk
- WHERE se.supplierFk = vSupplierFk
- AND vCurrencyFk IN (se.currencyFk,0)
- AND vCompanyFk IN (se.companyFk,0)
- AND (vOnlyConciliated = se.isConciliated OR NOT vOnlyConciliated)
- ) AS SUB
- ORDER BY (fecha is null and NOT contabilizada),fecha, IF(vOrderBy = 'dueDate', id, NULL) LIMIT 10000000000000000000) t;
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/traslado.sql b/db/routines/vn2008/procedures/traslado.sql
deleted file mode 100644
index 9c1e5efe7..000000000
--- a/db/routines/vn2008/procedures/traslado.sql
+++ /dev/null
@@ -1,182 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`traslado`(IN i_entrada INTEGER)
-BEGIN
- DECLARE dateShipment DATE;
- DECLARE dateLanding DATE;
- DECLARE warehouseShipment INTEGER;
- DECLARE warehouseLanding INTEGER;
- DECLARE v_calc_visible INTEGER;
- DECLARE vInventoryDate DATE;
-
- SET vInventoryDate := vn.getInventoryDate();
- SELECT shipment, landing, warehouse_id_out, warehouse_id
- INTO dateShipment, dateLanding, warehouseShipment, warehouseLanding
- FROM travel t JOIN Entradas e ON t.id = e.travel_id
- WHERE Id_Entrada = i_entrada;
-
- CALL vn.rate_getPrices(dateShipment, warehouseLanding);
-
- -- Traslado en almacen origen
-
- DROP TEMPORARY TABLE IF EXISTS buy_edi_temp;
- CREATE TEMPORARY TABLE buy_edi_temp
- (KEY (Id_Article), INDEX(Id_Compra)) ENGINE = MEMORY
- SELECT *
- FROM (SELECT c.Id_Article, c.Id_Compra
- FROM Compres c INNER JOIN Entradas e USING(Id_Entrada)
- INNER JOIN travel t ON t.id = e.travel_id
- WHERE t.landing BETWEEN vInventoryDate AND dateShipment
- AND c.Novincular = FALSE
- AND c.Tarifa2 >= 0
- ORDER BY (warehouseShipment = t.warehouse_id) DESC, t.landing DESC
- LIMIT 10000000000000000000) t
- GROUP BY Id_Article;
-
- IF dateShipment >= util.VN_CURDATE() THEN
- CALL `cache`.visible_refresh(v_calc_visible, TRUE, warehouseShipment);
-
- DROP TEMPORARY TABLE IF EXISTS tmp.item;
-
- CREATE TEMPORARY TABLE tmp.item (
- `itemFk` int(10) unsigned NOT NULL,
- `visible` int(11) NOT NULL DEFAULT 0,
- `available` int(11) NOT NULL DEFAULT 0,
- `visibleLanding` int(11) NOT NULL DEFAULT 0,
- `availableLanding` int(11) NOT NULL DEFAULT 0,
- UNIQUE INDEX i USING HASH (itemFk)
- ) ENGINE = MEMORY;
-
- INSERT INTO tmp.item(itemFk, visible)
- SELECT item_id itemFk, visible
- FROM `cache`.visible
- WHERE calc_id = v_calc_visible
- AND visible;
-
- CALL `cache`.visible_refresh(v_calc_visible, TRUE, warehouseLanding);
-
- INSERT INTO tmp.item(itemFk, visibleLanding)
- SELECT item_id, `visible`
- FROM `cache`.`visible` v
- WHERE v.calc_id = v_calc_visible
- AND v.`visible`
- ON DUPLICATE KEY UPDATE visibleLanding = v.`visible`;
-
- CALL availableTraslate(warehouseShipment, dateShipment, NULL);
-
- INSERT INTO tmp.item(itemFk, available)
- SELECT a.item_id, a.available
- FROM availableTraslate a
- WHERE a.available
- ON DUPLICATE KEY UPDATE available = a.available;
-
- CALL availableTraslate(warehouseLanding, dateLanding, warehouseShipment);
-
- INSERT INTO tmp.item(itemFk, availableLanding)
- SELECT a.item_id, a.available
- FROM availableTraslate a
- WHERE a.available
- ON DUPLICATE KEY UPDATE availableLanding = a.available;
- ELSE
- CALL vn.item_getStock(warehouseShipment, dateShipment, NULL);
-
- DROP TEMPORARY TABLE IF EXISTS tmp.item;
- CREATE TEMPORARY TABLE tmp.item (UNIQUE INDEX i USING HASH (itemFk)) ENGINE = MEMORY
- SELECT itemFk, `visible`, available , 0 visibleLanding, 0 availableLanding
- FROM tmp.itemList;
-
- DROP TEMPORARY TABLE tmp.itemList;
- END IF;
-
- CALL vn.buyUltimateFromInterval(warehouseLanding,vInventoryDate, dateLanding);
-
- DROP TEMPORARY TABLE IF EXISTS Traslados;
- CREATE TEMPORARY TABLE Traslados ENGINE = MEMORY
- SELECT tp.Id_Tipo AS Tipo,
- tp.reino_id,
- ar.tipo_id,
- ar.Id_Article AS article_id,
- ar.Article,
- ar.Medida,
- ar.Categoria,
- ar.Color,
- Origen.abreviatura as Origen,
- CE.Cantidad,
- ar.Tallos,
- CAST(AIM.visible AS DECIMAL(10,0)) as vis1,
- CAST(AIM.available AS DECIMAL(10,0)) as dis1,
- CAST(AIM.visibleLanding AS DECIMAL(10,0)) as vis2,
- CAST(AIM.availableLanding AS DECIMAL(10,0)) as dis2,
- COALESCE(CE.`grouping`, C.`grouping`) as `grouping`,
- COALESCE(CE.Packing, C.Packing) as Packing,
- COALESCE(cl.caja, CE.caja, C.caja) as caja,
- IFNULL(p.name, P2.Alias) AS Productor,
- C.Id_Cubo,
- 1 Tinta,
- CE.Id_Compra,
- CE.Etiquetas,
- C.buy_edi_id,
- tp.Id_Trabajador,
- CB.Volumen,
- IFNULL(CB.x,0) x,
- IFNULL(CB.y,0) y,
- IFNULL(CB.z,0) z,
- IFNULL(C.Costefijo,0) Costefijo,
- IFNULL(C.Comisionfija,0) Comisionfija,
- IFNULL(C.Portefijo,0) Portefijo,
- A.m3,
- E.comision,
- CB.Retornable,
- IFNULL(CEB.Valor,CB.Valor) Valor,
- r.rate3 t3, r.rate2 t2, tp.promo,
- C.`grouping` groupingOrigin,
- C.Packing PackingOrigin,
- C.Id_Compra CompraOrigin,
- CB.costeRetorno,
- C.weight
- FROM Articles ar
- JOIN tmp.item AIM ON AIM.itemFk = ar.Id_Article
- LEFT JOIN producer p ON p.producer_id = ar.producer_id
- LEFT JOIN Tipos tp ON tp.tipo_id = ar.tipo_id
- JOIN vn.itemCategory ic ON ic.id = tp.reino_id
- LEFT JOIN Origen ON Origen.id = ar.id_origen
- LEFT JOIN buy_edi_temp lb ON lb.Id_Article = ar.Id_Article
- LEFT JOIN Compres C ON C.Id_Compra = lb.Id_Compra
- LEFT JOIN Cubos CB ON CB.Id_Cubo = C.Id_Cubo
- LEFT JOIN Entradas E2 ON E2.Id_Entrada = C.Id_Entrada
- LEFT JOIN Proveedores P2 ON P2.Id_Proveedor = E2.Id_Proveedor
- LEFT JOIN Entradas E ON E.Id_Entrada = i_entrada
- LEFT JOIN travel TR ON TR.id = E.travel_id
- LEFT JOIN Agencias A ON A.Id_Agencia = TR.agency_id
- LEFT JOIN Compres CE ON CE.Id_Article = ar.Id_Article AND CE.Id_Entrada = i_entrada
- LEFT JOIN Cubos CEB ON CEB.Id_Cubo = CE.Id_Cubo
- LEFT JOIN tmp.rate r ON TRUE
- LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = ar.Id_Article
- LEFT JOIN Compres cl ON cl.Id_Compra = bufi.buyFk
- WHERE ic.display
- AND E.Redada = FALSE
- AND (AIM.visible != 0 OR AIM.available != 0)
- ORDER BY tipo_id, Article, article_id, Medida, Categoria, Origen;
-
- CREATE INDEX tindex USING HASH ON Traslados (article_id);
-
- SELECT t.*,
- Cantidad - MOD(Cantidad , `grouping`) as Subcantidad,
- MOD(Cantidad , `grouping`) as Soll,
- ROUND((IF(Volumen > 0,Volumen,x * y * IF(z = 0, Medida + 10, z))) / Packing,0) as cm3,
- Costefijo + Comisionfija + Portefijo AS Cost,
- @porte := ROUND((IF(Volumen > 0,Volumen,x * y * IF(z = 0, Medida + 10, z))) * m3 / 1000000 / Packing ,3) AS Porte,
- @comision := ROUND((Costefijo + Comisionfija + Portefijo) * comision / 100 ,3) AS Comision,
- ROUND(@embalaje := (costeRetorno + IF(Retornable != 0, 0, Valor)) / packing ,3) AS Embalaje,
- @coste := IFNULL((Costefijo + Comisionfija + Portefijo),0) + IFNULL(@embalaje,0) + IFNULL(@porte,0) + IFNULL(@comision,0) AS Coste,
- @t3 := ROUND(@coste / ( (100 - t3 - t.promo)/100),2) AS Tarifa3,
- ROUND(@t3 * (1 + ((t2 - t3)/100)),2) AS Tarifa2,
- 0 selected
- FROM Traslados t;
-
- DROP TEMPORARY TABLE Traslados;
- DROP TEMPORARY TABLE tmp.item;
- DROP TEMPORARY TABLE buy_edi_temp;
- DROP TEMPORARY TABLE tmp.buyUltimateFromInterval;
- DROP TEMPORARY TABLE tmp.rate;
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/procedures/travelDetail.sql b/db/routines/vn2008/procedures/travelDetail.sql
deleted file mode 100644
index 39ed4f7b8..000000000
--- a/db/routines/vn2008/procedures/travelDetail.sql
+++ /dev/null
@@ -1,119 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`travelDetail`()
-BEGIN
-/**
- * Returns the details of the travels that have a departure warehouse in Ecuador or Colombia.
- */
- DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL 12 WEEK;
- SELECT IFNULL(CONCAT(" ",Entrada),travel) travelAndEntry,
- travel,
- Entrada,
- IsTravel,
- Agencia,
- ref,
- shipment,
- OrigenCajas,
- landing,
- Destino,
- Etiquetas,
- Notas_Eva,
- kg,
- loadedKg,
- volumeKg,
- loadPriority,
- invoiceAmount,
- Carguera,
- reference
- FROM
- (SELECT TRUE IsTravel,
- tr.id travel,
- NULL Entrada,
- ag.Agencia,
- tr.ref,
- tr.shipment,
- wo.name OrigenCajas,
- tr.landing,
- w.name Destino,
- SUM(c.Etiquetas) Etiquetas,
- NULL Notas_Eva,
- tr.kg,
- CAST(SUM(c.weight * c.Etiquetas) AS INT) loadedkg,
- CAST(
- SUM(vc.aerealVolumetricDensity *
- c.Etiquetas *
- IF(cb.Volumen,
- cb.Volumen,
- cb.X * cb.Y * cb.Z
- ) / 1000000
- ) AS INT
- ) volumeKg,
- NULL loadPriority,
- NULL invoiceAmount,
- pc.Alias Carguera,
- NULL reference
- FROM travel tr
- LEFT JOIN Proveedores pc ON pc.Id_Proveedor = tr.cargoSupplierFk
- LEFT JOIN Entradas e ON e.travel_id = tr.id
- LEFT JOIN Compres c ON c.Id_Entrada = e.Id_Entrada
- LEFT JOIN Cubos cb ON cb.Id_Cubo = c.Id_Cubo
- LEFT JOIN Articles a ON a.Id_Article = c.Id_Article
- LEFT JOIN Tipos tp ON tp.tipo_id = a.tipo_id
- JOIN warehouse w ON w.id = tr.warehouse_id
- JOIN warehouse wo ON wo.id = tr.warehouse_id_out
- JOIN Agencias ag ON ag.Id_Agencia = tr.agency_id
- JOIN vn.volumeConfig vc
- WHERE tr.landing >= vDateFrom
- AND (wo.name="Colombia" OR wo.name="Ecuador")
- GROUP BY tr.id
- UNION ALL
- SELECT 0 IsTravel,
- e.travel_id travel,
- e.Id_Entrada,
- p.Proveedor,
- e.Referencia,
- tr.shipment,
- wo.name OrigenCajas,
- tr.landing,
- w.name Destino,
- SUM(Etiquetas) Etiquetas,
- e.Notas_Eva,
- NULL kg,
- CAST(SUM(c.weight * c.Etiquetas) AS INT) loadedkg,
- CAST(
- SUM(vc.aerealVolumetricDensity *
- c.Etiquetas *
- IF(cb.Volumen,
- cb.Volumen,
- cb.X * cb.Y * cb.Z
- ) / 1000000
- ) AS INT
- ) volumeKg,
- loadPriority,
- e.invoiceAmount,
- pc.Alias carguera,
- e.reference
- FROM Entradas e
- JOIN Compres c ON c.Id_Entrada = e.Id_Entrada
- JOIN Cubos cb ON cb.Id_Cubo = c.Id_Cubo
- JOIN Articles a ON a.Id_Article = c.Id_Article
- JOIN Tipos tp ON tp.tipo_id = a.tipo_id
- JOIN Proveedores p ON p.Id_Proveedor = e.Id_Proveedor
- JOIN travel tr ON tr.id = e.travel_id
- LEFT JOIN Proveedores pc ON pc.Id_Proveedor = tr.cargoSupplierFk
- JOIN warehouse w ON w.id = tr.warehouse_id
- JOIN warehouse wo ON wo.id = tr.warehouse_id_out
- JOIN vn.volumeConfig vc
- WHERE tr.landing >= vDateFrom
- AND (wo.name="Colombia" OR wo.name="Ecuador")
- GROUP BY e.Id_Entrada
- ) sub
- ORDER BY landing ASC,
- shipment ASC,
- travel,
- IsTravel DESC,
- (loadPriority > 0) DESC,
- loadPriority,
- Agencia,
- Notas_Eva;
-END$$
-DELIMITER ;
diff --git a/db/routines/vn2008/views/Facturas.sql b/db/routines/vn2008/views/Facturas.sql
deleted file mode 100644
index bc99c02d8..000000000
--- a/db/routines/vn2008/views/Facturas.sql
+++ /dev/null
@@ -1,20 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn2008`.`Facturas`
-AS SELECT `io`.`id` AS `factura_id`,
- `io`.`ref` AS `Id_Factura`,
- `io`.`serial` AS `Serie`,
- `io`.`issued` AS `Fecha`,
- `io`.`amount` AS `Importe`,
- `io`.`clientFk` AS `Id_Cliente`,
- `io`.`created` AS `odbc_date`,
- `io`.`companyFk` AS `empresa_id`,
- `io`.`dued` AS `Vencimiento`,
- `io`.`booked` AS `booked`,
- `io`.`bankFk` AS `Id_Banco`,
- `io`.`siiTypeInvoiceOutFk` AS `siiTypeInvoiceOutFk`,
- `io`.`cplusTaxBreakFk` AS `cplusTaxBreakFk`,
- `io`.`cplusSubjectOpFk` AS `cplusSubjectOpFk`,
- `io`.`siiTrascendencyInvoiceOutFk` AS `siiTrascendencyInvoiceOutFk`,
- `io`.`hasPdf` AS `pdf`
-FROM `vn`.`invoiceOut` `io`
diff --git a/db/routines/vn2008/views/Gastos.sql b/db/routines/vn2008/views/Gastos.sql
deleted file mode 100644
index 2eee445d8..000000000
--- a/db/routines/vn2008/views/Gastos.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn2008`.`Gastos`
-AS SELECT `e`.`id` AS `Id_Gasto`,
- `e`.`name` AS `Gasto`,
- `e`.`isWithheld` AS `isWithheld`
-FROM `vn`.`expense` `e`
diff --git a/db/routines/vn2008/views/Greuges.sql b/db/routines/vn2008/views/Greuges.sql
deleted file mode 100644
index 8958ec455..000000000
--- a/db/routines/vn2008/views/Greuges.sql
+++ /dev/null
@@ -1,12 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn2008`.`Greuges`
-AS SELECT `g`.`Id` AS `Id`,
- `g`.`clientFk` AS `Id_Cliente`,
- `g`.`description` AS `Comentario`,
- `g`.`amount` AS `Importe`,
- `g`.`shipped` AS `Fecha`,
- `g`.`created` AS `odbc_date`,
- `g`.`greugeTypeFk` AS `Greuges_type_id`,
- `g`.`ticketFk` AS `Id_Ticket`
-FROM `vn`.`greuge` `g`
diff --git a/db/routines/vn2008/views/Greuges_type.sql b/db/routines/vn2008/views/Greuges_type.sql
deleted file mode 100644
index 500a1cc03..000000000
--- a/db/routines/vn2008/views/Greuges_type.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn2008`.`Greuges_type`
-AS SELECT `gt`.`id` AS `Greuges_type_id`,
- `gt`.`name` AS `name`
-FROM `vn`.`greugeType` `gt`
diff --git a/db/routines/vn2008/views/Intrastat.sql b/db/routines/vn2008/views/Intrastat.sql
deleted file mode 100644
index 9ed3ef283..000000000
--- a/db/routines/vn2008/views/Intrastat.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn2008`.`Intrastat`
-AS SELECT `i`.`id` AS `Codintrastat`,
- `i`.`description` AS `Definicion`,
- `i`.`taxClassFk` AS `iva_group_id`,
- `i`.`taxCodeFk` AS `iva_codigo_id`
-FROM `vn`.`intrastat` `i`
diff --git a/db/routines/vn2008/views/expeditions.sql b/db/routines/vn2008/views/expeditions.sql
deleted file mode 100644
index d93e2a1c6..000000000
--- a/db/routines/vn2008/views/expeditions.sql
+++ /dev/null
@@ -1,16 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn2008`.`expeditions`
-AS SELECT `e`.`id` AS `expeditions_id`,
- `e`.`agencyModeFk` AS `agency_id`,
- `e`.`ticketFk` AS `ticket_id`,
- `e`.`freightItemFk` AS `EsBulto`,
- `e`.`created` AS `odbc_date`,
- `e`.`counter` AS `counter`,
- `e`.`workerFk` AS `workerFk`,
- `e`.`externalId` AS `externalId`,
- `p`.`itemFk` AS `Id_article`
-FROM (
- `vn`.`expedition` `e`
- LEFT JOIN `vn`.`packaging` `p` ON(`p`.`id` = `e`.`packagingFk`)
- )
diff --git a/db/routines/vn2008/views/gestdoc.sql b/db/routines/vn2008/views/gestdoc.sql
deleted file mode 100644
index f9fef2895..000000000
--- a/db/routines/vn2008/views/gestdoc.sql
+++ /dev/null
@@ -1,16 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn2008`.`gestdoc`
-AS SELECT `d`.`id` AS `id`,
- `d`.`dmsTypeFk` AS `gesttip_id`,
- `d`.`file` AS `file`,
- `d`.`contentType` AS `contentType`,
- `d`.`workerFk` AS `trabajador_id`,
- `d`.`warehouseFk` AS `warehouse_id`,
- `d`.`companyFk` AS `emp_id`,
- `d`.`hardCopyNumber` AS `orden`,
- `d`.`hasFile` AS `original`,
- `d`.`reference` AS `sref`,
- `d`.`description` AS `brief`,
- `d`.`created` AS `odbc_date`
-FROM `vn`.`dms` `d`
diff --git a/db/routines/vn2008/views/gesttip.sql b/db/routines/vn2008/views/gesttip.sql
deleted file mode 100644
index 663e70617..000000000
--- a/db/routines/vn2008/views/gesttip.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn2008`.`gesttip`
-AS SELECT `g`.`id` AS `id`,
- `g`.`name` AS `tipo`,
- `g`.`readRoleFk` AS `readRoleFk`,
- `g`.`writeRoleFk` AS `writeRoleFk`,
- `g`.`code` AS `code`
-FROM `vn`.`dmsType` `g`
diff --git a/db/routines/vn2008/views/intrastat_data.sql b/db/routines/vn2008/views/intrastat_data.sql
deleted file mode 100644
index 54853b69c..000000000
--- a/db/routines/vn2008/views/intrastat_data.sql
+++ /dev/null
@@ -1,13 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn2008`.`intrastat_data`
-AS SELECT `ii`.`id` AS `id`,
- `ii`.`invoiceInFk` AS `recibida_id`,
- `ii`.`net` AS `neto`,
- `ii`.`intrastatFk` AS `intrastat_id`,
- `ii`.`amount` AS `importe`,
- `ii`.`stems` AS `unidades`,
- `ii`.`countryFk` AS `Paises_Id`,
- `ii`.`dated` AS `odbc_date`,
- `ii`.`statisticalValue` AS `valorestadistico`
-FROM `vn`.`invoiceInIntrastat` `ii`
diff --git a/db/routines/vn2008/views/invoiceCorrection.sql b/db/routines/vn2008/views/invoiceCorrection.sql
deleted file mode 100644
index 5ed1d5844..000000000
--- a/db/routines/vn2008/views/invoiceCorrection.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn2008`.`invoiceCorrection`
-AS SELECT `ic`.`correctingFk` AS `correctingFk`,
- `ic`.`correctedFk` AS `correctedFk`,
- `ic`.`cplusRectificationTypeFk` AS `cplusRectificationTypeFk`,
- `ic`.`siiTypeInvoiceOutFk` AS `siiTypeInvoiceOutFk`,
- `ic`.`invoiceCorrectionTypeFk` AS `invoiceCorrectionTypeFk`
-FROM `vn`.`invoiceCorrection` `ic`
diff --git a/db/routines/vn2008/views/itemTag.sql b/db/routines/vn2008/views/itemTag.sql
deleted file mode 100644
index ff247089f..000000000
--- a/db/routines/vn2008/views/itemTag.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn2008`.`itemTag`
-AS SELECT `i`.`id` AS `id`,
- `i`.`itemFk` AS `itemFk`,
- `i`.`tagFk` AS `tagFk`,
- `i`.`value` AS `value`,
- `i`.`priority` AS `priority`
-FROM `vn`.`itemTag` `i`
diff --git a/db/routines/vn2008/views/item_entry_in.sql b/db/routines/vn2008/views/item_entry_in.sql
deleted file mode 100644
index 1cc7d21b1..000000000
--- a/db/routines/vn2008/views/item_entry_in.sql
+++ /dev/null
@@ -1,20 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn2008`.`item_entry_in`
-AS SELECT `t`.`warehouse_id` AS `warehouse_id`,
- `t`.`warehouse_id_out` AS `warehouse_id_out`,
- `t`.`landing` AS `dat`,
- `m`.`Id_Article` AS `item_id`,
- `m`.`Cantidad` AS `amount`,
- `t`.`received` AS `received`,
- `e`.`Redada` AS `isVirtualStock`,
- `e`.`Id_Entrada` AS `entryFk`
-FROM (
- (
- `vn2008`.`Compres` `m`
- JOIN `vn2008`.`Entradas` `e` ON(`m`.`Id_Entrada` = `e`.`Id_Entrada`)
- )
- JOIN `vn2008`.`travel` `t` ON(`e`.`travel_id` = `t`.`id`)
- )
-WHERE `e`.`Inventario` = 0
- AND `m`.`Cantidad` <> 0
diff --git a/db/routines/vn2008/views/item_entry_out.sql b/db/routines/vn2008/views/item_entry_out.sql
deleted file mode 100644
index d99672df8..000000000
--- a/db/routines/vn2008/views/item_entry_out.sql
+++ /dev/null
@@ -1,27 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn2008`.`item_entry_out`
-AS SELECT `t`.`warehouse_id_out` AS `warehouse_id`,
- `t`.`shipment` AS `dat`,
- `m`.`Id_Article` AS `item_id`,
- - `m`.`Cantidad` AS `amount`,
- `t`.`delivered` <> 0
- OR IFNULL(`co`.`valor`, 0) AS `delivered`,
- `e`.`Id_Entrada` AS `entryFk`
-FROM (
- (
- (
- `vn2008`.`Compres` `m`
- JOIN `vn2008`.`Entradas` `e` ON(`m`.`Id_Entrada` = `e`.`Id_Entrada`)
- )
- JOIN `vn2008`.`travel` `t` ON(`e`.`travel_id` = `t`.`id`)
- )
- LEFT JOIN `vn2008`.`Compres_ok` `co` ON(
- `co`.`Id_Compra` = `m`.`Id_Compra`
- AND `co`.`Id_Accion` = 3
- AND `co`.`valor` <> 0
- )
- )
-WHERE `e`.`Inventario` = 0
- AND `e`.`Redada` = 0
- AND `m`.`Cantidad` <> 0
diff --git a/db/routines/vn2008/views/item_out.sql b/db/routines/vn2008/views/item_out.sql
deleted file mode 100644
index 57353a6d6..000000000
--- a/db/routines/vn2008/views/item_out.sql
+++ /dev/null
@@ -1,17 +0,0 @@
-CREATE OR REPLACE DEFINER=`root`@`localhost`
- SQL SECURITY DEFINER
- VIEW `vn2008`.`item_out`
-AS SELECT `t`.`warehouse_id` AS `warehouse_id`,
- `t`.`Fecha` AS `dat`,
- `m`.`Id_Article` AS `item_id`,
- - `m`.`Cantidad` AS `amount`,
- `m`.`OK` AS `ok`,
- `m`.`Reservado` AS `Reservado`,
- `t`.`Factura` AS `invoice`,
- `m`.`Id_Movimiento` AS `saleFk`,
- `m`.`Id_Ticket` AS `ticketFk`
-FROM (
- `vn2008`.`Movimientos` `m`
- JOIN `vn2008`.`Tickets` `t` ON(`m`.`Id_Ticket` = `t`.`Id_Ticket`)
- )
-WHERE `m`.`Cantidad` <> 0
diff --git a/db/versions/10832-purpleAralia/01-update_procedure_TravelCloneWithEntries.sql b/db/versions/10832-purpleAralia/01-update_procedure_TravelCloneWithEntries.sql
index b0c177b9a..59041a5b3 100644
--- a/db/versions/10832-purpleAralia/01-update_procedure_TravelCloneWithEntries.sql
+++ b/db/versions/10832-purpleAralia/01-update_procedure_TravelCloneWithEntries.sql
@@ -27,7 +27,7 @@ BEGIN
DECLARE vEvaNotes VARCHAR(255);
DECLARE vDone BOOL;
DECLARE vAuxEntryFk INT;
- DECLARE vTx BOOLEAN DEFAULT !@@in_transaction;
+ DECLARE vTx BOOLEAN DEFAULT @@in_transaction;
DECLARE vRsEntry CURSOR FOR
SELECT e.id
FROM entry e
@@ -41,8 +41,8 @@ BEGIN
CALL util.tx_rollback(vTx);
RESIGNAL;
END;
-
- CALL util.tx_start(vTx);
+
+ CALL util.tx_start(vTx);
INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, `ref`, isDelivered, isReceived, m3, cargoSupplierFk, kg,clonedFrom)
SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3,cargoSupplierFk, kg,vTravelFk
diff --git a/db/versions/10835-brownCarnation/12-account_conciliacion.sql b/db/versions/10835-brownCarnation/12-account_conciliacion.sql
index d8469e035..22399da1b 100644
--- a/db/versions/10835-brownCarnation/12-account_conciliacion.sql
+++ b/db/versions/10835-brownCarnation/12-account_conciliacion.sql
@@ -1,4 +1,4 @@
-DROP TRIGGER IF EXISTS vn2008.account_conciliacion_BEFORE_INSERT;
+DROP TRIGGER IF EXISTS vn2008.account_conciliacion_beforeInsert;
ALTER TABLE IF EXISTS `vn2008`.`account_conciliacion` RENAME `vn`.`accountReconciliation`;
diff --git a/db/versions/10835-brownCarnation/25-awb_recibida.sql b/db/versions/10835-brownCarnation/25-awb_recibida.sql
index e403775c9..82dc01ab2 100644
--- a/db/versions/10835-brownCarnation/25-awb_recibida.sql
+++ b/db/versions/10835-brownCarnation/25-awb_recibida.sql
@@ -1,4 +1,4 @@
-DROP TRIGGER IF EXISTS vn2008.awb_recibida_ad;
+DROP TRIGGER IF EXISTS vn2008.awb_recibida_afterDelete;
ALTER TABLE IF EXISTS `vn2008`.`awb_recibida` RENAME `vn`.`awbInvoiceIn`;
diff --git a/db/versions/10835-brownCarnation/28-balance_nest_tree.sql b/db/versions/10835-brownCarnation/28-balance_nest_tree.sql
index 043bde2e4..6a3fd1edd 100644
--- a/db/versions/10835-brownCarnation/28-balance_nest_tree.sql
+++ b/db/versions/10835-brownCarnation/28-balance_nest_tree.sql
@@ -6,9 +6,11 @@ CHANGE COLUMN IF EXISTS `Id_Gasto` `expenseFk` varchar(10) DEFAULT NULL;
ALTER TABLE vn.balanceNestTree
MODIFY COLUMN IF EXISTS expenseFk varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL NULL;
-UPDATE vn.balanceNestTree
- SET expenseFk = NULL
- WHERE expenseFk ='';
+UPDATE vn.balanceNestTree b
+ LEFT JOIN vn.expense e ON e.id = b.expenseFk COLLATE utf8mb3_general_ci
+ SET b.expenseFk = NULL
+ WHERE b.expenseFk =''
+ OR (e.id IS NULL AND b.expenseFk IS NOT NULL);
ALTER TABLE IF EXISTS vn.balanceNestTree ADD CONSTRAINT balanceNestTree_expense_FK
FOREIGN KEY (expenseFk) REFERENCES vn.expense(id) ON DELETE CASCADE ON UPDATE CASCADE;
diff --git a/db/versions/10868-grayChico/00-firstScript.sql b/db/versions/10868-grayChico/00-firstScript.sql
new file mode 100644
index 000000000..d0b98362c
--- /dev/null
+++ b/db/versions/10868-grayChico/00-firstScript.sql
@@ -0,0 +1,15 @@
+REVOKE SELECT ON TABLE vn2008.expeditions FROM employee;
+REVOKE SELECT, INSERT, UPDATE, DELETE ON TABLE vn2008.Gastos FROM administrative;
+REVOKE SELECT ON TABLE vn2008.Facturas FROM salesPerson;
+REVOKE SELECT ON TABLE vn2008.Facturas FROM logistic;
+REVOKE SELECT ON TABLE vn2008.Facturas FROM palletizer;
+REVOKE SELECT ON TABLE vn2008.Facturas FROM hr;
+REVOKE SELECT ON TABLE vn2008.gestdoc FROM employee;
+REVOKE INSERT, UPDATE ON TABLE vn2008.gestdoc FROM administrative;
+REVOKE DELETE ON TABLE vn2008.gestdoc FROM hr;
+REVOKE SELECT ON TABLE vn2008.gesttip FROM employee;
+REVOKE SELECT ON TABLE vn2008.Greuges FROM employee;
+REVOKE SELECT ON TABLE vn2008.Greuges_type FROM financial;
+REVOKE SELECT ON TABLE vn2008.intrastat_data FROM buyer;
+REVOKE SELECT, INSERT, UPDATE, DELETE ON TABLE vn2008.intrastat_data FROM administrative;
+REVOKE SELECT, INSERT ON TABLE vn2008.invoiceCorrection FROM administrative;
diff --git a/db/versions/10876-goldenRoebelini/00-firstScript.sql b/db/versions/10876-goldenRoebelini/00-firstScript.sql
new file mode 100644
index 000000000..c089f8950
--- /dev/null
+++ b/db/versions/10876-goldenRoebelini/00-firstScript.sql
@@ -0,0 +1,17 @@
+-- Para la tabla Monitoring
+ALTER TABLE IF EXISTS vn2008.Monitoring RENAME vn2008.Monitoring__;
+ALTER TABLE IF EXISTS vn2008.Monitoring__ COMMENT='refs #6371 deprecated 2024-01-11';
+
+-- Para la tabla Movimientos_avisar
+ALTER TABLE IF EXISTS vn2008.Movimientos_avisar RENAME vn2008.Movimientos_avisar__;
+ALTER TABLE IF EXISTS vn2008.Movimientos_avisar__ COMMENT='refs #6371 deprecated 2024-01-11';
+
+
+-- Para la tabla Movimientos_revisar
+ALTER TABLE IF EXISTS vn2008.Movimientos_revisar RENAME vn2008.Movimientos_revisar__;
+ALTER TABLE IF EXISTS vn2008.Movimientos_revisar__ COMMENT='refs #6371 deprecated 2024-01-11';
+
+
+-- Para la tabla Proveedores_escritos
+ALTER TABLE IF EXISTS vn2008.Proveedores_escritos RENAME vn2008.Proveedores_escritos__;
+ALTER TABLE IF EXISTS vn2008.Proveedores_escritos__ COMMENT='refs #6371 deprecated 2024-01-11';
\ No newline at end of file
diff --git a/db/versions/10878-blueSalal/00-firstScript.sql b/db/versions/10878-blueSalal/00-firstScript.sql
new file mode 100644
index 000000000..64506fa61
--- /dev/null
+++ b/db/versions/10878-blueSalal/00-firstScript.sql
@@ -0,0 +1,35 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`supplier_statement`()
+BEGIN
+ SELECT 1;
+END$$
+DELIMITER ;
+
+GRANT EXECUTE ON PROCEDURE vn.supplier_statement TO administrative, buyer, hrBoss;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`XDiario_check`()
+BEGIN
+ SELECT 1;
+END$$
+DELIMITER ;
+
+GRANT EXECUTE ON PROCEDURE vn.XDiario_check TO adminBoss;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_getDetailFromContinent`()
+BEGIN
+ SELECT 1;
+END$$
+DELIMITER ;
+
+GRANT EXECUTE ON PROCEDURE vn.travel_getDetailFromContinent TO buyer;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_getTransfer`()
+BEGIN
+ SELECT 1;
+END$$
+DELIMITER ;
+
+GRANT EXECUTE ON PROCEDURE vn.entry_getTransfer TO claimManager, buyer;
\ No newline at end of file
diff --git a/db/versions/10882-blueRuscus/00-vehicle.sql b/db/versions/10882-blueRuscus/00-vehicle.sql
new file mode 100644
index 000000000..337778cef
--- /dev/null
+++ b/db/versions/10882-blueRuscus/00-vehicle.sql
@@ -0,0 +1,13 @@
+ALTER TABLE vn.vehicle ADD supplierFk int(10) unsigned NULL COMMENT 'supplier from whom the vehicle was purchased';
+ALTER TABLE vn.vehicle ADD CONSTRAINT vehicle_supplierFk FOREIGN KEY (supplierFk) REFERENCES vn.supplier(id);
+
+ALTER TABLE vn.vehicle ADD import decimal(10,2) NULL;
+
+ALTER TABLE vn.vehicle ADD supplierCoolerFk int(10) unsigned NULL;
+ALTER TABLE vn.vehicle ADD CONSTRAINT vehicle_supplierCoolerFk FOREIGN KEY (supplierCoolerFk) REFERENCES vn.supplier(id) ON DELETE RESTRICT ON UPDATE CASCADE;
+
+ALTER TABLE vn.vehicle ADD vin varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL;
+
+ALTER TABLE vn.vehicle ADD bankPolicyFk int(11) NULL;
+ALTER TABLE vn.vehicle ADD CONSTRAINT vehicle_bankPolicyFk FOREIGN KEY (bankPolicyFk) REFERENCES vn.bankPolicy(id) ON DELETE RESTRICT ON UPDATE CASCADE;
+
diff --git a/db/versions/10883-azureRuscus/00-firstScript.sql b/db/versions/10883-azureRuscus/00-firstScript.sql
index 8e046d95b..89fdbf781 100644
--- a/db/versions/10883-azureRuscus/00-firstScript.sql
+++ b/db/versions/10883-azureRuscus/00-firstScript.sql
@@ -1 +1,6 @@
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn2008`.`credit`AS
+SELECT 1;
+
GRANT SELECT ON TABLE vn2008.credit TO financialBoss;
\ No newline at end of file
diff --git a/db/versions/10884-maroonGerbera/00-firstScript.sql b/db/versions/10884-maroonGerbera/00-firstScript.sql
new file mode 100644
index 000000000..704342a7c
--- /dev/null
+++ b/db/versions/10884-maroonGerbera/00-firstScript.sql
@@ -0,0 +1 @@
+DROP TABLE vn.timeControlDevice;
diff --git a/db/versions/10885-wheatHydrangea/00-revokeUpdateClient.sql b/db/versions/10885-wheatHydrangea/00-revokeUpdateClient.sql
new file mode 100644
index 000000000..b22e09615
--- /dev/null
+++ b/db/versions/10885-wheatHydrangea/00-revokeUpdateClient.sql
@@ -0,0 +1,37 @@
+REVOKE UPDATE ON vn.ticket FROM employee;
+
+GRANT UPDATE (id,
+ warehouseFk,
+ shipped,
+ nickname,
+ refFk,
+ addressFk,
+ workerFk,
+ observations,
+ isSigned,
+ isLabeled,
+ isPrinted,
+ packages,
+ location,
+ hour,
+ created,
+ isBlocked,
+ solution,
+ routeFk,
+ priority,
+ hasPriority,
+ companyFk,
+ agencyModeFk,
+ landed,
+ isBoxed,
+ isDeleted,
+ zoneFk,
+ zonePrice,
+ zoneBonus,
+ totalWithVat,
+ totalWithoutVat,
+ weight,
+ clonedFrom,
+ cmrFk,
+ editorFk)
+ ON vn.ticket TO employee;
diff --git a/e2e/helpers/tests.js b/e2e/tests.js
similarity index 94%
rename from e2e/helpers/tests.js
rename to e2e/tests.js
index 7dd299e0b..829056f4c 100644
--- a/e2e/helpers/tests.js
+++ b/e2e/tests.js
@@ -10,7 +10,7 @@ const Myt = require('@verdnatura/myt/myt');
const Run = require('@verdnatura/myt/myt-run');
const axios = require('axios');
-const e2eConfig = require('./config.js');
+const e2eConfig = require('./helpers/config.js');
const log = require('fancy-log');
process.on('warning', warning => {
@@ -23,11 +23,12 @@ async function test() {
const opts = getopts(process.argv.slice(2), {
boolean: ['show']
});
- process.env.E2E_SHOW = opts.show;
+ if (opts.show)
+ process.env.E2E_SHOW = true;
console.log('Building and running DB container.');
const myt = new Myt();
- await myt.init({workspace: path.join(__dirname, '../..')});
+ await myt.init({workspace: path.join(__dirname, '..')});
await myt.run(Run);
await myt.deinit();
diff --git a/gulpfile.js b/gulpfile.js
index 054a65c1c..aa2b65bc1 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -256,7 +256,7 @@ async function dockerStart() {
await myt.run(Start);
await myt.deinit();
}
-dockerStart.description = `Starts the salix-db container`;
+dockerStart.description = `Starts the DB container`;
async function docker() {
const myt = new Myt();
@@ -264,7 +264,7 @@ async function docker() {
await myt.run(Run);
await myt.deinit();
}
-docker.description = `Runs the salix-db container`;
+docker.description = `Builds and starts the DB container`;
module.exports = {
default: defaultTask,
diff --git a/loopback/locale/en.json b/loopback/locale/en.json
index 39756a615..2187371cd 100644
--- a/loopback/locale/en.json
+++ b/loopback/locale/en.json
@@ -1,211 +1,213 @@
{
- "State cannot be blank": "State cannot be blank",
- "Cannot be blank": "Cannot be blank",
- "The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero",
- "The grade must be an integer greater than or equal to zero": "The grade must be an integer greater than or equal to zero",
- "Invalid email": "Invalid email",
- "Name cannot be blank": "Name cannot be blank",
- "Phone cannot be blank": "Phone cannot be blank",
- "Description should have maximum of 45 characters": "Description should have maximum of 45 characters",
- "Period cannot be blank": "Period cannot be blank",
- "Sample type cannot be blank": "Sample type cannot be blank",
- "That payment method requires an IBAN": "That payment method requires an IBAN",
- "That payment method requires a BIC": "That payment method requires a BIC",
- "The default consignee can not be unchecked": "The default consignee can not be unchecked",
- "Enter an integer different to zero": "Enter an integer different to zero",
- "Package cannot be blank": "Package cannot be blank",
- "The price of the item changed": "The price of the item changed",
- "The sales of this ticket can't be modified": "The sales of this ticket can't be modified",
- "Cannot check Equalization Tax in this NIF/CIF": "Cannot check Equalization Tax in this NIF/CIF",
- "You can't create an order for a frozen client": "You can't create an order for a frozen client",
- "This address doesn't exist": "This address doesn't exist",
- "Warehouse cannot be blank": "Warehouse cannot be blank",
- "Agency cannot be blank": "Agency cannot be blank",
- "The IBAN does not have the correct format": "The IBAN does not have the correct format",
- "You can't make changes on the basic data of an confirmed order or with rows": "You can't make changes on the basic data of an confirmed order or with rows",
- "You can't create a ticket for an inactive client": "You can't create a ticket for an inactive client",
- "Worker cannot be blank": "Worker cannot be blank",
- "You must delete the claim id %d first": "You must delete the claim id %d first",
- "You don't have enough privileges": "You don't have enough privileges",
- "Tag value cannot be blank": "Tag value cannot be blank",
- "A client with that Web User name already exists": "A client with that Web User name already exists",
- "The warehouse can't be repeated": "The warehouse can't be repeated",
- "Barcode must be unique": "Barcode must be unique",
- "You don't have enough privileges to do that": "You don't have enough privileges to do that",
- "You can't create a ticket for a frozen client": "You can't create a ticket for a frozen client",
- "can't be blank": "can't be blank",
- "Street cannot be empty": "Street cannot be empty",
- "City cannot be empty": "City cannot be empty",
- "EXTENSION_INVALID_FORMAT": "Invalid extension",
- "The secret can't be blank": "The secret can't be blank",
- "Invalid TIN": "Invalid Tax number",
- "This ticket can't be invoiced": "This ticket can't be invoiced",
- "The value should be a number": "The value should be a number",
- "The current ticket can't be modified": "The current ticket can't be modified",
- "Extension format is invalid": "Extension format is invalid",
- "NO_ZONE_FOR_THIS_PARAMETERS": "NO_ZONE_FOR_THIS_PARAMETERS",
- "This client can't be invoiced": "This client can't be invoiced",
- "You must provide the correction information to generate a corrective invoice": "You must provide the correction information to generate a corrective invoice",
- "The introduced hour already exists": "The introduced hour already exists",
- "Invalid parameters to create a new ticket": "Invalid parameters to create a new ticket",
- "Concept cannot be blank": "Concept cannot be blank",
- "Ticket id cannot be blank": "Ticket id cannot be blank",
- "Weekday cannot be blank": "Weekday cannot be blank",
- "This ticket can not be modified": "This ticket can not be modified",
- "You can't delete a confirmed order": "You can't delete a confirmed order",
- "Value has an invalid format": "Value has an invalid format",
- "The postcode doesn't exist. Please enter a correct one": "The postcode doesn't exist. Please enter a correct one",
- "Swift / BIC can't be empty": "Swift / BIC can't be empty",
- "Deleted sales from ticket": "I have deleted the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}",
- "Added sale to ticket": "I have added the following line to the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
- "Changed sale discount": "I have changed the following lines discounts from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
- "Created claim": "I have created the claim [{{claimId}}]({{{claimUrl}}}) for the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
- "Changed sale price": "I have changed the price of [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) from {{oldPrice}}€ ➔ *{{newPrice}}€* of the ticket [{{ticketId}}]({{{ticketUrl}}})",
- "Changed sale quantity": "I have changed the quantity of [{{itemId}} {{concept}}]({{{itemUrl}}}) from {{oldQuantity}} ➔ *{{newQuantity}}* of the ticket [{{ticketId}}]({{{ticketUrl}}})",
- "Changed sale reserved state": "I have changed the following lines reserved state from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
- "Bought units from buy request": "Bought {{quantity}} units of [{{itemId}} {{concept}}]({{{urlItem}}}) for the ticket id [{{ticketId}}]({{{url}}})",
- "MESSAGE_INSURANCE_CHANGE": "I have changed the insurence credit of client [{{clientName}} ({{clientId}})]({{{url}}}) to *{{credit}} €*",
- "Changed client paymethod": "I have changed the pay method for client [{{clientName}} ({{clientId}})]({{{url}}})",
- "Sent units from ticket": "I sent *{{quantity}}* units of [{{concept}} ({{itemId}})]({{{itemUrl}}}) to *\"{{nickname}}\"* coming from ticket id [{{ticketId}}]({{{ticketUrl}}})",
- "Change quantity": "{{concept}} change of {{oldQuantity}} to {{newQuantity}}",
- "Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked",
- "Claim state has changed to": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *{{newState}}*",
- "Customs agent is required for a non UEE member": "Customs agent is required for a non UEE member",
- "Incoterms is required for a non UEE member": "Incoterms is required for a non UEE member",
- "Client checked as validated despite of duplication": "Client checked as validated despite of duplication from client id {{clientId}}",
- "Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment",
- "NOT_ZONE_WITH_THIS_PARAMETERS": "There's no zone available for this day",
- "Created absence": "The worker {{author}} has added an absence of type '{{absenceType}}' to {{employee}} for day {{dated}}.",
- "Deleted absence": "The worker {{author}} has deleted an absence of type '{{absenceType}}' to {{employee}} for day {{dated}}.",
- "I have deleted the ticket id": "I have deleted the ticket id [{{id}}]({{{url}}})",
- "I have restored the ticket id": "I have restored the ticket id [{{id}}]({{{url}}})",
- "Changed this data from the ticket": "I have changed the data from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
- "The grade must be similar to the last one": "The grade must be similar to the last one",
- "agencyModeFk": "Agency",
- "clientFk": "Client",
- "zoneFk": "Zone",
- "warehouseFk": "Warehouse",
- "shipped": "Shipped",
- "landed": "Landed",
- "addressFk": "Address",
- "companyFk": "Company",
- "You need to fill sage information before you check verified data": "You need to fill sage information before you check verified data",
- "The social name cannot be empty": "The social name cannot be empty",
- "The nif cannot be empty": "The nif cannot be empty",
- "Amount cannot be zero": "Amount cannot be zero",
- "Company has to be official": "Company has to be official",
- "Unable to clone this travel": "Unable to clone this travel",
- "The observation type can't be repeated": "The observation type can't be repeated",
- "New ticket request has been created with price": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}* and a price of *{{price}} €*",
- "New ticket request has been created": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}*",
- "There's a new urgent ticket": "There's a new urgent ticket: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})",
- "Swift / BIC cannot be empty": "Swift / BIC cannot be empty",
- "Role name must be written in camelCase": "Role name must be written in camelCase",
- "Client assignment has changed": "I did change the salesperson ~*\"<{{previousWorkerName}}>\"*~ by *\"<{{currentWorkerName}}>\"* from the client [{{clientName}} ({{clientId}})]({{{url}}})",
- "None": "None",
- "error densidad = 0": "error densidad = 0",
- "This document already exists on this ticket": "This document already exists on this ticket",
- "serial non editable": "This serial doesn't allow to set a reference",
- "nickname": "nickname",
- "State": "State",
- "regular": "regular",
- "reserved": "reserved",
- "Global invoicing failed": "[Global invoicing] Wasn't able to invoice some of the clients",
- "A ticket with a negative base can't be invoiced": "A ticket with a negative base can't be invoiced",
- "This client is not invoiceable": "This client is not invoiceable",
- "INACTIVE_PROVIDER": "Inactive provider",
- "reference duplicated": "reference duplicated",
- "The PDF document does not exist": "The PDF document does not exists. Try regenerating it from 'Regenerate invoice PDF' option",
- "This item is not available": "This item is not available",
- "Deny buy request": "Purchase request for ticket id [{{ticketId}}]({{{url}}}) has been rejected. Reason: {{observation}}",
- "The type of business must be filled in basic data": "The type of business must be filled in basic data",
- "The worker has hours recorded that day": "The worker has hours recorded that day",
- "isWithoutNegatives": "isWithoutNegatives",
- "routeFk": "routeFk",
- "Not enough privileges to edit a client with verified data": "Not enough privileges to edit a client with verified data",
- "Can't change the password of another worker": "Can't change the password of another worker",
- "No hay un contrato en vigor": "There is no existing contract",
- "No está permitido trabajar": "Not allowed to work",
- "Dirección incorrecta": "Wrong direction",
- "No se permite fichar a futuro": "It is not allowed to sign in the future",
- "Descanso diario 12h.": "Daily rest 12h.",
- "Fichadas impares": "Odd signs",
- "Descanso diario 9h.": "Daily rest 9h.",
- "Descanso semanal 36h. / 72h.": "Weekly rest 36h. / 72h.",
- "Verify email": "Verify email",
- "Click on the following link to verify this email. If you haven't requested this email, just ignore it": "Click on the following link to verify this email. If you haven't requested this email, just ignore it",
- "Password does not meet requirements": "Password does not meet requirements",
- "You don't have privileges to change the zone": "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies",
- "Not enough privileges to edit a client": "Not enough privileges to edit a client",
- "Claim pickup order sent": "Claim pickup order sent [{{claimId}}]({{{claimUrl}}}) to client *{{clientName}}*",
- "You don't have grant privilege": "You don't have grant privilege",
- "You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user",
- "Email verify": "Email verify",
- "Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) merged with [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})",
- "App locked": "App locked by user {{userId}}",
- "The sales of the receiver ticket can't be modified": "The sales of the receiver ticket can't be modified",
- "Receipt's bank was not found": "Receipt's bank was not found",
- "This receipt was not compensated": "This receipt was not compensated",
- "Client's email was not found": "Client's email was not found",
- "Tickets with associated refunds": "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº %d",
- "It is not possible to modify tracked sales": "It is not possible to modify tracked sales",
- "It is not possible to modify sales that their articles are from Floramondo": "It is not possible to modify sales that their articles are from Floramondo",
- "It is not possible to modify cloned sales": "It is not possible to modify cloned sales",
- "Warehouse inventory not set": "Almacén inventario no está establecido",
- "Component cost not set": "Componente coste no está estabecido",
- "Description cannot be blank": "Description cannot be blank",
- "company": "Company",
- "country": "Country",
- "clientId": "Id client",
- "clientSocialName": "Client",
- "amount": "Amount",
- "taxableBase": "Taxable base",
- "ticketFk": "Id ticket",
- "isActive": "Active",
- "hasToInvoice": "Invoice",
- "isTaxDataChecked": "Data checked",
- "comercialId": "Id Comercial",
- "comercialName": "Comercial",
- "Added observation": "Added observation",
- "Comment added to client": "Comment added to client",
- "This ticket is already a refund": "This ticket is already a refund",
- "A claim with that sale already exists": "A claim with that sale already exists",
- "Pass expired": "The password has expired, change it from Salix",
- "Can't transfer claimed sales": "Can't transfer claimed sales",
- "Invalid quantity": "Invalid quantity",
- "Failed to upload delivery note": "Error to upload delivery note {{id}}",
- "Mail not sent": "There has been an error sending the invoice to the client [{{clientId}}]({{{clientUrl}}}), please check the email address",
- "The renew period has not been exceeded": "The renew period has not been exceeded",
- "You can not use the same password": "You can not use the same password",
- "Valid priorities": "Valid priorities: %d",
- "hasAnyNegativeBase": "Negative basis of tickets: {{ticketsIds}}",
- "hasAnyPositiveBase": "Positive basis of tickets: {{ticketsIds}}",
- "This ticket cannot be left empty.": "This ticket cannot be left empty. %s",
- "Social name should be uppercase": "Social name should be uppercase",
- "Street should be uppercase": "Street should be uppercase",
- "You don't have enough privileges.": "You don't have enough privileges.",
- "This ticket is locked": "This ticket is locked",
- "This ticket is not editable.": "This ticket is not editable.",
- "The ticket doesn't exist.": "The ticket doesn't exist.",
- "The sales do not exists": "The sales do not exists",
- "Ticket without Route": "Ticket without route",
- "Select a different client": "Select a different client",
- "Fill all the fields": "Fill all the fields",
- "Error while generating PDF": "Error while generating PDF",
- "Can't invoice to future": "Can't invoice to future",
- "This ticket is already invoiced": "This ticket is already invoiced",
- "Negative basis of tickets: 23": "Negative basis of tickets: 23",
- "Booking completed": "Booking complete",
- "The ticket is in preparation": "The ticket [{{ticketId}}]({{{ticketUrl}}}) of the sales person {{salesPersonId}} is in preparation",
- "You can only add negative amounts in refund tickets": "You can only add negative amounts in refund tickets",
- "Bank entity must be specified": "Bank entity must be specified",
- "Try again": "Try again",
- "keepPrice": "keepPrice",
- "Cannot past travels with entries": "Cannot past travels with entries",
- "It was not able to remove the next expeditions:": "It was not able to remove the next expeditions: {{expeditions}}",
- "Incorrect pin": "Incorrect pin.",
- "The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified",
- "Name should be uppercase": "Name should be uppercase",
- "You cannot update these fields": "You cannot update these fields",
- "CountryFK cannot be empty": "Country cannot be empty"
-}
\ No newline at end of file
+ "State cannot be blank": "State cannot be blank",
+ "Cannot be blank": "Cannot be blank",
+ "The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero",
+ "The grade must be an integer greater than or equal to zero": "The grade must be an integer greater than or equal to zero",
+ "Invalid email": "Invalid email",
+ "Name cannot be blank": "Name cannot be blank",
+ "Phone cannot be blank": "Phone cannot be blank",
+ "Description should have maximum of 45 characters": "Description should have maximum of 45 characters",
+ "Period cannot be blank": "Period cannot be blank",
+ "Sample type cannot be blank": "Sample type cannot be blank",
+ "That payment method requires an IBAN": "That payment method requires an IBAN",
+ "That payment method requires a BIC": "That payment method requires a BIC",
+ "The default consignee can not be unchecked": "The default consignee can not be unchecked",
+ "Enter an integer different to zero": "Enter an integer different to zero",
+ "Package cannot be blank": "Package cannot be blank",
+ "The price of the item changed": "The price of the item changed",
+ "The sales of this ticket can't be modified": "The sales of this ticket can't be modified",
+ "Cannot check Equalization Tax in this NIF/CIF": "Cannot check Equalization Tax in this NIF/CIF",
+ "You can't create an order for a frozen client": "You can't create an order for a frozen client",
+ "This address doesn't exist": "This address doesn't exist",
+ "Warehouse cannot be blank": "Warehouse cannot be blank",
+ "Agency cannot be blank": "Agency cannot be blank",
+ "The IBAN does not have the correct format": "The IBAN does not have the correct format",
+ "You can't make changes on the basic data of an confirmed order or with rows": "You can't make changes on the basic data of an confirmed order or with rows",
+ "You can't create a ticket for an inactive client": "You can't create a ticket for an inactive client",
+ "Worker cannot be blank": "Worker cannot be blank",
+ "You must delete the claim id %d first": "You must delete the claim id %d first",
+ "You don't have enough privileges": "You don't have enough privileges",
+ "Tag value cannot be blank": "Tag value cannot be blank",
+ "A client with that Web User name already exists": "A client with that Web User name already exists",
+ "The warehouse can't be repeated": "The warehouse can't be repeated",
+ "Barcode must be unique": "Barcode must be unique",
+ "You don't have enough privileges to do that": "You don't have enough privileges to do that",
+ "You can't create a ticket for a frozen client": "You can't create a ticket for a frozen client",
+ "can't be blank": "can't be blank",
+ "Street cannot be empty": "Street cannot be empty",
+ "City cannot be empty": "City cannot be empty",
+ "EXTENSION_INVALID_FORMAT": "Invalid extension",
+ "The secret can't be blank": "The secret can't be blank",
+ "Invalid TIN": "Invalid Tax number",
+ "This ticket can't be invoiced": "This ticket can't be invoiced",
+ "The value should be a number": "The value should be a number",
+ "The current ticket can't be modified": "The current ticket can't be modified",
+ "Extension format is invalid": "Extension format is invalid",
+ "NO_ZONE_FOR_THIS_PARAMETERS": "NO_ZONE_FOR_THIS_PARAMETERS",
+ "This client can't be invoiced": "This client can't be invoiced",
+ "You must provide the correction information to generate a corrective invoice": "You must provide the correction information to generate a corrective invoice",
+ "The introduced hour already exists": "The introduced hour already exists",
+ "Invalid parameters to create a new ticket": "Invalid parameters to create a new ticket",
+ "Concept cannot be blank": "Concept cannot be blank",
+ "Ticket id cannot be blank": "Ticket id cannot be blank",
+ "Weekday cannot be blank": "Weekday cannot be blank",
+ "This ticket can not be modified": "This ticket can not be modified",
+ "You can't delete a confirmed order": "You can't delete a confirmed order",
+ "Value has an invalid format": "Value has an invalid format",
+ "The postcode doesn't exist. Please enter a correct one": "The postcode doesn't exist. Please enter a correct one",
+ "Swift / BIC can't be empty": "Swift / BIC can't be empty",
+ "Deleted sales from ticket": "I have deleted the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}",
+ "Added sale to ticket": "I have added the following line to the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
+ "Changed sale discount": "I have changed the following lines discounts from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
+ "Created claim": "I have created the claim [{{claimId}}]({{{claimUrl}}}) for the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
+ "Changed sale price": "I have changed the price of [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) from {{oldPrice}}€ ➔ *{{newPrice}}€* of the ticket [{{ticketId}}]({{{ticketUrl}}})",
+ "Changed sale quantity": "I have changed the quantity of [{{itemId}} {{concept}}]({{{itemUrl}}}) from {{oldQuantity}} ➔ *{{newQuantity}}* of the ticket [{{ticketId}}]({{{ticketUrl}}})",
+ "Changed sale reserved state": "I have changed the following lines reserved state from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
+ "Bought units from buy request": "Bought {{quantity}} units of [{{itemId}} {{concept}}]({{{urlItem}}}) for the ticket id [{{ticketId}}]({{{url}}})",
+ "MESSAGE_INSURANCE_CHANGE": "I have changed the insurence credit of client [{{clientName}} ({{clientId}})]({{{url}}}) to *{{credit}} €*",
+ "Changed client paymethod": "I have changed the pay method for client [{{clientName}} ({{clientId}})]({{{url}}})",
+ "Sent units from ticket": "I sent *{{quantity}}* units of [{{concept}} ({{itemId}})]({{{itemUrl}}}) to *\"{{nickname}}\"* coming from ticket id [{{ticketId}}]({{{ticketUrl}}})",
+ "Change quantity": "{{concept}} change of {{oldQuantity}} to {{newQuantity}}",
+ "Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked",
+ "Claim state has changed to": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *{{newState}}*",
+ "Customs agent is required for a non UEE member": "Customs agent is required for a non UEE member",
+ "Incoterms is required for a non UEE member": "Incoterms is required for a non UEE member",
+ "Client checked as validated despite of duplication": "Client checked as validated despite of duplication from client id {{clientId}}",
+ "Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment",
+ "NOT_ZONE_WITH_THIS_PARAMETERS": "There's no zone available for this day",
+ "Created absence": "The worker {{author}} has added an absence of type '{{absenceType}}' to {{employee}} for day {{dated}}.",
+ "Deleted absence": "The worker {{author}} has deleted an absence of type '{{absenceType}}' to {{employee}} for day {{dated}}.",
+ "I have deleted the ticket id": "I have deleted the ticket id [{{id}}]({{{url}}})",
+ "I have restored the ticket id": "I have restored the ticket id [{{id}}]({{{url}}})",
+ "Changed this data from the ticket": "I have changed the data from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
+ "The grade must be similar to the last one": "The grade must be similar to the last one",
+ "agencyModeFk": "Agency",
+ "clientFk": "Client",
+ "zoneFk": "Zone",
+ "warehouseFk": "Warehouse",
+ "shipped": "Shipped",
+ "landed": "Landed",
+ "addressFk": "Address",
+ "companyFk": "Company",
+ "You need to fill sage information before you check verified data": "You need to fill sage information before you check verified data",
+ "The social name cannot be empty": "The social name cannot be empty",
+ "The nif cannot be empty": "The nif cannot be empty",
+ "Amount cannot be zero": "Amount cannot be zero",
+ "Company has to be official": "Company has to be official",
+ "Unable to clone this travel": "Unable to clone this travel",
+ "The observation type can't be repeated": "The observation type can't be repeated",
+ "New ticket request has been created with price": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}* and a price of *{{price}} €*",
+ "New ticket request has been created": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}*",
+ "There's a new urgent ticket": "There's a new urgent ticket: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})",
+ "Swift / BIC cannot be empty": "Swift / BIC cannot be empty",
+ "Role name must be written in camelCase": "Role name must be written in camelCase",
+ "Client assignment has changed": "I did change the salesperson ~*\"<{{previousWorkerName}}>\"*~ by *\"<{{currentWorkerName}}>\"* from the client [{{clientName}} ({{clientId}})]({{{url}}})",
+ "None": "None",
+ "error densidad = 0": "error densidad = 0",
+ "This document already exists on this ticket": "This document already exists on this ticket",
+ "serial non editable": "This serial doesn't allow to set a reference",
+ "nickname": "nickname",
+ "State": "State",
+ "regular": "regular",
+ "reserved": "reserved",
+ "Global invoicing failed": "[Global invoicing] Wasn't able to invoice some of the clients",
+ "A ticket with a negative base can't be invoiced": "A ticket with a negative base can't be invoiced",
+ "This client is not invoiceable": "This client is not invoiceable",
+ "INACTIVE_PROVIDER": "Inactive provider",
+ "reference duplicated": "reference duplicated",
+ "The PDF document does not exist": "The PDF document does not exists. Try regenerating it from 'Regenerate invoice PDF' option",
+ "This item is not available": "This item is not available",
+ "Deny buy request": "Purchase request for ticket id [{{ticketId}}]({{{url}}}) has been rejected. Reason: {{observation}}",
+ "The type of business must be filled in basic data": "The type of business must be filled in basic data",
+ "The worker has hours recorded that day": "The worker has hours recorded that day",
+ "isWithoutNegatives": "isWithoutNegatives",
+ "routeFk": "routeFk",
+ "Not enough privileges to edit a client with verified data": "Not enough privileges to edit a client with verified data",
+ "Can't change the password of another worker": "Can't change the password of another worker",
+ "No hay un contrato en vigor": "There is no existing contract",
+ "No está permitido trabajar": "Not allowed to work",
+ "Dirección incorrecta": "Wrong direction",
+ "No se permite fichar a futuro": "It is not allowed to sign in the future",
+ "Descanso diario 12h.": "Daily rest 12h.",
+ "Fichadas impares": "Odd signs",
+ "Descanso diario 9h.": "Daily rest 9h.",
+ "Descanso semanal 36h. / 72h.": "Weekly rest 36h. / 72h.",
+ "Verify email": "Verify email",
+ "Click on the following link to verify this email. If you haven't requested this email, just ignore it": "Click on the following link to verify this email. If you haven't requested this email, just ignore it",
+ "Password does not meet requirements": "Password does not meet requirements",
+ "You don't have privileges to change the zone": "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies",
+ "Not enough privileges to edit a client": "Not enough privileges to edit a client",
+ "Claim pickup order sent": "Claim pickup order sent [{{claimId}}]({{{claimUrl}}}) to client *{{clientName}}*",
+ "You don't have grant privilege": "You don't have grant privilege",
+ "You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user",
+ "Email verify": "Email verify",
+ "Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) merged with [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})",
+ "App locked": "App locked by user {{userId}}",
+ "The sales of the receiver ticket can't be modified": "The sales of the receiver ticket can't be modified",
+ "Receipt's bank was not found": "Receipt's bank was not found",
+ "This receipt was not compensated": "This receipt was not compensated",
+ "Client's email was not found": "Client's email was not found",
+ "Tickets with associated refunds": "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº %d",
+ "It is not possible to modify tracked sales": "It is not possible to modify tracked sales",
+ "It is not possible to modify sales that their articles are from Floramondo": "It is not possible to modify sales that their articles are from Floramondo",
+ "It is not possible to modify cloned sales": "It is not possible to modify cloned sales",
+ "Warehouse inventory not set": "Almacén inventario no está establecido",
+ "Component cost not set": "Componente coste no está estabecido",
+ "Description cannot be blank": "Description cannot be blank",
+ "company": "Company",
+ "country": "Country",
+ "clientId": "Id client",
+ "clientSocialName": "Client",
+ "amount": "Amount",
+ "taxableBase": "Taxable base",
+ "ticketFk": "Id ticket",
+ "isActive": "Active",
+ "hasToInvoice": "Invoice",
+ "isTaxDataChecked": "Data checked",
+ "comercialId": "Id Comercial",
+ "comercialName": "Comercial",
+ "Added observation": "Added observation",
+ "Comment added to client": "Comment added to client",
+ "This ticket is already a refund": "This ticket is already a refund",
+ "A claim with that sale already exists": "A claim with that sale already exists",
+ "Pass expired": "The password has expired, change it from Salix",
+ "Can't transfer claimed sales": "Can't transfer claimed sales",
+ "Invalid quantity": "Invalid quantity",
+ "Failed to upload delivery note": "Error to upload delivery note {{id}}",
+ "Mail not sent": "There has been an error sending the invoice to the client [{{clientId}}]({{{clientUrl}}}), please check the email address",
+ "The renew period has not been exceeded": "The renew period has not been exceeded",
+ "You can not use the same password": "You can not use the same password",
+ "Valid priorities": "Valid priorities: %d",
+ "hasAnyNegativeBase": "Negative basis of tickets: {{ticketsIds}}",
+ "hasAnyPositiveBase": "Positive basis of tickets: {{ticketsIds}}",
+ "This ticket cannot be left empty.": "This ticket cannot be left empty. %s",
+ "Social name should be uppercase": "Social name should be uppercase",
+ "Street should be uppercase": "Street should be uppercase",
+ "You don't have enough privileges.": "You don't have enough privileges.",
+ "This ticket is locked": "This ticket is locked",
+ "This ticket is not editable.": "This ticket is not editable.",
+ "The ticket doesn't exist.": "The ticket doesn't exist.",
+ "The sales do not exists": "The sales do not exists",
+ "Ticket without Route": "Ticket without route",
+ "Select a different client": "Select a different client",
+ "Fill all the fields": "Fill all the fields",
+ "Error while generating PDF": "Error while generating PDF",
+ "Can't invoice to future": "Can't invoice to future",
+ "This ticket is already invoiced": "This ticket is already invoiced",
+ "Negative basis of tickets: 23": "Negative basis of tickets: 23",
+ "Booking completed": "Booking complete",
+ "The ticket is in preparation": "The ticket [{{ticketId}}]({{{ticketUrl}}}) of the sales person {{salesPersonId}} is in preparation",
+ "You can only add negative amounts in refund tickets": "You can only add negative amounts in refund tickets",
+ "Bank entity must be specified": "Bank entity must be specified",
+ "Try again": "Try again",
+ "keepPrice": "keepPrice",
+ "Cannot past travels with entries": "Cannot past travels with entries",
+ "It was not able to remove the next expeditions:": "It was not able to remove the next expeditions: {{expeditions}}",
+ "Incorrect pin": "Incorrect pin.",
+ "The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified",
+ "Name should be uppercase": "Name should be uppercase",
+ "You cannot update these fields": "You cannot update these fields",
+ "CountryFK cannot be empty": "Country cannot be empty",
+ "You are not allowed to modify the alias": "You are not allowed to modify the alias",
+ "You already have the mailAlias": "You already have the mailAlias"
+}
diff --git a/loopback/locale/es.json b/loopback/locale/es.json
index b0eb59cd5..aea0c311c 100644
--- a/loopback/locale/es.json
+++ b/loopback/locale/es.json
@@ -1,347 +1,348 @@
{
- "Phone format is invalid": "El formato del teléfono no es correcto",
- "You are not allowed to change the credit": "No tienes privilegios para modificar el crédito",
- "Unable to mark the equivalence surcharge": "No se puede marcar el recargo de equivalencia",
- "The default consignee can not be unchecked": "No se puede desmarcar el consignatario predeterminado",
- "Unable to default a disabled consignee": "No se puede poner predeterminado un consignatario desactivado",
- "Can't be blank": "No puede estar en blanco",
- "Invalid TIN": "NIF/CIF inválido",
- "TIN must be unique": "El NIF/CIF debe ser único",
- "A client with that Web User name already exists": "Ya existe un cliente con ese Usuario Web",
- "Is invalid": "Es inválido",
- "Quantity cannot be zero": "La cantidad no puede ser cero",
- "Enter an integer different to zero": "Introduce un entero distinto de cero",
- "Package cannot be blank": "El embalaje no puede estar en blanco",
- "The company name must be unique": "La razón social debe ser única",
- "Invalid email": "Correo electrónico inválido",
- "The IBAN does not have the correct format": "El IBAN no tiene el formato correcto",
- "That payment method requires an IBAN": "El método de pago seleccionado requiere un IBAN",
- "That payment method requires a BIC": "El método de pago seleccionado requiere un BIC",
- "State cannot be blank": "El estado no puede estar en blanco",
- "Worker cannot be blank": "El trabajador no puede estar en blanco",
- "Cannot change the payment method if no salesperson": "No se puede cambiar la forma de pago si no hay comercial asignado",
- "can't be blank": "El campo no puede estar vacío",
- "Observation type must be unique": "El tipo de observación no puede repetirse",
- "The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero",
- "The grade must be similar to the last one": "El grade debe ser similar al último",
- "Only manager can change the credit": "Solo el gerente puede cambiar el credito de este cliente",
- "Name cannot be blank": "El nombre no puede estar en blanco",
- "Phone cannot be blank": "El teléfono no puede estar en blanco",
- "Period cannot be blank": "El periodo no puede estar en blanco",
- "Choose a company": "Selecciona una empresa",
- "Se debe rellenar el campo de texto": "Se debe rellenar el campo de texto",
- "Description should have maximum of 45 characters": "La descripción debe tener maximo 45 caracteres",
- "Cannot be blank": "El campo no puede estar en blanco",
- "The grade must be an integer greater than or equal to zero": "El grade debe ser un entero mayor o igual a cero",
- "Sample type cannot be blank": "El tipo de plantilla no puede quedar en blanco",
- "Description cannot be blank": "Se debe rellenar el campo de texto",
- "The price of the item changed": "El precio del artículo cambió",
- "The value should not be greater than 100%": "El valor no debe de ser mayor de 100%",
- "The value should be a number": "El valor debe ser un numero",
- "This order is not editable": "Esta orden no se puede modificar",
- "You can't create an order for a frozen client": "No puedes crear una orden para un cliente congelado",
- "You can't create an order for a client that has a debt": "No puedes crear una orden para un cliente con deuda",
- "is not a valid date": "No es una fecha valida",
- "Barcode must be unique": "El código de barras debe ser único",
- "The warehouse can't be repeated": "El almacén no puede repetirse",
- "The tag or priority can't be repeated for an item": "El tag o prioridad no puede repetirse para un item",
- "The observation type can't be repeated": "El tipo de observación no puede repetirse",
- "A claim with that sale already exists": "Ya existe una reclamación para esta línea",
- "You don't have enough privileges to change that field": "No tienes permisos para cambiar ese campo",
- "Warehouse cannot be blank": "El almacén no puede quedar en blanco",
- "Agency cannot be blank": "La agencia no puede quedar en blanco",
- "Not enough privileges to edit a client with verified data": "No tienes permisos para hacer cambios en un cliente con datos comprobados",
- "This address doesn't exist": "Este consignatario no existe",
- "You must delete the claim id %d first": "Antes debes borrar la reclamación %d",
- "You don't have enough privileges": "No tienes suficientes permisos",
- "Cannot check Equalization Tax in this NIF/CIF": "No se puede marcar RE en este NIF/CIF",
- "You can't make changes on the basic data of an confirmed order or with rows": "No puedes cambiar los datos básicos de una orden con artículos",
- "INVALID_USER_NAME": "El nombre de usuario solo debe contener letras minúsculas o, a partir del segundo carácter, números o subguiones, no está permitido el uso de la letra ñ",
- "You can't create a ticket for a frozen client": "No puedes crear un ticket para un cliente congelado",
- "You can't create a ticket for an inactive client": "No puedes crear un ticket para un cliente inactivo",
- "Tag value cannot be blank": "El valor del tag no puede quedar en blanco",
- "ORDER_EMPTY": "Cesta vacía",
- "You don't have enough privileges to do that": "No tienes permisos para cambiar esto",
- "NO SE PUEDE DESACTIVAR EL CONSIGNAT": "NO SE PUEDE DESACTIVAR EL CONSIGNAT",
- "Error. El NIF/CIF está repetido": "Error. El NIF/CIF está repetido",
- "Street cannot be empty": "Dirección no puede estar en blanco",
- "City cannot be empty": "Ciudad no puede estar en blanco",
- "Code cannot be blank": "Código no puede estar en blanco",
- "You cannot remove this department": "No puedes eliminar este departamento",
- "The extension must be unique": "La extensión debe ser unica",
- "The secret can't be blank": "La contraseña no puede estar en blanco",
- "We weren't able to send this SMS": "No hemos podido enviar el SMS",
- "This client can't be invoiced": "Este cliente no puede ser facturado",
- "You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa",
- "This ticket can't be invoiced": "Este ticket no puede ser facturado",
- "You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado",
- "This ticket can not be modified": "Este ticket no puede ser modificado",
- "The introduced hour already exists": "Esta hora ya ha sido introducida",
- "INFINITE_LOOP": "Existe una dependencia entre dos Jefes",
- "The sales of the receiver ticket can't be modified": "Las lineas del ticket al que envias no pueden ser modificadas",
- "NO_AGENCY_AVAILABLE": "No hay una zona de reparto disponible con estos parámetros",
- "ERROR_PAST_SHIPMENT": "No puedes seleccionar una fecha de envío en pasado",
- "The current ticket can't be modified": "El ticket actual no puede ser modificado",
- "The current claim can't be modified": "La reclamación actual no puede ser modificada",
- "The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas",
- "The sales do not exists": "La(s) línea(s) seleccionada(s) no existe(n)",
- "Please select at least one sale": "Por favor selecciona al menos una linea",
- "All sales must belong to the same ticket": "Todas las lineas deben pertenecer al mismo ticket",
- "NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada",
- "This item doesn't exists": "El artículo no existe",
- "NOT_ZONE_WITH_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada",
- "Extension format is invalid": "El formato de la extensión es inválido",
- "Invalid parameters to create a new ticket": "Parámetros inválidos para crear un nuevo ticket",
- "This item is not available": "Este artículo no está disponible",
- "This postcode already exists": "Este código postal ya existe",
- "Concept cannot be blank": "El concepto no puede quedar en blanco",
- "File doesn't exists": "El archivo no existe",
- "You don't have privileges to change the zone": "No tienes permisos para cambiar la zona o para esos parámetros hay más de una opción de envío, hable con las agencias",
- "This ticket is already on weekly tickets": "Este ticket ya está en tickets programados",
- "Ticket id cannot be blank": "El id de ticket no puede quedar en blanco",
- "Weekday cannot be blank": "El día de la semana no puede quedar en blanco",
- "You can't delete a confirmed order": "No puedes borrar un pedido confirmado",
- "The social name has an invalid format": "El nombre fiscal tiene un formato incorrecto",
- "Invalid quantity": "Cantidad invalida",
- "This postal code is not valid": "Este código postal no es válido",
- "is invalid": "es inválido",
- "The postcode doesn't exist. Please enter a correct one": "El código postal no existe. Por favor, introduce uno correcto",
- "The department name can't be repeated": "El nombre del departamento no puede repetirse",
- "This phone already exists": "Este teléfono ya existe",
- "You cannot move a parent to its own sons": "No puedes mover un elemento padre a uno de sus hijos",
- "You can't create a claim for a removed ticket": "No puedes crear una reclamación para un ticket eliminado",
- "You cannot delete a ticket that part of it is being prepared": "No puedes eliminar un ticket en el que una parte que está siendo preparada",
- "You must delete all the buy requests first": "Debes eliminar todas las peticiones de compra primero",
- "You should specify a date": "Debes especificar una fecha",
- "You should specify at least a start or end date": "Debes especificar al menos una fecha de inicio o de fin",
- "Start date should be lower than end date": "La fecha de inicio debe ser menor que la fecha de fin",
- "You should mark at least one week day": "Debes marcar al menos un día de la semana",
- "Swift / BIC can't be empty": "Swift / BIC no puede estar vacío",
- "Customs agent is required for a non UEE member": "El agente de aduanas es requerido para los clientes extracomunitarios",
- "Incoterms is required for a non UEE member": "El incoterms es requerido para los clientes extracomunitarios",
- "Deleted sales from ticket": "He eliminado las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}",
- "Added sale to ticket": "He añadido la siguiente linea al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
- "Changed sale discount": "He cambiado el descuento de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
- "Created claim": "He creado la reclamación [{{claimId}}]({{{claimUrl}}}) de las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
- "Changed sale price": "He cambiado el precio de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* del ticket [{{ticketId}}]({{{ticketUrl}}})",
- "Changed sale quantity": "He cambiado la cantidad de [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}* del ticket [{{ticketId}}]({{{ticketUrl}}})",
- "State": "Estado",
- "regular": "normal",
- "reserved": "reservado",
- "Changed sale reserved state": "He cambiado el estado reservado de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
- "Bought units from buy request": "Se ha comprado {{quantity}} unidades de [{{itemId}} {{concept}}]({{{urlItem}}}) para el ticket id [{{ticketId}}]({{{url}}})",
- "Deny buy request": "Se ha rechazado la petición de compra para el ticket id [{{ticketId}}]({{{url}}}). Motivo: {{observation}}",
- "MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} ({{clientId}})]({{{url}}}) a *{{credit}} €*",
- "Changed client paymethod": "He cambiado la forma de pago del cliente [{{clientName}} ({{clientId}})]({{{url}}})",
- "Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})",
- "Change quantity": "{{concept}} cambia de {{oldQuantity}} a {{newQuantity}}",
- "Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*",
- "Claim state has changed to": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *{{newState}}*",
- "Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}",
- "ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto",
- "Distance must be lesser than 1000": "La distancia debe ser inferior a 1000",
- "This ticket is deleted": "Este ticket está eliminado",
- "Unable to clone this travel": "No ha sido posible clonar este travel",
- "This thermograph id already exists": "La id del termógrafo ya existe",
- "Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante",
- "ORDER_ALREADY_CONFIRMED": "ORDEN YA CONFIRMADA",
- "Invalid password": "Invalid password",
- "Password does not meet requirements": "La contraseña no cumple los requisitos",
- "Role already assigned": "Rol ya asignado",
- "Invalid role name": "Nombre de rol no válido",
- "Role name must be written in camelCase": "El nombre del rol debe escribirse en camelCase",
- "Email already exists": "El correo ya existe",
- "User already exists": "El/La usuario/a ya existe",
- "Absence change notification on the labour calendar": "Notificación de cambio de ausencia en el calendario laboral",
- "Record of hours week": "Registro de horas semana {{week}} año {{year}} ",
- "Created absence": "El empleado {{author}} ha añadido una ausencia de tipo '{{absenceType}}' a {{employee}} para el día {{dated}}.",
- "Deleted absence": "El empleado {{author}} ha eliminado una ausencia de tipo '{{absenceType}}' a {{employee}} del día {{dated}}.",
- "I have deleted the ticket id": "He eliminado el ticket id [{{id}}]({{{url}}})",
- "I have restored the ticket id": "He restaurado el ticket id [{{id}}]({{{url}}})",
- "You can only restore a ticket within the first hour after deletion": "Únicamente puedes restaurar el ticket dentro de la primera hora después de su eliminación",
- "Changed this data from the ticket": "He cambiado estos datos del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
- "agencyModeFk": "Agencia",
- "clientFk": "Cliente",
- "zoneFk": "Zona",
- "warehouseFk": "Almacén",
- "shipped": "F. envío",
- "landed": "F. entrega",
- "addressFk": "Consignatario",
- "companyFk": "Empresa",
- "The social name cannot be empty": "La razón social no puede quedar en blanco",
- "The nif cannot be empty": "El NIF no puede quedar en blanco",
- "You need to fill sage information before you check verified data": "Debes rellenar la información de sage antes de marcar datos comprobados",
- "ASSIGN_ZONE_FIRST": "Asigna una zona primero",
- "Amount cannot be zero": "El importe no puede ser cero",
- "Company has to be official": "Empresa inválida",
- "You can not select this payment method without a registered bankery account": "No se puede utilizar este método de pago si no has registrado una cuenta bancaria",
- "Action not allowed on the test environment": "Esta acción no está permitida en el entorno de pruebas",
- "The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta",
- "New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}* y un precio de *{{price}} €*",
- "New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}*",
- "Swift / BIC cannot be empty": "Swift / BIC no puede estar vacío",
- "This BIC already exist.": "Este BIC ya existe.",
- "That item doesn't exists": "Ese artículo no existe",
- "There's a new urgent ticket:": "Hay un nuevo ticket urgente:",
- "Invalid account": "Cuenta inválida",
- "Compensation account is empty": "La cuenta para compensar está vacia",
- "This genus already exist": "Este genus ya existe",
- "This specie already exist": "Esta especie ya existe",
- "Client assignment has changed": "He cambiado el comercial ~*\"<{{previousWorkerName}}>\"*~ por *\"<{{currentWorkerName}}>\"* del cliente [{{clientName}} ({{clientId}})]({{{url}}})",
- "None": "Ninguno",
- "The contract was not active during the selected date": "El contrato no estaba activo durante la fecha seleccionada",
- "Cannot add more than one '1/2 day vacation'": "No puedes añadir más de un 'Vacaciones 1/2 dia'",
- "This document already exists on this ticket": "Este documento ya existe en el ticket",
- "Some of the selected tickets are not billable": "Algunos de los tickets seleccionados no son facturables",
- "You can't invoice tickets from multiple clients": "No puedes facturar tickets de multiples clientes",
- "nickname": "nickname",
- "INACTIVE_PROVIDER": "Proveedor inactivo",
- "This client is not invoiceable": "Este cliente no es facturable",
- "serial non editable": "Esta serie no permite asignar la referencia",
- "Max shipped required": "La fecha límite es requerida",
- "Can't invoice to future": "No se puede facturar a futuro",
- "Can't invoice to past": "No se puede facturar a pasado",
- "This ticket is already invoiced": "Este ticket ya está facturado",
- "A ticket with an amount of zero can't be invoiced": "No se puede facturar un ticket con importe cero",
- "A ticket with a negative base can't be invoiced": "No se puede facturar un ticket con una base negativa",
- "Global invoicing failed": "[Facturación global] No se han podido facturar algunos clientes",
- "Wasn't able to invoice the following clients": "No se han podido facturar los siguientes clientes",
- "Can't verify data unless the client has a business type": "No se puede verificar datos de un cliente que no tiene tipo de negocio",
- "You don't have enough privileges to set this credit amount": "No tienes suficientes privilegios para establecer esta cantidad de crédito",
- "You can't change the credit set to zero from a financialBoss": "No puedes cambiar el cŕedito establecido a cero por un jefe de finanzas",
- "Amounts do not match": "Las cantidades no coinciden",
- "The PDF document does not exist": "El documento PDF no existe. Prueba a regenerarlo desde la opción 'Regenerar PDF factura'",
- "The type of business must be filled in basic data": "El tipo de negocio debe estar rellenado en datos básicos",
- "You can't create a claim from a ticket delivered more than seven days ago": "No puedes crear una reclamación de un ticket entregado hace más de siete días",
- "The worker has hours recorded that day": "El trabajador tiene horas fichadas ese día",
- "The worker has a marked absence that day": "El trabajador tiene marcada una ausencia ese día",
- "You can not modify is pay method checked": "No se puede modificar el campo método de pago validado",
- "The account size must be exactly 10 characters": "El tamaño de la cuenta debe ser exactamente de 10 caracteres",
- "Can't transfer claimed sales": "No puedes transferir lineas reclamadas",
- "You don't have privileges to create refund": "No tienes permisos para crear un abono",
- "The item is required": "El artículo es requerido",
- "The agency is already assigned to another autonomous": "La agencia ya está asignada a otro autónomo",
- "date in the future": "Fecha en el futuro",
- "reference duplicated": "Referencia duplicada",
- "This ticket is already a refund": "Este ticket ya es un abono",
- "isWithoutNegatives": "Sin negativos",
- "routeFk": "routeFk",
- "Can't change the password of another worker": "No se puede cambiar la contraseña de otro trabajador",
- "No hay un contrato en vigor": "No hay un contrato en vigor",
- "No se permite fichar a futuro": "No se permite fichar a futuro",
- "No está permitido trabajar": "No está permitido trabajar",
- "Fichadas impares": "Fichadas impares",
- "Descanso diario 12h.": "Descanso diario 12h.",
- "Descanso semanal 36h. / 72h.": "Descanso semanal 36h. / 72h.",
- "Dirección incorrecta": "Dirección incorrecta",
- "Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador",
- "Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador",
- "Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente",
- "This route does not exists": "Esta ruta no existe",
- "Claim pickup order sent": "Reclamación Orden de recogida enviada [{{claimId}}]({{{claimUrl}}}) al cliente *{{clientName}}*",
- "You don't have grant privilege": "No tienes privilegios para dar privilegios",
- "You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario",
- "Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) fusionado con [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})",
- "Already has this status": "Ya tiene este estado",
- "There aren't records for this week": "No existen registros para esta semana",
- "Empty data source": "Origen de datos vacio",
- "App locked": "Aplicación bloqueada por el usuario {{userId}}",
- "Email verify": "Correo de verificación",
- "Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment",
- "Receipt's bank was not found": "No se encontró el banco del recibo",
- "This receipt was not compensated": "Este recibo no ha sido compensado",
- "Client's email was not found": "No se encontró el email del cliente",
- "Negative basis": "Base negativa",
- "This worker code already exists": "Este codigo de trabajador ya existe",
- "This personal mail already exists": "Este correo personal ya existe",
- "This worker already exists": "Este trabajador ya existe",
- "App name does not exist": "El nombre de aplicación no es válido",
- "Try again": "Vuelve a intentarlo",
- "Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9",
- "Failed to upload delivery note": "Error al subir albarán {{id}}",
- "The DOCUWARE PDF document does not exists": "El documento PDF Docuware no existe",
- "It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que se hayan empezado a preparar",
- "It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo",
- "It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas",
- "A supplier with the same name already exists. Change the country.": "Un proveedor con el mismo nombre ya existe. Cambie el país.",
- "There is no assigned email for this client": "No hay correo asignado para este cliente",
- "Exists an invoice with a future date": "Existe una factura con fecha posterior",
- "Invoice date can't be less than max date": "La fecha de factura no puede ser inferior a la fecha límite",
- "Warehouse inventory not set": "El almacén inventario no está establecido",
- "This locker has already been assigned": "Esta taquilla ya ha sido asignada",
- "Tickets with associated refunds": "No se pueden borrar tickets con abonos asociados. Este ticket está asociado al abono Nº %d",
- "Not exist this branch": "La rama no existe",
- "This ticket cannot be signed because it has not been boxed": "Este ticket no puede firmarse porque no ha sido encajado",
- "Collection does not exist": "La colección no existe",
- "Cannot obtain exclusive lock": "No se puede obtener un bloqueo exclusivo",
- "Insert a date range": "Inserte un rango de fechas",
- "Added observation": "{{user}} añadió esta observacion: {{text}}",
- "Comment added to client": "Observación añadida al cliente {{clientFk}}",
- "Invalid auth code": "Código de verificación incorrecto",
- "Invalid or expired verification code": "Código de verificación incorrecto o expirado",
- "Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen",
- "company": "Compañía",
- "country": "País",
- "clientId": "Id cliente",
- "clientSocialName": "Cliente",
- "amount": "Importe",
- "taxableBase": "Base",
- "ticketFk": "Id ticket",
- "isActive": "Activo",
- "hasToInvoice": "Facturar",
- "isTaxDataChecked": "Datos comprobados",
- "comercialId": "Id comercial",
- "comercialName": "Comercial",
- "Pass expired": "La contraseña ha caducado, cambiela desde Salix",
- "Invalid NIF for VIES": "Invalid NIF for VIES",
- "Ticket does not exist": "Este ticket no existe",
- "Ticket is already signed": "Este ticket ya ha sido firmado",
- "Authentication failed": "Autenticación fallida",
- "You can't use the same password": "No puedes usar la misma contraseña",
- "You can only add negative amounts in refund tickets": "Solo se puede añadir cantidades negativas en tickets abono",
- "Fecha fuera de rango": "Fecha fuera de rango",
- "Error while generating PDF": "Error al generar PDF",
- "Error when sending mail to client": "Error al enviar el correo al cliente",
- "Mail not sent": "Se ha producido un fallo al enviar la factura al cliente [{{clientId}}]({{{clientUrl}}}), por favor revisa la dirección de correo electrónico",
- "The renew period has not been exceeded": "El periodo de renovación no ha sido superado",
- "Valid priorities": "Prioridades válidas: %d",
- "hasAnyNegativeBase": "Base negativa para los tickets: {{ticketsIds}}",
- "hasAnyPositiveBase": "Base positivas para los tickets: {{ticketsIds}}",
- "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado",
- "This ticket cannot be left empty.": "Este ticket no se puede dejar vacío. %s",
- "The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias",
- "You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado",
- "This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado",
- "You don't have enough privileges.": "No tienes suficientes permisos.",
- "This ticket is locked": "Este ticket está bloqueado.",
- "This ticket is not editable.": "Este ticket no es editable.",
- "The ticket doesn't exist.": "No existe el ticket.",
- "Social name should be uppercase": "La razón social debe ir en mayúscula",
- "Street should be uppercase": "La dirección fiscal debe ir en mayúscula",
- "Ticket without Route": "Ticket sin ruta",
- "Select a different client": "Seleccione un cliente distinto",
- "Fill all the fields": "Rellene todos los campos",
- "The response is not a PDF": "La respuesta no es un PDF",
- "Booking completed": "Reserva completada",
- "The ticket is in preparation": "El ticket [{{ticketId}}]({{{ticketUrl}}}) del comercial {{salesPersonId}} está en preparación",
- "Incoterms data for consignee is missing": "Faltan los datos de los Incoterms para el consignatario",
- "The notification subscription of this worker cant be modified": "La subscripción a la notificación de este trabajador no puede ser modificada",
- "User disabled": "Usuario desactivado",
- "The amount cannot be less than the minimum": "La cantidad no puede ser menor que la cantidad mínima",
- "quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mínima",
- "Cannot past travels with entries": "No se pueden pasar envíos con entradas",
- "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}",
- "This claim has been updated": "La reclamación con Id: {{claimId}}, ha sido actualizada",
- "This user does not have an assigned tablet": "Este usuario no tiene tablet asignada",
- "Incorrect pin": "Pin incorrecto",
- "You already have the mailAlias": "Ya tienes este alias de correo",
- "The alias cant be modified": "Este alias de correo no puede ser modificado",
- "No tickets to invoice": "No hay tickets para facturar",
- "This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado",
- "Name should be uppercase": "El nombre debe ir en mayúscula",
- "Bank entity must be specified": "La entidad bancaria es obligatoria",
- "An email is necessary": "Es necesario un email",
- "You cannot update these fields": "No puedes actualizar estos campos",
- "CountryFK cannot be empty": "El país no puede estar vacío",
- "Cmr file does not exist": "El archivo del cmr no existe"
-}
\ No newline at end of file
+ "Phone format is invalid": "El formato del teléfono no es correcto",
+ "You are not allowed to change the credit": "No tienes privilegios para modificar el crédito",
+ "Unable to mark the equivalence surcharge": "No se puede marcar el recargo de equivalencia",
+ "The default consignee can not be unchecked": "No se puede desmarcar el consignatario predeterminado",
+ "Unable to default a disabled consignee": "No se puede poner predeterminado un consignatario desactivado",
+ "Can't be blank": "No puede estar en blanco",
+ "Invalid TIN": "NIF/CIF inválido",
+ "TIN must be unique": "El NIF/CIF debe ser único",
+ "A client with that Web User name already exists": "Ya existe un cliente con ese Usuario Web",
+ "Is invalid": "Es inválido",
+ "Quantity cannot be zero": "La cantidad no puede ser cero",
+ "Enter an integer different to zero": "Introduce un entero distinto de cero",
+ "Package cannot be blank": "El embalaje no puede estar en blanco",
+ "The company name must be unique": "La razón social debe ser única",
+ "Invalid email": "Correo electrónico inválido",
+ "The IBAN does not have the correct format": "El IBAN no tiene el formato correcto",
+ "That payment method requires an IBAN": "El método de pago seleccionado requiere un IBAN",
+ "That payment method requires a BIC": "El método de pago seleccionado requiere un BIC",
+ "State cannot be blank": "El estado no puede estar en blanco",
+ "Worker cannot be blank": "El trabajador no puede estar en blanco",
+ "Cannot change the payment method if no salesperson": "No se puede cambiar la forma de pago si no hay comercial asignado",
+ "can't be blank": "El campo no puede estar vacío",
+ "Observation type must be unique": "El tipo de observación no puede repetirse",
+ "The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero",
+ "The grade must be similar to the last one": "El grade debe ser similar al último",
+ "Only manager can change the credit": "Solo el gerente puede cambiar el credito de este cliente",
+ "Name cannot be blank": "El nombre no puede estar en blanco",
+ "Phone cannot be blank": "El teléfono no puede estar en blanco",
+ "Period cannot be blank": "El periodo no puede estar en blanco",
+ "Choose a company": "Selecciona una empresa",
+ "Se debe rellenar el campo de texto": "Se debe rellenar el campo de texto",
+ "Description should have maximum of 45 characters": "La descripción debe tener maximo 45 caracteres",
+ "Cannot be blank": "El campo no puede estar en blanco",
+ "The grade must be an integer greater than or equal to zero": "El grade debe ser un entero mayor o igual a cero",
+ "Sample type cannot be blank": "El tipo de plantilla no puede quedar en blanco",
+ "Description cannot be blank": "Se debe rellenar el campo de texto",
+ "The price of the item changed": "El precio del artículo cambió",
+ "The value should not be greater than 100%": "El valor no debe de ser mayor de 100%",
+ "The value should be a number": "El valor debe ser un numero",
+ "This order is not editable": "Esta orden no se puede modificar",
+ "You can't create an order for a frozen client": "No puedes crear una orden para un cliente congelado",
+ "You can't create an order for a client that has a debt": "No puedes crear una orden para un cliente con deuda",
+ "is not a valid date": "No es una fecha valida",
+ "Barcode must be unique": "El código de barras debe ser único",
+ "The warehouse can't be repeated": "El almacén no puede repetirse",
+ "The tag or priority can't be repeated for an item": "El tag o prioridad no puede repetirse para un item",
+ "The observation type can't be repeated": "El tipo de observación no puede repetirse",
+ "A claim with that sale already exists": "Ya existe una reclamación para esta línea",
+ "You don't have enough privileges to change that field": "No tienes permisos para cambiar ese campo",
+ "Warehouse cannot be blank": "El almacén no puede quedar en blanco",
+ "Agency cannot be blank": "La agencia no puede quedar en blanco",
+ "Not enough privileges to edit a client with verified data": "No tienes permisos para hacer cambios en un cliente con datos comprobados",
+ "This address doesn't exist": "Este consignatario no existe",
+ "You must delete the claim id %d first": "Antes debes borrar la reclamación %d",
+ "You don't have enough privileges": "No tienes suficientes permisos",
+ "Cannot check Equalization Tax in this NIF/CIF": "No se puede marcar RE en este NIF/CIF",
+ "You can't make changes on the basic data of an confirmed order or with rows": "No puedes cambiar los datos básicos de una orden con artículos",
+ "INVALID_USER_NAME": "El nombre de usuario solo debe contener letras minúsculas o, a partir del segundo carácter, números o subguiones, no está permitido el uso de la letra ñ",
+ "You can't create a ticket for a frozen client": "No puedes crear un ticket para un cliente congelado",
+ "You can't create a ticket for an inactive client": "No puedes crear un ticket para un cliente inactivo",
+ "Tag value cannot be blank": "El valor del tag no puede quedar en blanco",
+ "ORDER_EMPTY": "Cesta vacía",
+ "You don't have enough privileges to do that": "No tienes permisos para cambiar esto",
+ "NO SE PUEDE DESACTIVAR EL CONSIGNAT": "NO SE PUEDE DESACTIVAR EL CONSIGNAT",
+ "Error. El NIF/CIF está repetido": "Error. El NIF/CIF está repetido",
+ "Street cannot be empty": "Dirección no puede estar en blanco",
+ "City cannot be empty": "Ciudad no puede estar en blanco",
+ "Code cannot be blank": "Código no puede estar en blanco",
+ "You cannot remove this department": "No puedes eliminar este departamento",
+ "The extension must be unique": "La extensión debe ser unica",
+ "The secret can't be blank": "La contraseña no puede estar en blanco",
+ "We weren't able to send this SMS": "No hemos podido enviar el SMS",
+ "This client can't be invoiced": "Este cliente no puede ser facturado",
+ "You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa",
+ "This ticket can't be invoiced": "Este ticket no puede ser facturado",
+ "You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado",
+ "This ticket can not be modified": "Este ticket no puede ser modificado",
+ "The introduced hour already exists": "Esta hora ya ha sido introducida",
+ "INFINITE_LOOP": "Existe una dependencia entre dos Jefes",
+ "The sales of the receiver ticket can't be modified": "Las lineas del ticket al que envias no pueden ser modificadas",
+ "NO_AGENCY_AVAILABLE": "No hay una zona de reparto disponible con estos parámetros",
+ "ERROR_PAST_SHIPMENT": "No puedes seleccionar una fecha de envío en pasado",
+ "The current ticket can't be modified": "El ticket actual no puede ser modificado",
+ "The current claim can't be modified": "La reclamación actual no puede ser modificada",
+ "The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas",
+ "The sales do not exists": "La(s) línea(s) seleccionada(s) no existe(n)",
+ "Please select at least one sale": "Por favor selecciona al menos una linea",
+ "All sales must belong to the same ticket": "Todas las lineas deben pertenecer al mismo ticket",
+ "NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada",
+ "This item doesn't exists": "El artículo no existe",
+ "NOT_ZONE_WITH_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada",
+ "Extension format is invalid": "El formato de la extensión es inválido",
+ "Invalid parameters to create a new ticket": "Parámetros inválidos para crear un nuevo ticket",
+ "This item is not available": "Este artículo no está disponible",
+ "This postcode already exists": "Este código postal ya existe",
+ "Concept cannot be blank": "El concepto no puede quedar en blanco",
+ "File doesn't exists": "El archivo no existe",
+ "You don't have privileges to change the zone": "No tienes permisos para cambiar la zona o para esos parámetros hay más de una opción de envío, hable con las agencias",
+ "This ticket is already on weekly tickets": "Este ticket ya está en tickets programados",
+ "Ticket id cannot be blank": "El id de ticket no puede quedar en blanco",
+ "Weekday cannot be blank": "El día de la semana no puede quedar en blanco",
+ "You can't delete a confirmed order": "No puedes borrar un pedido confirmado",
+ "The social name has an invalid format": "El nombre fiscal tiene un formato incorrecto",
+ "Invalid quantity": "Cantidad invalida",
+ "This postal code is not valid": "Este código postal no es válido",
+ "is invalid": "es inválido",
+ "The postcode doesn't exist. Please enter a correct one": "El código postal no existe. Por favor, introduce uno correcto",
+ "The department name can't be repeated": "El nombre del departamento no puede repetirse",
+ "This phone already exists": "Este teléfono ya existe",
+ "You cannot move a parent to its own sons": "No puedes mover un elemento padre a uno de sus hijos",
+ "You can't create a claim for a removed ticket": "No puedes crear una reclamación para un ticket eliminado",
+ "You cannot delete a ticket that part of it is being prepared": "No puedes eliminar un ticket en el que una parte que está siendo preparada",
+ "You must delete all the buy requests first": "Debes eliminar todas las peticiones de compra primero",
+ "You should specify a date": "Debes especificar una fecha",
+ "You should specify at least a start or end date": "Debes especificar al menos una fecha de inicio o de fin",
+ "Start date should be lower than end date": "La fecha de inicio debe ser menor que la fecha de fin",
+ "You should mark at least one week day": "Debes marcar al menos un día de la semana",
+ "Swift / BIC can't be empty": "Swift / BIC no puede estar vacío",
+ "Customs agent is required for a non UEE member": "El agente de aduanas es requerido para los clientes extracomunitarios",
+ "Incoterms is required for a non UEE member": "El incoterms es requerido para los clientes extracomunitarios",
+ "Deleted sales from ticket": "He eliminado las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}",
+ "Added sale to ticket": "He añadido la siguiente linea al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
+ "Changed sale discount": "He cambiado el descuento de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
+ "Created claim": "He creado la reclamación [{{claimId}}]({{{claimUrl}}}) de las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
+ "Changed sale price": "He cambiado el precio de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* del ticket [{{ticketId}}]({{{ticketUrl}}})",
+ "Changed sale quantity": "He cambiado la cantidad de [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}* del ticket [{{ticketId}}]({{{ticketUrl}}})",
+ "State": "Estado",
+ "regular": "normal",
+ "reserved": "reservado",
+ "Changed sale reserved state": "He cambiado el estado reservado de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
+ "Bought units from buy request": "Se ha comprado {{quantity}} unidades de [{{itemId}} {{concept}}]({{{urlItem}}}) para el ticket id [{{ticketId}}]({{{url}}})",
+ "Deny buy request": "Se ha rechazado la petición de compra para el ticket id [{{ticketId}}]({{{url}}}). Motivo: {{observation}}",
+ "MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} ({{clientId}})]({{{url}}}) a *{{credit}} €*",
+ "Changed client paymethod": "He cambiado la forma de pago del cliente [{{clientName}} ({{clientId}})]({{{url}}})",
+ "Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})",
+ "Change quantity": "{{concept}} cambia de {{oldQuantity}} a {{newQuantity}}",
+ "Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*",
+ "Claim state has changed to": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *{{newState}}*",
+ "Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}",
+ "ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto",
+ "Distance must be lesser than 4000": "La distancia debe ser inferior a 4000",
+ "This ticket is deleted": "Este ticket está eliminado",
+ "Unable to clone this travel": "No ha sido posible clonar este travel",
+ "This thermograph id already exists": "La id del termógrafo ya existe",
+ "Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante",
+ "ORDER_ALREADY_CONFIRMED": "ORDEN YA CONFIRMADA",
+ "Invalid password": "Invalid password",
+ "Password does not meet requirements": "La contraseña no cumple los requisitos",
+ "Role already assigned": "Rol ya asignado",
+ "Invalid role name": "Nombre de rol no válido",
+ "Role name must be written in camelCase": "El nombre del rol debe escribirse en camelCase",
+ "Email already exists": "El correo ya existe",
+ "User already exists": "El/La usuario/a ya existe",
+ "Absence change notification on the labour calendar": "Notificación de cambio de ausencia en el calendario laboral",
+ "Record of hours week": "Registro de horas semana {{week}} año {{year}} ",
+ "Created absence": "El empleado {{author}} ha añadido una ausencia de tipo '{{absenceType}}' a {{employee}} para el día {{dated}}.",
+ "Deleted absence": "El empleado {{author}} ha eliminado una ausencia de tipo '{{absenceType}}' a {{employee}} del día {{dated}}.",
+ "I have deleted the ticket id": "He eliminado el ticket id [{{id}}]({{{url}}})",
+ "I have restored the ticket id": "He restaurado el ticket id [{{id}}]({{{url}}})",
+ "You can only restore a ticket within the first hour after deletion": "Únicamente puedes restaurar el ticket dentro de la primera hora después de su eliminación",
+ "Changed this data from the ticket": "He cambiado estos datos del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
+ "agencyModeFk": "Agencia",
+ "clientFk": "Cliente",
+ "zoneFk": "Zona",
+ "warehouseFk": "Almacén",
+ "shipped": "F. envío",
+ "landed": "F. entrega",
+ "addressFk": "Consignatario",
+ "companyFk": "Empresa",
+ "The social name cannot be empty": "La razón social no puede quedar en blanco",
+ "The nif cannot be empty": "El NIF no puede quedar en blanco",
+ "You need to fill sage information before you check verified data": "Debes rellenar la información de sage antes de marcar datos comprobados",
+ "ASSIGN_ZONE_FIRST": "Asigna una zona primero",
+ "Amount cannot be zero": "El importe no puede ser cero",
+ "Company has to be official": "Empresa inválida",
+ "You can not select this payment method without a registered bankery account": "No se puede utilizar este método de pago si no has registrado una cuenta bancaria",
+ "Action not allowed on the test environment": "Esta acción no está permitida en el entorno de pruebas",
+ "The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta",
+ "New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}* y un precio de *{{price}} €*",
+ "New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}*",
+ "Swift / BIC cannot be empty": "Swift / BIC no puede estar vacío",
+ "This BIC already exist.": "Este BIC ya existe.",
+ "That item doesn't exists": "Ese artículo no existe",
+ "There's a new urgent ticket:": "Hay un nuevo ticket urgente:",
+ "Invalid account": "Cuenta inválida",
+ "Compensation account is empty": "La cuenta para compensar está vacia",
+ "This genus already exist": "Este genus ya existe",
+ "This specie already exist": "Esta especie ya existe",
+ "Client assignment has changed": "He cambiado el comercial ~*\"<{{previousWorkerName}}>\"*~ por *\"<{{currentWorkerName}}>\"* del cliente [{{clientName}} ({{clientId}})]({{{url}}})",
+ "None": "Ninguno",
+ "The contract was not active during the selected date": "El contrato no estaba activo durante la fecha seleccionada",
+ "Cannot add more than one '1/2 day vacation'": "No puedes añadir más de un 'Vacaciones 1/2 dia'",
+ "This document already exists on this ticket": "Este documento ya existe en el ticket",
+ "Some of the selected tickets are not billable": "Algunos de los tickets seleccionados no son facturables",
+ "You can't invoice tickets from multiple clients": "No puedes facturar tickets de multiples clientes",
+ "nickname": "nickname",
+ "INACTIVE_PROVIDER": "Proveedor inactivo",
+ "This client is not invoiceable": "Este cliente no es facturable",
+ "serial non editable": "Esta serie no permite asignar la referencia",
+ "Max shipped required": "La fecha límite es requerida",
+ "Can't invoice to future": "No se puede facturar a futuro",
+ "Can't invoice to past": "No se puede facturar a pasado",
+ "This ticket is already invoiced": "Este ticket ya está facturado",
+ "A ticket with an amount of zero can't be invoiced": "No se puede facturar un ticket con importe cero",
+ "A ticket with a negative base can't be invoiced": "No se puede facturar un ticket con una base negativa",
+ "Global invoicing failed": "[Facturación global] No se han podido facturar algunos clientes",
+ "Wasn't able to invoice the following clients": "No se han podido facturar los siguientes clientes",
+ "Can't verify data unless the client has a business type": "No se puede verificar datos de un cliente que no tiene tipo de negocio",
+ "You don't have enough privileges to set this credit amount": "No tienes suficientes privilegios para establecer esta cantidad de crédito",
+ "You can't change the credit set to zero from a financialBoss": "No puedes cambiar el cŕedito establecido a cero por un jefe de finanzas",
+ "Amounts do not match": "Las cantidades no coinciden",
+ "The PDF document does not exist": "El documento PDF no existe. Prueba a regenerarlo desde la opción 'Regenerar PDF factura'",
+ "The type of business must be filled in basic data": "El tipo de negocio debe estar rellenado en datos básicos",
+ "You can't create a claim from a ticket delivered more than seven days ago": "No puedes crear una reclamación de un ticket entregado hace más de siete días",
+ "The worker has hours recorded that day": "El trabajador tiene horas fichadas ese día",
+ "The worker has a marked absence that day": "El trabajador tiene marcada una ausencia ese día",
+ "You can not modify is pay method checked": "No se puede modificar el campo método de pago validado",
+ "The account size must be exactly 10 characters": "El tamaño de la cuenta debe ser exactamente de 10 caracteres",
+ "Can't transfer claimed sales": "No puedes transferir lineas reclamadas",
+ "You don't have privileges to create refund": "No tienes permisos para crear un abono",
+ "The item is required": "El artículo es requerido",
+ "The agency is already assigned to another autonomous": "La agencia ya está asignada a otro autónomo",
+ "date in the future": "Fecha en el futuro",
+ "reference duplicated": "Referencia duplicada",
+ "This ticket is already a refund": "Este ticket ya es un abono",
+ "isWithoutNegatives": "Sin negativos",
+ "routeFk": "routeFk",
+ "Can't change the password of another worker": "No se puede cambiar la contraseña de otro trabajador",
+ "No hay un contrato en vigor": "No hay un contrato en vigor",
+ "No se permite fichar a futuro": "No se permite fichar a futuro",
+ "No está permitido trabajar": "No está permitido trabajar",
+ "Fichadas impares": "Fichadas impares",
+ "Descanso diario 12h.": "Descanso diario 12h.",
+ "Descanso semanal 36h. / 72h.": "Descanso semanal 36h. / 72h.",
+ "Dirección incorrecta": "Dirección incorrecta",
+ "Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador",
+ "Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador",
+ "Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente",
+ "This route does not exists": "Esta ruta no existe",
+ "Claim pickup order sent": "Reclamación Orden de recogida enviada [{{claimId}}]({{{claimUrl}}}) al cliente *{{clientName}}*",
+ "You don't have grant privilege": "No tienes privilegios para dar privilegios",
+ "You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario",
+ "Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) fusionado con [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})",
+ "Already has this status": "Ya tiene este estado",
+ "There aren't records for this week": "No existen registros para esta semana",
+ "Empty data source": "Origen de datos vacio",
+ "App locked": "Aplicación bloqueada por el usuario {{userId}}",
+ "Email verify": "Correo de verificación",
+ "Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment",
+ "Receipt's bank was not found": "No se encontró el banco del recibo",
+ "This receipt was not compensated": "Este recibo no ha sido compensado",
+ "Client's email was not found": "No se encontró el email del cliente",
+ "Negative basis": "Base negativa",
+ "This worker code already exists": "Este codigo de trabajador ya existe",
+ "This personal mail already exists": "Este correo personal ya existe",
+ "This worker already exists": "Este trabajador ya existe",
+ "App name does not exist": "El nombre de aplicación no es válido",
+ "Try again": "Vuelve a intentarlo",
+ "Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9",
+ "Failed to upload delivery note": "Error al subir albarán {{id}}",
+ "The DOCUWARE PDF document does not exists": "El documento PDF Docuware no existe",
+ "It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que se hayan empezado a preparar",
+ "It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo",
+ "It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas",
+ "A supplier with the same name already exists. Change the country.": "Un proveedor con el mismo nombre ya existe. Cambie el país.",
+ "There is no assigned email for this client": "No hay correo asignado para este cliente",
+ "Exists an invoice with a future date": "Existe una factura con fecha posterior",
+ "Invoice date can't be less than max date": "La fecha de factura no puede ser inferior a la fecha límite",
+ "Warehouse inventory not set": "El almacén inventario no está establecido",
+ "This locker has already been assigned": "Esta taquilla ya ha sido asignada",
+ "Tickets with associated refunds": "No se pueden borrar tickets con abonos asociados. Este ticket está asociado al abono Nº %d",
+ "Not exist this branch": "La rama no existe",
+ "This ticket cannot be signed because it has not been boxed": "Este ticket no puede firmarse porque no ha sido encajado",
+ "Collection does not exist": "La colección no existe",
+ "Cannot obtain exclusive lock": "No se puede obtener un bloqueo exclusivo",
+ "Insert a date range": "Inserte un rango de fechas",
+ "Added observation": "{{user}} añadió esta observacion: {{text}}",
+ "Comment added to client": "Observación añadida al cliente {{clientFk}}",
+ "Invalid auth code": "Código de verificación incorrecto",
+ "Invalid or expired verification code": "Código de verificación incorrecto o expirado",
+ "Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen",
+ "company": "Compañía",
+ "country": "País",
+ "clientId": "Id cliente",
+ "clientSocialName": "Cliente",
+ "amount": "Importe",
+ "taxableBase": "Base",
+ "ticketFk": "Id ticket",
+ "isActive": "Activo",
+ "hasToInvoice": "Facturar",
+ "isTaxDataChecked": "Datos comprobados",
+ "comercialId": "Id comercial",
+ "comercialName": "Comercial",
+ "Pass expired": "La contraseña ha caducado, cambiela desde Salix",
+ "Invalid NIF for VIES": "Invalid NIF for VIES",
+ "Ticket does not exist": "Este ticket no existe",
+ "Ticket is already signed": "Este ticket ya ha sido firmado",
+ "Authentication failed": "Autenticación fallida",
+ "You can't use the same password": "No puedes usar la misma contraseña",
+ "You can only add negative amounts in refund tickets": "Solo se puede añadir cantidades negativas en tickets abono",
+ "Fecha fuera de rango": "Fecha fuera de rango",
+ "Error while generating PDF": "Error al generar PDF",
+ "Error when sending mail to client": "Error al enviar el correo al cliente",
+ "Mail not sent": "Se ha producido un fallo al enviar la factura al cliente [{{clientId}}]({{{clientUrl}}}), por favor revisa la dirección de correo electrónico",
+ "The renew period has not been exceeded": "El periodo de renovación no ha sido superado",
+ "Valid priorities": "Prioridades válidas: %d",
+ "hasAnyNegativeBase": "Base negativa para los tickets: {{ticketsIds}}",
+ "hasAnyPositiveBase": "Base positivas para los tickets: {{ticketsIds}}",
+ "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado",
+ "This ticket cannot be left empty.": "Este ticket no se puede dejar vacío. %s",
+ "The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias",
+ "You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado",
+ "This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado",
+ "You don't have enough privileges.": "No tienes suficientes permisos.",
+ "This ticket is locked": "Este ticket está bloqueado.",
+ "This ticket is not editable.": "Este ticket no es editable.",
+ "The ticket doesn't exist.": "No existe el ticket.",
+ "Social name should be uppercase": "La razón social debe ir en mayúscula",
+ "Street should be uppercase": "La dirección fiscal debe ir en mayúscula",
+ "Ticket without Route": "Ticket sin ruta",
+ "Select a different client": "Seleccione un cliente distinto",
+ "Fill all the fields": "Rellene todos los campos",
+ "The response is not a PDF": "La respuesta no es un PDF",
+ "Booking completed": "Reserva completada",
+ "The ticket is in preparation": "El ticket [{{ticketId}}]({{{ticketUrl}}}) del comercial {{salesPersonId}} está en preparación",
+ "Incoterms data for consignee is missing": "Faltan los datos de los Incoterms para el consignatario",
+ "The notification subscription of this worker cant be modified": "La subscripción a la notificación de este trabajador no puede ser modificada",
+ "User disabled": "Usuario desactivado",
+ "The amount cannot be less than the minimum": "La cantidad no puede ser menor que la cantidad mínima",
+ "quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mínima",
+ "Cannot past travels with entries": "No se pueden pasar envíos con entradas",
+ "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}",
+ "This claim has been updated": "La reclamación con Id: {{claimId}}, ha sido actualizada",
+ "This user does not have an assigned tablet": "Este usuario no tiene tablet asignada",
+ "Incorrect pin": "Pin incorrecto",
+ "You already have the mailAlias": "Ya tienes este alias de correo",
+ "The alias cant be modified": "Este alias de correo no puede ser modificado",
+ "This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado",
+ "Name should be uppercase": "El nombre debe ir en mayúscula",
+ "Bank entity must be specified": "La entidad bancaria es obligatoria",
+ "An email is necessary": "Es necesario un email",
+ "You cannot update these fields": "No puedes actualizar estos campos",
+ "CountryFK cannot be empty": "El país no puede estar vacío",
+ "Cmr file does not exist": "El archivo del cmr no existe",
+ "You are not allowed to modify the alias": "No estás autorizado a modificar el alias",
+ "No tickets to invoice": "No hay tickets para facturar"
+}
diff --git a/modules/account/back/models/mail-alias-account.js b/modules/account/back/models/mail-alias-account.js
index 5eb561408..61ca344e9 100644
--- a/modules/account/back/models/mail-alias-account.js
+++ b/modules/account/back/models/mail-alias-account.js
@@ -1,5 +1,5 @@
-const UserError = require('vn-loopback/util/user-error');
+const ForbiddenError = require('vn-loopback/util/forbiddenError');
module.exports = Self => {
Self.rewriteDbError(function(err) {
@@ -8,38 +8,38 @@ module.exports = Self => {
return err;
});
- Self.observe('before save', async ctx => {
- const changes = ctx.currentInstance || ctx.instance;
-
- await checkModifyPermission(ctx, changes.mailAlias);
+ Self.beforeRemote('create', async function(ctx) {
+ const mailAlias = ctx.args.data?.mailAlias;
+ if (!mailAlias) return;
+ await checkModifyPermission(ctx, mailAlias);
});
-
- Self.observe('before delete', async ctx => {
- const mailAliasAccount = await Self.findById(ctx.where.id);
-
- await checkModifyPermission(ctx, mailAliasAccount.mailAlias);
+ Self.beforeRemote('deleteById', async function(ctx) {
+ const instance = await Self.findById(ctx.args.id,
+ {fields: ['mailAlias']}
+ );
+ await checkModifyPermission(ctx, instance.mailAlias);
});
async function checkModifyPermission(ctx, mailAliasFk) {
- const userId = ctx.options.accessToken.userId;
const models = Self.app.models;
+ const userId = ctx.req.accessToken.userId;
- const roles = await models.RoleMapping.find({
- fields: ['roleId'],
- where: {principalId: userId}
+ const canEditAlias = await models.ACL.checkAccessAcl(ctx,
+ 'MailAliasAccount', 'canEditAlias', 'WRITE');
+ if (canEditAlias) return;
+
+ const allowedRoles = await models.MailAliasAcl.find({
+ fields: ['roleFk'],
+ where: {mailAliasFk}
});
+ const nRoles = allowedRoles.length &&
+ await models.RoleMapping.count({
+ principalId: userId,
+ principalType: 'USER',
+ roleId: {inq: allowedRoles.map(x => x.roleFk)}
+ });
- const availableMailAlias = await models.MailAliasAcl.findOne({
- fields: ['mailAliasFk'],
- include: {relation: 'mailAlias'},
- where: {
- roleFk: {
- inq: roles.map(role => role.roleId),
- },
- mailAliasFk
- }
- });
-
- if (!availableMailAlias) throw new UserError('The alias cant be modified');
+ if (!nRoles)
+ throw new ForbiddenError('You are not allowed to modify the alias');
}
};
diff --git a/modules/account/front/descriptor/index.js b/modules/account/front/descriptor/index.js
index 18d93b924..de41d619d 100644
--- a/modules/account/front/descriptor/index.js
+++ b/modules/account/front/descriptor/index.js
@@ -71,7 +71,7 @@ class Controller extends Descriptor {
const params = {newPassword: this.newPassword};
if (this.askOldPass) {
- method = 'changePassword';
+ method = 'change-password';
params.oldPassword = this.oldPassword;
} else
method = 'setPassword';
diff --git a/modules/route/back/models/route.js b/modules/route/back/models/route.js
index a25e8769b..3505609d1 100644
--- a/modules/route/back/models/route.js
+++ b/modules/route/back/models/route.js
@@ -22,16 +22,16 @@ module.exports = Self => {
require('../methods/route/getByWorker')(Self);
Self.validate('kmStart', validateDistance, {
- message: 'Distance must be lesser than 1000'
+ message: 'Distance must be lesser than 4000'
});
Self.validate('kmEnd', validateDistance, {
- message: 'Distance must be lesser than 1000'
+ message: 'Distance must be lesser than 4000'
});
function validateDistance(err) {
const routeTotalKm = this.kmEnd - this.kmStart;
- const routeMaxKm = 1000;
+ const routeMaxKm = 4000;
if (routeTotalKm > routeMaxKm || this.kmStart > this.kmEnd)
err();
}
diff --git a/modules/route/front/create/index.html b/modules/route/front/create/index.html
index b76878f2e..de341220e 100644
--- a/modules/route/front/create/index.html
+++ b/modules/route/front/create/index.html
@@ -22,7 +22,6 @@
label="Vehicle"
ng-model="$ctrl.route.vehicleFk"
url="Vehicles"
- where="{warehouseFk: $ctrl.vnConfig.warehouseFk}"
show-field="numberPlate">
{
- const userId = 9;
- const activeCtx = {
- accessToken: {userId: userId},
- };
- const ctx = {req: activeCtx};
+ const originalTicketId = 8;
+ const refundTicketId = 24;
+ const clientId = 1;
+ let ctx;
+ let options;
+ let tx;
+ beforeEach(async() => {
+ ctx = {
+ req: {
+ accessToken: {userId: 9},
+ headers: {origin: 'http://localhost'}
+ },
+ args: {}
+ };
+
+ options = {transaction: tx};
+ tx = await models.Ticket.beginTransaction({});
+ options.transaction = tx;
+ });
+
+ afterEach(async() => {
+ await tx.rollback();
+ });
it('should throw an error as the ticket is not editable', async() => {
- const tx = await models.Ticket.beginTransaction({});
- let error;
-
try {
- const options = {transaction: tx};
const ticketId = 4;
const clientId = 1;
await models.Ticket.transferClient(ctx, ticketId, clientId, options);
-
- await tx.rollback();
} catch (e) {
- await tx.rollback();
- error = e;
+ expect(e.message).toEqual(`This ticket is locked`);
}
-
- expect(error.message).toEqual(`This ticket is locked`);
});
- it('should be assigned a different clientFk', async() => {
- const tx = await models.Ticket.beginTransaction({});
- let updatedTicket;
- const ticketId = 10;
- const clientId = 1;
+ it('should be assigned a different clientFk in the original ticket', async() => {
+ await models.Ticket.transferClient(ctx, 2, clientId, options);
+ const afterTransfer = await models.Ticket.findById(2, null, options);
- try {
- const options = {transaction: tx};
+ expect(afterTransfer.clientFk).toEqual(clientId);
+ });
- await models.Ticket.transferClient(ctx, ticketId, clientId, options);
- updatedTicket = await models.Ticket.findById(ticketId, {fields: ['clientFk']}, options);
+ it('should be assigned a different clientFk in the original and refund ticket and claim', async() => {
+ await models.Ticket.transferClient(ctx, originalTicketId, clientId, options);
- await tx.rollback();
- } catch (e) {
- await tx.rollback();
- throw e;
- }
+ const [originalTicket, refundTicket] = await models.Ticket.find({
+ where: {id: {inq: [originalTicketId, refundTicketId]}}
+ }, options);
- expect(updatedTicket.clientFk).toEqual(clientId);
+ const claim = await models.Claim.findOne({
+ where: {ticketFk: originalTicketId}
+ }, options);
+
+ expect(originalTicket.clientFk).toEqual(clientId);
+ expect(refundTicket.clientFk).toEqual(clientId);
+ expect(claim.clientFk).toEqual(clientId);
});
});
diff --git a/modules/ticket/back/methods/ticket/transferClient.js b/modules/ticket/back/methods/ticket/transferClient.js
index 60e70d710..d38c0e8a7 100644
--- a/modules/ticket/back/methods/ticket/transferClient.js
+++ b/modules/ticket/back/methods/ticket/transferClient.js
@@ -2,20 +2,17 @@ module.exports = Self => {
Self.remoteMethodCtx('transferClient', {
description: 'Transfering ticket to another client',
accessType: 'WRITE',
- accepts: [
- {
- arg: 'id',
- type: 'number',
- required: true,
- description: 'the ticket id',
- http: {source: 'path'}
- },
- {
- arg: 'clientFk',
- type: 'number',
- required: true,
- },
- ],
+ accepts: [{
+ arg: 'id',
+ type: 'number',
+ required: true,
+ description: 'the ticket id',
+ http: {source: 'path'}
+ }, {
+ arg: 'clientFk',
+ type: 'number',
+ required: true,
+ }],
http: {
path: `/:id/transferClient`,
verb: 'PATCH'
@@ -25,21 +22,51 @@ module.exports = Self => {
Self.transferClient = async(ctx, id, clientFk, options) => {
const models = Self.app.models;
const myOptions = {};
+ let tx;
+
if (typeof options == 'object')
Object.assign(myOptions, options);
- await Self.isEditableOrThrow(ctx, id, myOptions);
+ if (!myOptions.transaction) {
+ tx = await Self.beginTransaction({});
+ myOptions.transaction = tx;
+ }
- const ticket = await models.Ticket.findById(
- id,
- {fields: ['id', 'shipped', 'clientFk', 'addressFk']},
- myOptions
- );
- const client = await models.Client.findById(clientFk, {fields: ['id', 'defaultAddressFk']}, myOptions);
+ try {
+ await Self.isEditableOrThrow(ctx, id, myOptions);
- await ticket.updateAttributes({
- clientFk,
- addressFk: client.defaultAddressFk,
- });
+ const ticketRefund = await models.TicketRefund.findOne({
+ where: {or: [{originalTicketFk: id}, {refundTicketFk: id}]},
+ include: [{relation: 'refundTicket'}, {relation: 'originalTicket'}]
+ }, myOptions);
+
+ const {defaultAddressFk: addressFk} = await models.Client.findById(clientFk,
+ {fields: ['id', 'defaultAddressFk']}, myOptions);
+
+ const attributes = {clientFk, addressFk};
+
+ const tickets = [];
+ const ticketIds = [];
+
+ if (ticketRefund) {
+ const {refundTicket, originalTicket} = ticketRefund;
+ tickets.push(refundTicket(), originalTicket());
+
+ for (const ticket of tickets) {
+ await ticket.updateAttributes(attributes, myOptions);
+ ticketIds.push(ticket.id);
+ }
+ } else {
+ await Self.updateAll({id}, attributes, myOptions);
+ ticketIds.push(id);
+ }
+
+ await models.Claim.updateAll({ticketFk: {inq: ticketIds}}, {clientFk}, myOptions);
+
+ if (tx) await tx.commit();
+ } catch (e) {
+ if (tx) await tx.rollback();
+ throw e;
+ }
};
};
diff --git a/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js b/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js
index 74ec10155..950da7bb1 100644
--- a/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js
+++ b/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js
@@ -27,7 +27,10 @@ describe('Travel cloneWithEntries()', () => {
expect(newTravel.warehouseOutFk).toEqual(warehouseThree);
expect(newTravel.agencyModeFk).toEqual(agencyModeOne);
expect(travelEntries.length).toBeGreaterThan(0);
-
+ await models.Entry.destroyAll({
+ travelFk: newTravelId
+ }, options);
+ await models.Travel.destroyById(newTravelId, options);
await tx.rollback();
const travelRemoved = await models.Travel.findById(newTravelId, options);
diff --git a/package.json b/package.json
index 9ae8b276b..47b3a1564 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "salix-back",
- "version": "24.8.0",
+ "version": "24.10.0",
"author": "Verdnatura Levante SL",
"description": "Salix backend",
"license": "GPL-3.0",
@@ -42,7 +42,8 @@
"mysql": "2.18.1",
"node-ssh": "^11.0.0",
"object.pick": "^1.3.0",
- "puppeteer": "^21.10.0",
+ "puppeteer": "^21.11.0",
+ "read-chunk": "^3.2.0",
"require-yaml": "0.0.1",
"smbhash": "0.0.1",
"strong-error-handler": "^2.3.2",
@@ -55,7 +56,7 @@
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
"@babel/preset-env": "^7.11.0",
"@babel/register": "^7.7.7",
- "@verdnatura/myt": "^1.6.6",
+ "@verdnatura/myt": "^1.6.7",
"angular-mocks": "^1.7.9",
"babel-jest": "^26.0.1",
"babel-loader": "^8.2.4",
@@ -105,14 +106,11 @@
"yaml-loader": "^0.5.0"
},
"scripts": {
- "dbtest": "nodemon -q db/tests.js -w db/tests",
"test:back": "nodemon -q back/tests.js --config back/nodemonConfig.json",
- "test:back:ci": "node back/tests.js --ci --junit --network jenkins",
- "test:e2e": "node e2e/helpers/tests.js",
+ "test:e2e": "node e2e/tests.js",
"test:front": "jest --watch",
"back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back",
- "lint": "eslint ./ --cache --ignore-pattern .gitignore",
- "docker": "docker build --progress=plain -t salix-db ./db"
+ "lint": "eslint ./ --cache --ignore-pattern .gitignore"
},
"jest": {
"projects": [
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 221008dd9..025be234e 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -93,8 +93,11 @@ dependencies:
specifier: ^1.3.0
version: 1.3.0
puppeteer:
- specifier: ^21.10.0
- version: 21.10.0
+ specifier: ^21.11.0
+ version: 21.11.0
+ read-chunk:
+ specifier: ^3.2.0
+ version: 3.2.0
require-yaml:
specifier: 0.0.1
version: 0.0.1
@@ -128,8 +131,8 @@ devDependencies:
specifier: ^7.7.7
version: 7.23.7(@babel/core@7.23.9)
'@verdnatura/myt':
- specifier: ^1.6.6
- version: 1.6.6
+ specifier: ^1.6.7
+ version: 1.6.7
angular-mocks:
specifier: ^1.7.9
version: 1.8.3
@@ -2630,8 +2633,8 @@ packages:
dev: false
optional: true
- /@verdnatura/myt@1.6.6:
- resolution: {integrity: sha512-5KHi9w1baEQ6Oe/pAR8pl0oD5yyJJuPirE+ZhygreUGGURfig4VekjhlGE3WEbWquDiIAMi89J1VQ+1Ba0+jQw==}
+ /@verdnatura/myt@1.6.7:
+ resolution: {integrity: sha512-t/Q1T3QzHpZFdxwIyQL/CV5g+HJvWE6Q65VeA9k0svZdX/vezgnQ21nkI+wuvIurIl6BXqq2Arx7EWYkAhGNNA==}
hasBin: true
dependencies:
'@sqltools/formatter': 1.2.5
@@ -4057,8 +4060,8 @@ packages:
engines: {node: '>=6.0'}
dev: true
- /chromium-bidi@0.5.6(devtools-protocol@0.0.1232444):
- resolution: {integrity: sha512-ber8smgoAs4EqSUHRb0I8fpx371ZmvsdQav8HRM9oO4fk5Ox16vQiNYXlsZkRj4FfvVL2dCef+zBFQixp+79CA==}
+ /chromium-bidi@0.5.8(devtools-protocol@0.0.1232444):
+ resolution: {integrity: sha512-blqh+1cEQbHBKmok3rVJkBlBxt9beKBgOsxbFgs7UJcoVbbeZ+K7+6liAsjgpc8l1Xd55cQUy14fXZdGSb4zIw==}
peerDependencies:
devtools-protocol: '*'
dependencies:
@@ -10680,7 +10683,6 @@ packages:
/p-try@2.2.0:
resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==}
engines: {node: '>=6'}
- dev: true
/pac-proxy-agent@7.0.1:
resolution: {integrity: sha512-ASV8yU4LLKBAjqIPMbrgtaKIvxQri/yh2OpI+S6hVa9JRkUI3Y3NPFbfngDtY7oFtSMD3w31Xns89mDa3Feo5A==}
@@ -11220,12 +11222,12 @@ packages:
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
engines: {node: '>=6'}
- /puppeteer-core@21.10.0:
- resolution: {integrity: sha512-NVaqO3K462qwMuLO4Gurs/Mau1Wss+08QgNYzF0dIqZWMvpskrt/TbxbmHU+7zMTUOvPEq/lR4BLJmjMBgBGfQ==}
+ /puppeteer-core@21.11.0:
+ resolution: {integrity: sha512-ArbnyA3U5SGHokEvkfWjW+O8hOxV1RSJxOgriX/3A4xZRqixt9ZFHD0yPgZQF05Qj0oAqi8H/7stDorjoHY90Q==}
engines: {node: '>=16.13.2'}
dependencies:
'@puppeteer/browsers': 1.9.1
- chromium-bidi: 0.5.6(devtools-protocol@0.0.1232444)
+ chromium-bidi: 0.5.8(devtools-protocol@0.0.1232444)
cross-fetch: 4.0.0
debug: 4.3.4(supports-color@6.1.0)
devtools-protocol: 0.0.1232444
@@ -11237,15 +11239,15 @@ packages:
- utf-8-validate
dev: false
- /puppeteer@21.10.0:
- resolution: {integrity: sha512-Y1yQjcLE00hHTDAmv3M3A6hhW0Ytjdp6xr6nyjl7FZ7E7hzp/6Rsw80FbaTJzJHFCplBNi082wrgynbmD7RlYw==}
+ /puppeteer@21.11.0:
+ resolution: {integrity: sha512-9jTHuYe22TD3sNxy0nEIzC7ZrlRnDgeX3xPkbS7PnbdwYjl2o/z/YuCrRBwezdKpbTDTJ4VqIggzNyeRcKq3cg==}
engines: {node: '>=16.13.2'}
hasBin: true
requiresBuild: true
dependencies:
'@puppeteer/browsers': 1.9.1
cosmiconfig: 9.0.0
- puppeteer-core: 21.10.0
+ puppeteer-core: 21.11.0
transitivePeerDependencies:
- bufferutil
- encoding
@@ -11367,6 +11369,14 @@ packages:
resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==}
dev: true
+ /read-chunk@3.2.0:
+ resolution: {integrity: sha512-CEjy9LCzhmD7nUpJ1oVOE6s/hBkejlcJEgLQHVnQznOSilOPb+kpKktlLfFDK3/WP43+F80xkUTM2VOkYoSYvQ==}
+ engines: {node: '>=6'}
+ dependencies:
+ pify: 4.0.1
+ with-open-file: 0.1.7
+ dev: false
+
/read-pkg-up@1.0.1:
resolution: {integrity: sha512-WD9MTlNtI55IwYUS27iHh9tK3YoIVhxis8yKhLpTqWtml739uXc9NWTpxoHkfZf3+DkCCsXox94/VWZniuZm6A==}
engines: {node: '>=0.10.0'}
@@ -14119,6 +14129,15 @@ packages:
resolution: {integrity: sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==}
dev: true
+ /with-open-file@0.1.7:
+ resolution: {integrity: sha512-ecJS2/oHtESJ1t3ZfMI3B7KIDKyfN0O16miWxdn30zdh66Yd3LsRFebXZXq6GU4xfxLf6nVxp9kIqElb5fqczA==}
+ engines: {node: '>=6'}
+ dependencies:
+ p-finally: 1.0.0
+ p-try: 2.2.0
+ pify: 4.0.1
+ dev: false
+
/word-count@0.2.2:
resolution: {integrity: sha512-tPRTbQ+nTCPY3F0z1f/y0PX22ScE6l/4/8j9KqA3h77JhlZ/w6cbVS8LIO5Pq/aV96SWBOoiE2IEgzxF0Cn+kA==}
dev: false
diff --git a/print/core/cluster.js b/print/core/cluster.js
index f2b2c3f21..e50c26823 100644
--- a/print/core/cluster.js
+++ b/print/core/cluster.js
@@ -6,7 +6,7 @@ module.exports = {
init() {
if (this.pool) return;
Cluster.launch({
- concurrency: Cluster.CONCURRENCY_CONTEXT,
+ concurrency: Cluster.CONCURRENCY_PAGE,
maxConcurrency: cpus().length,
puppeteerOptions: {
headless: 'new',
diff --git a/print/templates/reports/driver-route/assets/css/style.css b/print/templates/reports/driver-route/assets/css/style.css
index 6b76748eb..101ef7b3f 100644
--- a/print/templates/reports/driver-route/assets/css/style.css
+++ b/print/templates/reports/driver-route/assets/css/style.css
@@ -46,6 +46,9 @@ section.text-area {
padding-left: 1em;
padding-right: 1em;
background-color: #e5e5e5;
+ & > p {
+ word-break: break-all;
+ }
}
.route-block {
diff --git a/print/templates/reports/driver-route/driver-route.js b/print/templates/reports/driver-route/driver-route.js
index c166e3809..bfe04f337 100755
--- a/print/templates/reports/driver-route/driver-route.js
+++ b/print/templates/reports/driver-route/driver-route.js
@@ -5,7 +5,6 @@ module.exports = {
mixins: [vnReport],
async serverPrefetch() {
let ids = this.id;
-
const hasMultipleRoutes = String(this.id).includes(',');
if (hasMultipleRoutes)
ids = this.id.split(',');
@@ -30,7 +29,7 @@ module.exports = {
},
props: {
id: {
- type: Number,
+ type: String,
required: true,
description: 'The route id'
}