Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6861-Pasar-modo-trabajo-de-previa-a-reservas
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Sergio De la torre 2024-05-16 07:08:47 +02:00
commit 75bb08a0c6
129 changed files with 2034 additions and 2753 deletions

View File

@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- (InvoiceOut -> Crear factura) Cuando falla al crear una factura, se devuelve un error
- (Worker -> Ver albarán) Ya no aparece la página en blanco
### Changed
- (InvoiceOut) Las facturas ahora muestran el ticket del cual proviene el abono
## [24.18.01] - 2024-05-07
## [24.16.01] - 2024-04-18

1
Jenkinsfile vendored
View File

@ -24,7 +24,6 @@ node {
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT
RUN_BUILD = PROTECTED_BRANCH && FROM_GIT
// env.DEBUG = 'strong-remoting:shared-method'
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
echo "NODE_NAME: ${env.NODE_NAME}"
echo "WORKSPACE: ${env.WORKSPACE}"

View File

@ -45,7 +45,7 @@ module.exports = Self => {
{'pc.code': {like: `%${value}%`}},
{'t.name': {like: `%${value}%`}},
{'p.name': {like: `%${value}%`}},
{'c.country': {like: `%${value}%`}}
{'c.name': {like: `%${value}%`}}
]
};
}
@ -62,7 +62,7 @@ module.exports = Self => {
pc.code,
t.name as town,
p.name as province,
c.country
c.name country
FROM
postCode pc
JOIN town t on t.id = pc.townFk

View File

@ -13,7 +13,7 @@
"id": true,
"description": "Identifier"
},
"country": {
"name": {
"type": "string",
"required": true
},

View File

@ -3,7 +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 ('vn-database','11018','878ee9e3039dd06ad456fa475f0d646d8bae3d4b','2024-05-07 07:34:42','11032');
INSERT INTO `version` VALUES ('vn-database','11031','12f36dc825b6660062e2c86fde9c6b451cb58f0d','2024-05-14 08:25:58','11048');
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);
@ -651,6 +651,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10855','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','10856','00-cloneAcl.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:57',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10857','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:57',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','10859','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:25',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);
INSERT INTO `versionLog` VALUES ('vn-database','10862','00-alterAgencyTermConfig.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:55',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10862','00-alterGastosResumen.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:55',NULL,NULL);
@ -776,16 +777,33 @@ INSERT INTO `versionLog` VALUES ('vn-database','10977','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','10984','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10988','00-pbx_prefix.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-04-11 17:00:16',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10990','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10991','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10992','00-acl.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10992','00-referenceRate.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10994','00-modifyAcls.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10995','01-agencyLogCreate.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10995','02-agencyWorkCenterCreate.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10995','03-tableAcl.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10996','00-dropOrderRecalc.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10996','01-dropTicketRecalc.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10996','02-dropTravelRecalc.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10997','00-groupingMode.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:34:21',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11001','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11002','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11003','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:34:21',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11007','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:34:21',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11008','00-alter.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:27',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11012','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:27',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11014','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:27',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11016','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-27 13:16:09',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11018','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:34:21',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11021','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-30 09:07:56',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11026','00-entryAlter.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:27',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11026','01-entryUpdate.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:27',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11026','02-entryInternal.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:27',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11031','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:27',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11033','00-rollbackAcls.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-07 12:45:45',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11045','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-10 14:53:29',NULL,NULL);
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
@ -1683,9 +1701,9 @@ INSERT INTO `ACL` VALUES (610,'Ticket','deliveryNoteCsv','READ','ALLOW','ROLE','
INSERT INTO `ACL` VALUES (611,'State','find','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (612,'State','findById','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (613,'State','findOne','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (614,'Worker','find','READ','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (615,'Worker','findById','READ','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (616,'Worker','findOne','READ','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (614,'Worker','find','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (615,'Worker','findById','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (616,'Worker','findOne','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (617,'Worker','filter','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (618,'Worker','getWorkedHours','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (619,'Worker','active','READ','ALLOW','ROLE','employee');
@ -1861,7 +1879,14 @@ INSERT INTO `ACL` VALUES (825,'Application','getEnumValues','*','ALLOW','ROLE','
INSERT INTO `ACL` VALUES (826,'Ticket','editZone','WRITE','ALLOW','ROLE','salesAssistant');
INSERT INTO `ACL` VALUES (827,'TicketWeekly','deleteById','WRITE','ALLOW','ROLE','buyerBoss');
INSERT INTO `ACL` VALUES (828,'TicketWeekly','upsert','WRITE','ALLOW','ROLE','buyer');
INSERT INTO `ACL` VALUES (829,'Worker','__get__summary','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (830,'InvoiceIn','*','READ','ALLOW','ROLE','deliveryBoss');
INSERT INTO `ACL` VALUES (831,'InvoiceIn','exchangeRateUpdate','*','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (832,'AgencyLog','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (833,'AgencyWorkCenter','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (834,'AgencyMode','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (835,'Agency','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (836,'Agency','*','WRITE','ALLOW','ROLE','deliveryAssistant');
INSERT INTO `ACL` VALUES (837,'AgencyWorkCenter','*','WRITE','ALLOW','ROLE','deliveryAssistant');
INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee');
INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee');
@ -2007,6 +2032,7 @@ INSERT INTO `businessType` VALUES ('others','Otros');
INSERT INTO `businessType` VALUES ('otherSector','Profesional de otro sector');
INSERT INTO `businessType` VALUES ('restoration','Restauración');
INSERT INTO `businessType` VALUES ('trainingCentre','Centro de formación');
INSERT INTO `businessType` VALUES ('VIP','Very important person');
INSERT INTO `businessType` VALUES ('wholesaler','Mayorista');
INSERT INTO `businessType` VALUES ('worker','Trabajador');
@ -2180,7 +2206,7 @@ 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,118,763,0,0,0,0,26,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,110,763,0,0,0,0,26,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL,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,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,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,NULL,NULL);
@ -2191,54 +2217,50 @@ INSERT INTO `department` VALUES (37,'PROD','PRODUCCION',12,35,NULL,72,1,1,1,11,1
INSERT INTO `department` VALUES (38,'picking','SACADO',15,16,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,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,1,NULL,NULL,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,NULL,NULL);
INSERT INTO `department` VALUES (43,'VT','VENTAS',38,77,NULL,0,0,0,1,19,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (44,'management','GERENCIA',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (46,'delivery','REPARTO',82,83,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',84,85,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',86,87,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',88,89,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (43,'VT','VENTAS',38,69,NULL,0,0,0,1,15,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (44,'management','GERENCIA',70,71,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',72,73,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (46,'delivery','REPARTO',74,75,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',76,77,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',39,40,NULL,72,0,0,2,0,43,'/1/43/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',90,91,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',82,83,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,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,NULL,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,NULL,NULL);
INSERT INTO `department` VALUES (58,'CMP','CAMPOS',92,95,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',96,97,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (58,'CMP','CAMPOS',84,87,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',88,89,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',41,42,NULL,72,0,0,2,0,43,'/1/43/',NULL,1,NULL,1,1,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (61,NULL,'VNH',98,101,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',102,103,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,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,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,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,NULL,NULL);
INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',104,105,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (80,'vallesTeam','EQUIPO J VALLES',43,44,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'equipojvalles@verdnatura.es',0,0,0,0,NULL,NULL,'5300',NULL);
INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',106,107,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (89,NULL,'COORDINACION',108,109,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (90,NULL,'TRAILER',99,100,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL,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,NULL,NULL);
INSERT INTO `department` VALUES (80,'vallesTeam','EQUIPO ESPAÑA 5',43,44,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'equipojvalles@verdnatura.es',0,0,0,0,NULL,NULL,'5300',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,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,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,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,NULL,NULL);
INSERT INTO `department` VALUES (92,NULL,'EQUIPO SILVERIO',45,46,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (94,'brocalTeam','EQUIPO J BROCAL',47,48,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',0,'equipojbrocal@verdnatura.es',0,0,0,0,NULL,NULL,'5100',NULL);
INSERT INTO `department` VALUES (95,'spainTeam1','EQUIPO ESPAÑA 1',49,50,24065,0,0,0,2,0,43,'/1/43/','es1_equipo',0,'españa1@verdnatura.es',0,0,0,0,NULL,NULL,'5000',NULL);
INSERT INTO `department` VALUES (94,'spainTeam2','EQUIPO ESPAÑA 2',47,48,3797,0,0,0,2,0,43,'/1/43/','es2_equipo',0,'es2@verdnatura.es',0,0,0,0,NULL,NULL,'5100',NULL);
INSERT INTO `department` VALUES (95,'spainTeam1','EQUIPO ESPAÑA 1',49,50,24065,0,0,0,2,0,43,'/1/43/','es1_equipo',0,'es1@verdnatura.es',0,0,0,0,NULL,NULL,'5000',NULL);
INSERT INTO `department` VALUES (96,NULL,'EQUIPO C LOPEZ',51,52,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (115,NULL,'EQUIPO CLAUDI',53,54,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (123,NULL,'EQUIPO ELENA BASCUÑANA',55,56,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',110,111,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (125,'miriamMarTeam','EQUIPO MIRIAM MAR',57,58,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',0,'equipomirgir@verdnatura.es',0,0,0,0,NULL,NULL,'5200',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,NULL,NULL);
INSERT INTO `department` VALUES (125,'miriamMarTeam','EQUIPO ESPAÑA 3',57,58,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',0,'equipomirgir@verdnatura.es',0,0,0,0,NULL,NULL,'5200',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,NULL,NULL);
INSERT INTO `department` VALUES (128,NULL,'PALETIZADO',29,30,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (130,NULL,'REVISION',31,32,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',93,94,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',85,86,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',59,60,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',61,62,1731,72,0,0,2,0,43,'/1/43/','fr_equipo',1,'gestionfrancia@verdnatura.es',0,0,0,0,NULL,NULL,'3300',NULL);
INSERT INTO `department` VALUES (134,'portugalTeam','EQUIPO PORTUGAL',63,64,6264,0,0,0,2,0,43,'/1/43/','pt_equipo',1,'portugal@verdnatura.es',0,0,0,0,NULL,NULL,'3500',NULL);
INSERT INTO `department` VALUES (135,'routers','ENRUTADORES',112,113,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (136,'heavyVehicles','VEHICULOS PESADOS',114,115,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (137,'sorter','SORTER',116,117,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (139,'soriaTeam','EQUIPO J SORIA ',65,66,3803,0,0,0,2,0,43,'/1/43/','jss_equipo',1,'equipojsoria@verdnatura.es',0,0,0,0,NULL,NULL,'5400',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,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,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,NULL,NULL);
INSERT INTO `department` VALUES (139,'soriaTeam','EQUIPO ESPAÑA 4',65,66,3803,0,0,0,2,0,43,'/1/43/','jss_equipo',1,'equipojsoria@verdnatura.es',0,0,0,0,NULL,NULL,'5400',NULL);
INSERT INTO `department` VALUES (140,'hollandTeam','EQUIPO HOLANDA',67,68,NULL,0,0,0,2,0,43,'/1/43/','nl_equipo',1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (141,NULL,'PREVIA',33,34,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (142,NULL,'EQUIPO ESPAÑA 2',69,70,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',0,'equipojbrocal@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (143,NULL,'EQUIPO ESPAÑA 3',71,72,4379,0,0,0,2,0,43,'/1/43/','mir_equipo',0,'equipomirgir@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (144,NULL,'EQUIPO ESPAÑA 4',73,74,3803,0,0,0,2,0,43,'/1/43/','jss_equipo',0,'equipojsoria@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (145,NULL,'EQUIPO ESPAÑA 5',75,76,4250,0,0,0,2,0,43,'/1/43/','jvp_equipo',0,'equipojvalles@verdnatura.es',0,0,0,0,NULL,NULL,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);
@ -2541,7 +2563,7 @@ INSERT INTO `volumeConfig` VALUES (2.67,1.60,0.8,150,0.30,120,57,2.0,50,200,10,1
INSERT INTO `workCenter` VALUES (1,'Silla',20,859,1,'Av espioca 100',552703,NULL);
INSERT INTO `workCenter` VALUES (2,'Mercaflor',19,NULL,NULL,NULL,NULL,NULL);
INSERT INTO `workCenter` VALUES (3,'Marjales',26,20008,NULL,NULL,NULL,NULL);
INSERT INTO `workCenter` VALUES (4,'VNH',NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO `workCenter` VALUES (4,'VNH',NULL,NULL,7,NULL,NULL,NULL);
INSERT INTO `workCenter` VALUES (5,'Madrid',28,2869,5,'Av constitución 3',554145,2.00);
INSERT INTO `workCenter` VALUES (6,'Vilassar',88,88038,NULL,'Cami del Crist, 33',556412,NULL);
INSERT INTO `workCenter` VALUES (7,'Tenerife',NULL,NULL,NULL,NULL,NULL,NULL);

View File

@ -327,20 +327,16 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','price_fixed','
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','printQueue','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','preservedBoss','travel','alexm@%','0000-00-00 00:00:00','Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','travel','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
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 ('','vn','buyerAssistant','itemType','jgallego@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
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','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','artificialBoss','state','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','travel','alexm@%','0000-00-00 00:00:00','Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Bancos_poliza','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','cmr','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','duaDismissed','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','edi_article','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','edi_bucket','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','edi_bucket_type','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','time','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','operator','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','payment','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert','');
@ -553,7 +549,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','client','alexm@%',
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','saleVolume','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','Proveedores_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','awb_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','Cubos','alexm@%','0000-00-00 00:00:00','Insert,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerAssistant','Cubos','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','routesMonitor','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','Update');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminBoss','sale','alexm@%','0000-00-00 00:00:00','Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','sale','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Delete','Update');
@ -1379,9 +1375,9 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','zoneIncluded','guil
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','zoneGeo','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','quality','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','category','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerAssistant','edi_bucket_type','carlosap@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','edi_bucket','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','ektEntryAssign','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerAssistant','edi_bucket','carlosap@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','edi_bucket_type','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','calendarType','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','timeSlots','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','supplierFreight','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
@ -1395,6 +1391,15 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','deliveryNote','guil
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','invoiceOutExpense','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','delivery','carlosap@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','entry','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Cubos_Retorno','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','claimDestination','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','entryConfig','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','farmingDeliveryNote','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','sage','grafana','TiposIva','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','bs','buyer','waste','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','clientObservation','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceInConfig','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','workerActivity','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
/*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */;
/*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */;
@ -1719,18 +1724,13 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_afterUpsert','PROC
INSERT IGNORE INTO `procs_priv` VALUES ('','util','grafana','dayend','FUNCTION','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','srt','production','buffer_settypebyname','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buyUltimate','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','financialBoss','balance_create','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','buyUltimate','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','barcodeToItem','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','ticket_splititempackingtype','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','entry_getCommission','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','deliveryAssistant','expeditionstate_addbypallet','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','buy_tarifas_entry','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','entryEditor','buy_tarifas','PROCEDURE','guillermo@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','claimManager','buy_tarifas_entry','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','mail_insert','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','entry_fixMisfit','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','employee','buy_tarifas_entry','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_CURDATE','FUNCTION','juan@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','marketingBoss','clientTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','clientTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
@ -1766,7 +1766,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','productionBoss','saleSplit','P
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','grafana','client_getDebt','FUNCTION','guillermo@db-proxy1.servers.dc.verdnatura.es','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');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','claimManager','dayend','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
@ -1913,7 +1912,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','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','buyer','buy_recalcPricesByBuy','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','handmadeBoss','confection_controlSource','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','bi','productionAssi','rutasanalyze','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','productionPlus','workerCreateExternal','PROCEDURE','juan@10.5.1.2','Execute','0000-00-00 00:00:00');
@ -2044,7 +2043,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','tx_rollback','PROCED
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');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPricesByEntry','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','hr','accountNumberToIban','FUNCTION','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','financial','accountNumberToIban','FUNCTION','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','supplier_statement','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
@ -2059,6 +2058,14 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','artificialBoss','confection_co
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','remittance_calc','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','developer','connection_kill','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','client_getRisk','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','grafana','item_ValuateInventory','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financialBoss','balance_create','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hrBoss','balance_create','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','buy_recalcPricesByEntry','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','buy_recalcPricesByEntry','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','entryEditor','buy_recalcPricesByBuy','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','buy_recalcPricesByBuy','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','buy_recalcPricesByBuy','PROCEDURE','jenkins@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 */;

File diff suppressed because it is too large Load Diff

View File

@ -1855,6 +1855,26 @@ 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`.`agency_beforeInsert`
BEFORE INSERT ON `agency`
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`.`agency_afterInsert`
AFTER INSERT ON `agency`
FOR EACH ROW
@ -3211,12 +3231,6 @@ BEGIN
UPDATE `address` SET isDefaultAddress = TRUE
WHERE id = NEW.defaultAddressFk;
END IF;
IF NOT NEW.isActive THEN
UPDATE account.`user`
SET active = FALSE
WHERE id = NEW.id;
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -4577,9 +4591,19 @@ BEGIN
DECLARE vIsVirtual BOOL;
DECLARE vPrintedCount INT;
DECLARE vHasDistinctWarehouses BOOL;
DECLARE vTotalBuy INT;
IF NEW.isBooked = OLD.isBooked THEN
CALL entry_checkBooked(OLD.id);
ELSE
IF NEW.isBooked THEN
SELECT COUNT(*) INTO vTotalBuy
FROM buy
WHERE entryFk = NEW.id;
IF NOT vTotalBuy THEN
CALL util.throw('Entry must have lines to be marked booked');
END IF;
END IF;
END IF;
SET NEW.editorFk = account.myUser_getId();
@ -4587,7 +4611,7 @@ BEGIN
IF NOT (NEW.travelFk <=> OLD.travelFk) THEN
IF NEW.travelFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.travelFk) THEN
CALL util.throw('The travel is incorrect, there is a different AWB in the associated entries');
CALL util.throw('The travel is incorrect, there is a different AWB in the associated entries');
END IF;
SELECT COUNT(*) > 0 INTO vIsVirtual
@ -5295,10 +5319,6 @@ DELIMITER ;;
BEGIN
DECLARE vWithholdingSageFk INT;
IF NEW.isBooked = OLD.isBooked THEN
CALL invoiceIn_checkBooked(OLD.id);
END IF;
IF NOT (NEW.supplierRef <=> OLD.supplierRef) AND NOT util.checkPrintableChars(NEW.supplierRef) THEN
CALL util.throw('The invoiceIn reference contains invalid characters');
END IF;
@ -5419,74 +5439,12 @@ 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`.`invoiceInCorrection_beforeInsert`
BEFORE INSERT ON `invoiceInCorrection`
FOR EACH ROW
BEGIN
CALL invoiceIn_checkBooked(NEW.correctingFk);
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`.`invoiceInCorrection_beforeUpdate`
BEFORE UPDATE ON `invoiceInCorrection`
FOR EACH ROW
BEGIN
CALL invoiceIn_checkBooked(OLD.correctingFk);
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`.`invoiceInCorrection_beforeDelete`
BEFORE DELETE ON `invoiceInCorrection`
FOR EACH ROW
BEGIN
CALL invoiceIn_checkBooked(OLD.correctingFk);
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`.`invoiceInDueDay_beforeInsert`
BEFORE INSERT ON `invoiceInDueDay`
FOR EACH ROW
BEGIN
DECLARE vIsNotified BOOLEAN;
CALL invoiceIn_checkBooked(NEW.invoiceInFk);
SET NEW.editorFk = account.myUser_getId();
SELECT isNotified INTO vIsNotified
@ -5529,7 +5487,6 @@ DELIMITER ;;
BEGIN
DECLARE vIsNotified BOOLEAN;
CALL invoiceIn_checkBooked(OLD.invoiceInFk);
SET NEW.editorFk = account.myUser_getId();
SELECT isNotified INTO vIsNotified
@ -5566,26 +5523,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`.`invoiceInDueDay_beforeDelete`
BEFORE DELETE ON `invoiceInDueDay`
FOR EACH ROW
BEGIN
CALL invoiceIn_checkBooked(OLD.invoiceInFk);
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`.`invoiceInDueDay_afterDelete`
AFTER DELETE ON `invoiceInDueDay`
FOR EACH ROW
@ -5610,66 +5547,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`.`invoiceInIntrastat_beforeInsert`
BEFORE INSERT ON `invoiceInIntrastat`
FOR EACH ROW
BEGIN
CALL invoiceIn_checkBooked(NEW.invoiceInFk);
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`.`invoiceInIntrastat_beforeUpdate`
BEFORE UPDATE ON `invoiceInIntrastat`
FOR EACH ROW
BEGIN
CALL invoiceIn_checkBooked(OLD.invoiceInFk);
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`.`invoiceInIntrastat_beforeDelete`
BEFORE DELETE ON `invoiceInIntrastat`
FOR EACH ROW
BEGIN
CALL invoiceIn_checkBooked(OLD.invoiceInFk);
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`.`invoiceInTax_beforeInsert`
BEFORE INSERT ON `invoiceInTax`
FOR EACH ROW
@ -5695,8 +5572,6 @@ DELIMITER ;;
BEFORE UPDATE ON `invoiceInTax`
FOR EACH ROW
BEGIN
CALL invoiceIn_checkBooked(OLD.invoiceInFk);
IF NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) THEN
CALL invoiceInTax_afterUpsert(NEW.invoiceInFk);
END IF;
@ -5717,26 +5592,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`.`invoiceInTax_beforeDelete`
BEFORE DELETE ON `invoiceInTax`
FOR EACH ROW
BEGIN
CALL invoiceIn_checkBooked(OLD.invoiceInFk);
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`.`invoiceInTax_afterDelete`
AFTER DELETE ON `invoiceInTax`
FOR EACH ROW
@ -8459,8 +8314,8 @@ DELIMITER ;;
AFTER INSERT ON `solunionCAP`
FOR EACH ROW
BEGIN
UPDATE vn2008.Clientes c
JOIN creditClassification cc ON c.Id_Cliente = cc.client
UPDATE client c
JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassification = cc.id
SET creditInsurance = ci.credit * 2 WHERE ci.id = NEW.creditInsurance;
END */;;
@ -8483,13 +8338,13 @@ DELIMITER ;;
FOR EACH ROW
BEGIN
IF NEW.dateLeaving IS NOT NULL THEN
UPDATE vn2008.Clientes c
JOIN creditClassification cc ON c.Id_Cliente = cc.client
UPDATE client c
JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassification = cc.id
SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance;
ELSE
UPDATE vn2008.Clientes c
JOIN creditClassification cc ON c.Id_Cliente = cc.client
UPDATE client c
JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassification = cc.id
SET creditInsurance = ci.credit * 2 WHERE ci.id = OLD.creditInsurance;
END IF;
@ -8512,8 +8367,8 @@ DELIMITER ;;
BEFORE DELETE ON `solunionCAP`
FOR EACH ROW
BEGIN
UPDATE vn2008.Clientes c
JOIN creditClassification cc ON c.Id_Cliente = cc.client
UPDATE client c
JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassification = cc.id
SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance;
END */;;
@ -9539,7 +9394,7 @@ BEGIN
END IF;
IF NEW.attenderFk IS NULL THEN
SET NEW.attenderFk = (SELECT w.id FROM worker w WHERE w.code = NEW.buyerCode);
SET NEW.attenderFk = (SELECT defaultAttenderFk FROM ticketConfig LIMIT 1);
END IF;
END */;;
DELIMITER ;
@ -9569,10 +9424,6 @@ BEGIN
IF NEW.salesPersonCode <> OLD.salesPersonCode THEN
SET NEW.requesterFk = (SELECT w.id FROM worker w WHERE w.code = NEW.salesPersonCode);
END IF;
IF NEW.buyerCode <> OLD.buyerCode THEN
SET NEW.attenderFk = (SELECT w.id FROM worker w WHERE w.code = NEW.buyerCode);
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -10954,4 +10805,4 @@ USE `vn2008`;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2024-05-07 5:48:41
-- Dump completed on 2024-05-14 6:26:46

View File

@ -162,7 +162,7 @@ INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`)
(4, 'JPY', 'Yen Japones', 1),
(5, 'CNY', 'Yuan Chino', 1.2);
INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`, `continentFk`, `hasDailyInvoice`, `CEE`)
INSERT INTO `vn`.`country`(`id`, `name`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`, `continentFk`, `hasDailyInvoice`, `CEE`)
VALUES
(1, 'España', 1, 'ES', 1, 24, 4, 0, 1),
(2, 'Italia', 1, 'IT', 1, 27, 4, 0, 1),

View File

@ -1,7 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`sale_add`(
IN vStarted DATE,
IN vEnded DATE)
IN vEnded DATE
)
BEGIN
/**
* Añade las ventas que se realizaron entre 2 fechas a la tabla bs.sale
@ -10,63 +11,54 @@ BEGIN
* @param vEnded Fecha de fin
*
*/
DECLARE vLoopDate DATE;
DECLARE vLoopDateTime DATETIME;
IF vStarted < (util.VN_CURDATE() - INTERVAL 5 YEAR) OR vStarted > vEnded THEN
CALL util.throw('Wrong date');
END IF;
SET vLoopDate = vStarted;
DELETE FROM sale
WHERE dated BETWEEN vStarted AND vEnded;
WHILE vLoopDate <= vEnded DO
SET vLoopDateTime = util.dayEnd(vLoopDate);
REPLACE sale(
saleFk,
amount,
surcharge,
dated,
typeFk,
clientFk,
companyFk,
margin
)WITH calculatedSales AS(
SELECT s.id saleFk,
SUM(IF(ct.isBase, s.quantity * sc.value, 0)) amount,
SUM(IF(ct.isBase, 0, s.quantity * sc.value)) surcharge,
s.total pvp,
DATE(t.shipped) dated,
i.typeFk,
t.clientFk,
t.companyFk,
SUM(IF(ct.isMargin, s.quantity * sc.value, 0 )) marginComponents
FROM vn.ticket t
STRAIGHT_JOIN vn.sale s ON s.ticketFk = t.id
JOIN vn.item i ON i.id = s.itemFk
JOIN vn.itemType it ON it.id = i.typeFk
JOIN vn.itemCategory ic ON ic.id = it.categoryFk
JOIN vn.saleComponent sc ON sc.saleFk = s.id
JOIN vn.component c ON c.id = sc.componentFk
JOIN vn.componentType ct ON ct.id = c.typeFk
WHERE t.shipped BETWEEN vLoopDate AND vLoopDateTime
AND s.quantity <> 0
AND ic.merchandise
GROUP BY s.id
)SELECT saleFk,
amount,
surcharge,
dated,
typeFk,
clientFk,
companyFk,
marginComponents + amount + surcharge - pvp
FROM calculatedSales;
SET vLoopDate = vLoopDate + INTERVAL 1 DAY;
END WHILE;
REPLACE sale(
saleFk,
amount,
surcharge,
dated,
typeFk,
clientFk,
companyFk,
margin
)WITH calculatedSales AS(
SELECT s.id saleFk,
CAST(SUM(IF(ct.isBase, s.quantity * sc.value, 0)) AS DECIMAL(10, 3)) amount,
CAST(SUM(IF(ct.isBase, 0, s.quantity * sc.value)) AS DECIMAL(10, 3)) surcharge,
s.total,
DATE(t.shipped) dated,
i.typeFk,
t.clientFk,
t.companyFk,
CAST(SUM(IF(ct.isMargin, s.quantity * sc.value, 0 )) AS DECIMAL(10, 3)) marginComponents
FROM vn.ticket t
STRAIGHT_JOIN vn.sale s ON s.ticketFk = t.id
JOIN vn.item i ON i.id = s.itemFk
JOIN vn.itemType it ON it.id = i.typeFk
JOIN vn.itemCategory ic ON ic.id = it.categoryFk
JOIN vn.saleComponent sc ON sc.saleFk = s.id
JOIN vn.component c ON c.id = sc.componentFk
JOIN vn.componentType ct ON ct.id = c.typeFk
WHERE t.shipped BETWEEN vStarted AND vEnded
AND s.quantity <> 0
AND ic.merchandise
GROUP BY s.id
)SELECT saleFk,
amount,
surcharge,
dated,
typeFk,
clientFk,
companyFk,
IF (marginComponents IS NULL,
0,
CAST(marginComponents + amount + surcharge - total AS DECIMAL(10, 3)))
FROM calculatedSales;
END$$
DELIMITER ;

View File

@ -34,7 +34,7 @@ BEGIN
vPrinterFk,
IFNULL(right(`t`.`routeFk`, 3),0),
if (@vVolume := vn.ticketTotalVolume(t.id) > 1.5, @vVolume, IFNULL( rm.beachFk, 0)),
LEFT(IFNULL(et.description ,replace(`z`.`name`, 'ZONA ', 'Z')),14) truckName,
LEFT(IFNULL(rs.description ,replace(`z`.`name`, 'ZONA ', 'Z')),14) truckName,
t.clientFk ,
ifnull(c.mobile, ifnull(a.mobile, ifnull(c.phone, a.phone))),
LEFT(p.name, 20),
@ -46,7 +46,7 @@ BEGIN
JOIN vn.address a ON a.id = t.addressFk
JOIN vn.province p ON p.id = a.provinceFk
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk
LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk
LEFT JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk
LEFT JOIN vn.beach b ON b.code = rm.beachFk
LEFT JOIN vn.`zone`z ON z.id = t.zoneFk
JOIN vn.agencyMode am ON t.agencyModeFk = am.id

View File

@ -12,7 +12,7 @@ AS SELECT `s`.`user_id` AS `id`,
`c`.`permit` AS `permit`,
`c`.`type` AS `type`,
`c`.`context` AS `context`,
`c`.`incomingLimit` AS `incominglimit`,
`c`.`call-limit` AS `call-limit`,
`c`.`pickupGroup` AS `pickupgroup`,
`c`.`directMedia` AS `directmedia`,
`c`.`insecure` AS `insecure`,

View File

@ -15,14 +15,14 @@ BEGIN
DECLARE vDayMinute INT;
SELECT HOUR(IFNULL(et.ETD, z.`hour`)) * 60 + MINUTE(IFNULL(et.ETD, z.`hour`)) INTO vDayMinute
SELECT HOUR(IFNULL(rs.ETD, z.`hour`)) * 60 + MINUTE(IFNULL(rs.ETD, z.`hour`)) INTO vDayMinute
FROM vn.expedition e
JOIN vn.ticket t ON e.ticketFk = t.id
JOIN vn.`zone` z ON z.id = t.zoneFk
LEFT JOIN vn.route r ON r.id = t.routeFk
LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk
LEFT JOIN vn.routesMonitor rm ON t.routeFk = rm.routeFk
LEFT JOIN vn.expeditionTruck et ON rm.expeditionTruckFk = et.id
LEFT JOIN vn.roadmapStop rs ON rm.expeditionTruckFk = rs.id
WHERE e.id = vExpeditionFk;
RETURN vDayMinute;

View File

@ -296,8 +296,8 @@ BEGIN
SET @dm := (24 * 60) - 10;
UPDATE vn.expeditionTruck et
SET et.eta = timestampadd(MINUTE ,@dm := 1 + @dm,util.VN_CURDATE())
UPDATE vn.roadmapStop rs
SET rs.eta = timestampadd(MINUTE ,@dm := 1 + @dm,util.VN_CURDATE())
WHERE description LIKE 'PRU%' ;
DELETE FROM srt.movingLog ;

View File

@ -3,10 +3,10 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
VIEW `srt`.`bufferDayMinute`
AS SELECT `b`.`id` AS `bufferFk`,
`e`.`id` AS `expeditionFk`,
`srt`.`dayMinute`(IFNULL(`et`.`eta`, `z`.`hour`)) AS `dayMinute`,
`srt`.`dayMinute`(IFNULL(`rs`.`eta`, `z`.`hour`)) AS `dayMinute`,
`e`.`position` AS `position`,
IFNULL(
`et`.`eta`,
`rs`.`eta`,
`util`.`VN_CURDATE`() + INTERVAL `srt`.`dayMinute`(`z`.`hour`) MINUTE
) AS `ETD`,
`e2`.`ticketFk` AS `ticketFk`,
@ -34,7 +34,7 @@ FROM (
)
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`t`.`routeFk` = `rm`.`routeFk`)
)
LEFT JOIN `vn`.`expeditionTruck` `et` ON(`rm`.`expeditionTruckFk` = `et`.`id`)
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rm`.`expeditionTruckFk` = `rs`.`id`)
)
LEFT JOIN `vn`.`zone` `z` ON(`z`.`id` = `t`.`zoneFk`)
)

View File

@ -4,22 +4,22 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
AS SELECT `e`.`id` AS `expeditionFk`,
`e`.`bufferFk` AS `bufferFk`,
`e`.`position` AS `position`,
`srt`.`dayMinute`(IFNULL(`et`.`eta`, `z`.`hour`)) AS `dayMinute`,
`srt`.`dayMinute`(IFNULL(`rs`.`eta`, `z`.`hour`)) AS `dayMinute`,
IFNULL(
`et`.`eta`,
`rs`.`eta`,
`util`.`VN_CURDATE`() + INTERVAL `srt`.`dayMinute`(`z`.`hour`) + 120 MINUTE
) AS `eta`,
`ve`.`ticketFk` AS `ticketFk`,
IFNULL(`t`.`routeFk`, `t`.`agencyModeFk`) AS `routeFk`,
`z`.`name` AS `zonaTicket`,
`et`.`description` AS `truck`,
`rs`.`description` AS `truck`,
`es`.`description` AS `expeditionState`,
`b`.`hasWorkerWaiting` AS `hasWorkerWaiting`,
`b`.`isActive` AS `isActive`,
IF(
`et`.`id` IS NULL,
`rs`.`id` IS NULL,
`c`.`bufferDefault`,
`et`.`bufferFk`
`rs`.`bufferFk`
) AS `bufferTruck`,
`bt`.`typeName` AS `typeName`,
`rm`.`bufferFk` AS `routeBuffer`
@ -45,7 +45,7 @@ FROM (
)
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`t`.`routeFk` = `rm`.`routeFk`)
)
LEFT JOIN `vn`.`expeditionTruck` `et` ON(`rm`.`expeditionTruckFk` = `et`.`id`)
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rm`.`expeditionTruckFk` = `rs`.`id`)
)
JOIN `srt`.`config` `c`
)

View File

@ -4,13 +4,13 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
AS SELECT `e`.`id` AS `expeditionFk`,
`e`.`id` MOD 10000 AS `expedition`,
IFNULL(
`et`.`eta`,
`rs`.`eta`,
`util`.`VN_CURDATE`() + INTERVAL `srt`.`dayMinute`(`z`.`hour`) + 120 MINUTE
) AS `ETD`,
`ve`.`ticketFk` AS `ticketFk`,
right(IFNULL(`t`.`routeFk`, `t`.`agencyModeFk`), 3) AS `routeFk`,
`z`.`name` AS `zonaTicket`,
`et`.`description` AS `truck`,
`rs`.`description` AS `truck`,
`epo`.`workerCode` AS `worker`,
`p`.`name` AS `labeler`,
`ve`.`counter` AS `expeditionCounter`,
@ -32,7 +32,7 @@ FROM (
)
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`t`.`routeFk` = `rm`.`routeFk`)
)
LEFT JOIN `vn`.`expeditionTruck` `et` ON(`rm`.`expeditionTruckFk` = `et`.`id`)
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rm`.`expeditionTruckFk` = `rs`.`id`)
)
JOIN `dipole`.`expedition_PrintOut` `epo` ON(`epo`.`expeditionFk` = `e`.`id`)
)

View File

@ -7,15 +7,19 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`clientsDisable`
DO BEGIN
UPDATE account.user u
JOIN client c ON c.id = u.id
LEFT JOIN account.account a ON a.id = u.id
SET u.active = FALSE
WHERE c.typeFk = 'normal'
AND a.id IS NULL
AND u.active
AND c.created < util.VN_CURDATE() - INTERVAL 12 MONTH
AND u.id NOT IN (
SELECT DISTINCT c.id
FROM client c
LEFT JOIN ticket t ON t.clientFk = c.id
WHERE c.salesPersonFk IS NOT NULL
OR t.created > util.VN_CURDATE() - INTERVAL 2 MONTH
OR shipped > util.VN_CURDATE() - INTERVAL 2 MONTH
OR t.created > util.VN_CURDATE() - INTERVAL 12 MONTH
OR shipped > util.VN_CURDATE() - INTERVAL 12 MONTH
);
END$$
DELIMITER ;

View File

@ -0,0 +1,28 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`sale_hasComponentLack`(
vSelf INT
)RETURNS tinyint(1)
READS SQL DATA
BEGIN
/**
* Check if a sales line has all the required components.
*
* @param vSelf Id de sale
* @return BOOL
*/
DECLARE vHasComponentLack TINYINT(1);
WITH componentRequired AS(
SELECT COUNT(*) total
FROM vn.component
WHERE isRequired
)SELECT SUM(IF(c.isRequired, TRUE, FALSE)) <> cr.total INTO vHasComponentLack
FROM vn.sale s
JOIN componentRequired cr
LEFT JOIN vn.saleComponent sc ON sc.saleFk = s.id
LEFT JOIN vn.component c ON c.id = sc.componentFk
WHERE s.id = vSelf;
RETURN vHasComponentLack;
END$$
DELIMITER ;

View File

@ -0,0 +1,25 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticket_isTooLittle`(
vSelf INT
)
RETURNS tinyint(1)
READS SQL DATA
BEGIN
/**
* Check if the ticket is small based on the volume and amount parameters.
*
* @param vSelf Id ticket
* @return BOOL
*/
DECLARE vIsTooLittle TINYINT(1);
SELECT (SUM(IFNULL(sv.litros, 0)) < vc.minTicketVolume
OR IFNULL(t.totalWithoutVat, 0) < vc.minTicketValue) INTO vIsTooLittle
FROM ticket t
LEFT JOIN saleVolume sv ON sv.ticketFk = t.id
JOIN volumeConfig vc
WHERE t.id = vSelf;
RETURN vIsTooLittle;
END$$
DELIMITER ;

View File

@ -9,7 +9,7 @@ BEGIN
DECLARE vEnded DATETIME DEFAULT util.dayEnd(util.VN_CURDATE());
SELECT ag.id agency_id,
CONCAT(RPAD(c.country, 16,' _') ,' ',ag.name) Agencia,
CONCAT(RPAD(c.name, 16,' _') ,' ',ag.name) Agencia,
COUNT(*) expediciones,
SUM(t.packages) Bultos,
SUM(tpe.boxes) Faltan

View File

@ -86,7 +86,7 @@ BEGIN
WHERE cs.description = 'Anulado'
AND c.created < v2Months;
DELETE FROM expeditionTruck WHERE eta < v3Months;
DELETE FROM roadmapStop WHERE eta < v3Months;
DELETE FROM XDiario WHERE FECHA < v3Months OR FECHA IS NULL;
-- Borrar travels sin entradas

View File

@ -22,7 +22,7 @@ BEGIN
c.credit,
CAST(r.risk AS DECIMAL (10,2)) risk,
CAST(c.credit - r.risk AS DECIMAL (10,2)) difference,
co.country
co.name country
FROM client c
JOIN tmp.risk r ON r.clientFk = c.id
JOIN country co ON co.id = c.countryFk

View File

@ -30,7 +30,10 @@ BEGIN
-- Si hay colecciones sin terminar, sale del proceso
CALL collection_get(vUserFk);
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0 INTO vHasTooMuchCollections
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0,
collection_assign_lockname
INTO vHasTooMuchCollections,
vLockName
FROM productionConfig pc
LEFT JOIN tCollection ON TRUE;

View File

@ -24,7 +24,7 @@ BEGIN
10 * p.height as height,
IFNULL(t.routeFk,am.agencyFk) routeFk,
hour(e.created) * 60 + minute(e.created),
IFNULL(et.description , a.name),
IFNULL(rs.description , a.name),
IFNULL(t.routeFk,am.agencyFk) criterion,
IFNULL(p.conveyorBuildingClassFk , pc.defaultConveyorBuildingClass)
FROM vn.expedition e
@ -34,7 +34,7 @@ BEGIN
LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk
LEFT JOIN vn.agency a ON a.id = am.agencyFk
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk
LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk
LEFT JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk
JOIN vn.packagingConfig pc
WHERE t.warehouseFk IN (60,1,44)
AND e.created BETWEEN vStarted AND vEnded

View File

@ -27,7 +27,7 @@ BEGIN
cac.invoiced billedAnnually,
c.dueDay,
cgd.grade,
c2.country
c2.name country
FROM tmp.clientGetDebt cgd
LEFT JOIN tmp.risk r ON r.clientFk = cgd.clientFk
JOIN client c ON c.id = cgd.clientFk

View File

@ -2,7 +2,7 @@ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`expeditionTruck_Add`(vHour VARCHAR(5), vDescription VARCHAR(45))
BEGIN
INSERT INTO vn.expeditionTruck(eta,description)
INSERT INTO vn.roadmapStop(eta,description)
VALUES(CONCAT(util.VN_CURDATE(), ' ', vHour), vDescription);
END$$

View File

@ -4,9 +4,9 @@ BEGIN
SELECT id truckFk,
eta,
description Destino
FROM expeditionTruck
WHERE eta BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
ORDER BY eta;
description Destino
FROM roadmapStop
WHERE eta BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
ORDER BY eta;
END$$
DELIMITER ;

View File

@ -53,8 +53,8 @@ BEGIN
am.name zonaRuta,
t.routeFk ruta,
rm.beachFk ubicacion,
et.eta ,
et.description camion,
rs.eta ,
rs.description camion,
vTicketsPendientes AS ticketsPendientes,
vEtiquetasTotales AS etiquetasTotales,
vEtiquetasEscaneadas AS etiquetasEscaneadas,
@ -67,7 +67,7 @@ BEGIN
LEFT JOIN vn.route r ON r.id = t.routeFk
LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id
LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk
LEFT JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk
WHERE e.id = vExpeditionFk;
END$$

View File

@ -37,8 +37,8 @@ BEGIN
am.name zonaRuta,
t.routeFk ruta,
rm.beachFk ubicacion,
et.eta ,
et.description camion,
rs.eta ,
rs.description camion,
vTicketsPendientes AS ticketsPendientes,
vEtiquetasTotales AS etiquetasTotales,
vEtiquetasEscaneadas AS etiquetasEscaneadas
@ -50,7 +50,7 @@ BEGIN
LEFT JOIN vn.route r ON r.id = t.routeFk
LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id
LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk
LEFT JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk
WHERE e.id = vExpeditionFk;
END$$

View File

@ -2,7 +2,7 @@ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingRadar`(
vSectorFk INT
)
proc:BEGIN
BEGIN
/**
* Calcula la información detallada respecto un sector.
*
@ -15,37 +15,24 @@ proc:BEGIN
DECLARE vWarehouseFk INT DEFAULT 0;
DECLARE vSonSectorFk INT;
DECLARE vWorkerFk INT;
SELECT s.workerFk
INTO vWorkerFk
FROM vn.sector s
SELECT s.workerFk INTO vWorkerFk
FROM sector s
WHERE s.id = vSectorFk;
SELECT w.id, s.warehouseFk INTO vBuyerFk, vWarehouseFk
FROM vn.worker w
JOIN vn.sector s ON s.code = w.code
WHERE s.id = vSectorFk;
SELECT s.id INTO vSectorFk
FROM vn.sector s
WHERE s.warehouseFk = vWarehouseFk
AND s.isMain;
SELECT COUNT(*) INTO hasFatherSector
FROM vn.sector
FROM sector
WHERE sonFk = vSectorFk;
SELECT warehouseFk, sonFk INTO vWarehouseFk, vSonSectorFk
FROM vn.sector
FROM sector
WHERE id = vSectorFk;
CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk);
CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE());
DROP TEMPORARY TABLE IF EXISTS tmp.itemShelvingRadar;
IF hasFatherSector THEN
CREATE TEMPORARY TABLE tmp.itemShelvingRadar
CREATE OR REPLACE TEMPORARY TABLE tItemShelvingRadar
(PRIMARY KEY (itemFk))
ENGINE = MEMORY
SELECT *
@ -54,57 +41,77 @@ proc:BEGIN
i.longName,
i.size,
i.subName producer,
IFNULL(a.available,0) available,
SUM(IF(s.sonFk = vSectorFk, IFNULL(iss.visible,0), 0)) upstairs,
SUM(IF(iss.sectorFk = vSectorFk, IFNULL(iss.visible,0), 0)) downstairs,
IF(it.isPackaging, NULL, IFNULL(v.visible,0)) as visible,
vSectorFk sectorFk
FROM vn.itemShelvingStock iss
JOIN vn.sector s ON s.id = iss.sectorFk
JOIN vn.item i on i.id = iss.itemFk
JOIN vn.itemType it ON it.id = i.typeFk AND vBuyerFk IN (0,it.workerFk)
LEFT JOIN cache.available a ON a.item_id = iss.itemFk AND a.calc_id = vCalcAvailableFk
LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk
IFNULL(a.available, 0) available,
SUM(IF(s.sonFk = vSectorFk, IFNULL(iss.visible, 0), 0)) upstairs,
SUM(IF(iss.sectorFk = vSectorFk, IFNULL(iss.visible, 0), 0)) downstairs,
IF(it.isPackaging, NULL, IFNULL(v.visible, 0)) visible,
vSectorFk sectorFk,
ish.isChecked,
sub.isAllChecked
FROM itemShelvingStock iss
JOIN itemShelving ish ON ish.shelvingFk = iss.shelvingFk
LEFT JOIN (
SELECT itemFk,
IF(
COUNT(*) = SUM(IF(isChecked >= 0, 1, 0)),
TRUE,
FALSE
) isAllChecked
FROM itemShelving is2
GROUP BY itemFk
) sub ON sub.itemFk = ish.itemFk
JOIN sector s ON s.id = iss.sectorFk
JOIN item i ON i.id = iss.itemFk
JOIN itemType it ON it.id = i.typeFk
LEFT JOIN cache.available a ON a.item_id = iss.itemFk
AND a.calc_id = vCalcAvailableFk
LEFT JOIN cache.visible v ON v.item_id = iss.itemFk
AND v.calc_id = vCalcVisibleFk
WHERE vSectorFk IN (iss.sectorFk, s.sonFk)
GROUP BY iss.itemFk
UNION ALL
SELECT v.item_id,
SELECT v.item_id,
i.longName,
i.size,
i.subName producer,
IFNULL(a.available,0) as available,
0 upstairs,
0 downstairs,
IF(it.isPackaging, NULL, v.visible) visible,
vSectorFk as sectorFk
i.subName,
IFNULL(a.available, 0),
0,
0,
IF(it.isPackaging, NULL, v.visible),
vSectorFk,
NULL,
NULL
FROM cache.visible v
JOIN vn.item i on i.id = v.item_id
JOIN vn.itemType it ON it.id = i.typeFk AND vBuyerFk IN (0,it.workerFk)
LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = v.item_id AND iss.warehouseFk = vWarehouseFk
LEFT JOIN cache.available a ON a.item_id = v.item_id AND a.calc_id = vCalcAvailableFk
JOIN item i ON i.id = v.item_id
JOIN itemType it ON it.id = i.typeFk
LEFT JOIN itemShelvingStock iss ON iss.itemFk = v.item_id
AND iss.warehouseFk = vWarehouseFk
LEFT JOIN cache.available a ON a.item_id = v.item_id
AND a.calc_id = vCalcAvailableFk
WHERE v.calc_id = vCalcVisibleFk
AND iss.itemFk IS NULL
AND it.isInventory
) sub GROUP BY itemFk;
) sub
GROUP BY itemFk;
SELECT ishr.*,
CAST(visible - upstairs - downstairs AS DECIMAL(10,0)) AS nicho,
CAST(downstairs - IFNULL(notPickedYed,0) AS DECIMAL(10,0)) as pendiente
FROM tmp.itemShelvingRadar ishr
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.ticketFk = t.id
JOIN vn.sale s ON s.ticketFk = t.id
WHERE t.warehouseFk = vWarehouseFk
AND tst.alertLevel = 0
GROUP BY s.itemFk
) sub ON sub.itemFk = ishr.itemFk
ORDER BY i.typeFk, i.longName;
CAST(visible - upstairs - downstairs AS DECIMAL(10, 0)) nicho,
CAST(downstairs - IFNULL(notPickedYed, 0) AS DECIMAL(10, 0)) pendiente
FROM tItemShelvingRadar ishr
JOIN item i ON i.id = ishr.itemFk
LEFT JOIN (
SELECT s.itemFk, SUM(s.quantity) notPickedYed
FROM ticket t
JOIN ticketStateToday tst ON tst.ticketFk = t.id
JOIN alertLevel al ON al.id = tst.alertLevel
JOIN sale s ON s.ticketFk = t.id
WHERE t.warehouseFk = vWarehouseFk
AND al.code = 'FREE'
GROUP BY s.itemFk
) sub ON sub.itemFk = ishr.itemFk
ORDER BY i.typeFk, i.longName;
ELSE
CREATE TEMPORARY TABLE tmp.itemShelvingRadar
CREATE OR REPLACE TEMPORARY TABLE tItemShelvingRadar
(PRIMARY KEY (itemFk))
ENGINE = MEMORY
SELECT iss.itemFk,
@ -115,80 +122,86 @@ proc:BEGIN
i.size,
i.subName producer,
i.upToDown,
IFNULL(a.available,0) available,
IFNULL(v.visible - iss.visible,0) dayEndVisible,
IFNULL(v.visible - iss.visible,0) firstNegative,
IFNULL(v.visible - iss.visible,0) itemPlacementVisible,
IFNULL(i.minimum * b.packing,0) itemPlacementSize,
IFNULL(a.available, 0) available,
IFNULL(v.visible - iss.visible, 0) dayEndVisible,
IFNULL(v.visible - iss.visible, 0) firstNegative,
IFNULL(v.visible - iss.visible, 0) itemPlacementVisible,
IFNULL(i.minimum * b.packing, 0) itemPlacementSize,
ips.onTheWay,
iss.visible itemShelvingStock,
IFNULL(v.visible,0) visible,
IFNULL(v.visible, 0) visible,
b.isPickedOff,
iss.sectorFk
FROM vn.itemShelvingStock iss
JOIN vn.item i on i.id = iss.itemFk
LEFT JOIN cache.last_buy lb ON lb.item_id = iss.itemFk AND lb.warehouse_id = vWarehouseFk
LEFT JOIN vn.buy b ON b.id = lb.buy_id
LEFT JOIN cache.available a ON a.item_id = iss.itemFk AND a.calc_id = vCalcAvailableFk
LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk
LEFT JOIN (SELECT itemFk, sum(saldo) as onTheWay
FROM vn.itemPlacementSupplyList
WHERE saldo > 0
GROUP BY itemFk
) ips ON ips.itemFk = i.id
WHERE IFNULL(iss.sectorFk,0) IN (0, vSectorFk)
OR iss.sectorFk = vSectorFk;
FROM itemShelvingStock iss
JOIN item i ON i.id = iss.itemFk
LEFT JOIN cache.last_buy lb ON lb.item_id = iss.itemFk
AND lb.warehouse_id = vWarehouseFk
LEFT JOIN buy b ON b.id = lb.buy_id
LEFT JOIN cache.available a ON a.item_id = iss.itemFk
AND a.calc_id = vCalcAvailableFk
LEFT JOIN cache.visible v ON v.item_id = iss.itemFk
AND v.calc_id = vCalcVisibleFk
LEFT JOIN (
SELECT itemFk, SUM(saldo) onTheWay
FROM itemPlacementSupplyList
WHERE saldo > 0
GROUP BY itemFk
) ips ON ips.itemFk = i.id
WHERE iss.sectorFk = vSectorFk
OR iss.sectorFk IS NULL;
DROP TEMPORARY TABLE IF EXISTS tmp.itemOutTime;
CREATE TEMPORARY TABLE tmp.itemOutTime
SELECT *,SUM(amount) quantity
FROM
(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 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
LEFT JOIN vn.zone z ON z.id = t.zoneFk
LEFT JOIN (SELECT DISTINCT saleFk
FROM vn.saleTracking st
WHERE st.created > util.VN_CURDATE()
AND st.isChecked
) stPrevious ON `stPrevious`.`saleFk` = io.saleFk
WHERE t.warehouseFk = vWarehouseFk
AND s.isPicked = 0
AND NOT io.reserved
AND stPrevious.saleFk IS NULL
AND io.shipped >= util.VN_CURDATE()
AND io.shipped < util.VN_CURDATE() + INTERVAL 1 DAY
) sub
GROUP BY itemFk, hours, minutes;
CREATE OR REPLACE TEMPORARY TABLE tmp.itemOutTime
SELECT *, SUM(amount) quantity
FROM (
SELECT io.itemFk,
io.quantity amount,
IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) `hours`,
IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) `minutes`
FROM itemTicketOut `io`
JOIN tItemShelvingRadar isr ON isr.itemFk = io.itemFk
JOIN ticket t ON t.id= io.ticketFk
JOIN ticketState ts ON ts.ticketFk = io.ticketFk
JOIN `state` s ON s.id = ts.stateFk
LEFT JOIN `zone` z ON z.id = t.zoneFk
LEFT JOIN (
SELECT DISTINCT saleFk
FROM saleTracking st
WHERE st.created > util.VN_CURDATE()
AND st.isChecked
) stPrevious ON stPrevious.saleFk = io.saleFk
WHERE t.warehouseFk = vWarehouseFk
AND NOT s.isPicked
AND NOT io.reserved
AND stPrevious.saleFk IS NULL
AND io.shipped >= util.VN_CURDATE()
AND io.shipped < util.VN_CURDATE() + INTERVAL 1 DAY
) sub
GROUP BY itemFk, `hours`, `minutes`;
INSERT INTO tmp.itemShelvingRadar (itemFk)
INSERT INTO tItemShelvingRadar (itemFk)
SELECT itemFk FROM tmp.itemOutTime
ON DUPLICATE KEY UPDATE dayEndVisible = dayEndVisible + quantity,
firstNegative = if (firstNegative < 0, firstNegative, firstNegative + quantity),
`hour` = ifnull(if (firstNegative > 0 , `hour`, hours),0),
`minute` = ifnull(if (firstNegative > 0, `minute`, minutes),0);
ON DUPLICATE KEY UPDATE dayEndVisible = dayEndVisible + quantity,
firstNegative = IF(firstNegative < 0, firstNegative, firstNegative + quantity),
`hour` = IFNULL(IF(firstNegative > 0 , `hour`, `hours`), 0),
`minute` = IFNULL(IF(firstNegative > 0, `minute`, `minutes`), 0);
UPDATE tmp.itemShelvingRadar isr
JOIN (SELECT s.itemFk, sum(s.quantity) amount
FROM sale s
JOIN ticket t ON t.id = s.ticketFk
JOIN ticketLastState tls ON tls.ticketFk = t.id
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
AND tls.name = 'Prep Camara'
GROUP BY s.itemFk) sub ON sub.itemFk = isr.itemFk
UPDATE tItemShelvingRadar isr
JOIN (
SELECT s.itemFk, SUM(s.quantity) amount
FROM sale s
JOIN ticket t ON t.id = s.ticketFk
JOIN ticketState ts ON ts.ticketFk = t.id
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
AND ts.code = 'COOLER_PREPARATION'
GROUP BY s.itemFk
) sub ON sub.itemFk = isr.itemFk
SET isr.dayEndVisible = dayEndVisible + sub.amount,
firstNegative = firstNegative + sub.amount;
SELECT * FROM tmp.itemShelvingRadar;
SELECT * FROM tItemShelvingRadar;
END IF;
DROP TEMPORARY TABLE tmp.itemShelvingRadar;
DROP TEMPORARY TABLE tItemShelvingRadar;
END$$
DELIMITER ;

View File

@ -20,8 +20,11 @@ BEGIN
SELECT barcodeToItem(vBarcode) INTO vItemFk;
SET vPacking = COALESCE(vPacking, GREATEST(vn.itemPacking(vBarcode,vWarehouseFk), 1));
SET vQuantity = vQuantity * vPacking;
IF vPacking IS NULL
THEN
SET vPacking = itemPacking(vBarcode, vWarehouseFk);
SET vQuantity = vQuantity * vPacking;
END IF;
IF (SELECT COUNT(*) FROM itemShelving
WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk

View File

@ -21,6 +21,9 @@ BEGIN
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDated);
-- Añadido temporalmente para que no se cuelgue la db
SET vShowType = TRUE;
WITH itemTags AS (
SELECT i.id,
typeFk,

View File

@ -20,7 +20,7 @@ BEGIN
CONCAT(tc.collectionFk, ' ', LEFT(cc.code, 4)) color,
CONCAT(tc.collectionFk, ' ', SUBSTRING('ABCDEFGH',tc.wagon, 1), '-', tc.level) levelV,
tc.ticketFk,
LEFT(COALESCE(et.description, zo.name, am.name),12) agencyDescription,
LEFT(COALESCE(rs.description, zo.name, am.name),12) agencyDescription,
am.name,
t.clientFk,
CONCAT(CAST(SUM(sv.volume) AS DECIMAL(5, 2)), '') m3 ,
@ -47,7 +47,7 @@ BEGIN
LEFT JOIN ticketTrolley tt ON tt.ticket = t.id
LEFT JOIN zone zo ON t.zoneFk = zo.id
LEFT JOIN routesMonitor rm ON rm.routeFk = t.routeFk
LEFT JOIN expeditionTruck et ON et.id = rm.expeditionTruckFk
LEFT JOIN roadmapStop rs ON rs.id = rm.expeditionTruckFk
WHERE IF(vIsCollection, tc.collectionFk = vParam, tc.ticketFk = vParam)
GROUP BY t.id
ORDER BY cc.code;

View File

@ -106,8 +106,8 @@ BEGIN
SET rm.m3boxes = sub.m3boxes;
UPDATE routesMonitor rm
JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk
SET rm.etd = et.eta;
JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk
SET rm.etd = rs.eta;
DROP TEMPORARY TABLE tmp.routesMonitor;
END$$

View File

@ -44,6 +44,7 @@ BEGIN
hasComponentLack INTEGER(1),
hasRounding VARCHAR(255),
isTooLittle BOOL DEFAULT FALSE,
isVip BOOL DEFAULT FALSE,
PRIMARY KEY (ticketFk, saleFk)
) ENGINE = MEMORY;
@ -79,6 +80,14 @@ BEGIN
JOIN volumeConfig vc
WHERE sub.litros < vc.minTicketVolume
AND sub.totalWithoutVat < vc.minTicketValue;
-- VIP
INSERT INTO tmp.sale_problems(ticketFk, isVip)
SELECT DISTINCT tl.ticketFk, TRUE
FROM tmp.ticket_list tl
JOIN client c ON c.id = tl.clientFk
WHERE c.businessTypeFk = 'VIP'
ON DUPLICATE KEY UPDATE isVip = TRUE;
-- Faltan componentes
INSERT INTO tmp.sale_problems(ticketFk, hasComponentLack, saleFk)

View File

@ -0,0 +1,18 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_setProblem`(
vProblemCode VARCHAR(25)
)
BEGIN
/**
* Update column sale.problem with a problem code
* @param vProblemCode Code to set or unset
* @table tmp.sale(saleFk, hasProblem)
*/
UPDATE sale s
JOIN tmp.sale ts ON ts.saleFk = s.id
SET s.problem = CONCAT(
IF(ts.hasProblem,
CONCAT(s.problem, ',', vProblemCode),
REPLACE(s.problem, vProblemCode , '')));
END$$
DELIMITER ;

View File

@ -0,0 +1,21 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_setProblemComponentLack`(
vSelf INT
)
BEGIN
/**
* Update the problems for sales lines that have or no longer have problems with components,
* verify whether all mandatory components are present or not
*
* @param vSelf Id del sale
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
(INDEX(saleFk))
ENGINE = MEMORY
SELECT vSelf saleFk, sale_hasComponentLack(vSelf) hasProblem;
CALL sale_setProblem('hasComponentLack');
DROP TEMPORARY TABLE tmp.sale;
END$$
DELIMITER ;

View File

@ -0,0 +1,26 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_setProblemComponentLackByComponent`(
vComponentFk INT
)
BEGIN
/**
* Update the issues for sales lines that have or no longer have problems with components, verify
* whether all mandatory components are present or not resulting from changes in the table vn.component
*
* @param vComponentFk Id component
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
(INDEX(saleFk))
ENGINE = MEMORY
SELECT s.id saleFk, sale_hasComponentLack(s.id) hasProblem
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
WHERE t.shipped >= util.midnight()
AND (vComponentFk IS NULL OR sc.componentFk = vComponentFk);
CALL sale_setProblem('hasComponentLack');
DROP TEMPORARY TABLE tmp.sale;
END$$
DELIMITER ;

View File

@ -0,0 +1,34 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_setProblemRounding`(
vSelf INT
)
BEGIN
/**
* Update the rounding problem for a sales line
* @param vSelf Id sale
*/
DECLARE vItemFk INT;
DECLARE vWarehouseFk INT;
DECLARE vShipped DATE;
DECLARE vQuantity INT;
SELECT s.itemFk, t.warehouseFk, t.shipped, s.quantity
INTO vItemFk, vWarehouseFk, vShipped, vQuantity
FROM sale s
JOIN ticket t ON t.id = s.ticketFk
WHERE s.id = vSelf;
CALL buyUltimate(vWarehouseFk, vShipped);
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
SELECT vSelf saleFk, MOD(vQuantity, bu.`grouping`) hasProblem
FROM tmp.buyUltimate bu
JOIN buy b ON b.id = bu.buyFk
WHERE bu.itemFk = vItemFk;
CALL sale_setProblem('hasRounding');
DROP TEMPORARY TABLE tmp.ticket;
DROP TEMPORARY TABLE tmp.buyUltimate;
END$$
DELIMITER ;

View File

@ -43,7 +43,7 @@ BEGIN
INSERT INTO stockBuyed(buyed, dated, description)
SELECT SUM(ic.cm3 * ito.quantity / vc.palletM3 / 1000000),
vDated,
IF(c.code = 'ES', p.name, c.country) destiny
IF(c.code = 'ES', p.name, c.name) destiny
FROM itemTicketOut ito
JOIN ticket t ON t.id = ito.ticketFk
JOIN `address` a ON a.id = t.addressFk

View File

@ -25,6 +25,7 @@ BEGIN
MAX(itemDelay) itemDelay,
MAX(hasRounding) hasRounding,
MAX(itemLost) itemLost,
MAX(isVip) isVip,
0 totalProblems
FROM tmp.sale_problems
GROUP BY ticketFk;
@ -40,7 +41,8 @@ BEGIN
(tp.isTooLittle) +
(tp.itemLost) +
(tp.hasRounding) +
(tp.itemShortage)
(tp.itemShortage) +
(tp.isVip)
);
DROP TEMPORARY TABLE tmp.sale_problems;

View File

@ -0,0 +1,19 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblem`(
vProblemCode VARCHAR(25)
)
BEGIN
/**
* Update column ticket.problem with a problem code
*
* @param vProblemCode Code to set or unset
* @table tmp.ticket(ticketFk, hasProblem)
*/
UPDATE ticket t
JOIN tmp.ticket tt ON tt.ticketFk = t.id
SET t.problem = CONCAT(
IF(tt.hasProblem,
CONCAT(problem, ',', vProblemCode),
REPLACE(problem, vProblemCode , '')));
END$$
DELIMITER ;

View File

@ -0,0 +1,29 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemFreeze`(
vClientFk INT
)
BEGIN
/**
* Update the problem of tickets whose client is frozen or unfrozen
*
* @param vClientFk Id Cliente, if NULL all clients
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
(INDEX(ticketFk))
ENGINE = MEMORY
SELECT t.id ticketFk, FALSE hasProblem
FROM ticket t
WHERE t.shipped >= util.midnight()
AND (vClientFk IS NULL OR t.clientFk = vClientFk);
UPDATE tmp.ticket t
JOIN ticket ti ON ti.id = t.ticketFk
JOIN client c ON c.id = ti.clientFk
SET t.hasProblem = TRUE
WHERE c.isFreezed;
CALL ticket_setProblem('hasTicketRequest');
DROP TEMPORARY TABLE tmp.ticket;
END$$
DELIMITER ;

View File

@ -0,0 +1,28 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemRequest`(
vSelf INT
)
BEGIN
/**
* Update the problems of tickets that have a pending ticketRequest or no longer have it
*
* @param vSelf Id ticket, if NULL ALL tickets
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
(INDEX(ticketFk))
ENGINE = MEMORY
SELECT t.id ticketFk, FALSE hasProblem
FROM ticket t
WHERE t.shipped >= util.midnight()
AND (vSelf IS NULL OR t.id = vSelf);
UPDATE tmp.ticket t
JOIN ticketRequest tr ON tr.ticketFk = t.ticketFk
SET t.hasProblem = TRUE
WHERE tr.isOK IS NULL;
CALL ticket_setProblem('hasTicketRequest');
DROP TEMPORARY TABLE tmp.ticket;
END$$
DELIMITER ;

View File

@ -0,0 +1,33 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemRisk`(
vSelf INT
)
BEGIN
/**
* Update the risk problem for a specific ticket
*
* @param vSelf Id ticket
*/
DECLARE vHasRisk BOOL;
DECLARE vHasHighRisk BOOL;
SELECT t.risk > (c.credit + 10), ((t.risk - cc.riskTolerance) > (c.credit + 10))
INTO vHasRisk, vHasHighRisk
FROM client c
JOIN ticket t ON t.clientFk = c.id
JOIN clientConfig cc
WHERE t.id = vSelf;
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
SELECT vSelf ticketFk, vRisk hasProblem;
CALL ticket_setProblem('hasRisk');
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
SELECT vSelf ticketFk, vHasHighRisk hasProblem;
CALL ticket_setProblem('hasHighRisk');
DROP TEMPORARY TABLE tmp.ticket;
END$$
DELIMITER ;

View File

@ -0,0 +1,34 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemRounding`(
vSelf INT
)
BEGIN
/**
* Update the rounding problem for the sales lines of a ticket
*
* @param vSelf Id de ticket
*/
DECLARE vWarehouseFk INT;
DECLARE vDated DATE;
SELECT warehouseFk, shipped
INTO vWarehouseFk, vDated
FROM ticket
WHERE id = vSelf;
CALL buyUltimate(vWarehouseFk, vDated);
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
SELECT s.id saleFk , MOD(s.quantity, b.`grouping`) hasProblem
FROM ticket t
JOIN sale s ON s.ticketFk = tl.ticketFk
JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
JOIN buy b ON b.id = bu.buyFk
WHERE t.id = vSelf;
CALL sale_setProblem('hasRounding');
DROP TEMPORARY TABLE tmp.ticket;
DROP TEMPORARY TABLE tmp.buyUltimate;
END$$
DELIMITER ;

View File

@ -0,0 +1,24 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost`
PROCEDURE `vn`.`ticket_setProblemTaxDataChecked`(vClientFk INT)
BEGIN
/**
* Update the problem of tickets, depending on whether
* the client taxDataCheched is verified or not
*
* @param vClientFk Id cliente, if NULL all clients
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
(INDEX(ticketFk))
ENGINE = MEMORY
SELECT t.id ticketFk, IF(c.isTaxDataChecked, FALSE, TRUE) hasProblem
FROM ticket t
JOIN client c ON c.id = t.clientFk
WHERE t.shipped >= util.midnight()
AND (c.id = vClientFk OR vClientFk IS NULL);
CALL ticket_setProblem('isTaxDataChecked');
DROP TEMPORARY TABLE tmp.ticket;
END$$
DELIMITER ;

View File

@ -0,0 +1,20 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemTooLittle`(
vSelf INT
)
BEGIN
/**
* Update the problems when the ticket is too small or is no longer so
*
* @param vSelf Id del ticket
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
(INDEX(ticketFk))
ENGINE = MEMORY
SELECT vSelf ticketFk, ticket_isTooLittle(vSelf) hasProblem;
CALL ticket_setProblem('isTooLittle');
DROP TEMPORARY TABLE tmp.ticket;
END$$
DELIMITER ;

View File

@ -0,0 +1,29 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemTooLittleItemCost`(
vItemFk INT
)
BEGIN
/**
* Update the problems when the ticket is too small or is no longer so,
* derived from changes in the itemCost table
*
* @param vItemFk Id del item, NULL ALL items
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
(INDEX(ticketFk))
ENGINE = MEMORY
WITH tickets AS(
SELECT t.id ticketFk
FROM vn.ticket t
JOIN vn.sale s ON s.ticketFk = t.id
WHERE t.shipped >= util.midnight()
AND (s.itemFk = vItemFk OR vItemFk IS NULL)
GROUP BY t.id
)SELECT ticketFk, ticket_isTooLittle(ticketFk) hasProblem
FROM tickets;
CALL ticket_setProblem('isTooLittle');
DROP TEMPORARY TABLE tmp.ticket;
END$$
DELIMITER ;

View File

@ -0,0 +1,87 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setRisk`(
vClientFk INT)
BEGIN
/**
* Update the risk for a client with pending tickets
*
* @param vClientFk Id cliente
*/
DECLARE vHasDebt BOOL;
SELECT COUNT(*) INTO vHasDebt
FROM `client`
WHERE id = vClientFk
AND typeFk = 'normal';
IF vHasDebt THEN
CREATE OR REPLACE TEMPORARY TABLE tTicketRisk
(KEY (ticketFk))
ENGINE = MEMORY
WITH ticket AS(
SELECT id ticketFk, companyFk, DATE(shipped) dated
FROM vn.ticket t
WHERE clientFk = vClientFk
AND refFk IS NULL
AND NOT isDeleted
AND totalWithoutVat <> 0
), dated AS(
SELECT t.companyFk, MIN(DATE(t.dated) - INTERVAL cc.riskScope MONTH) started,
MAX(DATE(t.dated)) ended
FROM ticket t
JOIN vn.clientConfig cc
GROUP BY t.companyFk
), balance AS(
SELECT SUM(amount)amount, companyFk
FROM (
SELECT amount, companyFk
FROM vn.clientRisk
WHERE clientFk = vClientFk
UNION ALL
SELECT -(SUM(amount) / 100) amount, tm.companyFk
FROM hedera.tpvTransaction t
JOIN hedera.tpvMerchant tm ON t.id = t.merchantFk
WHERE clientFk = vClientFk
AND receiptFk IS NULL
AND status = 'ok'
) sub
WHERE companyFk
GROUP BY companyFk
), uninvoiced AS(
SELECT t.companyFk, DATE(t.shipped) dated, SUM(IFNULL(t.totalWithVat, 0)) amount
FROM vn.ticket t
JOIN dated d
WHERE t.clientFk = vClientFk
AND t.refFk IS NULL
AND t.shipped BETWEEN d.started AND d.ended
GROUP BY t.companyFk, DATE(t.shipped)
), receipt AS(
SELECT companyFk,DATE(payed) dated, SUM(amountPaid) amount
FROM vn.receipt
WHERE clientFk = vClientFk
AND payed > util.VN_CURDATE()
GROUP BY companyFk, DATE(payed)
), risk AS(
SELECT b.companyFk,
ui.dated,
SUM(ui.amount) OVER (PARTITION BY b.companyFk ORDER BY ui.dated ) +
b.amount +
SUM(IFNULL(r.amount, 0)) amount
FROM balance b
JOIN uninvoiced ui ON ui.companyFk = b.companyFk
LEFT JOIN receipt r ON r.dated > ui.dated AND r.companyFk = ui.companyFk
GROUP BY b.companyFk, ui.dated
)
SELECT ti.ticketFk, r.amount
FROM ticket ti
JOIN risk r ON r.dated = ti.dated AND r.companyFk = ti.companyFk;
UPDATE ticket t
JOIN tTicketRisk tr ON tr.ticketFk = t.id
SET t.risk = tr.amount;
DROP TEMPORARY TABLE tTicketRisk;
END IF;
END$$
DELIMITER ;

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`worker_updateBalance`(vSelfFk INT(11), vCredit DECIMAL(10,2), vDebit DECIMAL(10,2))
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`worker_updateBalance`(vSelf INT(11), vCredit DECIMAL(10,2), vDebit DECIMAL(10,2))
BEGIN
/**
* Actualiza la columna balance de worker.
@ -8,6 +8,6 @@ BEGIN
*/
UPDATE worker
SET balance = IFNULL(balance, 0) + IFNULL(vCredit, 0) - IFNULL(vDebit, 0)
WHERE id = vSelfFk;
WHERE id = vSelf;
END$$
DELIMITER ;

View File

@ -10,11 +10,5 @@ BEGIN
UPDATE `address` SET isDefaultAddress = TRUE
WHERE id = NEW.defaultAddressFk;
END IF;
IF NOT NEW.isActive THEN
UPDATE account.`user`
SET active = FALSE
WHERE id = NEW.id;
END IF;
END$$
DELIMITER ;

View File

@ -5,14 +5,17 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`country_afterInsert`
BEGIN
UPDATE sage.Naciones
SET countryFk = NEW.id
WHERE Nacion = NEW.country;
WHERE Nacion = NEW.name;
IF ROW_COUNT() = 0 THEN
CALL mail_insert(
'cau@verdnatura.es',
NULL,
'Actualizar tabla sage.Naciones',
CONCAT('Se ha insertado un nuevo país en la tabla vn.conuntry. Para el correcto funcionamiento del sistema \n\t\t\t\tde contabilidad es necesario actualizar la columna sage.Naciones.countryFk con el valor del nuevo país. \n\t\t\t Hay que buscar el nuevo país: ', NEW.country, ' en la tabla sage.Naciones y actualizar el campo sage.Naciones.countryFk con el valor ', NEW.id)
CONCAT('Se ha insertado un nuevo país en la tabla vn.conuntry.
Para el correcto funcionamiento del sistema \n\t\t\t\tde contabilidad es necesario actualizar la columna
sage.Naciones.countryFk con el valor del nuevo país. \n\t\t\t Hay que buscar el nuevo país: ', NEW.name,
' en la tabla sage.Naciones y actualizar el campo sage.Naciones.countryFk con el valor ', NEW.id)
);
END IF;
END$$

View File

@ -3,8 +3,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`country_afterUpdate`
AFTER UPDATE ON `country`
FOR EACH ROW
BEGIN
IF !(OLD.country <=> NEW.country) THEN
UPDATE zoneGeo SET `name` = NEW.country
IF !(OLD.name <=> NEW.name) THEN
UPDATE zoneGeo SET `name` = NEW.name
WHERE id = NEW.geoFk;
END IF;
END$$

View File

@ -3,6 +3,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`country_beforeInsert`
BEFORE INSERT ON `country`
FOR EACH ROW
BEGIN
SET NEW.geoFk = zoneGeo_new('country', NEW.country, NULL);
SET NEW.geoFk = zoneGeo_new('country', NEW.name, NULL);
END$$
DELIMITER ;

View File

@ -1,22 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`exchangeReportSource`
AS SELECT `e`.`dated` AS `dated`,
cast(sum(`e`.`amountIn`) AS decimal(10, 2)) AS `amountIn`,
cast(sum(`e`.`rateIn`) AS decimal(10, 4)) AS `rateIn`,
cast(sum(`e`.`amountOut`) AS decimal(10, 2)) AS `amountOut`,
cast(sum(`e`.`rateOut`) AS decimal(10, 4)) AS `rateOut`,
cast(sum(`e`.`amountEntry`) AS decimal(10, 2)) AS `amountEntry`,
cast(sum(`e`.`rateEntry`) AS decimal(10, 4)) AS `rateEntry`,
cast(
IFNULL(`rr`.`value`, `rrc`.`simulatedValue`) AS decimal(10, 4)
) AS `rateECB`
FROM (
(
`vn`.`exchangeReportSourcePrevious` `e`
LEFT JOIN `vn`.`referenceRate` `rr` ON(`rr`.`dated` = `e`.`dated`)
)
JOIN `vn`.`referenceRateConfig` `rrc` ON(1)
)
GROUP BY `e`.`dated`
ORDER BY `e`.`dated`

View File

@ -1,29 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`exchangeReportSourcePrevious`
AS SELECT `exchangeInsuranceIn`.`dated` AS `dated`,
`exchangeInsuranceIn`.`amount` AS `amountIn`,
`exchangeInsuranceIn`.`rate` AS `rateIn`,
0.00 AS `amountOut`,
0.00 AS `rateOut`,
0.00 AS `amountEntry`,
0.00 AS `rateEntry`
FROM `vn`.`exchangeInsuranceIn`
UNION ALL
SELECT `exchangeInsuranceOut`.`received` AS `received`,
0.00 AS `amountIn`,
0.00 AS `ratedIn`,
`exchangeInsuranceOut`.`divisa` AS `amountOut`,
`exchangeInsuranceOut`.`rate` AS `ratedOut`,
0.00 AS `amountEntry`,
0.00 AS `rateEntry`
FROM `vn`.`exchangeInsuranceOut`
UNION ALL
SELECT `exchangeInsuranceEntry`.`dated` AS `dated`,
0.00 AS `amountIn`,
0.00 AS `ratedIn`,
0.00 AS `amountOut`,
0.00 AS `ratedOut`,
`exchangeInsuranceEntry`.`Dolares` AS `amountEntry`,
`exchangeInsuranceEntry`.`rate` AS `rateEntry`
FROM `vn`.`exchangeInsuranceEntry`

View File

@ -1,9 +1,9 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`expeditionCommon`
AS SELECT `et`.`id` AS `truckFk`,
`et`.`eta` AS `eta`,
IFNULL(ucase(`et`.`description`), 'SIN ESCANEAR') AS `description`,
AS SELECT `rs`.`id` AS `truckFk`,
`rs`.`eta` AS `eta`,
IFNULL(ucase(`rs`.`description`), 'SIN ESCANEAR') AS `description`,
`es`.`palletFk` AS `palletFk`,
`t`.`routeFk` AS `routeFk`,
`es`.`id` AS `scanFk`,
@ -17,8 +17,8 @@ FROM (
(
(
(
`vn`.`expeditionTruck` `et`
LEFT JOIN `vn`.`routesMonitor` `r` ON(`et`.`id` = `r`.`expeditionTruckFk`)
`vn`.`roadmapStop` `rs`
LEFT JOIN `vn`.`routesMonitor` `r` ON(`rs`.`id` = `r`.`expeditionTruckFk`)
)
LEFT JOIN `vn`.`ticket` `t` ON(`r`.`routeFk` = `t`.`routeFk`)
)
@ -28,4 +28,4 @@ FROM (
)
LEFT JOIN `vn`.`expeditionPallet` `ep` ON(`es`.`palletFk` = `ep`.`id`)
)
WHERE `et`.`eta` >= `util`.`VN_CURDATE`()
WHERE `rs`.`eta` >= `util`.`VN_CURDATE`()

View File

@ -1,12 +1,12 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`expeditionPallet_Print`
AS SELECT `et2`.`description` AS `truck`,
AS SELECT `rs2`.`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`,
`rs`.`id` <=> `rm`.`expeditionTruckFk` AS `isMatch`,
`t`.`warehouseFk` AS `warehouseFk`,
IF(
`r`.`created` > `util`.`VN_CURDATE`() + INTERVAL 1 DAY,
@ -20,8 +20,8 @@ FROM (
(
(
(
`vn`.`expeditionTruck` `et`
JOIN `vn`.`expeditionPallet` `ep` ON(`ep`.`truckFk` = `et`.`id`)
`vn`.`roadmapStop` `rs`
JOIN `vn`.`expeditionPallet` `ep` ON(`ep`.`truckFk` = `rs`.`id`)
)
JOIN `vn`.`expeditionScan` `es` ON(`es`.`palletFk` = `ep`.`id`)
)
@ -33,7 +33,7 @@ FROM (
)
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `r`.`id`)
)
LEFT JOIN `vn`.`expeditionTruck` `et2` ON(`et2`.`id` = `rm`.`expeditionTruckFk`)
LEFT JOIN `vn`.`roadmapStop` `rs2` ON(`rs2`.`id` = `rm`.`expeditionTruckFk`)
)
GROUP BY `ep`.`id`,
`t`.`routeFk`

View File

@ -15,7 +15,7 @@ FROM (
`vn`.`route` `r`
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`r`.`id` = `rm`.`routeFk`)
)
LEFT JOIN `vn`.`expeditionTruck` `et` ON(`et`.`id` = `rm`.`expeditionTruckFk`)
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `rm`.`expeditionTruckFk`)
)
JOIN `vn`.`ticket` `t` ON(`t`.`routeFk` = `r`.`id`)
)

View File

@ -1,9 +1,9 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`expeditionScan_Monitor`
AS SELECT `et`.`id` AS `truckFk`,
`et`.`eta` AS `ETD`,
`et`.`description` AS `description`,
AS SELECT `rs`.`id` AS `truckFk`,
`rs`.`eta` AS `ETD`,
`rs`.`description` AS `description`,
`ep`.`id` AS `palletFk`,
`ep`.`position` AS `position`,
`ep`.`built` AS `built`,
@ -12,8 +12,8 @@ AS SELECT `et`.`id` AS `truckFk`,
`es`.`scanned` AS `scanned`
FROM (
(
`vn`.`expeditionTruck` `et`
LEFT JOIN `vn`.`expeditionPallet` `ep` ON(`ep`.`truckFk` = `et`.`id`)
`vn`.`roadmapStop` `rs`
LEFT JOIN `vn`.`expeditionPallet` `ep` ON(`ep`.`truckFk` = `rs`.`id`)
)
LEFT JOIN `vn`.`expeditionScan` `es` ON(`es`.`palletFk` = `ep`.`id`)
)

View File

@ -14,7 +14,7 @@ AS SELECT `e`.`id` AS `expeditionFk`,
IF(
`t`.`routeFk`,
IFNULL(
`et`.`description`,
`rs`.`description`,
REPLACE(`am`.`name`, 'ZONA ', 'Z')
),
`z`.`name`
@ -45,7 +45,7 @@ FROM (
)
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `t`.`routeFk`)
)
LEFT JOIN `vn`.`expeditionTruck` `et` ON(`et`.`id` = `rm`.`expeditionTruckFk`)
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `rm`.`expeditionTruckFk`)
)
LEFT JOIN `vn`.`beach` `b` ON(`b`.`code` = `rm`.`beachFk`)
)

View File

@ -4,7 +4,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
AS SELECT `t`.`id` AS `ticketFk`,
`t`.`warehouseFk` AS `warehouseFk`,
`t`.`routeFk` AS `routeFk`,
`et`.`description` AS `description`
`rs`.`description` AS `description`
FROM (
(
(
@ -13,7 +13,7 @@ FROM (
)
JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `t`.`routeFk`)
)
JOIN `vn`.`expeditionTruck` `et` ON(`et`.`id` = `rm`.`expeditionTruckFk`)
JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `rm`.`expeditionTruckFk`)
)
WHERE `e`.`id` IS NULL
AND `et`.`eta` > `util`.`VN_CURDATE`()
AND `rs`.`eta` > `util`.`VN_CURDATE`()

View File

@ -7,13 +7,13 @@ AS SELECT `e`.`truckFk` AS `id`,
`e`.`palletFk` AS `pallet`,
`e`.`routeFk` AS `route`,
COUNT(DISTINCT `e`.`scanFk`) AS `scans`,
`et`.`description` AS `destinos`,
`rs`.`description` AS `destinos`,
sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,
`e`.`expeditionTruckFk` AS `expeditionTruckFk`,
max(`e`.`lastPacked`) AS `lastPacked`
FROM (
`vn`.`expeditionCommon` `e`
LEFT JOIN `vn`.`expeditionTruck` `et` ON(`et`.`id` = `e`.`expeditionTruckFk`)
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `e`.`expeditionTruckFk`)
)
GROUP BY `e`.`truckFk`,
`e`.`palletFk`,

View File

@ -6,8 +6,8 @@ AS SELECT `t`.`routeFk` AS `routeFk`,
COUNT(`es`.`id`) AS `scanned`,
COUNT(DISTINCT `es`.`palletFk`) AS `pallets`,
max(`es`.`scanned`) AS `lastScanned`,
max(`et`.`description`) AS `description`,
max(`et`.`eta`) AS `eta`
max(`rs`.`description`) AS `description`,
max(`rs`.`eta`) AS `eta`
FROM (
(
(
@ -19,9 +19,9 @@ FROM (
)
LEFT JOIN `vn`.`expeditionPallet` `ep` ON(`ep`.`id` = `es`.`palletFk`)
)
LEFT JOIN `vn`.`expeditionTruck` `et` ON(`et`.`id` = `ep`.`truckFk`)
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `ep`.`truckFk`)
)
WHERE `t`.`shipped` >= `util`.`VN_CURDATE`()
AND `t`.`routeFk` <> 0
GROUP BY `t`.`routeFk`
ORDER BY max(`et`.`eta`)
ORDER BY max(`rs`.`eta`)

View File

@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
VIEW `vn`.`saleVolume_Today_VNH`
AS SELECT `t`.`nickname` AS `Cliente`,
`p`.`name` AS `Provincia`,
`c`.`country` AS `Pais`,
`c`.`name` AS `Pais`,
cast(sum(`sv`.`volume`) AS decimal(5, 1)) AS `volume`
FROM (
(

View File

@ -16,7 +16,6 @@ AS SELECT `tr`.`id` AS `Id_ORDEN`,
`tr`.`ordered` AS `datORDEN`,
`tr`.`shipped` AS `datTICKET`,
`tr`.`salesPersonCode` AS `CodVENDEDOR`,
`tr`.`buyerCode` AS `CodCOMPRADOR`,
`tr`.`clientFk` AS `Id_CLIENTE`,
`tr`.`total` AS `TOTAL`,
`tr`.`buyed` AS `datCOMPRA`

View File

@ -2,7 +2,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`Paises`
AS SELECT `c`.`id` AS `Id`,
`c`.`country` AS `Pais`,
`c`.`name` AS `Pais`,
`c`.`CEE` AS `CEE`,
`c`.`isUeeMember` AS `isUeeMember`,
`c`.`code` AS `Codigo`,

View File

@ -14,6 +14,5 @@ AS SELECT `dn`.`id` AS `albaran_id`,
`dn`.`workerFk` AS `Id_Trabajador`,
`dn`.`supervisorFk` AS `Id_Responsable`,
`dn`.`departmentFk` AS `department_id`,
`dn`.`invoiceInFk` AS `recibida_id`,
`dn`.`farmingFk` AS `farmingFk`
`dn`.`invoiceInFk` AS `recibida_id`
FROM `vn`.`deliveryNote` `dn`

View File

@ -10,9 +10,10 @@ CREATE TABLE IF NOT EXISTS `vn`.`agencyWorkCenter` (
CONSTRAINT `agencyWorkCenter_agency_FK` FOREIGN KEY (`agencyFk`) REFERENCES `agency` (`id`) ON DELETE CASCADE,
CONSTRAINT `agencyWorkCenter_user_FK` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `agencyWorkCenter_workCenter_FK` FOREIGN KEY (`workCenterFk`) REFERENCES `workCenter` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #4988';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
INSERT INTO vn.agencyWorkCenter (agencyFk, workCenterFk)
SELECT id, workCenterFk
FROM vn.agency
WHERE workCenterFk IS NOT NULL;
SELECT a.id, wc.id
FROM vn.agency a
JOIN vn.warehouse w ON w.id = a.warehouseFk
JOIN vn.workCenter wc ON wc.warehouseFk = w.id;

View File

@ -0,0 +1,8 @@
ALTER TABLE vn.ticket DROP COLUMN IF EXISTS problem;
ALTER TABLE vn.sale DROP COLUMN IF EXISTS problem;
ALTER TABLE vn.ticket DROP COLUMN IF EXISTS risk;
ALTER TABLE vn.ticket ADD IF NOT EXISTS problem SET('hasTicketRequest', 'isFreezed', 'hasRisk', 'hasHighRisk', 'isTaxDataChecked', 'isTooLittle')NOT NULL DEFAULT '';
ALTER TABLE vn.sale ADD IF NOT EXISTS problem SET('hasItemShortage', 'hasComponentLack', 'hasItemDelay', 'hasRounding', 'hasItemLost')NOT NULL DEFAULT '';
ALTER TABLE vn.ticket ADD IF NOT EXISTS risk DECIMAL(10,2) DEFAULT NULL NULL COMMENT 'cache calculada con el riesgo del cliente';

View File

@ -0,0 +1,4 @@
-- Place your SQL code here
ALTER TABLE vn.country CHANGE country name varchar(25) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL;
ALTER TABLE vn.country ADD COLUMN country VARCHAR(25) AS (name) VIRTUAL;

View File

@ -0,0 +1,15 @@
-- Place your SQL code here
ALTER TABLE IF EXISTS vn.expeditionTruck RENAME vn.roadmapStop;
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`expeditionTruck`
AS SELECT `rs`.`id` AS `id`,
`rs`.`roadmapFk` AS `roadmapFk`,
`rs`.`warehouseFk` AS `warehouseFk`,
`rs`.`eta` AS `eta`,
`rs`.`description` AS `description`,
`rs`.`bufferFk` AS `bufferFk`,
`rs`.`created` AS `created`,
`rs`.`userFk` AS `userFk`
FROM `vn`.`roadmapStop` `rs`;

View File

@ -0,0 +1 @@
ALTER TABLE vn.deliveryNote CHANGE farmingFk farmingFk__ int(10) unsigned DEFAULT NULL NULL;

View File

@ -0,0 +1,4 @@
ALTER TABLE vn.productionConfig
ADD IF NOT EXISTS defaultSectorFk INT UNSIGNED DEFAULT 37 NOT NULL COMMENT 'Default sector';

View File

@ -0,0 +1,3 @@
ALTER TABLE pbx.sipConfig
CHANGE incomingLimit `call-limit` varchar(10)
CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL;

View File

@ -6,6 +6,7 @@ services:
context: front
environment:
- TZ
- NODE_ENV
ports:
- 80
deploy:

View File

@ -4,7 +4,9 @@ ENV TZ Europe/Madrid
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends nginx \
&& apt-get install -y --no-install-recommends \
nginx \
gettext-base \
&& rm -rf /var/lib/apt/lists/* \
&& ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
@ -14,5 +16,7 @@ COPY nginx.conf sites-available/salix
RUN rm sites-enabled/default && ln -s ../sites-available/salix sites-enabled/salix
COPY dist /salix/dist
COPY env.template.js /salix/dist
COPY nginx-entrypoint.sh /
CMD ["nginx", "-g", "daemon off;"]
ENTRYPOINT [ "sh", "/nginx-entrypoint.sh" ]

3
front/env.template.js Normal file
View File

@ -0,0 +1,3 @@
window.process = {
env: {NODE_ENV: '${NODE_ENV}'}
};

View File

@ -0,0 +1,7 @@
#!/bin/sh
WWW_DIR=/salix/dist
INJECT_FILE_SRC="${WWW_DIR}/env.template.js"
INJECT_FILE_DST="${WWW_DIR}/env.js"
envsubst < "${INJECT_FILE_SRC}" > "${INJECT_FILE_DST}"
[ -z "$@" ] && nginx -g 'daemon off;' || $@

View File

@ -28,7 +28,7 @@
ng-model="$ctrl.data.countryFk"
url="Countries"
fields="['id', 'country', 'code']"
show-field="country"
show-field="name"
value-field="id"
label="Country">
</vn-autocomplete>

View File

@ -5,6 +5,8 @@
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=no"/>
<meta name="mobile-web-app-capable" content="yes"/>
<link rel="manifest" href="<%= require('./manifest.json') %>"/>
<script type="text/javascript" src="/env.js">
</script>
<title vn-title translate></title>
</head>
<body>

View File

@ -139,6 +139,9 @@ function webpack(done) {
webpack.description = `Transpiles application into files`;
function webpackDevServer(done) {
const replace = require('gulp-replace');
const rename = require('gulp-rename');
const webpack = require('webpack');
const merge = require('webpack-merge');
const WebpackDevServer = require('webpack-dev-server');
@ -148,6 +151,12 @@ function webpackDevServer(done) {
let devServer = wpConfig.devServer;
// local env
gulp.src(srcDir + '/env.template.js')
.pipe(replace('${NODE_ENV}', 'development'))
.pipe(rename('env.js'))
.pipe(gulp.dest(buildDir));
for (let entryName in wpConfig.entry) {
let entry = wpConfig.entry[entryName];
if (!Array.isArray(entry))

View File

@ -101,7 +101,7 @@ module.exports = Self => {
clientFk: claim.ticket().clientFk,
shipped: today,
landed: today,
nickname: claim.ticket().address().nickname,
nickname: `Abono del: ${claim.ticketFk}`,
warehouseFk: claim.ticket().warehouseFk,
companyFk: claim.ticket().companyFk,
addressFk: claim.ticket().addressFk,

View File

@ -40,7 +40,8 @@ module.exports = Self => {
http: {
path: '/:id/client-debt-statement-pdf',
verb: 'GET'
}
},
accessScopes: ['DEFAULT', 'read:multimedia']
});
Self.clientDebtStatementPdf = (ctx, id) => Self.printReport(ctx, id, 'client-debt-statement');

View File

@ -3,6 +3,7 @@ const UserError = require('vn-loopback/util/user-error');
module.exports = function(Self) {
Self.remoteMethodCtx('createReceipt', {
description: 'Creates receipt and its compensation if necessary',
accessType: 'READ',
accepts: [{
arg: 'clientFk',
type: 'number',
@ -45,7 +46,8 @@ module.exports = function(Self) {
http: {
verb: 'post',
path: '/:clientFk/createReceipt'
}
},
accessScopes: ['DEFAULT', 'read:multimedia']
});
Self.createReceipt = async(ctx, options) => {

View File

@ -35,7 +35,8 @@ module.exports = Self => {
http: {
path: '/:id/credit-request-pdf',
verb: 'GET'
}
},
accessScopes: ['DEFAULT', 'read:multimedia']
});
Self.creditRequestPdf = (ctx, id) => Self.printReport(ctx, id, 'credit-request');

View File

@ -123,7 +123,7 @@ module.exports = Self => {
c.hasLcr,
c.hasCoreVnl,
ct.id AS countryFk,
ct.country,
ct.name country,
p.id AS provinceFk,
p.name AS province,
u.id AS salesPersonFk,

View File

@ -47,7 +47,8 @@ module.exports = Self => {
http: {
path: '/:id/incoterms-authorization-pdf',
verb: 'GET'
}
},
accessScopes: ['DEFAULT', 'read:multimedia']
});
Self.incotermsAuthorizationPdf = (ctx, id) => Self.printReport(ctx, id, 'incoterms-authorization');

View File

@ -41,7 +41,8 @@ module.exports = Self => {
http: {
path: '/:id/letter-debtor-pdf',
verb: 'GET'
}
},
accessScopes: ['DEFAULT', 'read:multimedia']
});
Self.letterDebtorPdf = (ctx, id) => Self.printReport(ctx, id, 'letter-debtor');

View File

@ -69,7 +69,7 @@ module.exports = Self => {
uw.name workerName,
c.creditInsurance,
d.defaulterSinced,
cn.country,
cn.name country,
c.countryFk,
pm.name payMethod
FROM vn.defaulter d

View File

@ -29,7 +29,8 @@ module.exports = Self => {
http: {
path: '/:id/balance-compensation-pdf',
verb: 'GET'
}
},
accessScopes: ['DEFAULT', 'read:multimedia']
});
Self.balanceCompensationPdf = (ctx, id) => Self.printReport(ctx, id, 'balance-compensation');

View File

@ -34,7 +34,8 @@ module.exports = Self => {
http: {
path: '/:id/receipt-pdf',
verb: 'GET'
}
},
accessScopes: ['DEFAULT', 'read:multimedia']
});
Self.receiptPdf = (ctx, id) => Self.printReport(ctx, id, 'receipt');

View File

@ -61,7 +61,7 @@
rule>
<tpl-item>
{{code}} - {{town.name}} ({{town.province.name}},
{{town.province.country.country}})
{{town.province.country.name}})
</tpl-item>
<append>
<vn-icon-button
@ -83,7 +83,7 @@
value-field="name">
<tpl-item>
{{name}}, {{province.name}}
({{province.country.country}})
({{province.country.name}})
</tpl-item>
</vn-datalist>
<vn-autocomplete vn-id="province" vn-one
@ -94,7 +94,7 @@
show-field="name"
value-field="id"
rule>
<tpl-item>{{name}} ({{country.country}})</tpl-item>
<tpl-item>{{name}} ({{country.name}})</tpl-item>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>

View File

@ -74,7 +74,7 @@
rule>
<tpl-item>
{{code}} - {{town.name}} ({{town.province.name}},
{{town.province.country.country}})
{{town.province.country.name}})
</tpl-item>
<append>
<vn-icon-button
@ -96,7 +96,7 @@
value-field="name">
<tpl-item>
{{name}}, {{province.name}}
({{province.country.country}})
({{province.country.name}})
</tpl-item>
</vn-datalist>
<vn-autocomplete vn-id="province" vn-one
@ -107,7 +107,7 @@
show-field="name"
value-field="id"
rule>
<tpl-item>{{name}} ({{country.country}})</tpl-item>
<tpl-item>{{name}} ({{country.name}})</tpl-item>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>

View File

@ -50,7 +50,7 @@
<span ng-show="::address.postalCode">{{::address.postalCode}} -</span>
<span ng-show="::address.city">{{::address.city}},</span>
<span ng-show="::address.province.name">{{::address.province.name}},</span>
{{::address.province.country.country}}
{{::address.province.country.name}}
</div>
<div class="ellipsize">
{{::address.phone}}<span ng-if="::address.mobile">, </span>

View File

@ -66,7 +66,7 @@
rule>
<tpl-item>
{{code}} - {{town.name}} ({{town.province.name}},
{{town.province.country.country}})
{{town.province.country.name}})
</tpl-item>
<append>
<vn-icon-button
@ -88,7 +88,7 @@
value-field="name">
<tpl-item>
{{name}}, {{province.name}}
({{province.country.country}})
({{province.country.name}})
</tpl-item>
</vn-datalist>
</vn-horizontal>
@ -101,14 +101,14 @@
url="Provinces/location"
fields="['id', 'name', 'countryFk']"
rule>
<tpl-item>{{name}} ({{country.country}})</tpl-item>
<tpl-item>{{name}} ({{country.name}})</tpl-item>
</vn-autocomplete>
<vn-autocomplete
vn-id="country"
label="Country"
ng-model="$ctrl.client.countryFk"
url="Countries"
show-field="country">
show-field="name">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>

View File

@ -16,7 +16,7 @@
auto-load="true"
url="Countries"
data="countries"
order="country">
order="name">
</vn-crud-model>
<vn-crud-model
auto-load="true"
@ -87,7 +87,7 @@
rule>
<tpl-item>
{{code}} - {{town.name}} ({{town.province.name}},
{{town.province.country.country}})
{{town.province.country.name}})
</tpl-item>
<append>
<vn-icon-button
@ -110,7 +110,7 @@
value-field="name">
<tpl-item>
{{name}}, {{province.name}}
({{province.country.country}})
({{province.country.name}})
</tpl-item>
</vn-datalist>
</vn-horizontal>
@ -126,14 +126,14 @@
show-field="name"
value-field="id"
rule>
<tpl-item>{{name}} ({{country.country}})</tpl-item>
<tpl-item>{{name}} ({{country.name}})</tpl-item>
</vn-autocomplete>
<vn-autocomplete
vn-one
vn-id="country"
ng-model="$ctrl.client.countryFk"
data="countries"
show-field="country"
show-field="name"
value-field="id"
label="Country"
rule>

View File

@ -104,7 +104,7 @@
value="{{$ctrl.summary.province.name}}">
</vn-label-value>
<vn-label-value label="Country"
value="{{$ctrl.summary.country.country}}">
value="{{$ctrl.summary.country.name}}">
</vn-label-value>
<vn-label-value label="Street" no-ellipsize
value="{{$ctrl.summary.street}}">

Some files were not shown because too many files have changed in this diff Show More