Merge branch 'dev' into 7247-monacoVies
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
3a7d93759c
|
@ -5,7 +5,14 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [24.18.01] - 2024-05-02
|
## [24.20.01] - 2024-05-14
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- (Worker -> time-control) Corrección de errores
|
||||||
|
- (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
|
||||||
|
|
||||||
|
## [24.18.01] - 2024-05-07
|
||||||
|
|
||||||
## [24.16.01] - 2024-04-18
|
## [24.16.01] - 2024-04-18
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ node {
|
||||||
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
|
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
|
||||||
RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT
|
RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT
|
||||||
RUN_BUILD = PROTECTED_BRANCH && FROM_GIT
|
RUN_BUILD = PROTECTED_BRANCH && FROM_GIT
|
||||||
env.DEBUG = 'strong-remoting:shared-method'
|
// env.DEBUG = 'strong-remoting:shared-method'
|
||||||
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
|
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
|
||||||
echo "NODE_NAME: ${env.NODE_NAME}"
|
echo "NODE_NAME: ${env.NODE_NAME}"
|
||||||
echo "WORKSPACE: ${env.WORKSPACE}"
|
echo "WORKSPACE: ${env.WORKSPACE}"
|
||||||
|
|
|
@ -12,8 +12,8 @@ module.exports = Self => {
|
||||||
http: {
|
http: {
|
||||||
path: `/renewToken`,
|
path: `/renewToken`,
|
||||||
verb: 'POST'
|
verb: 'POST'
|
||||||
}
|
},
|
||||||
});
|
accessScopes: ['DEFAULT', 'read:multimedia']});
|
||||||
|
|
||||||
Self.renewToken = async function(ctx) {
|
Self.renewToken = async function(ctx) {
|
||||||
const {accessToken: token} = ctx.req;
|
const {accessToken: token} = ctx.req;
|
||||||
|
|
|
@ -124,6 +124,9 @@
|
||||||
"Postcode": {
|
"Postcode": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"ReferenceRate": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"SageWithholding": {
|
"SageWithholding": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
@ -177,5 +180,11 @@
|
||||||
},
|
},
|
||||||
"ProductionConfig": {
|
"ProductionConfig": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"AgencyLog": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"AgencyWorkCenter": {
|
||||||
|
"dataSource": "vn"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"name": "AgencyLog",
|
||||||
|
"base": "Log",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "agencyLog"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.rewriteDbError(function(err) {
|
||||||
|
if (err.code === 'ER_DUP_ENTRY')
|
||||||
|
return new UserError(`This workCenter is already assigned to this agency`);
|
||||||
|
return err;
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,41 @@
|
||||||
|
{
|
||||||
|
"name": "AgencyWorkCenter",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "agencyWorkCenter"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"id": true,
|
||||||
|
"type": "number",
|
||||||
|
"forceId": false
|
||||||
|
},
|
||||||
|
"agencyFk": {
|
||||||
|
"type": "number",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
|
"workCenterFk": {
|
||||||
|
"type": "number",
|
||||||
|
"required": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"agency": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "WorkCenter",
|
||||||
|
"foreignKey": "agencyFk"
|
||||||
|
},
|
||||||
|
"workCenter": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "WorkCenter",
|
||||||
|
"foreignKey": "workCenterFk"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scope": {
|
||||||
|
"include":{
|
||||||
|
"relation": "workCenter"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,11 @@
|
||||||
{
|
{
|
||||||
"name": "Collection",
|
"name": "Collection",
|
||||||
"base": "VnModel",
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "collection"
|
||||||
|
}
|
||||||
|
},
|
||||||
"acls": [{
|
"acls": [{
|
||||||
"property": "validations",
|
"property": "validations",
|
||||||
"accessType": "EXECUTE",
|
"accessType": "EXECUTE",
|
||||||
|
@ -9,4 +14,3 @@
|
||||||
"permission": "ALLOW"
|
"permission": "ALLOW"
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"name": "ReferenceRate",
|
||||||
|
"base": "PersistedModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "referenceRate"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"currencyFk": {
|
||||||
|
"type": "number",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"dated": {
|
||||||
|
"type": "date",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"type": "number",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"acls": [
|
||||||
|
{
|
||||||
|
"accessType": "READ",
|
||||||
|
"principalType": "ROLE",
|
||||||
|
"principalId": "$everyone",
|
||||||
|
"permission": "ALLOW"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
# EditorConfig helps developers define and maintain consistent
|
||||||
|
# coding styles between different editors and IDEs
|
||||||
|
# http://editorconfig.org
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 4
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
|
@ -3,7 +3,7 @@ USE `util`;
|
||||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||||
|
|
||||||
INSERT INTO `version` VALUES ('vn-database','10977','7a021c9ac6f804cc120542b65d7461283d516569','2024-04-18 09:13:43','11000');
|
INSERT INTO `version` VALUES ('vn-database','11018','878ee9e3039dd06ad456fa475f0d646d8bae3d4b','2024-05-07 07:34:42','11032');
|
||||||
|
|
||||||
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','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);
|
INSERT INTO `versionLog` VALUES ('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL);
|
||||||
|
@ -688,6 +688,9 @@ INSERT INTO `versionLog` VALUES ('vn-database','10890','00-firstScript.sql','jen
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10891','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:58',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10891','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:58',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10892','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:53',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10892','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:53',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10893','00-sage.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:53',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10893','00-sage.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:53',NULL,NULL);
|
||||||
|
INSERT INTO `versionLog` VALUES ('vn-database','10895','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:53',NULL,NULL);
|
||||||
|
INSERT INTO `versionLog` VALUES ('vn-database','10895','01-secondScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:56',NULL,NULL);
|
||||||
|
INSERT INTO `versionLog` VALUES ('vn-database','10895','02-thirdScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10896','01-financialProductType.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:58',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10896','01-financialProductType.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:58',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10896','02-flight.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:58',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10896','02-flight.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:58',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10896','03-gastos_resumen.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:13:00',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10896','03-gastos_resumen.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:13:00',NULL,NULL);
|
||||||
|
@ -737,11 +740,13 @@ INSERT INTO `versionLog` VALUES ('vn-database','10940','00-firstScript.sql','jen
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10941','00-restoreVn2008Jerarquia.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-07 09:36:57',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10941','00-restoreVn2008Jerarquia.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-07 09:36:57',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10942','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 10:24:45',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10942','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 10:24:45',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10943','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-07 10:29:57',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10943','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-07 10:29:57',NULL,NULL);
|
||||||
|
INSERT INTO `versionLog` VALUES ('vn-database','10944','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10946','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-08 07:56:17',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10946','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-08 07:56:17',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10948','00-addReconciliationConfig.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:52',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10948','00-addReconciliationConfig.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:52',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10948','02-grantPrivileges.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:52',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10948','02-grantPrivileges.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:52',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10948','03-modifyColumn.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:52',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10948','03-modifyColumn.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:52',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10949','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:52',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10949','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:52',NULL,NULL);
|
||||||
|
INSERT INTO `versionLog` VALUES ('vn-database','10950','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10953','00-account.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10953','00-account.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10953','01-bs.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10953','01-bs.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10953','02-edi.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10953','02-edi.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL);
|
||||||
|
@ -768,7 +773,19 @@ INSERT INTO `versionLog` VALUES ('vn-database','10975','00-action.sql','jenkins@
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10975','01-expeditionFk.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-03 12:04:52',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10975','01-expeditionFk.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-03 12:04:52',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10976','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:57',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10976','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:57',NULL,NULL);
|
||||||
INSERT INTO `versionLog` VALUES ('vn-database','10977','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:57',NULL,NULL);
|
INSERT INTO `versionLog` VALUES ('vn-database','10977','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:57',NULL,NULL);
|
||||||
|
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','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','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','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','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','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);
|
||||||
|
|
||||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||||
|
@ -1311,7 +1328,6 @@ INSERT INTO `ACL` VALUES (211,'TravelLog','*','READ','ALLOW','ROLE','buyer');
|
||||||
INSERT INTO `ACL` VALUES (212,'Thermograph','*','*','ALLOW','ROLE','buyer');
|
INSERT INTO `ACL` VALUES (212,'Thermograph','*','*','ALLOW','ROLE','buyer');
|
||||||
INSERT INTO `ACL` VALUES (213,'TravelThermograph','*','WRITE','ALLOW','ROLE','buyer');
|
INSERT INTO `ACL` VALUES (213,'TravelThermograph','*','WRITE','ALLOW','ROLE','buyer');
|
||||||
INSERT INTO `ACL` VALUES (214,'Entry','*','*','ALLOW','ROLE','buyer');
|
INSERT INTO `ACL` VALUES (214,'Entry','*','*','ALLOW','ROLE','buyer');
|
||||||
INSERT INTO `ACL` VALUES (215,'TicketWeekly','*','WRITE','ALLOW','ROLE','buyer');
|
|
||||||
INSERT INTO `ACL` VALUES (216,'TravelThermograph','*','READ','ALLOW','ROLE','employee');
|
INSERT INTO `ACL` VALUES (216,'TravelThermograph','*','READ','ALLOW','ROLE','employee');
|
||||||
INSERT INTO `ACL` VALUES (218,'Intrastat','*','*','ALLOW','ROLE','buyer');
|
INSERT INTO `ACL` VALUES (218,'Intrastat','*','*','ALLOW','ROLE','buyer');
|
||||||
INSERT INTO `ACL` VALUES (221,'UserConfig','getUserConfig','READ','ALLOW','ROLE','account');
|
INSERT INTO `ACL` VALUES (221,'UserConfig','getUserConfig','READ','ALLOW','ROLE','account');
|
||||||
|
@ -1667,9 +1683,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 (611,'State','find','READ','ALLOW','ROLE','employee');
|
||||||
INSERT INTO `ACL` VALUES (612,'State','findById','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 (613,'State','findOne','READ','ALLOW','ROLE','employee');
|
||||||
INSERT INTO `ACL` VALUES (614,'Worker','find','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','employee');
|
INSERT INTO `ACL` VALUES (615,'Worker','findById','READ','ALLOW','ROLE','hr');
|
||||||
INSERT INTO `ACL` VALUES (616,'Worker','findOne','READ','ALLOW','ROLE','employee');
|
INSERT INTO `ACL` VALUES (616,'Worker','findOne','READ','ALLOW','ROLE','hr');
|
||||||
INSERT INTO `ACL` VALUES (617,'Worker','filter','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 (618,'Worker','getWorkedHours','READ','ALLOW','ROLE','employee');
|
||||||
INSERT INTO `ACL` VALUES (619,'Worker','active','READ','ALLOW','ROLE','employee');
|
INSERT INTO `ACL` VALUES (619,'Worker','active','READ','ALLOW','ROLE','employee');
|
||||||
|
@ -1842,6 +1858,10 @@ INSERT INTO `ACL` VALUES (822,'SupplierDms','*','*','ALLOW','ROLE','employee');
|
||||||
INSERT INTO `ACL` VALUES (823,'MailAlias','*','*','ALLOW','ROLE','developerBoss');
|
INSERT INTO `ACL` VALUES (823,'MailAlias','*','*','ALLOW','ROLE','developerBoss');
|
||||||
INSERT INTO `ACL` VALUES (824,'ItemShelving','hasItemOlder','READ','ALLOW','ROLE','production');
|
INSERT INTO `ACL` VALUES (824,'ItemShelving','hasItemOlder','READ','ALLOW','ROLE','production');
|
||||||
INSERT INTO `ACL` VALUES (825,'Application','getEnumValues','*','ALLOW','ROLE','employee');
|
INSERT INTO `ACL` VALUES (825,'Application','getEnumValues','*','ALLOW','ROLE','employee');
|
||||||
|
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 `fieldAcl` VALUES (1,'Client','name','update','employee');
|
INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee');
|
||||||
INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee');
|
INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee');
|
||||||
|
@ -2160,7 +2180,7 @@ INSERT INTO `continent` VALUES (3,'África','AF');
|
||||||
INSERT INTO `continent` VALUES (4,'Europa','EU');
|
INSERT INTO `continent` VALUES (4,'Europa','EU');
|
||||||
INSERT INTO `continent` VALUES (5,'Oceanía','OC');
|
INSERT INTO `continent` VALUES (5,'Oceanía','OC');
|
||||||
|
|
||||||
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 (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 (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 (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 (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);
|
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);
|
||||||
|
@ -2171,50 +2191,54 @@ 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 (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 (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 (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,69,NULL,0,0,0,1,15,1,'/1/',NULL,1,'',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',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 (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',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 (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',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 (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',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 (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',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 (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',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 (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 (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 (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',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 (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 (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 (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 (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',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 (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',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 (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 (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 (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',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 (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',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 (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 (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 (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',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 (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 (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',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 (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',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 (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',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 (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 (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 (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 (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 (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,'zambranoTeam','EQUIPO C ZAMBRANO',49,50,4667,0,0,0,2,0,43,'/1/43/','czg_equipo',0,'equipoczambrano@verdnatura.es',0,0,0,0,NULL,NULL,'5000',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 (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 (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 (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 (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',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 (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 (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 (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 (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 (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 (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',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 (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 (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 (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 (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 (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',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 (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',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 (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',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 (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 (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 (140,'hollandTeam','EQUIPO HOLANDA',67,68,NULL,0,0,0,2,0,43,'/1/43/','nl_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,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 (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 (1,'deliveryNote','Albaranes cliente','find','find','N__ALBAR_N',NULL);
|
||||||
INSERT INTO `docuware` VALUES (2,'deliveryNote','Albaranes cliente','store','Archivar','N__ALBAR_N',NULL);
|
INSERT INTO `docuware` VALUES (2,'deliveryNote','Albaranes cliente','store','Archivar','N__ALBAR_N',NULL);
|
||||||
|
|
|
@ -92,7 +92,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','tagL10n','root@pc-jua
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','guest','config','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','','Select');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','guest','config','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','','Select');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','originL10n','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','originL10n','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','origin','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','origin','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','entryEditor','entry','guillermo@10.5.1.4','0000-00-00 00:00:00','Insert,Update','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','entryEditor','entry','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert','Update');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','guest','social','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','guest','social','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','guest','image','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','guest','image','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','guest','tblContadores','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','','Select');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','guest','tblContadores','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','','Select');
|
||||||
|
@ -1248,7 +1248,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','Recib
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','Rutas','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Update,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','Rutas','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Update,Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','Movimientos','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Update','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','Movimientos','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Update','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','state','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','state','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','route','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','route','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','routeComplement','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','routeComplement','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','deliveryMethod','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','deliveryMethod','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','Tickets','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Update','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','Tickets','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Update','');
|
||||||
|
@ -1388,6 +1388,13 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','supplierFreight','jen
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','payrollWorker','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','payrollWorker','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','payrollWorkCenter','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','payrollWorkCenter','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','payrollComponent','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Update','');
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','payrollComponent','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Update','');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','professionalCategory','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','ticketObservation','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert','');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','deliveryNoteState','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','deliveryNote','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||||
|
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','');
|
||||||
/*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */;
|
||||||
|
|
||||||
/*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */;
|
||||||
|
@ -1623,6 +1630,36 @@ INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','ticket','cmrFk','
|
||||||
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','ticket','editorFk','0000-00-00 00:00:00','Update');
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','ticket','editorFk','0000-00-00 00:00:00','Update');
|
||||||
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','config','truckLength','0000-00-00 00:00:00','Select');
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','config','truckLength','0000-00-00 00:00:00','Select');
|
||||||
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','production','item','isBoxPickingMode','0000-00-00 00:00:00','Update');
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','production','item','isBoxPickingMode','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','id','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','supplierFk','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','dated','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','invoiceNumber','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','isExcludedFromAvailable','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','isConfirmed','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','isOrdered','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','isRaid','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','commission','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','created','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','evaNotes','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','travelFk','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','currencyFk','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','companyFk','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','gestDocFk','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','invoiceInFk','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','loadPriority','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','kop','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','sub','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','pro','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','auction','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','invoiceAmount','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','buyerFk','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','typeFk','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','reference','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','observationEditorFk','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','clonedFrom','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','editorFk','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','lockerUserFk','0000-00-00 00:00:00','Update');
|
||||||
|
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','locked','0000-00-00 00:00:00','Update');
|
||||||
/*!40000 ALTER TABLE `columns_priv` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `columns_priv` ENABLE KEYS */;
|
||||||
|
|
||||||
/*!40000 ALTER TABLE `procs_priv` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `procs_priv` DISABLE KEYS */;
|
||||||
|
@ -1741,9 +1778,8 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','hasanynegativ
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','marketingBoss','hasanynegativebase','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','marketingBoss','hasanynegativebase','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','hassomenegativebase','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','hassomenegativebase','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','util','administrative','accountshorttostandard','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','util','administrative','accountshorttostandard','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','logistic','raidupdate','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','grafana','lastdayofweek','FUNCTION','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','grafana','lastdayofweek','FUNCTION','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','artificialBoss','raidupdate','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','creditInsurance_GetRisk','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','marketingBoss','invoicefromclient','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','marketingBoss','invoicefromclient','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','invoicefromclient','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','invoicefromclient','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','invoicefromticket','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','invoicefromticket','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||||
|
@ -1843,7 +1879,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','packinglistswitch',
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','previoussticker_get','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','previoussticker_get','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','productioncontrol','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','productioncontrol','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','productionsectorlist','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','productionsectorlist','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financialBoss','riskallclients','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','routemonitor_calculate','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','routemonitor_calculate','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','account','developer','user_haspriv','FUNCTION','jgallego@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','account','developer','user_haspriv','FUNCTION','jgallego@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','salegroup_add','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','salegroup_add','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
|
||||||
|
@ -2022,6 +2057,8 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','entry_getTransfer','PR
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','intrastat_estimateNet','FUNCTION','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','intrastat_estimateNet','FUNCTION','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||||
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','artificialBoss','confection_controlSource','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','artificialBoss','confection_controlSource','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
|
||||||
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 ('','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');
|
||||||
/*!40000 ALTER TABLE `procs_priv` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `procs_priv` ENABLE KEYS */;
|
||||||
|
|
||||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||||
|
@ -2056,7 +2093,7 @@ INSERT IGNORE INTO `global_priv` VALUES ('','deliveryBoss','{\"access\":0,\"ver
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','developer','{\"access\": 5909905728, \"is_role\": true, \"version_id\": 101106}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','developer','{\"access\": 5909905728, \"is_role\": true, \"version_id\": 101106}');
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','developerBoss','{\"access\":33554432,\"version_id\":101106,\"is_role\":true}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','developerBoss','{\"access\":33554432,\"version_id\":101106,\"is_role\":true}');
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','employee','{\"access\": 0, \"is_role\": true, \"version_id\": 101106}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','employee','{\"access\": 0, \"is_role\": true, \"version_id\": 101106}');
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','entryEditor','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','entryEditor','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','ext','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','ext','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}');
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','financial','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','financial','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}');
|
||||||
INSERT IGNORE INTO `global_priv` VALUES ('','financialBoss','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}');
|
INSERT IGNORE INTO `global_priv` VALUES ('','financialBoss','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}');
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -999,14 +999,6 @@ DELIMITER ;;
|
||||||
AFTER UPDATE ON `order`
|
AFTER UPDATE ON `order`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
CALL stock.log_add('order', NEW.id, OLD.id);
|
|
||||||
|
|
||||||
IF !(OLD.address_id <=> NEW.address_id)
|
|
||||||
OR !(OLD.company_id <=> NEW.company_id)
|
|
||||||
OR !(OLD.customer_id <=> NEW.customer_id) THEN
|
|
||||||
CALL order_requestRecalc(NEW.id);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF !(OLD.address_id <=> NEW.address_id) AND NEW.address_id = 2850 THEN
|
IF !(OLD.address_id <=> NEW.address_id) AND NEW.address_id = 2850 THEN
|
||||||
-- Fallo que se actualiza no se sabe como tickets en este cliente
|
-- Fallo que se actualiza no se sabe como tickets en este cliente
|
||||||
CALL vn.mail_insert(
|
CALL vn.mail_insert(
|
||||||
|
@ -1071,70 +1063,6 @@ DELIMITER ;
|
||||||
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
||||||
/*!50003 SET character_set_results = @saved_cs_results */ ;
|
/*!50003 SET character_set_results = @saved_cs_results */ ;
|
||||||
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
/*!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 `hedera`.`orderRow_afterInsert`
|
|
||||||
AFTER INSERT ON `orderRow`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
CALL stock.log_add('orderRow', NEW.id, NULL);
|
|
||||||
CALL order_requestRecalc(NEW.orderFk);
|
|
||||||
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 `hedera`.`orderRow_afterUpdate`
|
|
||||||
AFTER UPDATE ON `orderRow`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
CALL stock.log_add('orderRow', NEW.id, OLD.id);
|
|
||||||
CALL order_requestRecalc(OLD.orderFk);
|
|
||||||
CALL order_requestRecalc(NEW.orderFk);
|
|
||||||
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 `hedera`.`orderRow_afterDelete`
|
|
||||||
AFTER DELETE ON `orderRow`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
CALL stock.log_add('orderRow', NULL, OLD.id);
|
|
||||||
CALL order_requestRecalc(OLD.orderFk);
|
|
||||||
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 */ ;
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Current Database: `pbx`
|
-- Current Database: `pbx`
|
||||||
|
@ -1398,12 +1326,6 @@ DELIMITER ;
|
||||||
|
|
||||||
USE `psico`;
|
USE `psico`;
|
||||||
|
|
||||||
--
|
|
||||||
-- Current Database: `rfid`
|
|
||||||
--
|
|
||||||
|
|
||||||
USE `rfid`;
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Current Database: `sage`
|
-- Current Database: `sage`
|
||||||
--
|
--
|
||||||
|
@ -1745,15 +1667,15 @@ DELIMITER ;;
|
||||||
BEFORE INSERT ON `accountReconciliation`
|
BEFORE INSERT ON `accountReconciliation`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
|
|
||||||
SET NEW.calculatedCode = REPLACE(
|
SET NEW.calculatedCode = REGEXP_REPLACE(
|
||||||
REPLACE(
|
CONCAT(NEW.supplierAccountFk,
|
||||||
REPLACE(
|
NEW.operationDated,
|
||||||
REPLACE(
|
NEW.amount,
|
||||||
CONCAT(NEW.supplierAccountFk,NEW.operationDated,NEW.amount,NEW.concept,NEW.debitCredit)
|
NEW.concept,
|
||||||
,' ','')
|
CAST(NEW.debitCredit AS UNSIGNED)
|
||||||
,":",'')
|
),
|
||||||
,'-','')
|
'[ :\\-.]', ''
|
||||||
,'.','') */;;
|
) */;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||||
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
||||||
|
@ -1881,18 +1803,14 @@ BEGIN
|
||||||
WHERE id = NEW.clientFk;
|
WHERE id = NEW.clientFk;
|
||||||
END IF;
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF NEW.isDefaultAddress AND NEW.isActive = FALSE THEN
|
IF NEW.isDefaultAddress AND NEW.isActive = FALSE THEN
|
||||||
CALL util.throw ('Cannot desactivate the default address');
|
CALL util.throw ('Cannot desactivate the default address');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF NOT (NEW.isEqualizated <=> OLD.isEqualizated) THEN
|
IF (NEW.clientFk <> OLD.clientFk
|
||||||
INSERT IGNORE INTO ticketRecalc (ticketFk)
|
OR NEW.isActive <> OLD.isActive
|
||||||
SELECT id FROM ticket t
|
OR NOT (NEW.provinceFk <=> OLD.provinceFk))
|
||||||
WHERE t.addressFk = NEW.id
|
|
||||||
AND t.refFk IS NULL;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF (NEW.clientFk <> OLD.clientFk OR NEW.isActive <> OLD.isActive OR NOT (NEW.provinceFk <=> OLD.provinceFk))
|
|
||||||
AND (SELECT client_hasDifferentCountries(NEW.clientFk)) THEN
|
AND (SELECT client_hasDifferentCountries(NEW.clientFk)) THEN
|
||||||
UPDATE client
|
UPDATE client
|
||||||
SET hasToInvoiceByAddress = TRUE
|
SET hasToInvoiceByAddress = TRUE
|
||||||
|
@ -2292,7 +2210,7 @@ trig: BEGIN
|
||||||
DECLARE vWarehouse INT;
|
DECLARE vWarehouse INT;
|
||||||
DECLARE vLanding DATE;
|
DECLARE vLanding DATE;
|
||||||
DECLARE vGrouping INT;
|
DECLARE vGrouping INT;
|
||||||
DECLARE vGroupingMode TINYINT;
|
DECLARE vGroupingMode VARCHAR(255);
|
||||||
DECLARE vGenericFk INT;
|
DECLARE vGenericFk INT;
|
||||||
DECLARE vGenericInDate BOOL;
|
DECLARE vGenericInDate BOOL;
|
||||||
DECLARE vBuyerFk INT;
|
DECLARE vBuyerFk INT;
|
||||||
|
@ -2398,8 +2316,6 @@ trig: BEGIN
|
||||||
LEAVE trig;
|
LEAVE trig;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
CALL stock.log_add('buy', NEW.id, NULL);
|
|
||||||
|
|
||||||
CALL buy_afterUpsert(NEW.id);
|
CALL buy_afterUpsert(NEW.id);
|
||||||
END */;;
|
END */;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
@ -2508,11 +2424,11 @@ DELIMITER ;
|
||||||
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
||||||
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
||||||
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
||||||
/*!50003 SET character_set_client = utf8mb3 */ ;
|
/*!50003 SET character_set_client = utf8mb4 */ ;
|
||||||
/*!50003 SET character_set_results = utf8mb3 */ ;
|
/*!50003 SET character_set_results = utf8mb4 */ ;
|
||||||
/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
|
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
|
||||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||||
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
|
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
||||||
DELIMITER ;;
|
DELIMITER ;;
|
||||||
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_afterUpdate`
|
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_afterUpdate`
|
||||||
AFTER UPDATE ON `buy`
|
AFTER UPDATE ON `buy`
|
||||||
|
@ -2527,14 +2443,6 @@ trig: BEGIN
|
||||||
LEAVE trig;
|
LEAVE trig;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF !(NEW.id <=> OLD.id)
|
|
||||||
OR !(NEW.entryFk <=> OLD.entryFk)
|
|
||||||
OR !(NEW.itemFk <=> OLD.itemFk)
|
|
||||||
OR !(NEW.quantity <=> OLD.quantity)
|
|
||||||
OR !(NEW.created <=> OLD.created) THEN
|
|
||||||
CALL stock.log_add('buy', NEW.id, OLD.id);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL buy_afterUpsert(NEW.id);
|
CALL buy_afterUpsert(NEW.id);
|
||||||
|
|
||||||
SELECT w.isBuyerToBeEmailed, t.landed
|
SELECT w.isBuyerToBeEmailed, t.landed
|
||||||
|
@ -2610,20 +2518,15 @@ DELIMITER ;;
|
||||||
AFTER DELETE ON `buy`
|
AFTER DELETE ON `buy`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
trig: BEGIN
|
trig: BEGIN
|
||||||
DECLARE vValues VARCHAR(255);
|
|
||||||
|
|
||||||
IF @isModeInventory OR @isTriggerDisabled THEN
|
IF @isModeInventory OR @isTriggerDisabled THEN
|
||||||
LEAVE trig;
|
LEAVE trig;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
CALL stock.log_add('buy', NULL, OLD.id);
|
|
||||||
|
|
||||||
INSERT INTO entryLog
|
INSERT INTO entryLog
|
||||||
SET `action` = 'delete',
|
SET `action` = 'delete',
|
||||||
`changedModel` = 'Buy',
|
`changedModel` = 'Buy',
|
||||||
`changedModelId` = OLD.id,
|
`changedModelId` = OLD.id,
|
||||||
`userFk` = account.myUser_getId();
|
`userFk` = account.myUser_getId();
|
||||||
|
|
||||||
END */;;
|
END */;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||||
|
@ -3302,20 +3205,13 @@ DELIMITER ;;
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
IF !(NEW.defaultAddressFk <=> OLD.defaultAddressFk) THEN
|
IF !(NEW.defaultAddressFk <=> OLD.defaultAddressFk) THEN
|
||||||
UPDATE `address` SET isDefaultAddress = 0
|
UPDATE `address` SET isDefaultAddress = FALSE
|
||||||
WHERE clientFk = NEW.id;
|
WHERE clientFk = NEW.id;
|
||||||
|
|
||||||
UPDATE `address` SET isDefaultAddress = 1
|
UPDATE `address` SET isDefaultAddress = TRUE
|
||||||
WHERE id = NEW.defaultAddressFk;
|
WHERE id = NEW.defaultAddressFk;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF NOT (NEW.provinceFk <=> OLD.provinceFk) OR NOT (NEW.isVies <=> OLD.isVies) THEN
|
|
||||||
INSERT IGNORE INTO ticketRecalc (ticketFk)
|
|
||||||
SELECT id FROM ticket t
|
|
||||||
WHERE t.clientFk = NEW.id
|
|
||||||
AND t.refFk IS NULL;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF NOT NEW.isActive THEN
|
IF NOT NEW.isActive THEN
|
||||||
UPDATE account.`user`
|
UPDATE account.`user`
|
||||||
SET active = FALSE
|
SET active = FALSE
|
||||||
|
@ -4674,26 +4570,6 @@ DELIMITER ;
|
||||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||||
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
||||||
DELIMITER ;;
|
DELIMITER ;;
|
||||||
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`entry_afterInsert`
|
|
||||||
AFTER INSERT ON `entry`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
CALL travel_requestRecalc(NEW.travelFk);
|
|
||||||
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`.`entry_beforeUpdate`
|
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`entry_beforeUpdate`
|
||||||
BEFORE UPDATE ON `entry`
|
BEFORE UPDATE ON `entry`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
|
@ -4769,18 +4645,6 @@ DELIMITER ;;
|
||||||
AFTER UPDATE ON `entry`
|
AFTER UPDATE ON `entry`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
IF NOT(NEW.id <=> OLD.id)
|
|
||||||
OR NOT(NEW.travelFk <=> OLD.travelFk)
|
|
||||||
OR NOT(NEW.isRaid <=> OLD.isRaid) THEN
|
|
||||||
CALL stock.log_add('entry', NEW.id, OLD.id);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF NOT (NEW.travelFk <=> OLD.travelFk) THEN
|
|
||||||
CALL travel_requestRecalc(OLD.travelFk);
|
|
||||||
CALL travel_requestRecalc(NEW.travelFk);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
|
|
||||||
IF NOT (NEW.travelFk <=> OLD.travelFk) THEN
|
IF NOT (NEW.travelFk <=> OLD.travelFk) THEN
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck
|
CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck
|
||||||
SELECT b.id
|
SELECT b.id
|
||||||
|
@ -4834,8 +4698,6 @@ BEGIN
|
||||||
`changedModel` = 'Entry',
|
`changedModel` = 'Entry',
|
||||||
`changedModelId` = OLD.id,
|
`changedModelId` = OLD.id,
|
||||||
`userFk` = account.myUser_getId();
|
`userFk` = account.myUser_getId();
|
||||||
|
|
||||||
CALL travel_requestRecalc(OLD.travelFk);
|
|
||||||
END */;;
|
END */;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||||
|
@ -5433,6 +5295,10 @@ DELIMITER ;;
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE vWithholdingSageFk INT;
|
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
|
IF NOT (NEW.supplierRef <=> OLD.supplierRef) AND NOT util.checkPrintableChars(NEW.supplierRef) THEN
|
||||||
CALL util.throw('The invoiceIn reference contains invalid characters');
|
CALL util.throw('The invoiceIn reference contains invalid characters');
|
||||||
END IF;
|
END IF;
|
||||||
|
@ -5475,7 +5341,6 @@ DELIMITER ;;
|
||||||
AFTER UPDATE ON `invoiceIn`
|
AFTER UPDATE ON `invoiceIn`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
IF NEW.issued != OLD.issued
|
IF NEW.issued != OLD.issued
|
||||||
OR NEW.currencyFk != OLD.currencyFk THEN
|
OR NEW.currencyFk != OLD.currencyFk THEN
|
||||||
|
|
||||||
|
@ -5510,6 +5375,26 @@ DELIMITER ;
|
||||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||||
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
||||||
DELIMITER ;;
|
DELIMITER ;;
|
||||||
|
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_beforeDelete`
|
||||||
|
BEFORE DELETE ON `invoiceIn`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
CALL invoiceIn_checkBooked(OLD.id);
|
||||||
|
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`.`invoiceIn_afterDelete`
|
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_afterDelete`
|
||||||
AFTER DELETE ON `invoiceIn`
|
AFTER DELETE ON `invoiceIn`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
|
@ -5534,12 +5419,74 @@ DELIMITER ;
|
||||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||||
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
||||||
DELIMITER ;;
|
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`
|
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceInDueDay_beforeInsert`
|
||||||
BEFORE INSERT ON `invoiceInDueDay`
|
BEFORE INSERT ON `invoiceInDueDay`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE vIsNotified BOOLEAN;
|
DECLARE vIsNotified BOOLEAN;
|
||||||
|
|
||||||
|
CALL invoiceIn_checkBooked(NEW.invoiceInFk);
|
||||||
|
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
|
||||||
SELECT isNotified INTO vIsNotified
|
SELECT isNotified INTO vIsNotified
|
||||||
|
@ -5582,6 +5529,7 @@ DELIMITER ;;
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE vIsNotified BOOLEAN;
|
DECLARE vIsNotified BOOLEAN;
|
||||||
|
|
||||||
|
CALL invoiceIn_checkBooked(OLD.invoiceInFk);
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
|
||||||
SELECT isNotified INTO vIsNotified
|
SELECT isNotified INTO vIsNotified
|
||||||
|
@ -5618,6 +5566,26 @@ DELIMITER ;
|
||||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||||
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
||||||
DELIMITER ;;
|
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`
|
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceInDueDay_afterDelete`
|
||||||
AFTER DELETE ON `invoiceInDueDay`
|
AFTER DELETE ON `invoiceInDueDay`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
|
@ -5642,6 +5610,66 @@ DELIMITER ;
|
||||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||||
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
||||||
DELIMITER ;;
|
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`
|
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceInTax_beforeInsert`
|
||||||
BEFORE INSERT ON `invoiceInTax`
|
BEFORE INSERT ON `invoiceInTax`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
|
@ -5667,6 +5695,8 @@ DELIMITER ;;
|
||||||
BEFORE UPDATE ON `invoiceInTax`
|
BEFORE UPDATE ON `invoiceInTax`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
CALL invoiceIn_checkBooked(OLD.invoiceInFk);
|
||||||
|
|
||||||
IF NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) THEN
|
IF NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) THEN
|
||||||
CALL invoiceInTax_afterUpsert(NEW.invoiceInFk);
|
CALL invoiceInTax_afterUpsert(NEW.invoiceInFk);
|
||||||
END IF;
|
END IF;
|
||||||
|
@ -5687,6 +5717,26 @@ DELIMITER ;
|
||||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||||
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
||||||
DELIMITER ;;
|
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`
|
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceInTax_afterDelete`
|
||||||
AFTER DELETE ON `invoiceInTax`
|
AFTER DELETE ON `invoiceInTax`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
|
@ -7827,11 +7877,7 @@ BEGIN
|
||||||
CALL util.throw('Cannot insert a service item into a ticket');
|
CALL util.throw('Cannot insert a service item into a ticket');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
CALL stock.log_add('sale', NEW.id, NULL);
|
|
||||||
CALL ticket_requestRecalc(NEW.ticketFk);
|
|
||||||
|
|
||||||
IF NEW.quantity > 0 THEN
|
IF NEW.quantity > 0 THEN
|
||||||
|
|
||||||
UPDATE vn.collection c
|
UPDATE vn.collection c
|
||||||
JOIN vn.ticketCollection tc ON tc.collectionFk = c.id
|
JOIN vn.ticketCollection tc ON tc.collectionFk = c.id
|
||||||
AND tc.ticketFk = NEW.ticketFk
|
AND tc.ticketFk = NEW.ticketFk
|
||||||
|
@ -7907,24 +7953,6 @@ BEGIN
|
||||||
DECLARE vIsToSendMail BOOL;
|
DECLARE vIsToSendMail BOOL;
|
||||||
DECLARE vUserRole VARCHAR(255);
|
DECLARE vUserRole VARCHAR(255);
|
||||||
|
|
||||||
IF !(NEW.id <=> OLD.id)
|
|
||||||
OR !(NEW.ticketFk <=> OLD.ticketFk)
|
|
||||||
OR !(NEW.itemFk <=> OLD.itemFk)
|
|
||||||
OR !(NEW.quantity <=> OLD.quantity)
|
|
||||||
OR !(NEW.created <=> OLD.created)
|
|
||||||
OR !(NEW.isPicked <=> OLD.isPicked) THEN
|
|
||||||
CALL stock.log_add('sale', NEW.id, OLD.id);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF !(NEW.price <=> OLD.price)
|
|
||||||
OR !(NEW.ticketFk <=> OLD.ticketFk)
|
|
||||||
OR !(NEW.itemFk <=> OLD.itemFk)
|
|
||||||
OR !(NEW.quantity <=> OLD.quantity)
|
|
||||||
OR !(NEW.discount <=> OLD.discount) THEN
|
|
||||||
CALL ticket_requestRecalc(NEW.ticketFk);
|
|
||||||
CALL ticket_requestRecalc(OLD.ticketFk);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF !(OLD.ticketFk <=> NEW.ticketFk) THEN
|
IF !(OLD.ticketFk <=> NEW.ticketFk) THEN
|
||||||
UPDATE ticketRequest SET ticketFk = NEW.ticketFk
|
UPDATE ticketRequest SET ticketFk = NEW.ticketFk
|
||||||
WHERE saleFk = NEW.id;
|
WHERE saleFk = NEW.id;
|
||||||
|
@ -8046,9 +8074,6 @@ BEGIN
|
||||||
`changedModelId` = OLD.id,
|
`changedModelId` = OLD.id,
|
||||||
`userFk` = account.myUser_getId();
|
`userFk` = account.myUser_getId();
|
||||||
|
|
||||||
CALL stock.log_add('sale', NULL, OLD.id);
|
|
||||||
CALL ticket_requestRecalc(OLD.ticketFk);
|
|
||||||
|
|
||||||
SELECT account.myUser_getName() INTO vUserRole;
|
SELECT account.myUser_getName() INTO vUserRole;
|
||||||
SELECT account.user_getMysqlRole(vUserRole) INTO vUserRole;
|
SELECT account.user_getMysqlRole(vUserRole) INTO vUserRole;
|
||||||
|
|
||||||
|
@ -9077,25 +9102,11 @@ DELIMITER ;;
|
||||||
AFTER UPDATE ON `ticket`
|
AFTER UPDATE ON `ticket`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
IF !(NEW.id <=> OLD.id)
|
|
||||||
OR !(NEW.warehouseFk <=> OLD.warehouseFk)
|
|
||||||
OR !(NEW.shipped <=> OLD.shipped) THEN
|
|
||||||
CALL stock.log_add('ticket', NEW.id, OLD.id);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF !(NEW.clientFk <=> OLD.clientFk)
|
|
||||||
OR !(NEW.addressFk <=> OLD.addressFk)
|
|
||||||
OR !(NEW.companyFk <=> OLD.companyFk) THEN
|
|
||||||
CALL ticket_requestRecalc(NEW.id);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF NEW.routeFk <> OLD.routeFk THEN
|
IF NEW.routeFk <> OLD.routeFk THEN
|
||||||
UPDATE expedition
|
UPDATE expedition
|
||||||
SET hasNewRoute = TRUE
|
SET hasNewRoute = TRUE
|
||||||
WHERE ticketFk = NEW.id;
|
WHERE ticketFk = NEW.id;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
END */;;
|
END */;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||||
|
@ -9366,8 +9377,6 @@ DELIMITER ;;
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
SET NEW.workerFk = account.myUser_getId();
|
|
||||||
|
|
||||||
END */;;
|
END */;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||||
|
@ -9623,28 +9632,6 @@ DELIMITER ;
|
||||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||||
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
||||||
DELIMITER ;;
|
DELIMITER ;;
|
||||||
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_afterInsert`
|
|
||||||
AFTER INSERT ON `ticketService`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
|
|
||||||
CALL ticket_requestRecalc(NEW.ticketFk);
|
|
||||||
|
|
||||||
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`.`ticketService_beforeUpdate`
|
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_beforeUpdate`
|
||||||
BEFORE UPDATE ON `ticketService`
|
BEFORE UPDATE ON `ticketService`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
|
@ -9665,31 +9652,6 @@ DELIMITER ;
|
||||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||||
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
||||||
DELIMITER ;;
|
DELIMITER ;;
|
||||||
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_afterUpdate`
|
|
||||||
AFTER UPDATE ON `ticketService`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
IF !(NEW.price <=> OLD.price)
|
|
||||||
OR !(NEW.ticketFk <=> OLD.ticketFk)
|
|
||||||
OR !(NEW.quantity <=> OLD.quantity) THEN
|
|
||||||
CALL ticket_requestRecalc(NEW.ticketFk);
|
|
||||||
CALL ticket_requestRecalc(OLD.ticketFk);
|
|
||||||
END IF;
|
|
||||||
END */;;
|
|
||||||
DELIMITER ;
|
|
||||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
|
||||||
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
|
||||||
/*!50003 SET character_set_results = @saved_cs_results */ ;
|
|
||||||
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
|
||||||
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
|
||||||
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
|
||||||
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
|
||||||
/*!50003 SET character_set_client = utf8mb4 */ ;
|
|
||||||
/*!50003 SET character_set_results = utf8mb4 */ ;
|
|
||||||
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
|
|
||||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
|
||||||
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
|
||||||
DELIMITER ;;
|
|
||||||
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_afterDelete`
|
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_afterDelete`
|
||||||
AFTER DELETE ON `ticketService`
|
AFTER DELETE ON `ticketService`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
|
@ -9699,9 +9661,6 @@ BEGIN
|
||||||
`changedModel` = 'TicketService',
|
`changedModel` = 'TicketService',
|
||||||
`changedModelId` = OLD.id,
|
`changedModelId` = OLD.id,
|
||||||
`userFk` = account.myUser_getId();
|
`userFk` = account.myUser_getId();
|
||||||
|
|
||||||
CALL ticket_requestRecalc(OLD.ticketFk);
|
|
||||||
|
|
||||||
END */;;
|
END */;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||||
|
@ -10142,8 +10101,6 @@ DELIMITER ;;
|
||||||
AFTER UPDATE ON `travel`
|
AFTER UPDATE ON `travel`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
CALL stock.log_add('travel', NEW.id, OLD.id);
|
|
||||||
|
|
||||||
IF NOT(NEW.shipped <=> OLD.shipped) THEN
|
IF NOT(NEW.shipped <=> OLD.shipped) THEN
|
||||||
UPDATE entry
|
UPDATE entry
|
||||||
SET commission = entry_getCommission(travelFk, currencyFk,supplierFk)
|
SET commission = entry_getCommission(travelFk, currencyFk,supplierFk)
|
||||||
|
@ -10997,4 +10954,4 @@ USE `vn2008`;
|
||||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||||
|
|
||||||
-- Dump completed on 2024-04-18 7:16:17
|
-- Dump completed on 2024-05-07 5:48:41
|
||||||
|
|
|
@ -146,7 +146,7 @@ INSERT INTO `vn`.`businessReasonEnd` (`id`, `reason`)
|
||||||
('2', 'No supera PP empresa'),
|
('2', 'No supera PP empresa'),
|
||||||
('3', 'Despido');
|
('3', 'Despido');
|
||||||
|
|
||||||
INSERT INTO `vn2008`.`payroll_categorias` (`codcategoria`, `descripcion`, `Tarifa`)
|
INSERT INTO `vn`.`payrollCategories` (`id`, `description`, `rate`)
|
||||||
VALUES
|
VALUES
|
||||||
('11', 'INFORMATICA', '2'),
|
('11', 'INFORMATICA', '2'),
|
||||||
('12', 'AUX INFORMATICA', '7');
|
('12', 'AUX INFORMATICA', '7');
|
||||||
|
|
|
@ -11,7 +11,6 @@ CREATE ROLE 'salix';
|
||||||
GRANT 'salix' TO 'root'@'%';
|
GRANT 'salix' TO 'root'@'%';
|
||||||
SET DEFAULT ROLE 'salix' FOR 'root'@'%';
|
SET DEFAULT ROLE 'salix' FOR 'root'@'%';
|
||||||
|
|
||||||
CREATE SCHEMA IF NOT EXISTS `vn2008`;
|
|
||||||
CREATE SCHEMA IF NOT EXISTS `tmp`;
|
CREATE SCHEMA IF NOT EXISTS `tmp`;
|
||||||
|
|
||||||
UPDATE `util`.`config`
|
UPDATE `util`.`config`
|
||||||
|
@ -160,7 +159,8 @@ INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`)
|
||||||
(1, 'EUR', 'Euro', 1),
|
(1, 'EUR', 'Euro', 1),
|
||||||
(2, 'USD', 'Dollar USA', 1.4),
|
(2, 'USD', 'Dollar USA', 1.4),
|
||||||
(3, 'GBP', 'Libra', 1),
|
(3, 'GBP', 'Libra', 1),
|
||||||
(4, 'JPY', 'Yen Japones', 1);
|
(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`, `country`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`, `continentFk`, `hasDailyInvoice`, `CEE`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -371,20 +371,20 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`)
|
||||||
(4, 'GCN Channel'),
|
(4, 'GCN Channel'),
|
||||||
(5, 'The Newspaper');
|
(5, 'The Newspaper');
|
||||||
|
|
||||||
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`,`typeFk`)
|
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`businessTypeFk`,`typeFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
||||||
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
||||||
(1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
(1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
||||||
(1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
(1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
|
||||||
(1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
(1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 18, 0, 'florist','normal'),
|
||||||
(1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
|
(1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
|
||||||
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
|
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
|
||||||
(1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
|
(1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 19, 0, 'florist','normal'),
|
||||||
(1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist','normal'),
|
(1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 9, 0, 'florist','normal'),
|
||||||
(1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist','normal'),
|
(1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, NULL, 0, 'florist','normal'),
|
||||||
(1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses'),
|
(1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses'),
|
||||||
(1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses');
|
(1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses');
|
||||||
|
|
||||||
INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`)
|
INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`)
|
||||||
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), UPPER(CONCAT(name, 'Social')), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1
|
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), UPPER(CONCAT(name, 'Social')), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1
|
||||||
|
@ -2617,15 +2617,31 @@ INSERT INTO `vn`.`invoiceInIntrastat` (`invoiceInFk`, `net`, `intrastatFk`, `amo
|
||||||
|
|
||||||
UPDATE `vn`.`invoiceIn`
|
UPDATE `vn`.`invoiceIn`
|
||||||
SET isBooked = TRUE
|
SET isBooked = TRUE
|
||||||
WHERE id IN (2, 5, 7, 8, 9, 10);
|
WHERE id IN (5, 7, 8, 9, 10);
|
||||||
|
|
||||||
INSERT INTO `vn`.`ticketRecalc`(`ticketFk`)
|
DELIMITER $$
|
||||||
SELECT t.id
|
CREATE PROCEDURE `tmp`.`ticket_recalc`()
|
||||||
FROM vn.ticket t
|
BEGIN
|
||||||
LEFT JOIN vn.ticketRecalc tr ON tr.ticketFk = t.id
|
DECLARE vDone BOOL;
|
||||||
WHERE tr.ticketFk IS NULL;
|
DECLARE vTicketFk INT;
|
||||||
|
|
||||||
CALL `vn`.`ticket_doRecalc`();
|
DECLARE cTickets CURSOR FOR SELECT id FROM vn.ticket;
|
||||||
|
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
||||||
|
SET vDone = TRUE;
|
||||||
|
|
||||||
|
OPEN cTickets;
|
||||||
|
myLoop: LOOP
|
||||||
|
SET vDone = FALSE;
|
||||||
|
FETCH cTickets INTO vTicketFk;
|
||||||
|
IF vDone THEN LEAVE myLoop; END IF;
|
||||||
|
CALL vn.ticket_recalc(vTicketFk, NULL);
|
||||||
|
END LOOP;
|
||||||
|
CLOSE cTickets;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
||||||
|
|
||||||
|
CALL tmp.ticket_recalc;
|
||||||
|
DROP PROCEDURE tmp.ticket_recalc;
|
||||||
|
|
||||||
UPDATE `vn`.`ticket`
|
UPDATE `vn`.`ticket`
|
||||||
SET refFk = 'T1111111'
|
SET refFk = 'T1111111'
|
||||||
|
@ -3771,3 +3787,6 @@ INSERT INTO `vn`.`accountReconciliationConfig`(currencyFk, warehouseFk)
|
||||||
INSERT INTO vn.workerTeam(id, team, workerFk)
|
INSERT INTO vn.workerTeam(id, team, workerFk)
|
||||||
VALUES
|
VALUES
|
||||||
(8, 1, 19);
|
(8, 1, 19);
|
||||||
|
|
||||||
|
INSERT INTO vn.workCenter (id, name, payrollCenterFk, counter, warehouseFk, street, geoFk, deliveryManAdjustment)
|
||||||
|
VALUES(100, 'workCenterOne', 1, NULL, 1, 'gotham', NULL, NULL);
|
|
@ -91,15 +91,15 @@ BEGIN
|
||||||
-- Recobro
|
-- Recobro
|
||||||
UPDATE bi.Greuge_Evolution ge
|
UPDATE bi.Greuge_Evolution ge
|
||||||
JOIN (
|
JOIN (
|
||||||
SELECT cs.Id_Cliente, sum(Valor * Cantidad) as Importe
|
SELECT a.clientFk Id_Cliente, sum(sc.value * s.quantity) as Importe
|
||||||
FROM vn.ticket t
|
FROM vn.ticket t
|
||||||
JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.addressFk
|
JOIN vn.address a on a.id = t.addressFk
|
||||||
JOIN vn2008.Movimientos m on m.Id_Ticket = t.id
|
JOIN vn.sale s on s.ticketFk = t.id
|
||||||
JOIN vn2008.Movimientos_componentes mc on mc.Id_Movimiento = m.Id_Movimiento
|
JOIN vn.saleComponent sc on sc.saleFk = s.id
|
||||||
WHERE t.shipped >= datFEC
|
WHERE t.shipped >= datFEC
|
||||||
AND t.shipped < datFEC_TOMORROW
|
AND t.shipped < datFEC_TOMORROW
|
||||||
AND mc.Id_Componente = 17 -- Recobro
|
AND sc.componentFk = 17 -- Recobro
|
||||||
GROUP BY cs.Id_Cliente
|
GROUP BY a.clientFk
|
||||||
) sub using(Id_Cliente)
|
) sub using(Id_Cliente)
|
||||||
SET Recobro = Importe
|
SET Recobro = Importe
|
||||||
WHERE ge.Fecha = datFEC;
|
WHERE ge.Fecha = datFEC;
|
||||||
|
|
|
@ -24,7 +24,7 @@ BEGIN
|
||||||
WHERE Periodo < vMaxPeriod;
|
WHERE Periodo < vMaxPeriod;
|
||||||
|
|
||||||
SELECT MIN(period) INTO vCurrentPeriod
|
SELECT MIN(period) INTO vCurrentPeriod
|
||||||
FROM vn2008.time
|
FROM vn.time
|
||||||
WHERE period > vPreviousPeriod;
|
WHERE period > vPreviousPeriod;
|
||||||
|
|
||||||
SET vYear = FLOOR(vCurrentPeriod / 100);
|
SET vYear = FLOOR(vCurrentPeriod / 100);
|
||||||
|
@ -66,7 +66,7 @@ BEGIN
|
||||||
WHERE periodo < vMaxPeriod;
|
WHERE periodo < vMaxPeriod;
|
||||||
|
|
||||||
SELECT MIN(period) INTO vCurrentPeriod
|
SELECT MIN(period) INTO vCurrentPeriod
|
||||||
FROM vn2008.time
|
FROM vn.time
|
||||||
WHERE period > vPreviousPeriod;
|
WHERE period > vPreviousPeriod;
|
||||||
|
|
||||||
SET vYear = FLOOR(vCurrentPeriod / 100);
|
SET vYear = FLOOR(vCurrentPeriod / 100);
|
||||||
|
@ -108,7 +108,7 @@ BEGIN
|
||||||
WHERE periodo < vMaxPeriod;
|
WHERE periodo < vMaxPeriod;
|
||||||
|
|
||||||
SELECT MIN(period) INTO vCurrentPeriod
|
SELECT MIN(period) INTO vCurrentPeriod
|
||||||
FROM vn2008.time
|
FROM vn.time
|
||||||
WHERE period > vPreviousPeriod;
|
WHERE period > vPreviousPeriod;
|
||||||
|
|
||||||
SET vYear = FLOOR(vCurrentPeriod / 100);
|
SET vYear = FLOOR(vCurrentPeriod / 100);
|
||||||
|
@ -156,7 +156,7 @@ BEGIN
|
||||||
WHERE periodo < vMaxPeriod;
|
WHERE periodo < vMaxPeriod;
|
||||||
|
|
||||||
SELECT MIN(period) INTO vCurrentPeriod
|
SELECT MIN(period) INTO vCurrentPeriod
|
||||||
FROM vn2008.time
|
FROM vn.time
|
||||||
WHERE period > vPreviousPeriod;
|
WHERE period > vPreviousPeriod;
|
||||||
|
|
||||||
SET vYear = FLOOR(vCurrentPeriod / 100);
|
SET vYear = FLOOR(vCurrentPeriod / 100);
|
||||||
|
@ -198,7 +198,7 @@ BEGIN
|
||||||
WHERE periodo < vMaxPeriod;
|
WHERE periodo < vMaxPeriod;
|
||||||
|
|
||||||
SELECT MIN(period) INTO vCurrentPeriod
|
SELECT MIN(period) INTO vCurrentPeriod
|
||||||
FROM vn2008.time
|
FROM vn.time
|
||||||
WHERE period > vPreviousPeriod;
|
WHERE period > vPreviousPeriod;
|
||||||
|
|
||||||
SET vYear = FLOOR(vCurrentPeriod / 100);
|
SET vYear = FLOOR(vCurrentPeriod / 100);
|
||||||
|
|
|
@ -23,31 +23,31 @@ BEGIN
|
||||||
Importe
|
Importe
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
tp.Tipo AS Familia,
|
it.name,
|
||||||
r.reino AS Reino,
|
ic.name,
|
||||||
tr.CodigoTrabajador AS Comercial,
|
w.code,
|
||||||
tr2.CodigoTrabajador AS Comprador,
|
w2.code,
|
||||||
p.name AS Provincia,
|
p.name,
|
||||||
w.name AS almacen,
|
wa.name,
|
||||||
tm.year AS Año,
|
tm.year,
|
||||||
tm.month AS Mes,
|
tm.month,
|
||||||
tm.week AS Semana,
|
tm.week,
|
||||||
dm.description AS Vista,
|
dm.description,
|
||||||
bt.importe AS Importe
|
bt.importe
|
||||||
FROM bs.ventas bt
|
FROM bs.ventas bt
|
||||||
LEFT JOIN vn2008.Tipos tp ON tp.tipo_id = bt.tipo_id
|
LEFT JOIN vn.itemType it ON it.id = bt.tipo_id
|
||||||
LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id
|
LEFT JOIN vn.itemCategory ic ON ic.id = it.categoryFk
|
||||||
LEFT JOIN vn2008.Clientes c on c.Id_Cliente = bt.Id_Cliente
|
LEFT JOIN vn.client c on c.id = bt.Id_Cliente
|
||||||
LEFT JOIN vn2008.Trabajadores tr ON tr.Id_Trabajador = c.Id_Trabajador
|
LEFT JOIN vn.worker w ON w.id = c.salesPersonFk
|
||||||
LEFT JOIN vn2008.Trabajadores tr2 ON tr2.Id_Trabajador = tp.Id_Trabajador
|
LEFT JOIN vn.worker w2 ON w2.id = it.workerFk
|
||||||
JOIN vn2008.time tm ON tm.date = bt.fecha
|
JOIN vn.time tm ON tm.dated = bt.fecha
|
||||||
JOIN vn2008.Movimientos m ON m.Id_Movimiento = bt.Id_Movimiento
|
JOIN vn.sale s ON s.id = bt.Id_Movimiento
|
||||||
LEFT JOIN vn.ticket t ON t.id = m.Id_Ticket
|
LEFT JOIN vn.ticket t ON t.id = s.ticketFk
|
||||||
JOIN vn2008.Agencias a ON a.Id_Agencia = t.agencyModeFk
|
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
|
||||||
LEFT JOIN vn.deliveryMethod dm ON dm.id = a.Vista
|
LEFT JOIN vn.deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
||||||
LEFT JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = t.addressFk
|
LEFT JOIN vn.address a ON a.id = t.addressFk
|
||||||
LEFT JOIN vn2008.province p ON p.province_id = cs.province_id
|
LEFT JOIN vn.province p ON p.id = a.provinceFk
|
||||||
LEFT JOIN vn.warehouse w ON w.id = t.warehouseFk
|
LEFT JOIN vn.warehouse wa ON wa.id = t.warehouseFk
|
||||||
WHERE bt.fecha >= vLastMonth AND r.mercancia;
|
WHERE bt.fecha >= vLastMonth AND ic.merchandise;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -13,46 +13,45 @@ BEGIN
|
||||||
|
|
||||||
INSERT INTO vn.greuge(shipped, clientFk, description,
|
INSERT INTO vn.greuge(shipped, clientFk, description,
|
||||||
amount, greugeTypeFk, ticketFk)
|
amount, greugeTypeFk, ticketFk)
|
||||||
SELECT cm.Fecha
|
SELECT c.ticketCreated
|
||||||
, cm.Id_Cliente
|
, c.clientFk
|
||||||
, concat('Claim ',cm.id,' : ', m.Concepte)
|
, concat('Claim ', c.id,' : ', s.concept)
|
||||||
,round( -1 * ((sensib -1)/4) * Cantidad *
|
,round( -1 * ((c.responsibility -1)/4) * s.quantity *
|
||||||
Preu * (100 - Descuento) / 100, 2) AS Reclamaciones
|
s.price * (100 - s.discount) / 100, 2)
|
||||||
, 4
|
, 4
|
||||||
, m.Id_Ticket
|
, s.ticketFk
|
||||||
FROM vn2008.Movimientos m
|
FROM vn.sale s
|
||||||
JOIN vn2008.cl_act ca USING(Id_Movimiento)
|
JOIN vn.claimEnd ce ON ce.saleFk = s.id
|
||||||
JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id
|
JOIN vn.claim c ON c.id = ce.claimFk
|
||||||
WHERE ca.cl_sol_id NOT IN (1,5)
|
WHERE ce.claimDestinationFk NOT IN (1,5)
|
||||||
AND ca.greuge = 0
|
AND NOT ce.isGreuge
|
||||||
AND cm.cl_est_id = 3;
|
AND c.claimStateFk = 3;
|
||||||
|
|
||||||
-- Reclamaciones que pasan a Maná
|
-- Reclamaciones que pasan a Maná
|
||||||
|
|
||||||
INSERT INTO vn.greuge(shipped, clientFk, description,
|
INSERT INTO vn.greuge(shipped, clientFk, description,
|
||||||
amount, greugeTypeFk, ticketFk)
|
amount, greugeTypeFk, ticketFk)
|
||||||
SELECT cm.Fecha
|
SELECT c.ticketCreated
|
||||||
, cm.Id_Cliente
|
, c.clientFk
|
||||||
, concat('Claim_mana ',cm.id,' : ', m.Concepte)
|
, concat('Claim_mana ',c.id,' : ', s.concept)
|
||||||
,round( ((sensib -1)/4) * Cantidad * Preu * (100 - Descuento) / 100, 2)
|
,round( ((c.responsibility -1)/4) * s.quantity * s.price * (100 - s.discount) / 100, 2)
|
||||||
AS Reclamaciones
|
|
||||||
,3
|
,3
|
||||||
,m.Id_Ticket
|
,s.ticketFk
|
||||||
FROM vn2008.Movimientos m
|
FROM vn.sale s
|
||||||
JOIN vn2008.cl_act ca USING(Id_Movimiento)
|
JOIN vn.claimEnd ce ON ce.saleFk = s.id
|
||||||
JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id
|
JOIN vn.claim c ON c.id = ce.claimFk
|
||||||
WHERE ca.cl_sol_id NOT IN (1,5)
|
WHERE ce.claimDestinationFk NOT IN (1,5)
|
||||||
AND ca.greuge = 0
|
AND NOT ce.isGreuge
|
||||||
AND cm.cl_est_id = 3
|
AND c.claimStateFk = 3
|
||||||
AND cm.mana;
|
AND c.isChargedToMana;
|
||||||
|
|
||||||
-- Marcamos para no repetir
|
-- Marcamos para no repetir
|
||||||
UPDATE vn2008.cl_act ca
|
UPDATE vn.claimEnd ce
|
||||||
JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id
|
JOIN vn.claim c ON c.id = ce.claimFk
|
||||||
SET greuge = 1
|
SET c.isChargedToMana = TRUE
|
||||||
WHERE ca.cl_sol_id NOT IN (1,5)
|
WHERE ce.claimDestinationFk NOT IN (1,5)
|
||||||
AND ca.greuge = 0
|
AND NOT ce.isGreuge
|
||||||
AND cm.cl_est_id = 3;
|
AND c.claimStateFk = 3;
|
||||||
|
|
||||||
-- Recobros
|
-- Recobros
|
||||||
|
|
||||||
|
@ -60,17 +59,17 @@ BEGIN
|
||||||
CREATE TEMPORARY TABLE tmp.ticket_list
|
CREATE TEMPORARY TABLE tmp.ticket_list
|
||||||
(PRIMARY KEY (Id_Ticket))
|
(PRIMARY KEY (Id_Ticket))
|
||||||
SELECT DISTINCT t.id Id_Ticket
|
SELECT DISTINCT t.id Id_Ticket
|
||||||
FROM vn2008.Movimientos_componentes mc
|
FROM vn.saleComponent sc
|
||||||
JOIN vn2008.Movimientos m ON mc.Id_Movimiento = m.Id_Movimiento
|
JOIN vn.sale s ON sc.saleFk = s.id
|
||||||
JOIN vn.ticket t ON t.id = m.Id_Ticket
|
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||||
JOIN vn.ticketLastState ts ON ts.ticketFk = t.id
|
JOIN vn.ticketLastState ts ON ts.ticketFk = t.id
|
||||||
JOIN vn.ticketTracking tt ON tt.id = ts.ticketTrackingFk
|
JOIN vn.ticketTracking tt ON tt.id = ts.ticketTrackingFk
|
||||||
JOIN vn.state s ON s.id = tt.stateFk
|
JOIN vn.state st ON st.id = tt.stateFk
|
||||||
WHERE mc.Id_Componente = 17
|
WHERE sc.componentFk = 17
|
||||||
AND mc.greuge = 0
|
AND sc.isGreuge = 0
|
||||||
AND t.shipped >= '2016-10-01'
|
AND t.shipped >= '2016-10-01'
|
||||||
AND t.shipped < util.VN_CURDATE()
|
AND t.shipped < util.VN_CURDATE()
|
||||||
AND s.alertLevel >= 3;
|
AND st.alertLevel >= 3;
|
||||||
|
|
||||||
DELETE g.*
|
DELETE g.*
|
||||||
FROM vn.greuge g
|
FROM vn.greuge g
|
||||||
|
@ -80,24 +79,24 @@ BEGIN
|
||||||
INSERT INTO vn.greuge(clientFk, description, amount,shipped,
|
INSERT INTO vn.greuge(clientFk, description, amount,shipped,
|
||||||
greugeTypeFk, ticketFk)
|
greugeTypeFk, ticketFk)
|
||||||
SELECT t.clientFk
|
SELECT t.clientFk
|
||||||
,concat('recobro ', m.Id_Ticket), - round(SUM(mc.Valor*Cantidad),2)
|
,concat('recobro ', s.ticketFk), - round(SUM(sc.value*s.quantity),2)
|
||||||
AS dif
|
AS dif,
|
||||||
,date(t.shipped)
|
date(t.shipped)
|
||||||
, 2
|
, 2
|
||||||
,tt.Id_Ticket
|
,tt.Id_Ticket
|
||||||
FROM vn2008.Movimientos m
|
FROM vn.sale s
|
||||||
JOIN vn.ticket t ON t.id = m.Id_Ticket
|
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||||
JOIN tmp.ticket_list tt ON tt.Id_Ticket = t.id
|
JOIN tmp.ticket_list tt ON tt.Id_Ticket = t.id
|
||||||
JOIN vn2008.Movimientos_componentes mc
|
JOIN vn.saleComponent sc
|
||||||
ON mc.Id_Movimiento = m.Id_Movimiento AND mc.Id_Componente = 17
|
ON sc.saleFk = s.id AND sc.componentFk = 17
|
||||||
GROUP BY t.id
|
GROUP BY t.id
|
||||||
HAVING ABS(dif) > 1;
|
HAVING ABS(dif) > 1;
|
||||||
|
|
||||||
UPDATE vn2008.Movimientos_componentes mc
|
UPDATE vn.saleComponent sc
|
||||||
JOIN vn2008.Movimientos m ON m.Id_Movimiento = mc.Id_Movimiento
|
JOIN vn.sale s ON s.id = sc.saleFk
|
||||||
JOIN tmp.ticket_list tt ON tt.Id_Ticket = m.Id_Ticket
|
JOIN tmp.ticket_list tt ON tt.Id_Ticket = s.ticketFk
|
||||||
SET greuge = 1
|
SET sc.isGreuge = 1
|
||||||
WHERE Id_Componente = 17;
|
WHERE sc.componentFk = 17;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Recalculamos la ratio de las reclamaciones, que luego
|
* Recalculamos la ratio de las reclamaciones, que luego
|
||||||
|
@ -105,26 +104,25 @@ BEGIN
|
||||||
*/
|
*/
|
||||||
|
|
||||||
REPLACE bi.claims_ratio(Id_Cliente, Consumo, Reclamaciones, Ratio, recobro)
|
REPLACE bi.claims_ratio(Id_Cliente, Consumo, Reclamaciones, Ratio, recobro)
|
||||||
SELECT Id_Cliente, 0,0,0,0
|
SELECT id, 0,0,0,0
|
||||||
FROM vn2008.Clientes;
|
FROM vn.client;
|
||||||
|
|
||||||
REPLACE bi.claims_ratio(Id_Cliente, Consumo, Reclamaciones, Ratio, recobro)
|
REPLACE bi.claims_ratio(Id_Cliente, Consumo, Reclamaciones, Ratio, recobro)
|
||||||
SELECT fm.Id_Cliente, 12 * fm.Consumo, Reclamaciones,
|
SELECT fm.Id_Cliente, 12 * fm.Consumo, Reclamaciones,
|
||||||
round(Reclamaciones / (12*fm.Consumo),4) AS Ratio, 0
|
round(Reclamaciones / (12*fm.Consumo),4), 0
|
||||||
FROM bi.facturacion_media_anual fm
|
FROM bi.facturacion_media_anual fm
|
||||||
LEFT JOIN(
|
LEFT JOIN(
|
||||||
SELECT cm.Id_Cliente, round(sum(-1 * ((sensib -1)/4) *
|
SELECT c.clientFk, round(sum(-1 * ((c.responsibility -1)/4) *
|
||||||
Cantidad * Preu * (100 - Descuento) / 100))
|
s.quantity * s.price * (100 - s.discount) / 100))
|
||||||
AS Reclamaciones
|
AS Reclamaciones
|
||||||
FROM vn2008.Movimientos m
|
FROM vn.sale s
|
||||||
JOIN vn2008.cl_act ca
|
JOIN vn.claimEnd ce ON ce.saleFk = s.id
|
||||||
ON ca.Id_Movimiento = m.Id_Movimiento
|
JOIN vn.claim c ON c.id = ce.claimFk
|
||||||
JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id
|
WHERE ce.claimDestinationFk NOT IN (1,5)
|
||||||
WHERE ca.cl_sol_id NOT IN (1,5)
|
AND c.claimStateFk = 3
|
||||||
AND cm.cl_est_id = 3
|
AND c.ticketCreated >= TIMESTAMPADD(YEAR, -1, util.VN_CURDATE())
|
||||||
AND cm.Fecha >= TIMESTAMPADD(YEAR, -1, util.VN_CURDATE())
|
GROUP BY c.clientFk
|
||||||
GROUP BY cm.Id_Cliente
|
) claims ON claims.clientFk = fm.Id_Cliente;
|
||||||
) claims ON claims.Id_Cliente = fm.Id_Cliente;
|
|
||||||
|
|
||||||
|
|
||||||
-- Calculamos el porcentaje del recobro para añadirlo al precio de venta
|
-- Calculamos el porcentaje del recobro para añadirlo al precio de venta
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`clean_launcher`()
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Borra registros de las principales tablas (excepto de "ticket").
|
|
||||||
*/
|
|
||||||
CALL vn2008.clean(0);
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,32 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`comparativa_add`()
|
|
||||||
BEGIN
|
|
||||||
DECLARE lastCOMP INT; # Se trata de una variable para almacenar el ultimo valor del Periodo
|
|
||||||
DECLARE vMaxPeriod INT;
|
|
||||||
DECLARE vMaxWeek INT;
|
|
||||||
|
|
||||||
SELECT t.period, t.`week` INTO vMaxPeriod, vMaxWeek
|
|
||||||
FROM vn.`time` t
|
|
||||||
WHERE t.dated = util.VN_CURDATE();
|
|
||||||
|
|
||||||
SELECT MAX(Periodo) INTO lastCOMP FROM vn2008.Comparativa;
|
|
||||||
-- Fijaremos las ventas con más de un mes de antiguedad en la tabla Comparativa
|
|
||||||
|
|
||||||
IF lastCOMP < vMaxPeriod - 3 AND vMaxWeek > 3 THEN
|
|
||||||
|
|
||||||
REPLACE vn2008.Comparativa(Periodo, Id_Article, warehouse_id, Cantidad,price)
|
|
||||||
SELECT tm.period as Periodo, m.Id_Article, t.warehouseFk, sum(m.Cantidad), sum(v.importe)
|
|
||||||
FROM bs.ventas v
|
|
||||||
JOIN vn2008.time tm ON tm.date = v.fecha
|
|
||||||
JOIN vn2008.Movimientos m ON m.Id_Movimiento = v.Id_Movimiento
|
|
||||||
JOIN vn2008.Tipos tp ON tp.tipo_id = v.tipo_id
|
|
||||||
JOIN vn2008.reinos r ON r.id = tp.reino_id
|
|
||||||
JOIN vn.ticket t ON t.id = m.Id_Ticket
|
|
||||||
WHERE tm.period BETWEEN lastCOMP AND vMaxPeriod - 3
|
|
||||||
AND t.clientFk NOT IN(400,200)
|
|
||||||
AND t.warehouseFk NOT IN (0,13)
|
|
||||||
GROUP BY m.Id_Article, Periodo, t.warehouseFk;
|
|
||||||
|
|
||||||
END IF;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,40 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`comparativa_add_manual`(IN vStarted DATE, IN vEnded DATE)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Recalcula la tabla Comparativa para dos valores dados
|
|
||||||
*
|
|
||||||
* @param vStarted fecha desde
|
|
||||||
* @param vEnded fecha hasta
|
|
||||||
*/
|
|
||||||
|
|
||||||
DECLARE periodStart INT;
|
|
||||||
DECLARE periodEnd INT;
|
|
||||||
|
|
||||||
-- Seleccionamos la fecha minima/maxima del periodo que vamos a consultar
|
|
||||||
|
|
||||||
SELECT t.period INTO periodStart
|
|
||||||
FROM vn.`time` t
|
|
||||||
WHERE t.dated = vStarted;
|
|
||||||
|
|
||||||
SELECT t.period INTO periodEnd
|
|
||||||
FROM vn.`time` t
|
|
||||||
WHERE t.dated = vEnded;
|
|
||||||
|
|
||||||
DELETE FROM vn2008.Comparativa
|
|
||||||
WHERE Periodo BETWEEN periodStart AND periodEnd;
|
|
||||||
|
|
||||||
INSERT INTO vn2008.Comparativa(Periodo, Id_Article, warehouse_id, Cantidad,price)
|
|
||||||
SELECT tm.period as Periodo, m.Id_Article, t.warehouseFk, sum(m.Cantidad), sum(v.importe)
|
|
||||||
FROM bs.ventas v
|
|
||||||
JOIN vn2008.time tm ON tm.date = v.fecha
|
|
||||||
JOIN vn2008.Movimientos m ON m.Id_Movimiento = v.Id_Movimiento
|
|
||||||
JOIN vn2008.Tipos tp ON tp.tipo_id = v.tipo_id
|
|
||||||
JOIN vn2008.reinos r ON r.id = tp.reino_id
|
|
||||||
JOIN vn.ticket t ON t.id = m.Id_Ticket
|
|
||||||
WHERE tm.period BETWEEN periodStart AND periodEnd
|
|
||||||
AND t.clientFk NOT IN(400,200)
|
|
||||||
AND t.warehouseFk NOT IN (0,13)
|
|
||||||
GROUP BY m.Id_Article, Periodo, t.warehouseFk;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -2,7 +2,7 @@ DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`defaultersFromDate`(IN vDate DATE)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`defaultersFromDate`(IN vDate DATE)
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
SELECT t1.*, c.Cliente, w.code AS workerCode, c.pay_met_id,c.Vencimiento
|
SELECT t1.*, c.name Cliente, w.code workerCode, c.payMethodFk pay_met_id, c.dueDay Vencimiento
|
||||||
FROM (
|
FROM (
|
||||||
-- Filtramos aquellos clientes cuyo saldo se ha incrementado de ayer a hoy
|
-- Filtramos aquellos clientes cuyo saldo se ha incrementado de ayer a hoy
|
||||||
select * from(
|
select * from(
|
||||||
|
@ -18,7 +18,7 @@ BEGIN
|
||||||
|
|
||||||
having today.amount > 0 and difference <> 0
|
having today.amount > 0 and difference <> 0
|
||||||
) newDefaulters
|
) newDefaulters
|
||||||
)t1 left join vn2008.Clientes c ON t1.client = c.Id_Cliente
|
)t1 left join vn.client c ON c.id = t1.client
|
||||||
left join vn.worker w ON w.id = c.Id_Trabajador;
|
left join vn.worker w ON w.id = c.salesPersonFk;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -8,9 +8,10 @@ BEGIN
|
||||||
DECLARE vAmountInvoice DECIMAL(10,2);
|
DECLARE vAmountInvoice DECIMAL(10,2);
|
||||||
DECLARE vGraceDays INT;
|
DECLARE vGraceDays INT;
|
||||||
DECLARE defaulters CURSOR FOR
|
DECLARE defaulters CURSOR FOR
|
||||||
SELECT client, amount, graceDays FROM bi.defaulters d
|
SELECT d.client, d.amount, pm.graceDays
|
||||||
JOIN vn2008.Clientes c ON c.Id_Cliente = d.client
|
FROM bi.defaulters d
|
||||||
JOIN vn2008.pay_met pm ON pm.id = c.pay_met_id
|
JOIN vn.client c ON c.id = d.client
|
||||||
|
JOIN vn.payMethod pm ON pm.id = c.payMethodFk
|
||||||
WHERE hasChanged AND date = vDate;
|
WHERE hasChanged AND date = vDate;
|
||||||
|
|
||||||
DECLARE invoices CURSOR FOR
|
DECLARE invoices CURSOR FOR
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
||||||
SQL SECURITY DEFINER
|
|
||||||
VIEW `bi`.`last_Id_Cubo`
|
|
||||||
AS SELECT `C`.`Id_Compra` AS `Id_Compra`,
|
|
||||||
`C`.`Id_Article` AS `Id_Article`,
|
|
||||||
`tr`.`warehouse_id` AS `warehouse_id`,
|
|
||||||
`C`.`Id_Cubo` AS `Id_Cubo`,
|
|
||||||
`C`.`Packing` AS `Packing`
|
|
||||||
FROM (
|
|
||||||
(
|
|
||||||
`vn2008`.`Compres` `C`
|
|
||||||
JOIN `vn2008`.`Entradas` `E` ON(`C`.`Id_Entrada` = `E`.`Id_Entrada`)
|
|
||||||
)
|
|
||||||
JOIN `vn2008`.`travel` `tr` ON(`E`.`travel_id` = `tr`.`id`)
|
|
||||||
)
|
|
||||||
WHERE `C`.`Id_Cubo` IS NOT NULL
|
|
||||||
AND `C`.`Id_Cubo` <> '--'
|
|
||||||
AND `tr`.`landing` > `util`.`VN_CURDATE`() - INTERVAL 18 MONTH
|
|
||||||
ORDER BY `C`.`Id_Compra` DESC
|
|
|
@ -1,23 +0,0 @@
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
||||||
SQL SECURITY DEFINER
|
|
||||||
VIEW `bi`.`v_ventas_contables`
|
|
||||||
AS SELECT `time`.`year` AS `year`,
|
|
||||||
`time`.`month` AS `month`,
|
|
||||||
cast(
|
|
||||||
sum(
|
|
||||||
`m`.`Cantidad` * `m`.`Preu` * (100 - `m`.`Descuento`) / 100
|
|
||||||
) AS decimal(10, 0)
|
|
||||||
) AS `importe`
|
|
||||||
FROM (
|
|
||||||
(
|
|
||||||
(
|
|
||||||
`vn`.`ticket` `t`
|
|
||||||
JOIN `bi`.`f_tvc` ON(`t`.`id` = `bi`.`f_tvc`.`Id_Ticket`)
|
|
||||||
)
|
|
||||||
JOIN `vn2008`.`Movimientos` `m` ON(`t`.`id` = `m`.`Id_Ticket`)
|
|
||||||
)
|
|
||||||
JOIN `vn2008`.`time` ON(`time`.`date` = cast(`t`.`shipped` AS date))
|
|
||||||
)
|
|
||||||
WHERE `t`.`shipped` >= '2014-01-01'
|
|
||||||
GROUP BY `time`.`year`,
|
|
||||||
`time`.`month`
|
|
|
@ -1,112 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`bancos_evolution_add`(vStartingDate DATE)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Inserta en la tabla bancos_evolution los saldos acumulados de cada banco
|
|
||||||
*
|
|
||||||
* @param vStartingDate Fecha desde la cual se recalculan la tabla bs.bancos_evolution
|
|
||||||
*/
|
|
||||||
DECLARE vCurrentDate DATE;
|
|
||||||
DECLARE vMaxDate DATE DEFAULT TIMESTAMPADD(MONTH, 7, util.VN_CURDATE());
|
|
||||||
IF IFNULL(vStartingDate,0) < TIMESTAMPADD(YEAR, -5, util.VN_CURDATE()) THEN
|
|
||||||
CALL util.throw('invalid date');
|
|
||||||
END IF;
|
|
||||||
DELETE FROM bs.bancos_evolution WHERE Fecha >= vStartingDate;
|
|
||||||
|
|
||||||
SET vCurrentDate = vStartingDate;
|
|
||||||
|
|
||||||
INSERT INTO bs.bancos_evolution(Fecha, Id_Banco, saldo)
|
|
||||||
SELECT vCurrentDate, Id_Banco, deuda
|
|
||||||
FROM bs.bancos_evolution
|
|
||||||
WHERE Fecha = TIMESTAMPADD(DAY,-1,vCurrentDate);
|
|
||||||
|
|
||||||
WHILE vCurrentDate < vMaxDate DO
|
|
||||||
-- insertar solo el dia de ayer
|
|
||||||
INSERT INTO bs.bancos_evolution(Fecha ,Id_Banco, saldo)
|
|
||||||
SELECT vCurrentDate, Id_Banco, SUM(saldo)
|
|
||||||
FROM (
|
|
||||||
SELECT Id_Banco ,saldo
|
|
||||||
FROM bs.bancos_evolution
|
|
||||||
WHERE Fecha = TIMESTAMPADD(DAY,-1,vCurrentDate) -- los saldos acumulados del dia anterior
|
|
||||||
UNION ALL
|
|
||||||
|
|
||||||
SELECT c.Id_Banco, IFNULL(SUM(Entrada),0) - IFNULL(SUM(Salida),0) as saldo
|
|
||||||
FROM vn2008.Cajas c
|
|
||||||
JOIN vn2008.Bancos b using(Id_Banco) -- saldos de las cajas
|
|
||||||
JOIN vn.accountingType at2 ON at2.id = b.cash
|
|
||||||
WHERE at2.code IN ('wireTransfer','fundingLine')
|
|
||||||
AND Cajafecha = vCurrentDate
|
|
||||||
AND (Serie = 'MB' OR at2.code = 'fundingLine')
|
|
||||||
GROUP BY Id_Banco
|
|
||||||
)sub
|
|
||||||
GROUP BY Id_Banco
|
|
||||||
ON DUPLICATE KEY UPDATE saldo = saldo + VALUES(saldo);
|
|
||||||
|
|
||||||
SET vCurrentDate = TIMESTAMPADD(DAY,1,vCurrentDate);
|
|
||||||
|
|
||||||
END WHILE;
|
|
||||||
|
|
||||||
-- Ahora actualizamos la quilla
|
|
||||||
UPDATE bs.bancos_evolution be
|
|
||||||
JOIN
|
|
||||||
(
|
|
||||||
SELECT bp.Id_Banco, - sum(bp.importe) as quilla, t.dated
|
|
||||||
FROM vn.time t
|
|
||||||
JOIN vn2008.Bancos_poliza bp ON t.dated between apertura AND IFNULL(cierre, t.dated)
|
|
||||||
WHERE t.dated BETWEEN vStartingDate AND vMaxDate
|
|
||||||
GROUP BY Id_Banco, t.dated
|
|
||||||
) sub ON be.Id_Banco = sub.Id_Banco AND sub.dated = be.Fecha
|
|
||||||
SET be.quilla = sub.quilla;
|
|
||||||
|
|
||||||
-- pagos futuros no concilidados
|
|
||||||
INSERT INTO bs.bancos_evolution(Fecha, Id_Banco, saldo)
|
|
||||||
SELECT t.dated, p.id_banco, - importe
|
|
||||||
FROM vn.time t
|
|
||||||
join vn2008.pago p ON p.fecha <= t.dated
|
|
||||||
WHERE t.dated BETWEEN util.VN_CURDATE() AND vMaxDate
|
|
||||||
AND p.fecha BETWEEN util.VN_CURDATE() AND vMaxDate
|
|
||||||
AND NOT conciliado
|
|
||||||
ON DUPLICATE KEY UPDATE saldo = saldo + VALUES(saldo);
|
|
||||||
|
|
||||||
-- cobros futuros
|
|
||||||
INSERT INTO bs.bancos_evolution(Fecha, Id_Banco, saldo)
|
|
||||||
SELECT t.dated, r.Id_Banco, SUM(Entregado)
|
|
||||||
FROM vn.time t
|
|
||||||
JOIN vn2008.Recibos r ON r.Fechacobro <= t.dated
|
|
||||||
WHERE r.Fechacobro > util.VN_CURDATE() AND r.Fechacobro <= vMaxDate
|
|
||||||
AND t.dated BETWEEN util.VN_CURDATE() AND vMaxDate
|
|
||||||
GROUP BY t.dated, r.Id_Banco
|
|
||||||
ON DUPLICATE KEY UPDATE saldo = saldo + VALUES(saldo);
|
|
||||||
|
|
||||||
-- saldos de la tabla prevision
|
|
||||||
INSERT INTO bs.bancos_evolution(Fecha, Id_Banco, saldo)
|
|
||||||
SELECT t.dated, sp.Id_Banco, SUM(Importe)
|
|
||||||
FROM vn.time t
|
|
||||||
JOIN vn2008.Saldos_Prevision sp ON sp.Fecha <= t.dated
|
|
||||||
JOIN vn2008.Bancos b ON sp.Id_Banco = b.Id_Banco
|
|
||||||
JOIN vn.accountingType at2 ON at2.id = b.cash
|
|
||||||
WHERE at2.code IN ('wireTransfer','fundingLine')
|
|
||||||
AND t.dated BETWEEN vStartingDate AND vMaxDate
|
|
||||||
GROUP BY t.dated, sp.Id_Banco
|
|
||||||
ON DUPLICATE KEY UPDATE saldo = saldo + VALUES(saldo);
|
|
||||||
|
|
||||||
-- Utilizamos el saldo_auxiliar para calcular lo dispuesto en las polizas
|
|
||||||
UPDATE bs.bancos_evolution be
|
|
||||||
SET saldo_aux = saldo
|
|
||||||
WHERE Fecha >= vStartingDate;
|
|
||||||
|
|
||||||
-- Deuda
|
|
||||||
UPDATE bs.bancos_evolution be
|
|
||||||
JOIN vn2008.Bancos b using(Id_Banco)
|
|
||||||
JOIN vn.accountingType at2 ON at2.id = b.cash
|
|
||||||
SET be.deuda = IF(at2.code = 'fundingLine', be.saldo_aux, 0)
|
|
||||||
, be.saldo = IF(at2.code = 'fundingLine', 0, be.saldo_aux)
|
|
||||||
WHERE Fecha >= vStartingDate;
|
|
||||||
|
|
||||||
-- Liquidez
|
|
||||||
update bs.bancos_evolution set liquidez = saldo - quilla + deuda WHERE Fecha >= vStartingDate;
|
|
||||||
-- Disponibilidad
|
|
||||||
update bs.bancos_evolution set `disponibilidad ajena` = - quilla + deuda WHERE Fecha >= vStartingDate;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,111 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`comercialesCompleto`(IN vWorker INT, vDate DATE)
|
|
||||||
BEGIN
|
|
||||||
DECLARE vAYearAgoStarted DATE DEFAULT DATE_FORMAT(TIMESTAMPADD(YEAR, - 1, vDate), '%Y-%m-01');
|
|
||||||
DECLARE vAYearAgoEnded DATE DEFAULT TIMESTAMPADD(YEAR, - 1, LAST_DAY(vDate));
|
|
||||||
|
|
||||||
CALL vn.worker_GetHierarchy(vWorker);
|
|
||||||
|
|
||||||
INSERT IGNORE INTO tmp.workerHierarchyList (workerFk)
|
|
||||||
SELECT wd2.workerFk
|
|
||||||
FROM vn.workerDepartment wd2
|
|
||||||
WHERE wd2.workerFk = vWorker;
|
|
||||||
|
|
||||||
-- Falta que en algunos casos solo tenga en cuenta los tipos afectados.
|
|
||||||
SELECT
|
|
||||||
c.Id_Cliente id_cliente,
|
|
||||||
c.Cliente cliente,
|
|
||||||
cr.recobro * 100 tarifa,
|
|
||||||
c.Telefono telefono,
|
|
||||||
c.movil,
|
|
||||||
c.POBLACION poblacion,
|
|
||||||
p.`name` provincia,
|
|
||||||
ROUND(f.futur, 2) futur,
|
|
||||||
c.Credito credito,
|
|
||||||
pm.`name` forma_pago,
|
|
||||||
ROUND(c365 / 12, 2) consumo_medio365,
|
|
||||||
ROUND(c365, 2) consumo365,
|
|
||||||
ROUND(CmLy.peso, 2) peso_mes_año_pasado,
|
|
||||||
ROUND(CmLy.peso * 1.19, 2) objetivo,
|
|
||||||
tr.CodigoTrabajador,
|
|
||||||
ROUND(mes_actual.consumo, 2) consumoMes,
|
|
||||||
ROUND(IFNULL(mes_actual.consumo, 0) - IFNULL(CmLy.peso * 1.19, 0), 2) como_lo_llevo,
|
|
||||||
DATE(LastTicket) ultimo_ticket,
|
|
||||||
dead.muerto,
|
|
||||||
g.Greuge,
|
|
||||||
cr.recobro
|
|
||||||
FROM
|
|
||||||
vn2008.Clientes c
|
|
||||||
LEFT JOIN
|
|
||||||
(SELECT g.clientFk Id_Cliente, CAST( SUM(g.amount) as DECIMAL(12,2)) AS Greuge
|
|
||||||
FROM vn.greuge g
|
|
||||||
JOIN vn.`client` c ON c.id = g.clientFk
|
|
||||||
LEFT JOIN vn.worker w ON c.salesPersonFk = w.id
|
|
||||||
WHERE (c.salesPersonFk = vWorker OR w.bossFk = vWorker)
|
|
||||||
GROUP BY Id_Cliente
|
|
||||||
) g ON g.Id_Cliente = c.Id_Cliente
|
|
||||||
LEFT JOIN
|
|
||||||
vn2008.province p ON p.province_id = c.province_id
|
|
||||||
JOIN
|
|
||||||
vn2008.pay_met pm ON pm.id = c.pay_met_id
|
|
||||||
LEFT JOIN
|
|
||||||
vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador
|
|
||||||
LEFT JOIN
|
|
||||||
bi.claims_ratio cr on cr.Id_Cliente = c.Id_Cliente
|
|
||||||
LEFT JOIN
|
|
||||||
(SELECT v.Id_Cliente, SUM(importe) c365 -- optimizat de 6s /5.3s/ 4.7s a 0.3/0.4/0.3
|
|
||||||
FROM bs.ventas v
|
|
||||||
JOIN vn2008.Clientes c ON c.Id_Cliente = v.Id_Cliente
|
|
||||||
WHERE v.fecha BETWEEN TIMESTAMPADD(YEAR, - 1, vDate) AND vDate
|
|
||||||
GROUP BY v.Id_Cliente) c365 ON c365.Id_Cliente = c.Id_Cliente
|
|
||||||
LEFT JOIN
|
|
||||||
(SELECT
|
|
||||||
Id_Cliente, SUM(importe) consumo
|
|
||||||
FROM
|
|
||||||
bs.ventas v
|
|
||||||
INNER JOIN vn2008.Clientes c USING (Id_Cliente)
|
|
||||||
LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador
|
|
||||||
WHERE
|
|
||||||
(c.Id_Trabajador = vWorker OR tr.boss = vWorker)
|
|
||||||
AND (v.fecha BETWEEN TIMESTAMPADD(DAY, - DAY(vDate) + 1, vDate) AND TIMESTAMPADD(DAY, - 1, vDate))
|
|
||||||
GROUP BY Id_Cliente) mes_actual ON mes_actual.Id_Cliente = c.Id_Cliente
|
|
||||||
LEFT JOIN
|
|
||||||
(SELECT t.clientFk Id_Cliente, SUM(m.preu * m.Cantidad * (1 - m.Descuento / 100)) futur
|
|
||||||
FROM vn.ticket t
|
|
||||||
JOIN vn2008.Clientes c ON c.Id_Cliente = t.clientFk
|
|
||||||
JOIN vn2008.Movimientos m ON m.Id_Ticket = t.id
|
|
||||||
LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador
|
|
||||||
WHERE
|
|
||||||
(c.Id_Trabajador = vWorker OR tr.boss = vWorker)
|
|
||||||
AND t.shipped BETWEEN vDate AND util.dayEnd(LAST_DAY(vDate))
|
|
||||||
GROUP BY Id_Cliente) f ON c.Id_Cliente = f.Id_Cliente
|
|
||||||
LEFT JOIN
|
|
||||||
(SELECT MAX(t.shipped) LastTicket, c.Id_Cliente
|
|
||||||
FROM vn.ticket t
|
|
||||||
JOIN vn2008.Clientes c ON c.Id_cliente = t.clientFk
|
|
||||||
LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador
|
|
||||||
WHERE
|
|
||||||
(c.Id_Trabajador = vWorker OR tr.boss = vWorker)
|
|
||||||
GROUP BY t.clientFk) LastTicket ON LastTicket.Id_Cliente = c.Id_Cliente
|
|
||||||
LEFT JOIN
|
|
||||||
(
|
|
||||||
SELECT SUM(importe) peso, c.Id_Cliente
|
|
||||||
FROM bs.ventas v
|
|
||||||
JOIN vn2008.Clientes c ON c.Id_Cliente = v.Id_Cliente
|
|
||||||
LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador
|
|
||||||
WHERE fecha BETWEEN vAYearAgoStarted and vAYearAgoEnded
|
|
||||||
AND (c.Id_Trabajador = vWorker OR tr.boss = vWorker)
|
|
||||||
GROUP BY c.Id_Cliente) CmLy ON CmLy.Id_Cliente = c.Id_Cliente
|
|
||||||
LEFT JOIN
|
|
||||||
(SELECT c.Id_Cliente,
|
|
||||||
IF(MAX(io.issued) < DATE_FORMAT(TIMESTAMPADD(MONTH, - 1, vDate), '%Y- %m-01'), TRUE, FALSE) muerto
|
|
||||||
FROM vn.invoiceOut io
|
|
||||||
JOIN vn2008.Clientes c ON c.Id_cliente = io.clientFk
|
|
||||||
LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador
|
|
||||||
WHERE (c.Id_Trabajador = vWorker OR tr.boss = vWorker)
|
|
||||||
GROUP BY Id_Cliente) dead ON dead.Id_Cliente = c.Id_Cliente
|
|
||||||
JOIN tmp.workerHierarchyList s ON s.workerFk = c.Id_Trabajador;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.workerHierarchyList;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -15,10 +15,10 @@ BEGIN
|
||||||
SET lastYearSales =
|
SET lastYearSales =
|
||||||
(SELECT SUM(importe + recargo)
|
(SELECT SUM(importe + recargo)
|
||||||
FROM ventas v
|
FROM ventas v
|
||||||
JOIN vn2008.empresa e ON e.id = v.empresa_id
|
JOIN vn.company c ON c.id = v.empresa_id
|
||||||
JOIN vn2008.empresa_grupo eg ON eg.empresa_grupo_id = e.empresa_grupo
|
JOIN vn.companyGroup cg ON cg.id = c.companyGroupFk
|
||||||
WHERE fecha BETWEEN oneYearBefore AND vDated
|
WHERE fecha BETWEEN oneYearBefore AND vDated
|
||||||
AND eg.grupo = 'Verdnatura'
|
AND cg.code = 'Verdnatura'
|
||||||
)
|
)
|
||||||
WHERE updated = vDated;
|
WHERE updated = vDated;
|
||||||
|
|
||||||
|
|
|
@ -31,56 +31,49 @@ BEGIN
|
||||||
INTO vManaFromDays, vManaToDays
|
INTO vManaFromDays, vManaToDays
|
||||||
FROM vn.salespersonConfig;
|
FROM vn.salespersonConfig;
|
||||||
|
|
||||||
SELECT MAX(dated)
|
SELECT MAX(dated) INTO vFromDated
|
||||||
INTO vFromDated
|
|
||||||
FROM vn.clientManaCache;
|
FROM vn.clientManaCache;
|
||||||
|
|
||||||
DELETE
|
DELETE FROM vn.clientManaCache
|
||||||
FROM vn.clientManaCache
|
|
||||||
WHERE dated = vFromDated;
|
WHERE dated = vFromDated;
|
||||||
|
|
||||||
SELECT MAX(dated)
|
SELECT MAX(dated) INTO vFromDated
|
||||||
INTO vFromDated
|
|
||||||
FROM vn.clientManaCache;
|
FROM vn.clientManaCache;
|
||||||
|
|
||||||
IF ISNULL(vFromDated) THEN
|
IF vFromDated IS NULL THEN
|
||||||
SELECT manaDateFrom
|
SELECT manaDateFrom
|
||||||
INTO vFromDated
|
INTO vFromDated
|
||||||
FROM vn.salespersonConfig;
|
FROM vn.salespersonConfig;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
WHILE vFromDated + INTERVAL vManaToDays DAY < util.VN_CURDATE() DO
|
WHILE vFromDated + INTERVAL vManaToDays DAY < util.VN_CURDATE() DO
|
||||||
SELECT
|
SELECT vFromDated + INTERVAL vManaToDays DAY,
|
||||||
vFromDated + INTERVAL vManaToDays DAY,
|
|
||||||
vFromDated - INTERVAL vManaFromDays DAY
|
vFromDated - INTERVAL vManaFromDays DAY
|
||||||
INTO
|
INTO vToDated,
|
||||||
vToDated,
|
|
||||||
vForDeleteDated;
|
vForDeleteDated;
|
||||||
|
|
||||||
DELETE FROM vn.clientManaCache
|
DELETE FROM vn.clientManaCache
|
||||||
WHERE dated <= vForDeleteDated;
|
WHERE dated <= vForDeleteDated;
|
||||||
|
|
||||||
INSERT INTO vn.clientManaCache(clientFk, mana, dated)
|
INSERT INTO vn.clientManaCache(clientFk, mana, dated)
|
||||||
SELECT
|
SELECT Id_Cliente,
|
||||||
Id_Cliente,
|
|
||||||
SUM(mana),
|
SUM(mana),
|
||||||
vToDated
|
vToDated
|
||||||
FROM
|
FROM (
|
||||||
(
|
SELECT a.clientFk Id_Cliente, s.quantity * sc.value mana
|
||||||
SELECT cs.Id_Cliente, Cantidad * Valor as mana
|
|
||||||
FROM vn.ticket t
|
FROM vn.ticket t
|
||||||
JOIN vn2008.Consignatarios cs using(Id_Consigna)
|
JOIN vn.address a ON a.id = t.addressFk
|
||||||
JOIN vn2008.Movimientos m on m.Id_Ticket = t.id
|
JOIN vn.sale s ON s.ticketFk = t.id
|
||||||
JOIN vn2008.Movimientos_componentes mc on mc.Id_Movimiento = m.Id_Movimiento
|
JOIN vn.saleComponent sc ON sc.saleFk = s.id
|
||||||
WHERE Id_Componente IN (vManaAutoId, vManaId, vClaimManaId)
|
WHERE sc.componentFk IN (vManaAutoId, vManaId, vClaimManaId)
|
||||||
AND t.shipped > vFromDated
|
AND t.shipped > vFromDated
|
||||||
AND date(t.shipped) <= vToDated
|
AND DATE(t.shipped) <= vToDated
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT r.Id_Cliente, - Entregado
|
SELECT clientFk, - amountPaid
|
||||||
FROM vn2008.Recibos r
|
FROM vn.receipt
|
||||||
WHERE Id_Banco = vManaBankId
|
WHERE bankFk = vManaBankId
|
||||||
AND Fechacobro > vFromDated
|
AND payed > vFromDated
|
||||||
AND Fechacobro <= vToDated
|
AND payed <= vToDated
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT clientFk, amount
|
SELECT clientFk, amount
|
||||||
FROM vn.greuge
|
FROM vn.greuge
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`sale_add`(
|
||||||
|
IN vStarted DATE,
|
||||||
|
IN vEnded DATE)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Añade las ventas que se realizaron entre 2 fechas a la tabla bs.sale
|
||||||
|
*
|
||||||
|
* @param vStarted Fecha de inicio
|
||||||
|
* @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;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -1,13 +1,12 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`ventas_add_launcher`()
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`sales_addLauncher`()
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Añade las ventas a la tabla bs.sale que se realizaron desde hace un mes hasta hoy
|
* Añade las ventas a la tabla bs.sale que se realizaron desde hace un mes hasta hoy
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DECLARE vCurDate DATE DEFAULT util.VN_CURDATE();
|
DECLARE vCurDate DATE DEFAULT util.VN_CURDATE();
|
||||||
CALL ventas_add(vCurDate - INTERVAL 1 MONTH, vCurDate);
|
|
||||||
|
|
||||||
|
CALL sale_add(vCurDate - INTERVAL 1 MONTH, vCurDate);
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
|
@ -1,78 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`ventas_add`(
|
|
||||||
IN vStarted DATETIME,
|
|
||||||
IN vEnded DATETIME)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Añade las ventas que se realizaron entre
|
|
||||||
* vStarted y vEnded
|
|
||||||
*
|
|
||||||
* @param vStarted Fecha de inicio
|
|
||||||
* @param vEnded Fecha de finalizacion
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
DECLARE vStartingDate DATETIME;
|
|
||||||
DECLARE vEndingDate DATETIME;
|
|
||||||
|
|
||||||
IF vStarted < TIMESTAMPADD(YEAR,-5,util.VN_CURDATE())
|
|
||||||
OR vEnded < TIMESTAMPADD(YEAR,-5,util.VN_CURDATE()) THEN
|
|
||||||
CALL util.throw('fechaDemasiadoAntigua');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
SET vEnded = util.dayEnd(vEnded);
|
|
||||||
SET vStartingDate = vStarted ;
|
|
||||||
SET vEndingDate = util.dayEnd(vStartingDate);
|
|
||||||
|
|
||||||
DELETE
|
|
||||||
FROM sale
|
|
||||||
WHERE dated BETWEEN vStartingDate AND vEnded;
|
|
||||||
|
|
||||||
WHILE vEndingDate <= vEnded DO
|
|
||||||
|
|
||||||
REPLACE ventas(Id_Movimiento, importe, recargo, fecha, tipo_id, Id_Cliente, empresa_id)
|
|
||||||
SELECT saleFk,
|
|
||||||
SUM(IF(ct.isBase, s.quantity * sc.value, 0)) importe,
|
|
||||||
SUM(IF(ct.isBase, 0, s.quantity * sc.value)) recargo,
|
|
||||||
vStartingDate,
|
|
||||||
i.typeFk,
|
|
||||||
a.clientFk,
|
|
||||||
t.companyFk
|
|
||||||
FROM vn.saleComponent sc
|
|
||||||
JOIN vn.component c ON c.id = sc.componentFk
|
|
||||||
JOIN vn.componentType ct ON ct.id = c.typeFk
|
|
||||||
JOIN vn.sale s ON s.id = sc.saleFk
|
|
||||||
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.ticket t ON t.id = s.ticketFk
|
|
||||||
JOIN vn.address a ON a.id = t.addressFk
|
|
||||||
JOIN vn.client cl ON cl.id = a.clientFk
|
|
||||||
WHERE t.shipped BETWEEN vStartingDate AND vEndingDate
|
|
||||||
AND s.quantity <> 0
|
|
||||||
AND s.discount <> 100
|
|
||||||
AND ic.merchandise
|
|
||||||
GROUP BY sc.saleFk
|
|
||||||
HAVING IFNULL(importe,0) <> 0 OR IFNULL(recargo,0) <> 0;
|
|
||||||
|
|
||||||
UPDATE sale s
|
|
||||||
JOIN (
|
|
||||||
SELECT s.id,
|
|
||||||
SUM(s.quantity * sc.value ) margen,
|
|
||||||
s.quantity * s.price * (100 - s.discount ) / 100 pvp
|
|
||||||
FROM vn.sale s
|
|
||||||
JOIN vn.ticket t ON t.id = s.ticketFk
|
|
||||||
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 vStartingDate AND vEndingDate
|
|
||||||
AND ct.isMargin = TRUE
|
|
||||||
GROUP BY s.id) sub ON sub.id = s.saleFk
|
|
||||||
SET s.margin = sub.margen + s.amount + s.surcharge - sub.pvp;
|
|
||||||
|
|
||||||
SET vStartingDate = TIMESTAMPADD(DAY,1, vStartingDate);
|
|
||||||
SET vEndingDate = util.dayEnd(vStartingDate);
|
|
||||||
|
|
||||||
END WHILE;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -38,35 +38,35 @@ BEGIN
|
||||||
|
|
||||||
SELECT vYear
|
SELECT vYear
|
||||||
, vMonth
|
, vMonth
|
||||||
, round(sum(Cantidad * Preu * (100 - m.Descuento)/100))
|
, round(sum(s.quantity * s.price * (100 - s.discount)/100))
|
||||||
, IF(
|
, IF(
|
||||||
e.empresa_grupo = e2.empresa_grupo
|
co.companyGroupFk = co2.companyGroupFk
|
||||||
,1
|
,1
|
||||||
,IF(e2.empresa_grupo,2,0)
|
,IF(co2.companyGroupFk,2,0)
|
||||||
) as grupo
|
) as grupo
|
||||||
, tp.reino_id
|
, it.categoryFk
|
||||||
, a.tipo_id
|
, i.typeFk
|
||||||
, t.companyFk
|
, t.companyFk
|
||||||
, a.expenseFk
|
, i.expenseFk
|
||||||
+ IF(e.empresa_grupo = e2.empresa_grupo
|
+ IF(co.companyGroupFk = co2.companyGroupFk
|
||||||
,1
|
,1
|
||||||
,IF(e2.empresa_grupo,2,0)
|
,IF(co2.companyGroupFk,2,0)
|
||||||
) * 100000
|
) * 100000
|
||||||
+ tp.reino_id * 1000 as Gasto
|
+ it.categoryFk * 1000 as Gasto
|
||||||
FROM vn2008.Movimientos m
|
FROM vn.sale s
|
||||||
JOIN vn.ticket t ON t.id = m.Id_Ticket
|
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||||
JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.addressFk
|
JOIN vn.address a on a.id = t.addressFk
|
||||||
JOIN vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente
|
JOIN vn.client c on c.id = a.clientFk
|
||||||
JOIN tmp.ticket_list tt on tt.id = t.id
|
JOIN tmp.ticket_list tt on tt.id = t.id
|
||||||
JOIN vn2008.Articles a on m.Id_Article = a.Id_Article
|
JOIN vn.item i on s.itemFk = i.id
|
||||||
JOIN vn2008.empresa e on e.id = t.companyFk
|
JOIN vn.company co on co.id = t.companyFk
|
||||||
LEFT JOIN vn2008.empresa e2 on e2.Id_Cliente = c.Id_Cliente
|
LEFT JOIN vn.company co2 on co2.clientFk = c.id
|
||||||
JOIN vn2008.Tipos tp on tp.tipo_id = a.tipo_id
|
JOIN vn.itemType it on it.id = i.typeFk
|
||||||
WHERE Cantidad <> 0
|
WHERE s.quantity <> 0
|
||||||
AND Preu <> 0
|
AND s.price <> 0
|
||||||
AND m.Descuento <> 100
|
AND s.discount <> 100
|
||||||
AND a.tipo_id != TIPO_PATRIMONIAL
|
AND i.typeFk <> TIPO_PATRIMONIAL
|
||||||
GROUP BY grupo, reino_id, tipo_id, companyFk, Gasto;
|
GROUP BY grupo, it.categoryFk, i.typeFk, t.companyFk, Gasto;
|
||||||
|
|
||||||
INSERT INTO bs.ventas_contables(year
|
INSERT INTO bs.ventas_contables(year
|
||||||
, month
|
, month
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`ventas_contables_por_cliente`(IN vYear INT, IN vMonth INT)
|
|
||||||
BEGIN
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Muestra las ventas (€) de cada cliente
|
|
||||||
* dependiendo del año
|
|
||||||
*/
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list;
|
|
||||||
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticket_list
|
|
||||||
(PRIMARY KEY (id))
|
|
||||||
SELECT t.id
|
|
||||||
FROM vn.ticket t
|
|
||||||
JOIN vn.invoiceOut io ON io.id = t.refFk
|
|
||||||
WHERE year(io.issued) = vYear
|
|
||||||
AND month(io.issued) = vMonth;
|
|
||||||
|
|
||||||
SELECT vYear Año,
|
|
||||||
vMonth Mes,
|
|
||||||
t.clientFk Id_Cliente,
|
|
||||||
round(sum(Cantidad * Preu * (100 - m.Descuento)/100)) Venta,
|
|
||||||
IF(e.empresa_grupo = e2.empresa_grupo,
|
|
||||||
1,
|
|
||||||
IF(e2.empresa_grupo,2,0))
|
|
||||||
AS grupo,
|
|
||||||
t.companyFk empresa
|
|
||||||
FROM vn2008.Movimientos m
|
|
||||||
JOIN vn.ticket t ON t.id = m.Id_Ticket
|
|
||||||
JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = t.addressFk
|
|
||||||
JOIN vn2008.Clientes c ON c.Id_Cliente = cs.Id_Cliente
|
|
||||||
JOIN tmp.ticket_list tt ON tt.id = t.id
|
|
||||||
JOIN vn2008.Articles a ON m.Id_Article = a.Id_Article
|
|
||||||
JOIN vn2008.empresa e ON e.id = t.companyFk
|
|
||||||
LEFT JOIN vn2008.empresa e2 ON e2.Id_Cliente = c.Id_Cliente
|
|
||||||
JOIN vn2008.Tipos tp ON tp.tipo_id = a.tipo_id
|
|
||||||
WHERE Cantidad <> 0
|
|
||||||
AND Preu <> 0
|
|
||||||
AND m.Descuento <> 100
|
|
||||||
AND a.tipo_id != 188
|
|
||||||
GROUP BY t.clientFk, grupo,t.companyFk;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.ticket_list;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,63 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`vivosMuertos`()
|
|
||||||
BEGIN
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Devuelve el número de clientes nuevos y muertos,
|
|
||||||
* dependiendo de la fecha actual.
|
|
||||||
*
|
|
||||||
* @param @datSTART Fecha de inicio a buscar
|
|
||||||
* @param @datEND Fecha de finalización a buscar
|
|
||||||
*/
|
|
||||||
|
|
||||||
SET @datSTART = TIMESTAMPADD(YEAR,-2,util.VN_CURDATE());
|
|
||||||
SET @datEND = TIMESTAMPADD(DAY,-DAY(util.VN_CURDATE()),util.VN_CURDATE());
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.VivosMuertos;
|
|
||||||
|
|
||||||
CREATE TEMPORARY TABLE tmp.VivosMuertos
|
|
||||||
SELECT c.Id_Cliente, tm.yearMonth, f.Compra, 0 as Nuevo, 0 as Muerto
|
|
||||||
FROM vn2008.Clientes c
|
|
||||||
JOIN
|
|
||||||
(SELECT DISTINCT yearMonth
|
|
||||||
FROM vn2008.time
|
|
||||||
WHERE date BETWEEN @datSTART
|
|
||||||
AND @datEND ) tm
|
|
||||||
LEFT JOIN
|
|
||||||
(SELECT DISTINCT tm.yearMonth, io.clientFk Id_Cliente , 1 as Compra
|
|
||||||
FROM vn.invoiceOut io
|
|
||||||
JOIN vn2008.time tm ON tm.date = io.issued
|
|
||||||
WHERE io.issued BETWEEN @datSTART
|
|
||||||
AND @datEND) f ON f.yearMonth = tm.yearMonth
|
|
||||||
AND f.Id_Cliente = c.Id_Cliente;
|
|
||||||
|
|
||||||
UPDATE tmp.VivosMuertos vm
|
|
||||||
JOIN
|
|
||||||
(SELECT MIN(tm.yearMonth) firstMonth, io.clientFk Id_Cliente
|
|
||||||
FROM vn.invoiceOut io
|
|
||||||
JOIN vn2008.time tm ON tm.date = io.issued
|
|
||||||
WHERE io.issued BETWEEN @datSTART AND @datEND
|
|
||||||
GROUP BY io.clientFk) fm ON fm.firstMonth = vm.yearMonth
|
|
||||||
AND fm.Id_Cliente = vm.Id_Cliente
|
|
||||||
|
|
||||||
SET Nuevo = 1;
|
|
||||||
|
|
||||||
SELECT max(yearMonth) INTO @lastYearMonth FROM tmp.VivosMuertos;
|
|
||||||
|
|
||||||
UPDATE tmp.VivosMuertos vm
|
|
||||||
JOIN (
|
|
||||||
SELECT MAX(tm.yearMonth) firstMonth, io.clientFk Id_Cliente
|
|
||||||
FROM vn.invoiceOut io
|
|
||||||
JOIN vn2008.time tm ON tm.date = io.issued
|
|
||||||
WHERE io.issued BETWEEN @datSTART AND @datEND
|
|
||||||
GROUP BY io.clientFk) fm ON fm.firstMonth = vm.yearMonth
|
|
||||||
AND fm.Id_Cliente = vm.Id_Cliente
|
|
||||||
|
|
||||||
SET Muerto = 1
|
|
||||||
|
|
||||||
WHERE yearMonth < @lastYearMonth;
|
|
||||||
|
|
||||||
SELECT * FROM tmp.VivosMuertos;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,14 +0,0 @@
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
||||||
SQL SECURITY DEFINER
|
|
||||||
VIEW `bs`.`VentasPorCliente`
|
|
||||||
AS SELECT `v`.`Id_Cliente` AS `Id_Cliente`,
|
|
||||||
round(sum(`v`.`importe`), 0) AS `VentaBasica`,
|
|
||||||
`t`.`year` AS `year`,
|
|
||||||
`t`.`month` AS `month`
|
|
||||||
FROM (
|
|
||||||
`vn2008`.`time` `t`
|
|
||||||
JOIN `bs`.`ventas` `v` ON(`v`.`fecha` = `t`.`date`)
|
|
||||||
)
|
|
||||||
GROUP BY `v`.`Id_Cliente`,
|
|
||||||
`t`.`year`,
|
|
||||||
`t`.`month`
|
|
|
@ -1,31 +0,0 @@
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
||||||
SQL SECURITY DEFINER
|
|
||||||
VIEW `bs`.`bajasLaborales`
|
|
||||||
AS SELECT `w`.`firstName` AS `firstname`,
|
|
||||||
`w`.`lastName` AS `name`,
|
|
||||||
`b`.`id` AS `businessFk`,
|
|
||||||
max(`c`.`dated`) AS `lastDate`,
|
|
||||||
max(IFNULL(`b`.`ended`, `util`.`VN_CURDATE`())) AS `endContract`,
|
|
||||||
`at`.`name` AS `type`,
|
|
||||||
cast(COUNT(0) AS decimal(10, 0)) AS `dias`,
|
|
||||||
`w`.`id` AS `userFk`
|
|
||||||
FROM (
|
|
||||||
(
|
|
||||||
(
|
|
||||||
`vn`.`calendar` `c`
|
|
||||||
JOIN `vn`.`business` `b` ON(`b`.`id` = `c`.`businessFk`)
|
|
||||||
)
|
|
||||||
JOIN `vn`.`worker` `w` ON(`w`.`id` = `b`.`workerFk`)
|
|
||||||
)
|
|
||||||
JOIN `vn`.`absenceType` `at` ON(`at`.`id` = `c`.`dayOffTypeFk`)
|
|
||||||
)
|
|
||||||
WHERE `c`.`dated` >= `util`.`VN_CURDATE`() + INTERVAL -1 year
|
|
||||||
AND `at`.`name` NOT IN (
|
|
||||||
'Vacaciones',
|
|
||||||
'Vacaciones 1/2 día',
|
|
||||||
'Compensar',
|
|
||||||
'Festivo'
|
|
||||||
)
|
|
||||||
GROUP BY `w`.`id`,
|
|
||||||
`at`.`id`
|
|
||||||
HAVING `endContract` >= `util`.`VN_CURDATE`()
|
|
|
@ -1,27 +0,0 @@
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
||||||
SQL SECURITY DEFINER
|
|
||||||
VIEW `bs`.`horasSilla`
|
|
||||||
AS SELECT `wj`.`dated` AS `Fecha`,
|
|
||||||
`d`.`name` AS `Departamento`,
|
|
||||||
cast(sum(`wj`.`total`) AS decimal(10, 2)) AS `Horas`,
|
|
||||||
cast(
|
|
||||||
sum(
|
|
||||||
(`wj`.`total` + `wj`.`lunch`) * `wj`.`priceOrdinaryHour`
|
|
||||||
) AS decimal(10, 2)
|
|
||||||
) AS `Salarios`
|
|
||||||
FROM (
|
|
||||||
(
|
|
||||||
`vn`.`workerJourney` `wj`
|
|
||||||
JOIN `vn`.`business` `b` ON(`b`.`id` = `wj`.`businessFk`)
|
|
||||||
)
|
|
||||||
JOIN `vn`.`department` `d` ON(`d`.`id` = `b`.`departmentFk`)
|
|
||||||
)
|
|
||||||
WHERE `d`.`name` IN (
|
|
||||||
'CAMARA',
|
|
||||||
'ENCAJADO',
|
|
||||||
'PALETIZADORES',
|
|
||||||
'PRODUCCION',
|
|
||||||
'SACADORES'
|
|
||||||
)
|
|
||||||
GROUP BY `wj`.`dated`,
|
|
||||||
`d`.`name`
|
|
|
@ -1,19 +0,0 @@
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
||||||
SQL SECURITY DEFINER
|
|
||||||
VIEW `bs`.`s1_ticketDetail`
|
|
||||||
AS SELECT `s`.`ticketFk` AS `ticketFk`,
|
|
||||||
cast(
|
|
||||||
sum(`s`.`price` * `s`.`quantity`) AS decimal(10, 2)
|
|
||||||
) AS `ticketAmount`,
|
|
||||||
COUNT(`s`.`id`) AS `ticketLines`,
|
|
||||||
cast(sum(`sv`.`volume`) AS decimal(10, 2)) AS `ticketM3`,
|
|
||||||
cast(`t`.`shipped` AS date) AS `shipped`
|
|
||||||
FROM (
|
|
||||||
(
|
|
||||||
`vn`.`ticket` `t`
|
|
||||||
JOIN `vn`.`sale` `s` ON(`s`.`ticketFk` = `t`.`id`)
|
|
||||||
)
|
|
||||||
JOIN `vn`.`saleVolume` `sv` ON(`sv`.`saleFk` = `s`.`id`)
|
|
||||||
)
|
|
||||||
WHERE `t`.`shipped` BETWEEN '2021-09-01' AND '2021-10-31 23:59'
|
|
||||||
GROUP BY `s`.`ticketFk`
|
|
|
@ -1,42 +0,0 @@
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
||||||
SQL SECURITY DEFINER
|
|
||||||
VIEW `bs`.`s21_saleDetail`
|
|
||||||
AS SELECT dayofmonth(`t`.`shipped`) AS `dia`,
|
|
||||||
year(`t`.`shipped`) AS `año`,
|
|
||||||
MONTH(`t`.`shipped`) AS `mes`,
|
|
||||||
`s`.`concept` AS `concepto`,
|
|
||||||
`s`.`quantity` AS `unidades`,
|
|
||||||
`s`.`price` AS `precio`,
|
|
||||||
`s`.`quantity` * `s`.`price` AS `venta`,
|
|
||||||
`it`.`name` AS `familia`,
|
|
||||||
`w`.`code` AS `comprador`,
|
|
||||||
`s`.`itemFk` AS `itemFk`,
|
|
||||||
`s`.`ticketFk` AS `ticketFk`,
|
|
||||||
`sv`.`volume` AS `volume`
|
|
||||||
FROM (
|
|
||||||
(
|
|
||||||
(
|
|
||||||
(
|
|
||||||
(
|
|
||||||
(
|
|
||||||
`vn`.`sale` `s`
|
|
||||||
JOIN `vn`.`item` `i` ON(`i`.`id` = `s`.`itemFk`)
|
|
||||||
)
|
|
||||||
JOIN `vn`.`itemType` `it` ON(`it`.`id` = `i`.`typeFk`)
|
|
||||||
)
|
|
||||||
JOIN `vn`.`worker` `w` ON(`w`.`id` = `it`.`workerFk`)
|
|
||||||
)
|
|
||||||
JOIN `vn`.`ticket` `t` ON(`t`.`id` = `s`.`ticketFk`)
|
|
||||||
)
|
|
||||||
JOIN `vn`.`client` `c` ON(`c`.`id` = `t`.`clientFk`)
|
|
||||||
)
|
|
||||||
JOIN `vn`.`saleVolume` `sv` ON(`sv`.`saleFk` = `s`.`id`)
|
|
||||||
)
|
|
||||||
WHERE (
|
|
||||||
`t`.`shipped` BETWEEN '2020-10-21' AND '2020-10-28'
|
|
||||||
OR `t`.`shipped` BETWEEN '2019-10-21' AND '2019-10-28'
|
|
||||||
OR `t`.`shipped` BETWEEN '2021-09-1' AND '2021-10-28'
|
|
||||||
)
|
|
||||||
AND `t`.`warehouseFk` IN (1, 60)
|
|
||||||
AND `c`.`isRelevant` <> 0
|
|
||||||
AND `s`.`quantity` > 0
|
|
|
@ -1,36 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`prod_graphic_refresh`(v_refresh BOOL, wh_id INT)
|
|
||||||
proc: BEGIN
|
|
||||||
DECLARE datEQ DATETIME;
|
|
||||||
DECLARE timDIF TIME;
|
|
||||||
DECLARE v_calc INT;
|
|
||||||
|
|
||||||
CALL cache_calc_start (v_calc, v_refresh, 'prod_graphic', wh_id);
|
|
||||||
|
|
||||||
IF !v_refresh
|
|
||||||
THEN
|
|
||||||
LEAVE proc;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL vn2008.production_control_source(wh_id, 0);
|
|
||||||
|
|
||||||
DELETE FROM prod_graphic_source;
|
|
||||||
|
|
||||||
INSERT INTO prod_graphic_source (warehouse_id, graphCategory, m3, hora, `order`, Agencia)
|
|
||||||
SELECT
|
|
||||||
wh_id,
|
|
||||||
st.graphCategory,
|
|
||||||
CAST(SUM(m3) AS DECIMAL(10,0)) as m3,
|
|
||||||
pb.Hora,
|
|
||||||
pb.state_order,
|
|
||||||
pb.Agencia
|
|
||||||
FROM tmp.production_buffer pb
|
|
||||||
JOIN vn.state st ON st.id = pb.state
|
|
||||||
WHERE Fecha = util.VN_CURDATE()
|
|
||||||
GROUP BY wh_id, graphCategory
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
CALL cache_calc_end (v_calc);
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -70,16 +70,16 @@ proc:BEGIN
|
||||||
|
|
||||||
ELSE
|
ELSE
|
||||||
|
|
||||||
INSERT IGNORE INTO vn2008.Cubos (Id_Cubo, X, Y, Z)
|
INSERT IGNORE INTO vn.packaging (id, width, depth, height)
|
||||||
SELECT bucket_id, ROUND(x_size/10), ROUND(y_size/10), ROUND(z_size/10)
|
SELECT bucket_id, ROUND(x_size/10), ROUND(y_size/10), ROUND(z_size/10)
|
||||||
FROM bucket WHERE bucket_id = vPackage;
|
FROM bucket WHERE bucket_id = vPackage;
|
||||||
|
|
||||||
IF ROW_COUNT() > 0
|
IF ROW_COUNT() > 0
|
||||||
THEN
|
THEN
|
||||||
INSERT INTO vn2008.mail SET
|
INSERT INTO vn.mail SET
|
||||||
`subject` = 'Cubo añadido',
|
`subject` = 'Cubo añadido',
|
||||||
`text` = CONCAT('Se ha añadido el cubo: ', vPackage),
|
`body` = CONCAT('Se ha añadido el cubo: ', vPackage),
|
||||||
`to` = 'ekt@verdnatura.es';
|
`receiver` = 'ekt@verdnatura.es';
|
||||||
END IF;
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `hedera`.`order_doRecalc`
|
|
||||||
ON SCHEDULE EVERY 10 SECOND
|
|
||||||
STARTS '2019-08-29 14:18:04.000'
|
|
||||||
ON COMPLETION PRESERVE
|
|
||||||
DISABLE
|
|
||||||
DO CALL order_doRecalc$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,53 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`order_doRecalc`()
|
|
||||||
proc: BEGIN
|
|
||||||
/**
|
|
||||||
* Recalculates modified orders.
|
|
||||||
*/
|
|
||||||
DECLARE vDone BOOL;
|
|
||||||
DECLARE vOrderFk INT;
|
|
||||||
|
|
||||||
DECLARE cCur CURSOR FOR
|
|
||||||
SELECT DISTINCT orderFk FROM tOrder;
|
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
|
||||||
SET vDone = TRUE;
|
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
DO RELEASE_LOCK('hedera.order_doRecalc');
|
|
||||||
ROLLBACK;
|
|
||||||
RESIGNAL;
|
|
||||||
END;
|
|
||||||
|
|
||||||
IF !GET_LOCK('hedera.order_doRecalc', 0) THEN
|
|
||||||
LEAVE proc;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tOrder;
|
|
||||||
CREATE TEMPORARY TABLE tOrder
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT id, orderFk FROM orderRecalc;
|
|
||||||
|
|
||||||
OPEN cCur;
|
|
||||||
|
|
||||||
myLoop: LOOP
|
|
||||||
SET vDone = FALSE;
|
|
||||||
FETCH cCur INTO vOrderFk;
|
|
||||||
|
|
||||||
IF vDone THEN
|
|
||||||
LEAVE myLoop;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL order_recalc(vOrderFk);
|
|
||||||
END LOOP;
|
|
||||||
|
|
||||||
CLOSE cCur;
|
|
||||||
|
|
||||||
DELETE o FROM orderRecalc o JOIN tOrder t ON t.id = o.id;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tOrder;
|
|
||||||
|
|
||||||
DO RELEASE_LOCK('hedera.order_doRecalc');
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,16 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`order_requestRecalc`(vSelf INT)
|
|
||||||
proc: BEGIN
|
|
||||||
/**
|
|
||||||
* Adds a request to recalculate the order total.
|
|
||||||
*
|
|
||||||
* @param vSelf The order identifier
|
|
||||||
*/
|
|
||||||
IF vSelf IS NULL THEN
|
|
||||||
LEAVE proc;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- #4409 Disable order recalc
|
|
||||||
-- INSERT INTO orderRecalc SET orderFk = vSelf;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,9 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `hedera`.`orderRow_afterDelete`
|
|
||||||
AFTER DELETE ON `orderRow`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
CALL stock.log_add('orderRow', NULL, OLD.id);
|
|
||||||
CALL order_requestRecalc(OLD.orderFk);
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,9 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `hedera`.`orderRow_afterInsert`
|
|
||||||
AFTER INSERT ON `orderRow`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
CALL stock.log_add('orderRow', NEW.id, NULL);
|
|
||||||
CALL order_requestRecalc(NEW.orderFk);
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,10 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `hedera`.`orderRow_afterUpdate`
|
|
||||||
AFTER UPDATE ON `orderRow`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
CALL stock.log_add('orderRow', NEW.id, OLD.id);
|
|
||||||
CALL order_requestRecalc(OLD.orderFk);
|
|
||||||
CALL order_requestRecalc(NEW.orderFk);
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -3,14 +3,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `hedera`.`order_afterUpdate
|
||||||
AFTER UPDATE ON `order`
|
AFTER UPDATE ON `order`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
CALL stock.log_add('order', NEW.id, OLD.id);
|
|
||||||
|
|
||||||
IF !(OLD.address_id <=> NEW.address_id)
|
|
||||||
OR !(OLD.company_id <=> NEW.company_id)
|
|
||||||
OR !(OLD.customer_id <=> NEW.customer_id) THEN
|
|
||||||
CALL order_requestRecalc(NEW.id);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF !(OLD.address_id <=> NEW.address_id) AND NEW.address_id = 2850 THEN
|
IF !(OLD.address_id <=> NEW.address_id) AND NEW.address_id = 2850 THEN
|
||||||
-- Fallo que se actualiza no se sabe como tickets en este cliente
|
-- Fallo que se actualiza no se sabe como tickets en este cliente
|
||||||
CALL vn.mail_insert(
|
CALL vn.mail_insert(
|
||||||
|
|
|
@ -43,7 +43,7 @@ BEGIN
|
||||||
WHERE sub.amountTaxableBase<>sub2.amountTaxableBase
|
WHERE sub.amountTaxableBase<>sub2.amountTaxableBase
|
||||||
AND sub.amountTaxableBase/2 <> sub2.amountTaxableBase
|
AND sub.amountTaxableBase/2 <> sub2.amountTaxableBase
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT CONCAT('- Factura Duplicada: ', mc.Asiento)
|
SELECT CONCAT('- Factura Duplicada: ', accountingEntryFk)
|
||||||
FROM accountingEntryError
|
FROM accountingEntryError
|
||||||
)sub;
|
)sub;
|
||||||
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `stock`.`log_add`(IN `vTableName` VARCHAR(255), IN `vNewId` VARCHAR(255), IN `vOldId` VARCHAR(255))
|
|
||||||
proc: BEGIN
|
|
||||||
-- XXX: Disabled while testing
|
|
||||||
LEAVE proc;
|
|
||||||
|
|
||||||
IF vOldId IS NOT NULL AND !(vOldId <=> vNewId) THEN
|
|
||||||
INSERT IGNORE INTO `log` SET
|
|
||||||
tableName = vTableName,
|
|
||||||
tableId = vOldId,
|
|
||||||
operation = 'delete';
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF vNewId IS NOT NULL THEN
|
|
||||||
INSERT IGNORE INTO `log` SET
|
|
||||||
tableName = vTableName,
|
|
||||||
tableId = vNewId,
|
|
||||||
operation = 'insert';
|
|
||||||
END IF;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,6 +1,7 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`binlogQueue_getDelay`(vCode VARCHAR(255))
|
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`binlogQueue_getDelay`(vCode VARCHAR(255))
|
||||||
RETURNS BIGINT
|
RETURNS BIGINT
|
||||||
|
READS SQL DATA
|
||||||
NOT DETERMINISTIC
|
NOT DETERMINISTIC
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`connection_kill`(
|
||||||
|
vConnectionId BIGINT
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Kill a connection
|
||||||
|
*
|
||||||
|
* @param vConnectionId
|
||||||
|
*/
|
||||||
|
KILL vConnectionId;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -1,8 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`ticket_doRecalc`
|
|
||||||
ON SCHEDULE EVERY 10 SECOND
|
|
||||||
STARTS '2022-01-28 09:29:18.000'
|
|
||||||
ON COMPLETION PRESERVE
|
|
||||||
ENABLE
|
|
||||||
DO CALL ticket_doRecalc$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,8 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`travel_doRecalc`
|
|
||||||
ON SCHEDULE EVERY 15 SECOND
|
|
||||||
STARTS '2019-05-17 10:52:29.000'
|
|
||||||
ON COMPLETION PRESERVE
|
|
||||||
ENABLE
|
|
||||||
DO CALL travel_doRecalc$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,40 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`getAlert3StateTest`(vTicket INT)
|
|
||||||
RETURNS varchar(45) CHARSET latin1 COLLATE latin1_swedish_ci
|
|
||||||
NOT DETERMINISTIC
|
|
||||||
READS SQL DATA
|
|
||||||
BEGIN
|
|
||||||
DECLARE vDeliveryType INTEGER DEFAULT 0;
|
|
||||||
DECLARE isWaitingForPickUp BOOLEAN DEFAULT FALSE;
|
|
||||||
DECLARE vCode VARCHAR(45);
|
|
||||||
|
|
||||||
SELECT
|
|
||||||
a.Vista
|
|
||||||
INTO vDeliveryType
|
|
||||||
FROM ticket t
|
|
||||||
JOIN vn2008.Agencias a ON a.Id_Agencia = t.agencyModeFk
|
|
||||||
WHERE t.id = vTicket;
|
|
||||||
|
|
||||||
CASE vDeliveryType
|
|
||||||
WHEN 1 THEN -- AGENCIAS
|
|
||||||
SET vCode = 'DELIVERED';
|
|
||||||
|
|
||||||
WHEN 2 THEN -- REPARTO
|
|
||||||
SET vCode = 'ON_DELIVERY';
|
|
||||||
|
|
||||||
ELSE -- MERCADO, OTROS
|
|
||||||
SELECT t.warehouseFk <> w.warehouse_id INTO isWaitingForPickUp
|
|
||||||
FROM ticket t
|
|
||||||
LEFT JOIN vn2008.warehouse_pickup w
|
|
||||||
ON w.agency_id = t.agencyModeFk AND w.warehouse_id = t.warehouseFk
|
|
||||||
WHERE t.id = vTicket;
|
|
||||||
|
|
||||||
IF isWaitingForPickUp THEN
|
|
||||||
SET vCode = 'WAITING_FOR_PICKUP';
|
|
||||||
ELSE
|
|
||||||
SET vCode = 'DELIVERED';
|
|
||||||
END IF;
|
|
||||||
END CASE;
|
|
||||||
RETURN vCode;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -26,11 +26,11 @@ SELECT t.routeFk, t.warehouseFk, IFNULL(ts.productionOrder,0)
|
||||||
LEFT JOIN ticketState ts on ts.ticketFk = t.id
|
LEFT JOIN ticketState ts on ts.ticketFk = t.id
|
||||||
WHERE t.id = vTicketId;
|
WHERE t.id = vTicketId;
|
||||||
|
|
||||||
SELECT (ag.`name` = 'VN_VALENCIA')
|
SELECT (a.`name` = 'VN_VALENCIA')
|
||||||
INTO vIsValenciaPath
|
INTO vIsValenciaPath
|
||||||
FROM `route` r
|
FROM `route` r
|
||||||
JOIN vn2008.Agencias a on a.Id_Agencia = r.agencyModeFk
|
JOIN agencyMode am on am.id = r.agencyModeFk
|
||||||
JOIN vn2008.agency ag on ag.agency_id = a.agency_id
|
JOIN agency a on a.id = am.agencyFk
|
||||||
WHERE r.id = vMyPath;
|
WHERE r.id = vMyPath;
|
||||||
|
|
||||||
IF vIsValenciaPath THEN -- Rutas Valencia
|
IF vIsValenciaPath THEN -- Rutas Valencia
|
||||||
|
|
|
@ -9,9 +9,9 @@ BEGIN
|
||||||
SELECT CONCAT(printedStickers,'/',Total, IF(printedStickers = Total ,' LS','')) INTO vSplitCounter
|
SELECT CONCAT(printedStickers,'/',Total, IF(printedStickers = Total ,' LS','')) INTO vSplitCounter
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT count(l.Id_Movimiento) as printedStickers, COUNT(*) as Total
|
SELECT count(sl.saleFk) as printedStickers, COUNT(*) as Total
|
||||||
FROM vn.sale s
|
FROM sale s
|
||||||
LEFT JOIN vn2008.movement_label l ON l.Id_Movimiento = s.id
|
LEFT JOIN saleLabel sl ON sl.saleFk = s.id
|
||||||
WHERE ticketFk = vTicketFk
|
WHERE ticketFk = vTicketFk
|
||||||
) sub;
|
) sub;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,138 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`available_traslate`(
|
||||||
|
vWarehouseLanding INT,
|
||||||
|
vDated DATE,
|
||||||
|
vWarehouseShipment INT)
|
||||||
|
proc: BEGIN
|
||||||
|
/**
|
||||||
|
* Calcular la disponibilidad dependiendo del almacen
|
||||||
|
* de origen y destino según la fecha.
|
||||||
|
*
|
||||||
|
* @param vWarehouseLanding Almacén de llegada
|
||||||
|
* @param vDated Fecha del calculo para la disponibilidad de articulos
|
||||||
|
* @param vWarehouseShipment Almacén de destino
|
||||||
|
*/
|
||||||
|
DECLARE vDatedFrom DATE;
|
||||||
|
DECLARE vDatedTo DATETIME;
|
||||||
|
DECLARE vDatedReserve DATETIME;
|
||||||
|
DECLARE vDatedInventory DATE;
|
||||||
|
|
||||||
|
IF vDated < util.VN_CURDATE() THEN
|
||||||
|
LEAVE proc;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
CALL item_getStock (vWarehouseLanding, vDated, NULL);
|
||||||
|
|
||||||
|
-- Calcula algunos parámetros necesarios.
|
||||||
|
SET vDatedFrom = vDated;
|
||||||
|
SET vDatedTo = util.dayEnd (vDated + INTERVAL 4 DAY);
|
||||||
|
SELECT inventoried INTO vDatedInventory FROM config;
|
||||||
|
SELECT SUBTIME(util.VN_NOW(), reserveTime) INTO vDatedReserve
|
||||||
|
FROM hedera.orderConfig;
|
||||||
|
|
||||||
|
-- Calcula el ultimo dia de vida para cada producto.
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tItemRange
|
||||||
|
(PRIMARY KEY (itemFk))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT c.itemFk, MAX(t.landed) dated
|
||||||
|
FROM buy c
|
||||||
|
JOIN entry e ON c.entryFk = e.id
|
||||||
|
JOIN travel t ON t.id = e.travelFk
|
||||||
|
JOIN warehouse w ON w.id = t.warehouseInFk
|
||||||
|
WHERE t.landed BETWEEN vDatedInventory AND vDatedFrom
|
||||||
|
AND t.warehouseInFk = vWarehouseLanding
|
||||||
|
AND NOT e.isExcludedFromAvailable
|
||||||
|
AND NOT e.isRaid
|
||||||
|
GROUP BY c.itemFk;
|
||||||
|
|
||||||
|
-- Tabla con el ultimo dia de last_buy para cada producto
|
||||||
|
-- que hace un replace de la anterior.
|
||||||
|
CALL buyUltimate(vWarehouseShipment, util.VN_CURDATE());
|
||||||
|
|
||||||
|
INSERT INTO tItemRange
|
||||||
|
SELECT t.itemFk, tr.landed
|
||||||
|
FROM tmp.buyUltimate t
|
||||||
|
JOIN buy b ON b.id = t.buyFk
|
||||||
|
JOIN entry e ON e.id = b.entryFk
|
||||||
|
JOIN travel tr ON tr.id = e.travelFk
|
||||||
|
LEFT JOIN tItemRange i ON t.itemFk = i.itemFk
|
||||||
|
WHERE t.warehouseFk = vWarehouseShipment
|
||||||
|
AND NOT e.isRaid
|
||||||
|
ON DUPLICATE KEY UPDATE tItemRange.dated = GREATEST(tItemRange.dated,
|
||||||
|
tr.landed);
|
||||||
|
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tItemRangeLive
|
||||||
|
(PRIMARY KEY (itemFk))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT ir.itemFk, util.dayEnd(ir.dated + INTERVAL it.life DAY) dated
|
||||||
|
FROM tItemRange ir
|
||||||
|
JOIN item i ON i.id = ir.itemFk
|
||||||
|
JOIN itemType it ON it.id = i.typeFk
|
||||||
|
HAVING dated >= vDatedFrom OR dated IS NULL;
|
||||||
|
|
||||||
|
-- Calcula el ATP.
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
|
||||||
|
(INDEX (itemFk,warehouseFk))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT i.itemFk,
|
||||||
|
vWarehouseLanding warehouseFk,
|
||||||
|
i.shipped dated,
|
||||||
|
i.quantity
|
||||||
|
FROM itemTicketOut i
|
||||||
|
JOIN tItemRangeLive ir ON ir.itemFK = i.itemFk
|
||||||
|
WHERE i.shipped >= vDatedFrom
|
||||||
|
AND (ir.dated IS NULL OR i.shipped <= ir.dated)
|
||||||
|
AND i.warehouseFk = vWarehouseLanding
|
||||||
|
UNION ALL
|
||||||
|
SELECT b.itemFk,
|
||||||
|
vWarehouseLanding,
|
||||||
|
t.landed,
|
||||||
|
b.quantity
|
||||||
|
FROM buy b
|
||||||
|
JOIN entry e ON b.entryFk = e.id
|
||||||
|
JOIN travel t ON t.id = e.travelFk
|
||||||
|
JOIN tItemRangeLive ir ON ir.itemFk = b.itemFk
|
||||||
|
WHERE NOT e.isExcludedFromAvailable
|
||||||
|
AND b.quantity <> 0
|
||||||
|
AND NOT e.isRaid
|
||||||
|
AND t.warehouseInFk = vWarehouseLanding
|
||||||
|
AND t.landed >= vDatedFrom
|
||||||
|
AND (ir.dated IS NULL OR t.landed <= ir.dated)
|
||||||
|
UNION ALL
|
||||||
|
SELECT i.itemFk, vWarehouseLanding, i.shipped, i.quantity
|
||||||
|
FROM itemEntryOut i
|
||||||
|
JOIN tItemRangeLive ir ON ir.itemFk = i.itemFk
|
||||||
|
WHERE i.shipped >= vDatedFrom
|
||||||
|
AND (ir.dated IS NULL OR i.shipped <= ir.dated)
|
||||||
|
AND i.warehouseOutFk = vWarehouseLanding
|
||||||
|
UNION ALL
|
||||||
|
SELECT r.item_id, vWarehouseLanding, r.shipment, -r.amount
|
||||||
|
FROM hedera.order_row r
|
||||||
|
JOIN hedera.`order` o ON o.id = r.order_id
|
||||||
|
JOIN tItemRangeLive ir ON ir.itemFk = r.item_id
|
||||||
|
WHERE r.shipment >= vDatedFrom
|
||||||
|
AND (ir.dated IS NULL OR r.shipment <= ir.dated)
|
||||||
|
AND r.warehouse_id = vWarehouseLanding
|
||||||
|
AND r.created >= vDatedReserve
|
||||||
|
AND NOT o.confirmed;
|
||||||
|
|
||||||
|
CALL item_getAtp(vDated);
|
||||||
|
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tmp.availableTraslate
|
||||||
|
(PRIMARY KEY (item_id))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT t.item_id, SUM(stock) available
|
||||||
|
FROM (
|
||||||
|
SELECT ti.itemFk item_id, stock
|
||||||
|
FROM tmp.itemList ti
|
||||||
|
JOIN tItemRange ir ON ir.itemFk = ti.itemFk
|
||||||
|
UNION ALL
|
||||||
|
SELECT itemFk, quantity
|
||||||
|
FROM tmp.itemAtp
|
||||||
|
) t
|
||||||
|
GROUP BY t.item_id
|
||||||
|
HAVING available <> 0;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE tmp.itemList, tItemRange, tItemRangeLive;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,217 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balance_create`(
|
||||||
|
IN vStartingMonth INT,
|
||||||
|
IN vEndingMonth INT,
|
||||||
|
IN vCompany INT,
|
||||||
|
IN vIsConsolidated BOOLEAN,
|
||||||
|
IN vInterGroupSalesIncluded BOOLEAN)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Crea un balance financiero para una empresa durante
|
||||||
|
* un período de tiempo determinado.
|
||||||
|
*
|
||||||
|
* @param vStartingMonth Mes de inicio del período
|
||||||
|
* @param vEndingMonth Mes de finalización del período
|
||||||
|
* @param vCompany Identificador de la empresa
|
||||||
|
* @param vIsConsolidated Indica si se trata de un balance consolidado
|
||||||
|
* @param vInterGroupSalesIncluded Indica si se incluyen las ventas del grupo
|
||||||
|
*/
|
||||||
|
DECLARE intGAP INT DEFAULT 7;
|
||||||
|
DECLARE vYears INT DEFAULT 2;
|
||||||
|
DECLARE vYear TEXT;
|
||||||
|
DECLARE vOneYearAgo TEXT;
|
||||||
|
DECLARE vTwoYearsAgo TEXT;
|
||||||
|
DECLARE vQuery TEXT;
|
||||||
|
DECLARE vConsolidatedGroup INT;
|
||||||
|
DECLARE vStartingDate DATE DEFAULT '2020-01-01';
|
||||||
|
DECLARE vCurYear INT DEFAULT YEAR(util.VN_CURDATE());
|
||||||
|
DECLARE vStartingYear INT DEFAULT vCurYear - 2;
|
||||||
|
DECLARE vTable TEXT;
|
||||||
|
|
||||||
|
SET vTable = util.quoteIdentifier('balanceNestTree');
|
||||||
|
SET vYear = util.quoteIdentifier(vCurYear);
|
||||||
|
SET vOneYearAgo = util.quoteIdentifier(vCurYear-1);
|
||||||
|
SET vTwoYearsAgo = util.quoteIdentifier(vCurYear-2);
|
||||||
|
|
||||||
|
-- Solicitamos la tabla tmp.nest, como base para el balance.
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp.nest;
|
||||||
|
|
||||||
|
EXECUTE IMMEDIATE CONCAT(
|
||||||
|
'CREATE TEMPORARY TABLE tmp.nest
|
||||||
|
SELECT node.id
|
||||||
|
,CONCAT( REPEAT(REPEAT(" ",?), COUNT(parent.id) - 1),
|
||||||
|
node.name) name,
|
||||||
|
node.lft,
|
||||||
|
node.rgt,
|
||||||
|
COUNT(parent.id) - 1 depth,
|
||||||
|
CAST((node.rgt - node.lft - 1) / 2 AS DECIMAL) sons
|
||||||
|
FROM ', vTable, ' node,
|
||||||
|
', vTable, ' parent
|
||||||
|
WHERE node.lft BETWEEN parent.lft AND parent.rgt
|
||||||
|
GROUP BY node.id
|
||||||
|
ORDER BY node.lft')
|
||||||
|
USING intGAP;
|
||||||
|
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tmp.balance
|
||||||
|
SELECT * FROM tmp.nest;
|
||||||
|
|
||||||
|
SELECT companyGroupFk INTO vConsolidatedGroup
|
||||||
|
FROM company
|
||||||
|
WHERE id = vCompany;
|
||||||
|
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tCompanyReceiving
|
||||||
|
SELECT id companyFk
|
||||||
|
FROM company
|
||||||
|
WHERE id = vCompany
|
||||||
|
OR companyGroupFk = IF(vIsConsolidated, vConsolidatedGroup, NULL);
|
||||||
|
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tCompanyIssuing
|
||||||
|
SELECT id companyFk
|
||||||
|
FROM supplier p;
|
||||||
|
|
||||||
|
IF NOT vInterGroupSalesIncluded THEN
|
||||||
|
|
||||||
|
DELETE ci
|
||||||
|
FROM tCompanyIssuing ci
|
||||||
|
JOIN company e on e.id = ci.companyFk
|
||||||
|
WHERE e.companyGroupFk = vConsolidatedGroup;
|
||||||
|
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
-- Se calculan las facturas que intervienen,
|
||||||
|
-- para luego poder servir el desglose desde aqui.
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tmp.balanceDetail
|
||||||
|
SELECT cr.companyFk receivingId,
|
||||||
|
ci.companyFk issuingId,
|
||||||
|
YEAR(IFNULL(r.bookEntried,IFNULL(r.booked, r.issued))) `year`,
|
||||||
|
MONTH(IFNULL(r.bookEntried,IFNULL(r.booked, r.issued))) `month`,
|
||||||
|
expenseFk,
|
||||||
|
SUM(taxableBase) amount
|
||||||
|
FROM invoiceIn r
|
||||||
|
JOIN invoiceInTax ri on ri.invoiceInFk = r.id
|
||||||
|
JOIN tCompanyReceiving cr on cr.companyFk = r.companyFk
|
||||||
|
JOIN tCompanyIssuing ci ON ci.companyFk = r.supplierFk
|
||||||
|
WHERE COALESCE(r.bookEntried, r.booked, r.issued) >= vStartingDate
|
||||||
|
AND r.isBooked
|
||||||
|
GROUP BY expenseFk, `year`, `month`, ci.companyFk, cr.companyFk;
|
||||||
|
|
||||||
|
INSERT INTO tmp.balanceDetail(
|
||||||
|
receivingId,
|
||||||
|
issuingId,
|
||||||
|
`year`,
|
||||||
|
`month`,
|
||||||
|
expenseFk,
|
||||||
|
amount)
|
||||||
|
SELECT em.companyFk,
|
||||||
|
em.companyFk,
|
||||||
|
`year`,
|
||||||
|
`month`,
|
||||||
|
expenseFk,
|
||||||
|
SUM(em.amount)
|
||||||
|
FROM expenseManual em
|
||||||
|
JOIN tCompanyReceiving er ON er.companyFk = em.companyFk
|
||||||
|
WHERE `year` >= vStartingYear
|
||||||
|
AND `month` BETWEEN vStartingMonth AND vEndingMonth
|
||||||
|
GROUP BY expenseFk, `year`, `month`, em.companyFk;
|
||||||
|
|
||||||
|
DELETE FROM tmp.balanceDetail
|
||||||
|
WHERE `month` < vStartingMonth
|
||||||
|
OR `month` > vEndingMonth;
|
||||||
|
|
||||||
|
-- Ahora el balance
|
||||||
|
EXECUTE IMMEDIATE CONCAT(
|
||||||
|
'ALTER TABLE tmp.balance
|
||||||
|
ADD COLUMN ', vTwoYearsAgo ,' INT(10) NULL ,
|
||||||
|
ADD COLUMN ', vOneYearAgo ,' INT(10) NULL ,
|
||||||
|
ADD COLUMN ', vYear,' INT(10) NULL ,
|
||||||
|
ADD COLUMN expenseFk VARCHAR(10) NULL,
|
||||||
|
ADD COLUMN expenseName VARCHAR(45) NULL');
|
||||||
|
|
||||||
|
-- Añadimos los gastos, para facilitar el formulario
|
||||||
|
UPDATE tmp.balance b
|
||||||
|
JOIN balanceNestTree bnt on bnt.id = b.id
|
||||||
|
JOIN expense e ON e.id = bnt.expenseFk COLLATE utf8_general_ci
|
||||||
|
SET b.expenseFk = e.id COLLATE utf8_general_ci,
|
||||||
|
b.expenseName = e.name COLLATE utf8_general_ci ;
|
||||||
|
|
||||||
|
-- Rellenamos los valores de primer nivel, los que corresponden
|
||||||
|
-- a los gastos simples.
|
||||||
|
WHILE vYears >= 0 DO
|
||||||
|
SET vQuery = CONCAT(
|
||||||
|
'UPDATE tmp.balance b
|
||||||
|
JOIN (
|
||||||
|
SELECT expenseFk, SUM(amount) amount
|
||||||
|
FROM tmp.balanceDetail
|
||||||
|
WHERE year = ?
|
||||||
|
GROUP BY expenseFk
|
||||||
|
) sub on sub.expenseFk = b.expenseFk COLLATE utf8_general_ci
|
||||||
|
SET ', util.quoteIdentifier(vCurYear - vYears), ' = - amount');
|
||||||
|
|
||||||
|
EXECUTE IMMEDIATE vQuery
|
||||||
|
USING vCurYear - vYears;
|
||||||
|
|
||||||
|
SET vYears = vYears - 1;
|
||||||
|
END WHILE;
|
||||||
|
|
||||||
|
-- Añadimos las ventas.
|
||||||
|
EXECUTE IMMEDIATE CONCAT(
|
||||||
|
'UPDATE tmp.balance b
|
||||||
|
JOIN (
|
||||||
|
SELECT SUM(IF(year = ?, venta, 0)) y2,
|
||||||
|
SUM(IF(year = ?, venta, 0)) y1,
|
||||||
|
SUM(IF(year = ?, venta, 0)) y0,
|
||||||
|
c.Gasto
|
||||||
|
FROM bs.ventas_contables c
|
||||||
|
JOIN tCompanyReceiving cr ON cr.companyFk = c.empresa_id
|
||||||
|
WHERE month BETWEEN ? AND ?
|
||||||
|
GROUP BY c.Gasto
|
||||||
|
) sub ON sub.gasto = b.expenseFk COLLATE utf8_general_ci
|
||||||
|
SET b.', vTwoYearsAgo, '= IFNULL(b.', vTwoYearsAgo, ', 0) + sub.y2,
|
||||||
|
b.', vOneYearAgo, '= IFNULL(b.', vOneYearAgo, ', 0) + sub.y1,
|
||||||
|
b.', vYear, '= IFNULL(b.', vYear, ', 0) + sub.y0')
|
||||||
|
USING vCurYear-2,
|
||||||
|
vCurYear-1,
|
||||||
|
vCurYear,
|
||||||
|
vStartingMonth,
|
||||||
|
vEndingMonth;
|
||||||
|
|
||||||
|
-- Ventas intra grupo.
|
||||||
|
IF NOT vInterGroupSalesIncluded THEN
|
||||||
|
|
||||||
|
SELECT lft, rgt INTO @groupLft, @groupRgt
|
||||||
|
FROM tmp.balance b
|
||||||
|
WHERE TRIM(b.`name`) = 'Grupo';
|
||||||
|
|
||||||
|
DELETE
|
||||||
|
FROM tmp.balance
|
||||||
|
WHERE lft BETWEEN @groupLft AND @groupRgt;
|
||||||
|
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
-- Rellenamos el valor de los padres con la suma de los hijos.
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tmp.balance_aux
|
||||||
|
SELECT * FROM tmp.balance;
|
||||||
|
|
||||||
|
EXECUTE IMMEDIATE
|
||||||
|
CONCAT('UPDATE tmp.balance b
|
||||||
|
JOIN (
|
||||||
|
SELECT b1.id,
|
||||||
|
b1.name,
|
||||||
|
SUM(b2.', vYear,') thisYear,
|
||||||
|
SUM(b2.', vOneYearAgo,') oneYearAgo,
|
||||||
|
SUM(b2.', vTwoYearsAgo,') twoYearsAgo
|
||||||
|
FROM tmp.nest b1
|
||||||
|
JOIN tmp.balance_aux b2 on b2.lft BETWEEN b1.lft and b1.rgt
|
||||||
|
GROUP BY b1.id
|
||||||
|
)sub ON sub.id = b.id
|
||||||
|
SET b.', vYear, ' = thisYear,
|
||||||
|
b.', vOneYearAgo, ' = oneYearAgo,
|
||||||
|
b.', vTwoYearsAgo, ' = twoYearsAgo');
|
||||||
|
|
||||||
|
SELECT *, CONCAT('',IFNULL(expenseFk,'')) newgasto
|
||||||
|
FROM tmp.balance;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tCompanyReceiving, tCompanyIssuing;
|
||||||
|
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -19,10 +19,10 @@ BEGIN
|
||||||
AND a.hasWeightVolumetric
|
AND a.hasWeightVolumetric
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.buysToCheck;
|
DROP TEMPORARY TABLE tmp.buysToCheck;
|
||||||
|
|
||||||
IF hasVolumetricAgency THEN
|
IF hasVolumetricAgency THEN
|
||||||
CALL util.throw('Some purchase line has an item without size or weight per stem in the volumetric agency.');
|
CALL util.throw('Item lacks size/weight in purchase line at agency');
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
|
@ -259,7 +259,7 @@ BEGIN
|
||||||
JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
|
JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
|
||||||
AND tcs.warehouseFk = tcc.warehouseFk
|
AND tcs.warehouseFk = tcc.warehouseFk
|
||||||
WHERE IFNULL(tcs.classRate, 1) = 1
|
WHERE IFNULL(tcs.classRate, 1) = 1
|
||||||
AND NOT tcc.groupingMode = 'packing'
|
AND (tcc.groupingMode = 'grouping' OR tcc.groupingMode IS NULL)
|
||||||
AND (tcc.packing > tcc.`grouping` OR tcc.groupingMode IS NULL)
|
AND (tcc.packing > tcc.`grouping` OR tcc.groupingMode IS NULL)
|
||||||
GROUP BY tcs.warehouseFk, tcs.itemFk;
|
GROUP BY tcs.warehouseFk, tcs.itemFk;
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,8 @@ BEGIN
|
||||||
|
|
||||||
DELETE e
|
DELETE e
|
||||||
FROM entry e
|
FROM entry e
|
||||||
JOIN tEntryToDelete tmp ON tmp.id = e.id;
|
JOIN tEntryToDelete tmp ON tmp.id = e.id
|
||||||
|
WHERE NOT e.isBooked;
|
||||||
|
|
||||||
-- borrar de route registros menores a 4 años
|
-- borrar de route registros menores a 4 años
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tRouteToDelete
|
CREATE OR REPLACE TEMPORARY TABLE tRouteToDelete
|
||||||
|
|
|
@ -52,6 +52,10 @@ BEGIN
|
||||||
|
|
||||||
SELECT LAST_INSERT_ID() INTO vSaleFk;
|
SELECT LAST_INSERT_ID() INTO vSaleFk;
|
||||||
|
|
||||||
|
UPDATE sale
|
||||||
|
SET originalQuantity = 0
|
||||||
|
WHERE id = vSaleFk;
|
||||||
|
|
||||||
CALL sale_calculateComponent(vSaleFk, NULL);
|
CALL sale_calculateComponent(vSaleFk, NULL);
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -30,10 +30,9 @@ BEGIN
|
||||||
-- Si hay colecciones sin terminar, sale del proceso
|
-- Si hay colecciones sin terminar, sale del proceso
|
||||||
CALL collection_get(vUserFk);
|
CALL collection_get(vUserFk);
|
||||||
|
|
||||||
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0
|
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0 INTO vHasTooMuchCollections
|
||||||
INTO vHasTooMuchCollections
|
FROM productionConfig pc
|
||||||
FROM tCollection
|
LEFT JOIN tCollection ON TRUE;
|
||||||
JOIN productionConfig pc;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tCollection;
|
DROP TEMPORARY TABLE tCollection;
|
||||||
|
|
||||||
|
@ -47,7 +46,7 @@ BEGIN
|
||||||
WHERE workerFk = vUserFk;
|
WHERE workerFk = vUserFk;
|
||||||
|
|
||||||
SET vLockName = CONCAT_WS('/',
|
SET vLockName = CONCAT_WS('/',
|
||||||
'collection_assign',
|
vLockName,
|
||||||
vWarehouseFk,
|
vWarehouseFk,
|
||||||
vItemPackingTypeFk
|
vItemPackingTypeFk
|
||||||
);
|
);
|
||||||
|
|
|
@ -63,7 +63,8 @@ BEGIN
|
||||||
o.numberOfWagons,
|
o.numberOfWagons,
|
||||||
o.trainFk,
|
o.trainFk,
|
||||||
o.linesLimit,
|
o.linesLimit,
|
||||||
o.volumeLimit
|
o.volumeLimit,
|
||||||
|
pc.collection_new_lockname
|
||||||
INTO vMaxTickets,
|
INTO vMaxTickets,
|
||||||
vHasUniqueCollectionTime,
|
vHasUniqueCollectionTime,
|
||||||
vWorkerCode,
|
vWorkerCode,
|
||||||
|
@ -73,14 +74,15 @@ BEGIN
|
||||||
vWagons,
|
vWagons,
|
||||||
vTrainFk,
|
vTrainFk,
|
||||||
vLinesLimit,
|
vLinesLimit,
|
||||||
vVolumeLimit
|
vVolumeLimit,
|
||||||
|
vLockName
|
||||||
FROM productionConfig pc
|
FROM productionConfig pc
|
||||||
JOIN worker w ON w.id = vUserFk
|
JOIN worker w ON w.id = vUserFk
|
||||||
JOIN state st ON st.`code` = 'ON_PREPARATION'
|
JOIN state st ON st.`code` = 'ON_PREPARATION'
|
||||||
JOIN operator o ON o.workerFk = vUserFk;
|
JOIN operator o ON o.workerFk = vUserFk;
|
||||||
|
|
||||||
SET vLockName = CONCAT_WS('/',
|
SET vLockName = CONCAT_WS('/',
|
||||||
'collection_new',
|
vLockName,
|
||||||
vWarehouseFk,
|
vWarehouseFk,
|
||||||
vItemPackingTypeFk
|
vItemPackingTypeFk
|
||||||
);
|
);
|
||||||
|
|
|
@ -28,8 +28,7 @@ BEGIN
|
||||||
JOIN entry e ON e.invoiceInFk = ii.id
|
JOIN entry e ON e.invoiceInFk = ii.id
|
||||||
JOIN duaEntry de ON de.entryFk = e.id
|
JOIN duaEntry de ON de.entryFk = e.id
|
||||||
JOIN dua d ON d.id = de.duaFk
|
JOIN dua d ON d.id = de.duaFk
|
||||||
SET ii.isBooked = TRUE,
|
SET ii.booked = IFNULL(ii.booked, d.booked),
|
||||||
ii.booked = IFNULL(ii.booked,d.booked),
|
|
||||||
ii.operated = IFNULL(ii.operated, d.operated),
|
ii.operated = IFNULL(ii.operated, d.operated),
|
||||||
ii.issued = IFNULL(ii.issued, d.issued),
|
ii.issued = IFNULL(ii.issued, d.issued),
|
||||||
ii.bookEntried = IFNULL(ii.bookEntried, d.bookEntried),
|
ii.bookEntried = IFNULL(ii.bookEntried, d.bookEntried),
|
||||||
|
@ -71,5 +70,9 @@ BEGIN
|
||||||
SET ASIEN = vASIEN
|
SET ASIEN = vASIEN
|
||||||
WHERE id = vDuaFk;
|
WHERE id = vDuaFk;
|
||||||
|
|
||||||
|
UPDATE invoiceIn ii
|
||||||
|
JOIN duaInvoiceIn dii ON dii.invoiceInFk = ii.id
|
||||||
|
SET ii.isBooked = TRUE
|
||||||
|
WHERE dii.duaFk = vDuaFk;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -15,7 +15,7 @@ BEGIN
|
||||||
FROM `entry`
|
FROM `entry`
|
||||||
WHERE id = vSelf;
|
WHERE id = vSelf;
|
||||||
|
|
||||||
IF vIsBooked AND NOT @isModeInventory THEN
|
IF vIsBooked AND NOT IFNULL(@isModeInventory, FALSE) THEN
|
||||||
CALL util.throw('Entry is already booked');
|
CALL util.throw('Entry is already booked');
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -68,19 +68,19 @@ BEGIN
|
||||||
AND v.`visible`
|
AND v.`visible`
|
||||||
ON DUPLICATE KEY UPDATE visibleLanding = v.`visible`;
|
ON DUPLICATE KEY UPDATE visibleLanding = v.`visible`;
|
||||||
|
|
||||||
CALL vn2008.availableTraslate(vWarehouseOut, vDateShipped, NULL);
|
CALL available_traslate(vWarehouseOut, vDateShipped, NULL);
|
||||||
|
|
||||||
INSERT INTO tItem(itemFk, available)
|
INSERT INTO tItem(itemFk, available)
|
||||||
SELECT a.item_id, a.available
|
SELECT a.item_id, a.available
|
||||||
FROM vn2008.availableTraslate a
|
FROM tmp.availableTraslate a
|
||||||
WHERE a.available
|
WHERE a.available
|
||||||
ON DUPLICATE KEY UPDATE available = a.available;
|
ON DUPLICATE KEY UPDATE available = a.available;
|
||||||
|
|
||||||
CALL vn2008.availableTraslate(vWarehouseIn, vDateLanded, vWarehouseOut);
|
CALL available_traslate(vWarehouseIn, vDateLanded, vWarehouseOut);
|
||||||
|
|
||||||
INSERT INTO tItem(itemFk, availableLanding)
|
INSERT INTO tItem(itemFk, availableLanding)
|
||||||
SELECT a.item_id, a.available
|
SELECT a.item_id, a.available
|
||||||
FROM vn2008.availableTraslate a
|
FROM tmp.availableTraslate a
|
||||||
WHERE a.available
|
WHERE a.available
|
||||||
ON DUPLICATE KEY UPDATE availableLanding = a.available;
|
ON DUPLICATE KEY UPDATE availableLanding = a.available;
|
||||||
ELSE
|
ELSE
|
||||||
|
|
|
@ -26,7 +26,7 @@ BEGIN
|
||||||
LEAVE l;
|
LEAVE l;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
CALL vn2008.buy_tarifas_entry(vEntryFk);
|
CALL buy_recalcPricesByEntry(vEntryFk);
|
||||||
END LOOP;
|
END LOOP;
|
||||||
|
|
||||||
CLOSE vCur;
|
CLOSE vCur;
|
||||||
|
|
|
@ -9,6 +9,14 @@ BEGIN
|
||||||
DECLARE vCurrencyName VARCHAR(25);
|
DECLARE vCurrencyName VARCHAR(25);
|
||||||
DECLARE vComission INT;
|
DECLARE vComission INT;
|
||||||
|
|
||||||
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
|
BEGIN
|
||||||
|
ROLLBACK;
|
||||||
|
RESIGNAL;
|
||||||
|
END;
|
||||||
|
|
||||||
|
START TRANSACTION;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.recalcEntryCommision
|
CREATE OR REPLACE TEMPORARY TABLE tmp.recalcEntryCommision
|
||||||
SELECT e.id
|
SELECT e.id
|
||||||
FROM vn.entry e
|
FROM vn.entry e
|
||||||
|
@ -28,6 +36,9 @@ BEGIN
|
||||||
WHERE id = vCurrency;
|
WHERE id = vCurrency;
|
||||||
|
|
||||||
CALL entry_recalc();
|
CALL entry_recalc();
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
SELECT util.notification_send(
|
SELECT util.notification_send(
|
||||||
'entry-update-comission',
|
'entry-update-comission',
|
||||||
JSON_OBJECT('currencyName', vCurrencyName, 'referenceCurrent', vComission),
|
JSON_OBJECT('currencyName', vCurrencyName, 'referenceCurrent', vComission),
|
||||||
|
|
|
@ -1,101 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`fv_pca`()
|
|
||||||
BEGIN
|
|
||||||
|
|
||||||
DECLARE done INT DEFAULT FALSE;
|
|
||||||
|
|
||||||
DECLARE vTicketFk INT;
|
|
||||||
DECLARE vSaleFk INT;
|
|
||||||
DECLARE vClonTicket INT DEFAULT 0;
|
|
||||||
|
|
||||||
DECLARE cur1 CURSOR FOR
|
|
||||||
SELECT s.ticketFk, s.id
|
|
||||||
FROM vn.sale s
|
|
||||||
JOIN vn.ticket t ON t.id = s.ticketFk
|
|
||||||
JOIN vn.item i ON i.id = s.itemFk
|
|
||||||
JOIN vn.itemType it ON it.id = i.typeFk
|
|
||||||
WHERE t.shipped BETWEEN '2020-10-18' AND '2020-10-31'
|
|
||||||
AND it.code IN ('ANT','ANS','ORQ','TRO')
|
|
||||||
and t.warehouseFk = 1;
|
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
|
||||||
|
|
||||||
OPEN cur1;
|
|
||||||
|
|
||||||
FETCH cur1 INTO vTicketFk, vSaleFk;
|
|
||||||
|
|
||||||
WHILE done = 0 DO
|
|
||||||
|
|
||||||
SELECT t.id INTO vClonTicket
|
|
||||||
FROM vn.ticket t
|
|
||||||
JOIN (SELECT addressFk, shipped FROM vn.ticket WHERE id = vTicketFk) sub USING(addressFk, shipped)
|
|
||||||
WHERE t.warehouseFk = 44
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
SELECT vTicketFk, vClonTicket;
|
|
||||||
|
|
||||||
IF vClonTicket = 0 THEN
|
|
||||||
|
|
||||||
INSERT INTO ticket (
|
|
||||||
clientFk,
|
|
||||||
shipped,
|
|
||||||
addressFk,
|
|
||||||
agencyModeFk,
|
|
||||||
nickname,
|
|
||||||
warehouseFk,
|
|
||||||
companyFk,
|
|
||||||
landed,
|
|
||||||
zoneFk,
|
|
||||||
zonePrice,
|
|
||||||
zoneBonus,
|
|
||||||
routeFk
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
clientFk,
|
|
||||||
shipped,
|
|
||||||
addressFk,
|
|
||||||
agencyModeFk,
|
|
||||||
nickname,
|
|
||||||
44,
|
|
||||||
companyFk,
|
|
||||||
landed,
|
|
||||||
zoneFk,
|
|
||||||
zonePrice,
|
|
||||||
zoneBonus,
|
|
||||||
routeFk
|
|
||||||
|
|
||||||
FROM ticket
|
|
||||||
WHERE id = vTicketFk;
|
|
||||||
|
|
||||||
SET vClonTicket = LAST_INSERT_ID();
|
|
||||||
|
|
||||||
SELECT 'lstID', vClonTicket;
|
|
||||||
/*
|
|
||||||
INSERT INTO ticketObservation(ticketFk, observationTypeFk, description)
|
|
||||||
SELECT vTicketFk, ao.observationTypeFk, ao.description
|
|
||||||
FROM addressObservation ao
|
|
||||||
JOIN ticket t ON t.addressFk = ao.addressFk
|
|
||||||
WHERE t.id = vClonTicket;
|
|
||||||
*/
|
|
||||||
INSERT INTO ticketLog
|
|
||||||
SET originFk = vTicketFk, userFk = account.myUser_getId(), `action` = 'insert',
|
|
||||||
description = CONCAT('Ha creado el ticket:', ' ', vClonTicket, ' clonando el ', vTicketFk);
|
|
||||||
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
UPDATE vn.sale
|
|
||||||
SET ticketFk = vClonTicket
|
|
||||||
WHERE id = vSaleFk;
|
|
||||||
|
|
||||||
SET vClonTicket = 0;
|
|
||||||
|
|
||||||
SET done = 0;
|
|
||||||
FETCH cur1 INTO vTicketFk, vSaleFk;
|
|
||||||
|
|
||||||
END WHILE;
|
|
||||||
|
|
||||||
CLOSE cur1;
|
|
||||||
|
|
||||||
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -94,15 +94,16 @@ BEGIN
|
||||||
SELECT id INTO vEntryFk
|
SELECT id INTO vEntryFk
|
||||||
FROM entry
|
FROM entry
|
||||||
WHERE supplierFk = vInventorySupplierFk
|
WHERE supplierFk = vInventorySupplierFk
|
||||||
AND travelFk = vTravelFk;
|
AND travelFk = vTravelFk
|
||||||
|
AND typeFk = 'inventory';
|
||||||
|
|
||||||
IF vEntryFk IS NULL THEN
|
IF vEntryFk IS NULL THEN
|
||||||
INSERT INTO entry
|
INSERT INTO entry
|
||||||
SET supplierFk = vInventorySupplierFk,
|
SET supplierFk = vInventorySupplierFk,
|
||||||
isConfirmed = TRUE,
|
isConfirmed = TRUE,
|
||||||
isOrdered = TRUE,
|
isOrdered = TRUE,
|
||||||
travelFk = vTravelFk;
|
travelFk = vTravelFk,
|
||||||
|
typeFk = 'inventory';
|
||||||
SELECT LAST_INSERT_ID() INTO vEntryFk;
|
SELECT LAST_INSERT_ID() INTO vEntryFk;
|
||||||
ELSE
|
ELSE
|
||||||
DELETE FROM buy WHERE entryFk = vEntryFk;
|
DELETE FROM buy WHERE entryFk = vEntryFk;
|
||||||
|
|
|
@ -10,8 +10,6 @@ BEGIN
|
||||||
DECLARE vLines INT;
|
DECLARE vLines INT;
|
||||||
DECLARE vHasDistinctTransactions INT;
|
DECLARE vHasDistinctTransactions INT;
|
||||||
|
|
||||||
CALL invoiceIn_checkBooked(vInvoiceInFk);
|
|
||||||
|
|
||||||
SELECT taxRowLimit INTO vTaxRowLimit FROM invoiceInConfig;
|
SELECT taxRowLimit INTO vTaxRowLimit FROM invoiceInConfig;
|
||||||
|
|
||||||
SELECT COUNT(*) INTO vLines
|
SELECT COUNT(*) INTO vLines
|
||||||
|
|
|
@ -5,8 +5,6 @@ BEGIN
|
||||||
DECLARE vDated DATE;
|
DECLARE vDated DATE;
|
||||||
DECLARE vExpenseFk VARCHAR(10);
|
DECLARE vExpenseFk VARCHAR(10);
|
||||||
|
|
||||||
CALL invoiceIn_checkBooked(vInvoiceInFk);
|
|
||||||
|
|
||||||
SELECT MAX(rr.dated) INTO vDated
|
SELECT MAX(rr.dated) INTO vDated
|
||||||
FROM referenceRate rr
|
FROM referenceRate rr
|
||||||
JOIN invoiceIn ii ON ii.id = vInvoiceInFk
|
JOIN invoiceIn ii ON ii.id = vInvoiceInFk
|
||||||
|
|
|
@ -20,17 +20,17 @@ BEGIN
|
||||||
GREATEST(0,iss.visible - IFNULL(sub3.transit,0)) as Altillo,
|
GREATEST(0,iss.visible - IFNULL(sub3.transit,0)) as Altillo,
|
||||||
s.id as saleFk,
|
s.id as saleFk,
|
||||||
IFNULL(sub3.transit,0) transit,
|
IFNULL(sub3.transit,0) transit,
|
||||||
v.visible, s.isPicked, s.reserved, t.shipped, tst.productionOrder, mm.Id_Movimiento
|
v.visible, s.isPicked, s.reserved, t.shipped, tst.productionOrder, st.saleFk
|
||||||
FROM vn.ticket t
|
FROM ticket t
|
||||||
JOIN vn.ticketState tst ON tst.ticketFk = t.id
|
JOIN ticketState tst ON tst.ticketFk = t.id
|
||||||
JOIN vn.sale s ON s.ticketFk = t.id
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
JOIN vn.item i ON i.id = s.itemFk
|
JOIN item i ON i.id = s.itemFk
|
||||||
JOIN cache.visible v ON s.itemFk = v.item_id AND v.calc_id = vVisibleCache
|
JOIN cache.visible v ON s.itemFk = v.item_id AND v.calc_id = vVisibleCache
|
||||||
LEFT JOIN vn2008.Movimientos_mark mm ON mm.Id_Movimiento = s.id AND mm.stateFk = 26
|
LEFT JOIN saleTracking st ON st.saleFk = s.id AND st.stateFk = 26
|
||||||
JOIN vn.itemShelvingStock iss ON iss.itemFk = v.item_id
|
JOIN itemShelvingStock iss ON iss.itemFk = v.item_id
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
(SELECT itemFk, sum(saldo) as transit
|
(SELECT itemFk, sum(saldo) as transit
|
||||||
FROM vn.itemPlacementSupplyList
|
FROM itemPlacementSupplyList
|
||||||
WHERE saldo > 0
|
WHERE saldo > 0
|
||||||
AND sectorFk = vSectorFk
|
AND sectorFk = vSectorFk
|
||||||
GROUP BY itemFk) sub3 ON sub3.itemFk = i.id
|
GROUP BY itemFk) sub3 ON sub3.itemFk = i.id
|
||||||
|
@ -42,7 +42,7 @@ BEGIN
|
||||||
AND tst.isPreviousPreparable = TRUE
|
AND tst.isPreviousPreparable = TRUE
|
||||||
AND t.warehouseFk = vWarehouseFk
|
AND t.warehouseFk = vWarehouseFk
|
||||||
AND iss.sectorFk = vSectorFk
|
AND iss.sectorFk = vSectorFk
|
||||||
AND mm.Id_Movimiento IS NULL
|
AND st.saleFk IS NULL
|
||||||
ORDER BY itemFk;
|
ORDER BY itemFk;
|
||||||
|
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -23,16 +23,6 @@ BEGIN
|
||||||
SET vPacking = COALESCE(vPacking, GREATEST(vn.itemPacking(vBarcode,vWarehouseFk), 1));
|
SET vPacking = COALESCE(vPacking, GREATEST(vn.itemPacking(vBarcode,vWarehouseFk), 1));
|
||||||
SET vQuantity = vQuantity * vPacking;
|
SET vQuantity = vQuantity * vPacking;
|
||||||
|
|
||||||
IF (SELECT COUNT(*) FROM shelving WHERE code = vShelvingFk COLLATE utf8_unicode_ci) = 0 THEN
|
|
||||||
|
|
||||||
INSERT IGNORE INTO parking(code) VALUES(vShelvingFk);
|
|
||||||
INSERT INTO shelving(code, parkingFk)
|
|
||||||
SELECT vShelvingFk, id
|
|
||||||
FROM parking
|
|
||||||
WHERE `code` = vShelvingFk COLLATE utf8_unicode_ci;
|
|
||||||
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF (SELECT COUNT(*) FROM itemShelving
|
IF (SELECT COUNT(*) FROM itemShelving
|
||||||
WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk
|
WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk
|
||||||
AND itemFk = vItemFk
|
AND itemFk = vItemFk
|
||||||
|
|
|
@ -101,9 +101,6 @@ BEGIN
|
||||||
DELETE FROM itemCost
|
DELETE FROM itemCost
|
||||||
WHERE itemFk = vItemOld;
|
WHERE itemFk = vItemOld;
|
||||||
|
|
||||||
DELETE FROM vn2008.rec_translator
|
|
||||||
WHERE Id_Article = vItemOld;
|
|
||||||
|
|
||||||
DELETE FROM bs.waste
|
DELETE FROM bs.waste
|
||||||
WHERE itemFk = vItemOld;
|
WHERE itemFk = vItemOld;
|
||||||
|
|
||||||
|
|
|
@ -155,30 +155,31 @@ BEGIN
|
||||||
SET @currentLineFk := 0;
|
SET @currentLineFk := 0;
|
||||||
SET @shipped := '';
|
SET @shipped := '';
|
||||||
|
|
||||||
SELECT DATE(@shipped:= shipped) shipped,
|
SELECT DATE(@shipped:= t.shipped) shipped,
|
||||||
alertLevel,
|
t.alertLevel,
|
||||||
stateName,
|
t.stateName,
|
||||||
origin,
|
t.origin,
|
||||||
reference,
|
t.reference,
|
||||||
clientFk,
|
t.clientFk,
|
||||||
name,
|
t.name,
|
||||||
`in` invalue,
|
t.`in` invalue,
|
||||||
`out`,
|
t.`out`,
|
||||||
@a := @a + IFNULL(`in`, 0) - IFNULL(`out`, 0) balance,
|
@a := @a + IFNULL(t.`in`, 0) - IFNULL(t.`out`, 0) balance,
|
||||||
@currentLineFk := IF (@shipped < util.VN_CURDATE()
|
@currentLineFk := IF (@shipped < util.VN_CURDATE()
|
||||||
OR (@shipped = util.VN_CURDATE() AND (isPicked OR a.`code` >= 'ON_PREPARATION')),
|
OR (@shipped = util.VN_CURDATE() AND (t.isPicked OR a.`code` >= 'ON_PREPARATION')),
|
||||||
lineFk,
|
t.lineFk,
|
||||||
@currentLineFk) lastPreparedLineFk,
|
@currentLineFk) lastPreparedLineFk,
|
||||||
isTicket,
|
t.isTicket,
|
||||||
lineFk,
|
t.lineFk,
|
||||||
isPicked,
|
t.isPicked,
|
||||||
clientType,
|
t.clientType,
|
||||||
claimFk
|
t.claimFk,
|
||||||
FROM tItemDiary
|
t.`order`
|
||||||
LEFT JOIN alertLevel a ON a.id = tItemDiary.alertLevel;
|
FROM tItemDiary t
|
||||||
|
LEFT JOIN alertLevel a ON a.id = t.alertLevel;
|
||||||
|
|
||||||
ELSE
|
ELSE
|
||||||
SELECT SUM(`in`) - SUM(`out`) INTO @a
|
SELECT IFNULL(SUM(IFNULL(`in`, 0)) - SUM(IFNULL(`out`, 0)), 0) INTO @a
|
||||||
FROM tItemDiary
|
FROM tItemDiary
|
||||||
WHERE shipped < vDate;
|
WHERE shipped < vDate;
|
||||||
|
|
||||||
|
@ -197,7 +198,8 @@ BEGIN
|
||||||
0 lineFk,
|
0 lineFk,
|
||||||
0 isPicked,
|
0 isPicked,
|
||||||
0 clientType,
|
0 clientType,
|
||||||
0 claimFk
|
0 claimFk,
|
||||||
|
NULL `order`
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT shipped,
|
SELECT shipped,
|
||||||
alertlevel,
|
alertlevel,
|
||||||
|
@ -213,7 +215,8 @@ BEGIN
|
||||||
lineFk,
|
lineFk,
|
||||||
isPicked,
|
isPicked,
|
||||||
clientType,
|
clientType,
|
||||||
claimFk
|
claimFk,
|
||||||
|
`order`
|
||||||
FROM tItemDiary
|
FROM tItemDiary
|
||||||
WHERE shipped >= vDate;
|
WHERE shipped >= vDate;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
|
@ -21,9 +21,6 @@ BEGIN
|
||||||
|
|
||||||
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDated);
|
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDated);
|
||||||
|
|
||||||
-- Añadido temporalmente para ver si ya no sucede el cuelgue de db
|
|
||||||
SET vShowType = TRUE;
|
|
||||||
|
|
||||||
WITH itemTags AS (
|
WITH itemTags AS (
|
||||||
SELECT i.id,
|
SELECT i.id,
|
||||||
typeFk,
|
typeFk,
|
||||||
|
@ -82,7 +79,7 @@ BEGIN
|
||||||
AND iss.warehouseFk = vWarehouseFk
|
AND iss.warehouseFk = vWarehouseFk
|
||||||
JOIN itemTags its
|
JOIN itemTags its
|
||||||
WHERE a.available > 0
|
WHERE a.available > 0
|
||||||
AND IF(vShowType, i.typeFk = its.typeFk, TRUE)
|
AND (i.typeFk = its.typeFk OR NOT vShowType)
|
||||||
AND i.id <> vSelf
|
AND i.id <> vSelf
|
||||||
ORDER BY `counter` DESC,
|
ORDER BY `counter` DESC,
|
||||||
(t.name = its.name) DESC,
|
(t.name = its.name) DESC,
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`packingListPrinted`(ticketFk INT)
|
|
||||||
BEGIN
|
|
||||||
|
|
||||||
UPDATE vn2008.Movimientos_mark mm
|
|
||||||
JOIN vn2008.Movimientos m ON m.Id_Movimiento = mm.Id_Movimiento
|
|
||||||
SET mm.valor = 2 -- Impreso
|
|
||||||
WHERE mm.valor = 1 -- Listo para imprimir
|
|
||||||
AND mm.stateFk = 9 -- Encajando
|
|
||||||
AND m.Id_Ticket = ticketFk;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -5,14 +5,14 @@ BEGIN
|
||||||
DECLARE valueFk INT;
|
DECLARE valueFk INT;
|
||||||
DECLARE encajando INT DEFAULT 9;
|
DECLARE encajando INT DEFAULT 9;
|
||||||
|
|
||||||
SELECT valor INTO valueFk
|
SELECT isChecked INTO valueFk
|
||||||
FROM vn2008.Movimientos_mark
|
FROM saleTracking
|
||||||
WHERE Id_Movimiento = saleFk
|
WHERE saleFk = saleFk
|
||||||
AND stateFk = encajando;
|
AND stateFk = encajando;
|
||||||
|
|
||||||
SET valueFk = (IFNULL(valueFk,0) + 1) MOD 3;
|
SET valueFk = (IFNULL(valueFk,0) + 1) MOD 3;
|
||||||
|
|
||||||
REPLACE vn2008.Movimientos_mark(Id_Movimiento, valor, Id_Trabajador, stateFk)
|
REPLACE saleTracking(saleFk, isChecked, workerFk, stateFk)
|
||||||
VALUES(saleFk,valueFk,account.myUser_getId(),encajando);
|
VALUES(saleFk,valueFk,account.myUser_getId(),encajando);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,74 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`recipe_Cook`(vItemFk INT, vBunchesQuantity INT, vDate DATE)
|
|
||||||
BEGIN
|
|
||||||
|
|
||||||
DECLARE vCalc INT;
|
|
||||||
DECLARE vWarehouseFk INT DEFAULT 1; -- Silla FV
|
|
||||||
|
|
||||||
SET @element := '';
|
|
||||||
SET @counter := 0;
|
|
||||||
|
|
||||||
CALL cache.available_refresh(vCalc, FALSE, vWarehouseFk, vDate);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.recipeCook;
|
|
||||||
|
|
||||||
CREATE TEMPORARY TABLE tmp.recipeCook
|
|
||||||
SELECT *,
|
|
||||||
@counter := IF(@element = element COLLATE utf8_general_ci , @counter + 1, 1) as counter,
|
|
||||||
@element := element COLLATE utf8_general_ci
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
SELECT i.id itemFk,
|
|
||||||
CONCAT(i.longName, ' (ref: ',i.id,')') longName,
|
|
||||||
i.size,
|
|
||||||
i.inkFk,
|
|
||||||
a.available,
|
|
||||||
r.element,
|
|
||||||
vBunchesQuantity * r.quantity as quantity,
|
|
||||||
r.itemFk as bunchItemFk,
|
|
||||||
IFNULL((i.inkFk = r.inkFk ) ,0)
|
|
||||||
+ IFNULL((i.size = r.size) ,0)
|
|
||||||
+ IFNULL((i.name LIKE CONCAT('%',r.name,'%')) ,0)
|
|
||||||
+ IFNULL((i.longName LIKE CONCAT('%',r.longName,'%')),0)
|
|
||||||
+ IFNULL((i.typeFk = r.typeFk),0) as matches,
|
|
||||||
i.typeFk,
|
|
||||||
rl.previousSelected
|
|
||||||
FROM vn.recipe r
|
|
||||||
JOIN vn.item i ON (IFNULL(i.name LIKE CONCAT('%',r.name,'%'), 0)
|
|
||||||
OR IFNULL(i.longName LIKE CONCAT('%',r.longName,'%'),0))
|
|
||||||
OR i.typeFk <=> r.typeFk
|
|
||||||
JOIN cache.available a ON a.item_id = i.id AND a.calc_id = vCalc
|
|
||||||
LEFT JOIN (SELECT recipe_ItemFk, element as log_element, selected_ItemFk, count(*) as previousSelected
|
|
||||||
FROM vn.recipe_log
|
|
||||||
GROUP BY recipe_ItemFk, element, selected_ItemFk) rl ON rl.recipe_ItemFk = r.itemFk
|
|
||||||
AND rl.log_element = r.element
|
|
||||||
AND rl.selected_ItemFk = i.id
|
|
||||||
WHERE r.itemFk = vItemFk
|
|
||||||
AND a.available > vBunchesQuantity * r.quantity
|
|
||||||
UNION ALL
|
|
||||||
SELECT 100 itemFk,
|
|
||||||
CONCAT('? ',r.element,' ',IFNULL(r.size,''),' ',IFNULL(r.inkFk,'')) as longName,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
r.element,
|
|
||||||
vBunchesQuantity * r.quantity as quantity,
|
|
||||||
r.itemFk as bunchItemFk,
|
|
||||||
-1 as matches,
|
|
||||||
r.typeFk,
|
|
||||||
NULL
|
|
||||||
FROM vn.recipe r
|
|
||||||
WHERE r.itemFk = vItemFk
|
|
||||||
GROUP BY r.element
|
|
||||||
) sub
|
|
||||||
|
|
||||||
ORDER BY element, matches DESC, previousSelected DESC;
|
|
||||||
|
|
||||||
SELECT *
|
|
||||||
FROM tmp.recipeCook
|
|
||||||
WHERE counter < 6
|
|
||||||
OR itemFk = 100
|
|
||||||
;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -79,6 +79,10 @@ BEGIN
|
||||||
ORDER BY (vQuantity % `grouping`) ASC
|
ORDER BY (vQuantity % `grouping`) ASC
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
|
|
||||||
|
IF vNewPrice IS NULL THEN
|
||||||
|
CALL util.throw('price retrieval failed');
|
||||||
|
END IF;
|
||||||
|
|
||||||
IF vNewPrice > vOldPrice THEN
|
IF vNewPrice > vOldPrice THEN
|
||||||
SET vFinalPrice = vOldPrice;
|
SET vFinalPrice = vOldPrice;
|
||||||
SET vOption = 'substitution';
|
SET vOption = 'substitution';
|
||||||
|
@ -90,7 +94,8 @@ BEGIN
|
||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
|
||||||
UPDATE sale
|
UPDATE sale
|
||||||
SET quantity = quantity - vQuantity
|
SET originalQuantity = quantity - vQuantity,
|
||||||
|
quantity = quantity - vQuantity
|
||||||
WHERE id = vSaleFk;
|
WHERE id = vSaleFk;
|
||||||
|
|
||||||
INSERT INTO vn.sale(ticketFk,
|
INSERT INTO vn.sale(ticketFk,
|
||||||
|
@ -100,7 +105,8 @@ BEGIN
|
||||||
price)
|
price)
|
||||||
SELECT vTicketFk,
|
SELECT vTicketFk,
|
||||||
vNewItemFk,
|
vNewItemFk,
|
||||||
CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, CONCAT('+ ', i.name),
|
CEIL(vQuantity / vRoundQuantity) * vRoundQuantity,
|
||||||
|
CONCAT('+ ', i.name),
|
||||||
vFinalPrice
|
vFinalPrice
|
||||||
FROM vn.item i
|
FROM vn.item i
|
||||||
WHERE id = vNewItemFk;
|
WHERE id = vNewItemFk;
|
||||||
|
|
|
@ -29,7 +29,7 @@ BEGIN
|
||||||
FROM sale
|
FROM sale
|
||||||
WHERE ticketFk = vTicketNew AND price > 0;
|
WHERE ticketFk = vTicketNew AND price > 0;
|
||||||
|
|
||||||
CALL sale_recalcComponent('imbalance');
|
CALL sale_recalcComponent('buyerDiscount');
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.recalculateSales;
|
DROP TEMPORARY TABLE IF EXISTS tmp.recalculateSales;
|
||||||
|
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketRequest_Add`(vDescription VARCHAR(255), vQuantity INT, vPrice DOUBLE, vTicketFk INT, vBuyerCode VARCHAR(3))
|
|
||||||
BEGIN
|
|
||||||
|
|
||||||
INSERT INTO vn.ticketRequest(description,
|
|
||||||
quantity,
|
|
||||||
price,
|
|
||||||
ticketFk,
|
|
||||||
buyerCode,
|
|
||||||
requesterFk)
|
|
||||||
VALUES(vDescription,
|
|
||||||
vQuantity,
|
|
||||||
vPrice,
|
|
||||||
vTicketFk,
|
|
||||||
vBuyerCode,
|
|
||||||
vn.getUser());
|
|
||||||
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -8,38 +8,14 @@ BEGIN
|
||||||
* @param vDateToAdvance Fecha a cuando se quiere adelantar.
|
* @param vDateToAdvance Fecha a cuando se quiere adelantar.
|
||||||
* @param vWarehouseFk Almacén
|
* @param vWarehouseFk Almacén
|
||||||
*/
|
*/
|
||||||
DECLARE vDateInventory DATE;
|
|
||||||
|
|
||||||
SELECT inventoried INTO vDateInventory FROM config;
|
CALL item_getStock(vWarehouseFk, vDateToAdvance, NULL);
|
||||||
|
CALL item_getMinacum(
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.stock
|
vWarehouseFk,
|
||||||
(itemFk INT PRIMARY KEY,
|
vDateToAdvance,
|
||||||
amount INT)
|
DATEDIFF(DATE_SUB(vDateFuture, INTERVAL 1 DAY), vDateToAdvance),
|
||||||
ENGINE = MEMORY;
|
NULL
|
||||||
|
);
|
||||||
INSERT INTO tmp.stock(itemFk, amount)
|
|
||||||
SELECT itemFk, SUM(quantity) amount FROM
|
|
||||||
(
|
|
||||||
SELECT itemFk, quantity
|
|
||||||
FROM itemTicketOut
|
|
||||||
WHERE shipped >= vDateInventory
|
|
||||||
AND shipped < vDateFuture
|
|
||||||
AND warehouseFk = vWarehouseFk
|
|
||||||
UNION ALL
|
|
||||||
SELECT itemFk, quantity
|
|
||||||
FROM itemEntryIn
|
|
||||||
WHERE landed >= vDateInventory
|
|
||||||
AND landed <= vDateToAdvance
|
|
||||||
AND isVirtualStock = FALSE
|
|
||||||
AND warehouseInFk = vWarehouseFk
|
|
||||||
UNION ALL
|
|
||||||
SELECT itemFk, quantity
|
|
||||||
FROM itemEntryOut
|
|
||||||
WHERE shipped >= vDateInventory
|
|
||||||
AND shipped < vDateFuture
|
|
||||||
AND warehouseOutFk = vWarehouseFk
|
|
||||||
) t
|
|
||||||
GROUP BY itemFk HAVING amount != 0;
|
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.filter
|
CREATE OR REPLACE TEMPORARY TABLE tmp.filter
|
||||||
(INDEX (id))
|
(INDEX (id))
|
||||||
|
@ -87,7 +63,7 @@ BEGIN
|
||||||
count(s.id) futureLines,
|
count(s.id) futureLines,
|
||||||
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt,
|
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt,
|
||||||
CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters,
|
CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters,
|
||||||
SUM((s.quantity <= IFNULL(st.amount,0))) hasStock,
|
SUM(s.quantity <= (IFNULL(il.stock,0) + IFNULL(im.amount, 0))) hasStock,
|
||||||
z.id futureZoneFk,
|
z.id futureZoneFk,
|
||||||
z.name futureZoneName,
|
z.name futureZoneName,
|
||||||
st.classColor,
|
st.classColor,
|
||||||
|
@ -107,7 +83,9 @@ BEGIN
|
||||||
JOIN agencyMode am ON t.agencyModeFk = am.id
|
JOIN agencyMode am ON t.agencyModeFk = am.id
|
||||||
JOIN zone z ON t.zoneFk = z.id
|
JOIN zone z ON t.zoneFk = z.id
|
||||||
LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
|
LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
|
||||||
LEFT JOIN tmp.stock st ON st.itemFk = i.id
|
LEFT JOIN tmp.itemMinacum im ON im.itemFk = i.id
|
||||||
|
AND im.warehouseFk = vWarehouseFk
|
||||||
|
LEFT JOIN tmp.itemList il ON il.itemFk = i.id
|
||||||
WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture)
|
WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture)
|
||||||
AND t.warehouseFk = vWarehouseFk
|
AND t.warehouseFk = vWarehouseFk
|
||||||
GROUP BY t.id
|
GROUP BY t.id
|
||||||
|
@ -146,6 +124,8 @@ BEGIN
|
||||||
) dest ON dest.addressFk = origin.addressFk
|
) dest ON dest.addressFk = origin.addressFk
|
||||||
WHERE origin.hasStock;
|
WHERE origin.hasStock;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.stock;
|
DROP TEMPORARY TABLE IF EXISTS
|
||||||
|
tmp.itemList,
|
||||||
|
tmp.itemMinacum;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -63,7 +63,7 @@ BEGIN
|
||||||
INSERT INTO ticketPackaging (ticketFk, packagingFk, quantity)
|
INSERT INTO ticketPackaging (ticketFk, packagingFk, quantity)
|
||||||
(SELECT vCurTicketFk, p.id, COUNT(*)
|
(SELECT vCurTicketFk, p.id, COUNT(*)
|
||||||
FROM expedition e
|
FROM expedition e
|
||||||
JOIN packaging p ON p.itemFk = e.freightItemFk
|
JOIN packaging p ON p.id = e.packagingFk
|
||||||
WHERE e.ticketFk = vCurTicketFk AND p.isPackageReturnable
|
WHERE e.ticketFk = vCurTicketFk AND p.isPackageReturnable
|
||||||
AND vWithPackage
|
AND vWithPackage
|
||||||
GROUP BY p.itemFk);
|
GROUP BY p.itemFk);
|
||||||
|
|
|
@ -7,7 +7,7 @@ BEGIN
|
||||||
*
|
*
|
||||||
* @param vSelf El id del ticket
|
* @param vSelf El id del ticket
|
||||||
*/
|
*/
|
||||||
DECLARE vCmrFk, vPreviousCmrFk, vCurrentCmrFk INT;
|
DECLARE vCmrFk INT;
|
||||||
SELECT cmrFk INTO vCmrFk
|
SELECT cmrFk INTO vCmrFk
|
||||||
FROM ticket
|
FROM ticket
|
||||||
WHERE id = vSelf;
|
WHERE id = vSelf;
|
||||||
|
@ -44,8 +44,6 @@ BEGIN
|
||||||
AND t.id = vSelf
|
AND t.id = vSelf
|
||||||
GROUP BY t.id;
|
GROUP BY t.id;
|
||||||
|
|
||||||
START TRANSACTION;
|
|
||||||
|
|
||||||
IF vCmrFk THEN
|
IF vCmrFk THEN
|
||||||
UPDATE cmr c
|
UPDATE cmr c
|
||||||
JOIN tTicket t
|
JOIN tTicket t
|
||||||
|
@ -58,8 +56,6 @@ BEGIN
|
||||||
c.ead = t.landed
|
c.ead = t.landed
|
||||||
WHERE id = vCmrFk;
|
WHERE id = vCmrFk;
|
||||||
ELSE
|
ELSE
|
||||||
SELECT MAX(id) INTO vPreviousCmrFk FROM cmr;
|
|
||||||
|
|
||||||
INSERT INTO cmr (
|
INSERT INTO cmr (
|
||||||
senderInstruccions,
|
senderInstruccions,
|
||||||
truckPlate,
|
truckPlate,
|
||||||
|
@ -71,16 +67,13 @@ BEGIN
|
||||||
)
|
)
|
||||||
SELECT * FROM tTicket;
|
SELECT * FROM tTicket;
|
||||||
|
|
||||||
SELECT MAX(id) INTO vCurrentCmrFk FROM cmr;
|
IF (SELECT EXISTS(SELECT * FROM tTicket)) THEN
|
||||||
|
|
||||||
IF vPreviousCmrFk <> vCurrentCmrFk THEN
|
|
||||||
UPDATE ticket
|
UPDATE ticket
|
||||||
SET cmrFk = vCurrentCmrFk
|
SET cmrFk = LAST_INSERT_ID()
|
||||||
WHERE id = vSelf;
|
WHERE id = vSelf;
|
||||||
END IF;
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
DROP TEMPORARY TABLE tTicket;
|
DROP TEMPORARY TABLE tTicket;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_doRecalc`()
|
|
||||||
proc: BEGIN
|
|
||||||
/**
|
|
||||||
* Recalculates modified ticket.
|
|
||||||
*/
|
|
||||||
DECLARE vDone BOOL;
|
|
||||||
DECLARE vTicketFk INT;
|
|
||||||
|
|
||||||
DECLARE cCur CURSOR FOR
|
|
||||||
SELECT DISTINCT ticketFk FROM tTicket;
|
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
|
||||||
SET vDone = TRUE;
|
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
DO RELEASE_LOCK('vn.ticket_doRecalc');
|
|
||||||
ROLLBACK;
|
|
||||||
RESIGNAL;
|
|
||||||
END;
|
|
||||||
|
|
||||||
IF !GET_LOCK('vn.ticket_doRecalc', 0) THEN
|
|
||||||
LEAVE proc;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tTicket;
|
|
||||||
CREATE TEMPORARY TABLE tTicket
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT id, ticketFk FROM ticketRecalc;
|
|
||||||
|
|
||||||
OPEN cCur;
|
|
||||||
|
|
||||||
myLoop: LOOP
|
|
||||||
SET vDone = FALSE;
|
|
||||||
FETCH cCur INTO vTicketFk;
|
|
||||||
|
|
||||||
IF vDone THEN
|
|
||||||
LEAVE myLoop;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL ticket_recalc(vTicketFk, NULL);
|
|
||||||
END LOOP;
|
|
||||||
|
|
||||||
CLOSE cCur;
|
|
||||||
|
|
||||||
DELETE tr FROM ticketRecalc tr JOIN tTicket t ON tr.id = t.id;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tTicket;
|
|
||||||
|
|
||||||
DO RELEASE_LOCK('vn.ticket_doRecalc');
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -21,7 +21,7 @@ BEGIN
|
||||||
WHERE t.id = vTicketFk;
|
WHERE t.id = vTicketFk;
|
||||||
|
|
||||||
-- Añadimos un dia más para calcular el stock hasta vNewShipped inclusive
|
-- Añadimos un dia más para calcular el stock hasta vNewShipped inclusive
|
||||||
CALL item_getStock(vWarehouseFk, DATE_ADD(vNewShipped, INTERVAL 1 DAY), NULL);
|
CALL item_getStock(vWarehouseFk, vNewShipped, NULL);
|
||||||
CALL item_getMinacum(
|
CALL item_getMinacum(
|
||||||
vWarehouseFk,
|
vWarehouseFk,
|
||||||
vNewShipped,
|
vNewShipped,
|
||||||
|
@ -38,7 +38,7 @@ BEGIN
|
||||||
s.discount,
|
s.discount,
|
||||||
i.image,
|
i.image,
|
||||||
i.subName,
|
i.subName,
|
||||||
il.stock + IFNULL(im.amount, 0) AS movable
|
IFNULL(il.stock,0) + IFNULL(im.amount, 0) AS movable
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
JOIN sale s ON s.ticketFk = t.id
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
JOIN item i ON i.id = s.itemFk
|
JOIN item i ON i.id = s.itemFk
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_recalcByScope`(
|
||||||
|
vScope VARCHAR(255),
|
||||||
|
vId INT
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Recalculates tickets in an scope.
|
||||||
|
*
|
||||||
|
* @param vScope The scope name
|
||||||
|
* @param vId The scope id
|
||||||
|
*/
|
||||||
|
DECLARE vDone BOOL;
|
||||||
|
DECLARE vTicketFk INT;
|
||||||
|
|
||||||
|
DECLARE cTickets CURSOR FOR
|
||||||
|
SELECT id FROM ticket
|
||||||
|
WHERE refFk IS NULL
|
||||||
|
AND ((vScope = 'client' AND clientFk = vId)
|
||||||
|
OR (vScope = 'address' AND addressFk = vId));
|
||||||
|
|
||||||
|
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
||||||
|
SET vDone = TRUE;
|
||||||
|
|
||||||
|
OPEN cTickets;
|
||||||
|
|
||||||
|
myLoop: LOOP
|
||||||
|
SET vDone = FALSE;
|
||||||
|
FETCH cTickets INTO vTicketFk;
|
||||||
|
|
||||||
|
IF vDone THEN
|
||||||
|
LEAVE myLoop;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
CALL ticket_recalc(vTicketFk, NULL);
|
||||||
|
END LOOP;
|
||||||
|
|
||||||
|
CLOSE cTickets;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -1,15 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_requestRecalc`(vSelf INT)
|
|
||||||
proc: BEGIN
|
|
||||||
/**
|
|
||||||
* Adds a request to recalculate the ticket total.
|
|
||||||
*
|
|
||||||
* @param vSelf The ticket identifier
|
|
||||||
*/
|
|
||||||
IF vSelf IS NULL THEN
|
|
||||||
LEAVE proc;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
INSERT INTO ticketRecalc SET ticketFk = vSelf;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,34 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_doRecalc`()
|
|
||||||
proc: BEGIN
|
|
||||||
/**
|
|
||||||
* Recounts the number of entries of changed travels.
|
|
||||||
*/
|
|
||||||
DECLARE vTravelFk INT;
|
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
DO RELEASE_LOCK('vn.ticket_doRecalc');
|
|
||||||
END;
|
|
||||||
|
|
||||||
IF !GET_LOCK('vn.travel_doRecalc', 0) THEN
|
|
||||||
LEAVE proc;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tTravel
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT travelFk FROM travelRecalc;
|
|
||||||
|
|
||||||
UPDATE travel t
|
|
||||||
JOIN tTravel tt ON tt.travelFk = t.id
|
|
||||||
SET t.totalEntries = (
|
|
||||||
SELECT COUNT(e.id)
|
|
||||||
FROM entry e
|
|
||||||
WHERE e.travelFk = t.id
|
|
||||||
);
|
|
||||||
|
|
||||||
DELETE tr FROM travelRecalc tr JOIN tTravel t ON tr.travelFk = t.travelFk;
|
|
||||||
DROP TEMPORARY TABLE tTravel;
|
|
||||||
DO RELEASE_LOCK('vn.travel_doRecalc');
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_recalc`(vSelf INT)
|
||||||
|
proc: BEGIN
|
||||||
|
/**
|
||||||
|
* Updates the number of entries assigned to the travel.
|
||||||
|
*
|
||||||
|
* @param vSelf The travel id
|
||||||
|
*/
|
||||||
|
UPDATE travel
|
||||||
|
SET totalEntries = (
|
||||||
|
SELECT COUNT(id)
|
||||||
|
FROM entry
|
||||||
|
WHERE travelFk = vSelf
|
||||||
|
)
|
||||||
|
WHERE id = vSelf;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -1,15 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_requestRecalc`(vSelf INT)
|
|
||||||
proc: BEGIN
|
|
||||||
/**
|
|
||||||
* Adds a request to recount the number of entries for the travel.
|
|
||||||
*
|
|
||||||
* @param vSelf The travel reference
|
|
||||||
*/
|
|
||||||
IF vSelf IS NULL THEN
|
|
||||||
LEAVE proc;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
INSERT IGNORE INTO travelRecalc SET travelFk = vSelf;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -121,15 +121,17 @@ BEGIN
|
||||||
CALL util.throw(vErrorCode);
|
CALL util.throw(vErrorCode);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
|
||||||
-- DIRECCION CORRECTA
|
-- DIRECCION CORRECTA
|
||||||
CALL workerTimeControl_direction(vWorkerFk, vTimed);
|
CALL workerTimeControl_direction(vWorkerFk, vTimed);
|
||||||
IF (SELECT
|
IF (SELECT
|
||||||
IF(IF(option1 IN ('inMiddle', 'outMiddle'),
|
IF((IF(option1 IN ('inMiddle', 'outMiddle'),
|
||||||
'middle',
|
'middle',
|
||||||
option1) <> vDirection
|
option1) <> vDirection
|
||||||
AND IF(option2 IN ('inMiddle', 'outMiddle'),
|
AND IF(option2 IN ('inMiddle', 'outMiddle'),
|
||||||
'middle',
|
'middle',
|
||||||
IFNULL(option2, '')) <> vDirection,
|
IFNULL(option2, '')) <> vDirection)
|
||||||
|
OR (option1 IS NULL AND option2 IS NULL),
|
||||||
TRUE ,
|
TRUE ,
|
||||||
FALSE)
|
FALSE)
|
||||||
FROM tmp.workerTimeControlDirection
|
FROM tmp.workerTimeControlDirection
|
||||||
|
@ -137,12 +139,17 @@ BEGIN
|
||||||
SET vIsError = TRUE;
|
SET vIsError = TRUE;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.workerTimeControlDirection;
|
|
||||||
IF vIsError THEN
|
IF vIsError THEN
|
||||||
SET vErrorCode = 'WRONG_DIRECTION';
|
SET vErrorCode = 'WRONG_DIRECTION';
|
||||||
|
IF(SELECT option1 IS NULL AND option2 IS NULL
|
||||||
|
FROM tmp.workerTimeControlDirection) THEN
|
||||||
|
|
||||||
|
SET vErrorCode = 'DAY_MAX_TIME';
|
||||||
|
END IF;
|
||||||
CALL util.throw(vErrorCode);
|
CALL util.throw(vErrorCode);
|
||||||
END IF;
|
END IF;
|
||||||
|
DROP TEMPORARY TABLE tmp.workerTimeControlDirection;
|
||||||
-- FICHADAS IMPARES
|
-- FICHADAS IMPARES
|
||||||
SELECT timed INTO vLastIn
|
SELECT timed INTO vLastIn
|
||||||
FROM workerTimeControl
|
FROM workerTimeControl
|
||||||
|
|
|
@ -26,7 +26,7 @@ BEGIN
|
||||||
FROM workerTimeControl
|
FROM workerTimeControl
|
||||||
WHERE userFk = vWorkerFk
|
WHERE userFk = vWorkerFk
|
||||||
AND direction = 'middle'
|
AND direction = 'middle'
|
||||||
AND timed BETWEEN vLastIn AND util.VN_NOW();
|
AND timed BETWEEN vLastIn AND vTimed;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlDirection;
|
DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlDirection;
|
||||||
CREATE TEMPORARY TABLE tmp.workerTimeControlDirection
|
CREATE TEMPORARY TABLE tmp.workerTimeControlDirection
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue