diff --git a/Jenkinsfile b/Jenkinsfile index d508da8bf..821316c87 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -235,11 +235,12 @@ pipeline { if (index != -1) message = message.substring(0, index) + setEnv() rocketSend( channel: 'vn-database', message: "*DB version uploaded:* ${message}" +"\n$COMMITTER_EMAIL ($BRANCH_NAME)" - +"\n$GIT_URL/commit/$GIT_COMMIT", + +"\n$RUN_DISPLAY_URL", rawMessage: true ) } diff --git a/back/methods/dms/uploadFile.js b/back/methods/dms/uploadFile.js index 8456cf2d3..9748b8225 100644 --- a/back/methods/dms/uploadFile.js +++ b/back/methods/dms/uploadFile.js @@ -88,7 +88,7 @@ module.exports = Self => { warehouseFk: args.warehouseId, reference: args.reference, description: args.description, - contentType: args.contentType, + contentType: uploadedFile.type, hasFile: args.hasFile }; const extension = await models.DmsContainer.getFileExtension(uploadedFile.name); diff --git a/back/methods/mrw-config/cancelShipment.ejs b/back/methods/mrw-config/cancelShipment.ejs new file mode 100644 index 000000000..9ef401bc8 --- /dev/null +++ b/back/methods/mrw-config/cancelShipment.ejs @@ -0,0 +1,20 @@ + + + + <%= mrw.franchiseCode %> + <%= mrw.subscriberCode %> + + <%= mrw.user %> + <%= mrw.password %> + + + + + + + <%= externalId %> + + + + + \ No newline at end of file diff --git a/back/methods/mrw-config/cancelShipment.js b/back/methods/mrw-config/cancelShipment.js new file mode 100644 index 000000000..218b6a96b --- /dev/null +++ b/back/methods/mrw-config/cancelShipment.js @@ -0,0 +1,46 @@ +const axios = require('axios'); +const fs = require('fs'); +const ejs = require('ejs'); +const {DOMParser} = require('xmldom'); + +module.exports = Self => { + Self.remoteMethod('cancelShipment', { + description: 'Cancel a shipment by providing the expedition ID, interacting with MRW WebService', + accessType: 'WRITE', + accepts: [{ + arg: 'expeditionFk', + type: 'number', + required: true + }], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/cancelShipment`, + verb: 'POST' + } + }); + + Self.cancelShipment = async expeditionFk => { + const models = Self.app.models; + + const mrw = await models.MrwConfig.findOne(); + const {externalId} = await models.Expedition.findById(expeditionFk); + + const template = fs.readFileSync(__dirname + '/cancelShipment.ejs', 'utf-8'); + const renderedXml = ejs.render(template, {mrw, externalId}); + const response = await axios.post(mrw.url, renderedXml, { + headers: { + 'Content-Type': 'application/soap+xml; charset=utf-8' + } + }); + + const xmlString = response.data; + const parser = new DOMParser(); + const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); + const [resultElement] = xmlDoc.getElementsByTagName('Mensaje'); + + return resultElement.textContent; + }; +}; diff --git a/back/methods/mrw-config/createShipment.ejs b/back/methods/mrw-config/createShipment.ejs new file mode 100644 index 000000000..bf8a07dab --- /dev/null +++ b/back/methods/mrw-config/createShipment.ejs @@ -0,0 +1,43 @@ + + + + + <%= mrw.franchiseCode %> + <%= mrw.subscriberCode %> + + <%= mrw.user %> + <%= mrw.password %> + + + + + + + + + <%= expeditionData.street %> + + + <%= expeditionData.postalCode %> + <%= expeditionData.city %> + + + + <%= expeditionData.fi %> + <%= expeditionData.clientName %> + <%= expeditionData.phone %> + + + <%= expeditionData.created %> + <%= expeditionData.expeditionDataId %> + <%= expeditionData.serviceType %> + 1 + <%= expeditionData.weekDays %> + <%= expeditionData.kg %> + + + + + + + \ No newline at end of file diff --git a/back/methods/mrw-config/createShipment.js b/back/methods/mrw-config/createShipment.js new file mode 100644 index 000000000..12263de03 --- /dev/null +++ b/back/methods/mrw-config/createShipment.js @@ -0,0 +1,118 @@ +const axios = require('axios'); +const {DOMParser} = require('xmldom'); +const fs = require('fs'); +const ejs = require('ejs'); +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethod('createShipment', { + description: 'Create an expedition and return a base64Binary label from de MRW WebService', + accessType: 'WRITE', + accepts: [{ + arg: 'expeditionFk', + type: 'number', + required: true + }], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/createShipment`, + verb: 'POST' + } + }); + + Self.createShipment = async(expeditionFk, options) => { + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + const models = Self.app.models; + const mrw = await models.MrwConfig.findOne(null, myOptions); + + if (!mrw) + throw new UserError(`Some mrwConfig parameters are not set`); + + const query = + `SELECT CASE co.code + WHEN 'ES' THEN a.postalCode + WHEN 'PT' THEN LEFT(a.postalCode, 4) + WHEN 'AD' THEN REPLACE(a.postalCode, 'AD', '00') + END postalCode, + a.city, + a.street, + co.code countryCode, + c.fi, + c.name clientName, + c.phone, + DATE_FORMAT(t.shipped, '%d/%m/%Y') created, + t.shipped, + e.id expeditionId, + LPAD(IF(mw.params IS NULL, ms.serviceType, mw.serviceType), 4 ,'0') serviceType, + IF(mw.weekdays, 'S', 'N') weekDays + FROM expedition e + JOIN ticket t ON e.ticketFk = t.id + JOIN agencyMode am ON am.id = t.agencyModeFk + JOIN mrwService ms ON ms.agencyModeCodeFk = am.code + LEFT JOIN mrwServiceWeekday mw ON mw.weekdays = DATE_FORMAT(t.shipped, '%a') + JOIN client c ON t.clientFk = c.id + JOIN address a ON t.addressFk = a.id + JOIN province p ON a.provinceFk = p.id + JOIN country co ON co.id = p.countryFk + WHERE e.id = ? + LIMIT 1`; + + const [expeditionData] = await Self.rawSql(query, [expeditionFk], myOptions); + + if (!expeditionData) + throw new UserError(`This expedition is not a MRW shipment`); + + const today = Date.vnNew(); + today.setHours(0, 0, 0, 0); + if (expeditionData?.shipped.setHours(0, 0, 0, 0) < today) + throw new UserError(`This ticket has a shipped date earlier than today`); + + const shipmentResponse = await sendXmlDoc('createShipment', {mrw, expeditionData}, 'application/soap+xml'); + const shipmentId = getTextByTag(shipmentResponse, 'NumeroEnvio'); + + if (!shipmentId) + throw new UserError(getTextByTag(shipmentResponse, 'Mensaje')); + + const getLabelResponse = await sendXmlDoc('getLabel', {mrw, shipmentId}, 'text/xml'); + const file = getTextByTag(getLabelResponse, 'EtiquetaFile'); + + try { + await models.Expedition.updateAll({id: expeditionFk}, {externalId: shipmentId}, myOptions); + if (tx) await tx.commit(); + } catch (error) { + if (tx) await tx.rollback(); + throw error; + } + return file; + }; + + function getTextByTag(xmlDoc, tag) { + return xmlDoc?.getElementsByTagName(tag)[0]?.textContent; + } + + async function sendXmlDoc(xmlDock, params, contentType) { + const parser = new DOMParser(); + + const xmlTemplate = fs.readFileSync(__dirname + `/${xmlDock}.ejs`, 'utf-8'); + const renderedTemplate = ejs.render(xmlTemplate, params); + const data = await axios.post(params.mrw.url, renderedTemplate, { + headers: { + 'Content-Type': `${contentType}; charset=utf-8` + } + }); + return parser.parseFromString(data.data, 'text/xml'); + } +}; diff --git a/back/methods/mrw-config/getLabel.ejs b/back/methods/mrw-config/getLabel.ejs new file mode 100644 index 000000000..09bdb3f6c --- /dev/null +++ b/back/methods/mrw-config/getLabel.ejs @@ -0,0 +1,25 @@ + + + + <%= mrw.franchiseCode %> + <%= mrw.subscriberCode %> + + <%= mrw.user %> + <%= mrw.password %> + + + + + + <%= shipmentId %> + 1 + + + + 0 + 0 + 0 + + + + \ No newline at end of file diff --git a/back/methods/mrw-config/specs/createShipment.spec.js b/back/methods/mrw-config/specs/createShipment.spec.js new file mode 100644 index 000000000..e7bba524a --- /dev/null +++ b/back/methods/mrw-config/specs/createShipment.spec.js @@ -0,0 +1,120 @@ +const models = require('vn-loopback/server/server').models; +const axios = require('axios'); +const fs = require('fs'); + +const mockBase64Binary = 'base64BinaryString'; +const ticket1 = { + 'id': '44', + 'clientFk': 1101, + 'shipped': Date.vnNew(), + 'nickname': 'MRW', + 'addressFk': 1, + 'agencyModeFk': 999 +}; + +const expedition1 = { + 'id': 17, + 'agencyModeFk': 999, + 'ticketFk': 44, + 'freightItemFk': 71, + 'created': '2001-01-01', + 'counter': 1, + 'workerFk': 18, + 'packagingFk': '94', + 'hostFk': '', + 'stateTypeFk': 3, + 'hasNewRoute': 0, + 'isBox': 71, + 'editorFk': 100 +}; + +let tx; +let options; + +describe('MRWConfig createShipment()', () => { + beforeEach(async() => { + options = tx = undefined; + tx = await models.MrwConfig.beginTransaction({}); + options = {transaction: tx}; + + await models.Agency.create( + {'id': 999, 'name': 'mrw'}, + options + ); + + await models.AgencyMode.create( + {'id': 999, 'name': 'mrw', 'agencyFk': 999, 'code': 'mrw'}, + options + ); + + await models.MrwConfig.create( + { + 'url': 'https://url.com', + 'user': 'user', + 'password': 'password', + 'franchiseCode': 'franchiseCode', + 'subscriberCode': 'subscriberCode' + }, options + ); + + await models.Application.rawSql( + `INSERT INTO vn.mrwService + SET agencyModeCodeFk = 'mrw', + clientType = 1, + serviceType = 1, + kg = 1`, null, options + ); + await models.Ticket.create(ticket1, options); + await models.Expedition.create(expedition1, options); + }); + + afterEach(async() => { + await tx.rollback(); + }); + + it('should create a shipment and return a base64Binary label', async() => { + const mockPostResponses = [ + {data: fs.readFileSync(__dirname + '/mockGetLabel.xml', 'utf-8')}, + {data: fs.readFileSync(__dirname + '/mockCreateShipment.xml', 'utf-8')} + ]; + + spyOn(axios, 'post').and.callFake(() => Promise.resolve(mockPostResponses.pop())); + + const base64Binary = await models.MrwConfig.createShipment(expedition1.id, options); + + expect(base64Binary).toEqual(mockBase64Binary); + }); + + it('should fail if mrwConfig has no data', async() => { + let error; + await models.MrwConfig.createShipment(expedition1.id).catch(e => { + error = e; + }).finally(async() => { + expect(error.message).toEqual(`Some mrwConfig parameters are not set`); + }); + + expect(error).toBeDefined(); + }); + + it('should fail if expeditionFk is not a MrwExpedition', async() => { + let error; + await models.MrwConfig.createShipment(undefined, options).catch(e => { + error = e; + }).finally(async() => { + expect(error.message).toEqual(`This expedition is not a MRW shipment`); + }); + }); + + it(' should fail if the creation date of this ticket is before the current date it', async() => { + let error; + const yesterday = Date.vnNew(); + + yesterday.setDate(yesterday.getDate() - 1); + await models.Ticket.updateAll({id: ticket1.id}, {shipped: yesterday}, options); + await models.MrwConfig.createShipment(expedition1.id, options).catch(e => { + error = e; + }).finally(async() => { + expect(error.message).toEqual(`This ticket has a shipped date earlier than today`); + }); + }); +}); diff --git a/back/methods/mrw-config/specs/mockCreateShipment.xml b/back/methods/mrw-config/specs/mockCreateShipment.xml new file mode 100644 index 000000000..dacc5d3f3 --- /dev/null +++ b/back/methods/mrw-config/specs/mockCreateShipment.xml @@ -0,0 +1,16 @@ + + + + + + 1 + + 1 + 1 + http://url.com + + + + \ No newline at end of file diff --git a/back/methods/mrw-config/specs/mockGetLabel.xml b/back/methods/mrw-config/specs/mockGetLabel.xml new file mode 100644 index 000000000..0401ce2c7 --- /dev/null +++ b/back/methods/mrw-config/specs/mockGetLabel.xml @@ -0,0 +1,14 @@ + + + + + + 1 + + base64BinaryString + + + + \ No newline at end of file diff --git a/back/methods/url/getUrl.js b/back/methods/url/getUrl.js index f30719b9f..ef741e5a0 100644 --- a/back/methods/url/getUrl.js +++ b/back/methods/url/getUrl.js @@ -22,7 +22,7 @@ module.exports = Self => { const {url} = await Self.app.models.Url.findOne({ where: { appName, - enviroment: process.env.NODE_ENV || 'development' + environment: process.env.NODE_ENV || 'development' } }); return url; diff --git a/back/model-config.json b/back/model-config.json index 27a94498c..c4eefd932 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -159,6 +159,9 @@ }, "VnRole": { "dataSource": "vn" + }, + "MrwConfig": { + "dataSource": "vn" } } diff --git a/back/models/mrw-config.js b/back/models/mrw-config.js new file mode 100644 index 000000000..f764b91cc --- /dev/null +++ b/back/models/mrw-config.js @@ -0,0 +1,4 @@ +module.exports = Self => { + require('../methods/mrw-config/createShipment')(Self); + require('../methods/mrw-config/cancelShipment')(Self); +}; diff --git a/back/models/mrw-config.json b/back/models/mrw-config.json new file mode 100644 index 000000000..f0cf799b1 --- /dev/null +++ b/back/models/mrw-config.json @@ -0,0 +1,31 @@ +{ + "name": "MrwConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "mrwConfig" + } + }, + "properties": { + "id": { + "type": "number", + "required": true + }, + "url": { + "type": "string", + "required": true + }, + "user": { + "type": "string" + }, + "password": { + "type": "string" + }, + "franchiseCode": { + "type": "string" + }, + "subscriberCode": { + "type": "string" + } + } +} diff --git a/db/dump/.dump/data.sql b/db/dump/.dump/data.sql index 6fe6c1414..d7e99a4ee 100644 --- a/db/dump/.dump/data.sql +++ b/db/dump/.dump/data.sql @@ -3,7 +3,7 @@ USE `util`; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -INSERT INTO `version` VALUES ('vn-database','10861','6685a201143a320920bbe04db7f8d0d1bd32d415','2024-02-15 10:04:54','10886'); +INSERT INTO `version` VALUES ('vn-database','10889','03550573b07783c82b290df4ebaeb91c1030bc18','2024-02-23 09:55:56','10906'); 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); @@ -586,6 +586,40 @@ INSERT INTO `versionLog` VALUES ('vn-database','10832','00-util_tx_rollback.sql' INSERT INTO `versionLog` VALUES ('vn-database','10832','00-util_tx_start.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10832','01-update_procedure_TravelCloneWithEntries.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10832','02-grant_privileges_util_tx.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:52',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','01-Bancos_poliza.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:52',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','03-Entradas_orden.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','04-Pagares.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','05-Proveedores_gestdoc.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','06-Remesas.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','07-Saldos_Prevision.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','08-Series.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','09-Split_lines.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','10-Split.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','11-Vehiculos_consumo.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','12-account_conciliacion.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','13-account_detail.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','14-account_detail_type.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','15-agencia_descuadre.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','16-airline.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','17-airport.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','18-albaran.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','19-albaran_gestdoc.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','20-albaran_state.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','21-awb_component.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','22-awb_component_template.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','23-awb_component_type.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','24-awb_gestdoc.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','25-awb_recibida.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','26-awb_role.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','27-awb_unit.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','28-balance_nest_tree.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','29-buy_edi_k012.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','30-buy_edi_k03.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','31-buy_edi_k04.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','32-definitivo.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','33-dropTables.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','34-permisos.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:57',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10838','00-createInventoryConfig.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-07 22:36:27',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10845','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10848','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); @@ -612,8 +646,30 @@ INSERT INTO `versionLog` VALUES ('vn-database','10853','00-firstScript.sql','jen INSERT INTO `versionLog` VALUES ('vn-database','10853','00-secondScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10854','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-30 16:20:34',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10855','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10856','00-cloneAcl.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:57',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10857','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:57',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10858','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10861','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10863','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:59',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10865','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:59',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10867','00-createAclInvoiceIn.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:59',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10867','01-createInvoiceInCorrection.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10868','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10869','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10871','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10872','00-aclUpdateFiscalData.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10873','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10874','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10876','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10878','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10879','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10882','00-vehicle.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10883','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10884','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10888','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-16 07:39:57',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10889','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-23 09:55:56',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10890','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10903','00-professionalCategoryAddCode.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-23 08:38:28',NULL,NULL); /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; @@ -821,7 +877,6 @@ INSERT INTO `roleInherit` VALUES (142,35,75,NULL); INSERT INTO `roleInherit` VALUES (143,15,49,NULL); INSERT INTO `roleInherit` VALUES (145,17,67,NULL); INSERT INTO `roleInherit` VALUES (146,38,13,NULL); -INSERT INTO `roleInherit` VALUES (147,101,35,NULL); INSERT INTO `roleInherit` VALUES (148,101,13,NULL); INSERT INTO `roleInherit` VALUES (150,15,56,NULL); INSERT INTO `roleInherit` VALUES (152,69,47,NULL); @@ -973,6 +1028,7 @@ INSERT INTO `roleInherit` VALUES (356,123,125,NULL); INSERT INTO `roleInherit` VALUES (357,36,35,NULL); INSERT INTO `roleInherit` VALUES (358,36,49,NULL); INSERT INTO `roleInherit` VALUES (359,129,35,NULL); +INSERT INTO `roleInherit` VALUES (360,101,129,NULL); INSERT INTO `userPassword` VALUES (1,7,1,0,2,1); @@ -1211,7 +1267,7 @@ INSERT INTO `ACL` VALUES (293,'RoleInherit','*','*','ALLOW','ROLE','it'); INSERT INTO `ACL` VALUES (294,'RoleRole','*','*','ALLOW','ROLE','it'); INSERT INTO `ACL` VALUES (295,'AccountConfig','*','*','ALLOW','ROLE','sysadmin'); INSERT INTO `ACL` VALUES (296,'Collection','*','READ','ALLOW','ROLE','employee'); -INSERT INTO `ACL` VALUES (297,'Sale','refund','WRITE','ALLOW','ROLE','invoicing'); +INSERT INTO `ACL` VALUES (297,'Sale','clone','WRITE','ALLOW','ROLE','invoicing'); INSERT INTO `ACL` VALUES (298,'InvoiceInDueDay','*','*','ALLOW','ROLE','administrative'); INSERT INTO `ACL` VALUES (299,'Collection','setSaleQuantity','*','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (302,'AgencyTerm','*','*','ALLOW','ROLE','administrative'); @@ -1238,8 +1294,8 @@ INSERT INTO `ACL` VALUES (323,'InvoiceOut','refund','WRITE','ALLOW','ROLE','clai INSERT INTO `ACL` VALUES (324,'Ticket','refund','WRITE','ALLOW','ROLE','invoicing'); INSERT INTO `ACL` VALUES (325,'Ticket','refund','WRITE','ALLOW','ROLE','salesAssistant'); INSERT INTO `ACL` VALUES (326,'Ticket','refund','WRITE','ALLOW','ROLE','claimManager'); -INSERT INTO `ACL` VALUES (327,'Sale','refund','WRITE','ALLOW','ROLE','salesAssistant'); -INSERT INTO `ACL` VALUES (328,'Sale','refund','WRITE','ALLOW','ROLE','claimManager'); +INSERT INTO `ACL` VALUES (327,'Sale','clone','WRITE','ALLOW','ROLE','salesAssistant'); +INSERT INTO `ACL` VALUES (328,'Sale','clone','WRITE','ALLOW','ROLE','claimManager'); INSERT INTO `ACL` VALUES (329,'TicketRefund','*','WRITE','ALLOW','ROLE','invoicing'); INSERT INTO `ACL` VALUES (330,'ClaimObservation','*','WRITE','ALLOW','ROLE','salesPerson'); INSERT INTO `ACL` VALUES (331,'ClaimObservation','*','READ','ALLOW','ROLE','salesPerson'); @@ -1593,7 +1649,7 @@ INSERT INTO `ACL` VALUES (725,'Account','findOne','READ','ALLOW','ROLE','employe INSERT INTO `ACL` VALUES (726,'Account','findById','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (727,'Account','find','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (728,'Account','exists','READ','ALLOW','ROLE','employee'); -INSERT INTO `ACL` VALUES (729,'Sale','refund','WRITE','ALLOW','ROLE','buyer'); +INSERT INTO `ACL` VALUES (729,'Sale','clone','WRITE','ALLOW','ROLE','buyer'); INSERT INTO `ACL` VALUES (730,'Ticket','setDeleted','WRITE','ALLOW','ROLE','deliveryAssistant'); INSERT INTO `ACL` VALUES (732,'Sale','isInPreparing','*','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (733,'Train','*','READ','ALLOW','ROLE','production'); @@ -1652,6 +1708,15 @@ INSERT INTO `ACL` VALUES (785,'VnRole','*','WRITE','ALLOW','ROLE','it'); INSERT INTO `ACL` VALUES (786,'State','isAllEditable','READ','ALLOW','ROLE','delivery'); INSERT INTO `ACL` VALUES (787,'Ticket','makePdfList','*','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (788,'Ticket','invoiceTicketsAndPdf','*','ALLOW','ROLE','employee'); +INSERT INTO `ACL` VALUES (789,'InvoiceIn','*','*','ALLOW','ROLE','buyer'); +INSERT INTO `ACL` VALUES (790,'InvoiceIn','getSerial','READ','ALLOW','ROLE','buyer'); +INSERT INTO `ACL` VALUES (791,'InvoiceIn','corrective','WRITE','ALLOW','ROLE','administrative'); +INSERT INTO `ACL` VALUES (792,'InvoiceInCorrection','*','*','ALLOW','ROLE','administrative'); +INSERT INTO `ACL` VALUES (793,'Supplier','updateAllFiscalData','WRITE','ALLOW','ROLE','administrative'); +INSERT INTO `ACL` VALUES (794,'Supplier','updateFiscalData','WRITE','ALLOW','ROLE','buyer'); +INSERT INTO `ACL` VALUES (795,'Ticket','myLastModified','*','ALLOW','ROLE','production'); +INSERT INTO `ACL` VALUES (796,'MrwConfig','cancelShipment','WRITE','ALLOW','ROLE','employee'); +INSERT INTO `ACL` VALUES (797,'MrwConfig','createShipment','WRITE','ALLOW','ROLE','employee'); INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee'); INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee'); @@ -1970,7 +2035,7 @@ INSERT INTO `continent` VALUES (3,'África','AF'); INSERT INTO `continent` VALUES (4,'Europa','EU'); INSERT INTO `continent` VALUES (5,'Oceanía','OC'); -INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,110,763,0,0,0,0,28,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,110,763,0,0,0,0,27,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (22,'shopping','COMPRAS',2,3,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (23,'CMA','CAMARA',13,14,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL,NULL); INSERT INTO `department` VALUES (31,'it','INFORMATICA',4,5,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL,NULL); @@ -1978,53 +2043,53 @@ INSERT INTO `department` VALUES (34,'accounting','CONTABILIDAD',6,7,NULL,0,0,0,1 INSERT INTO `department` VALUES (35,'finance','FINANZAS',8,9,NULL,0,0,0,1,0,1,'/1/',NULL,1,'begonya@verdnatura.es',1,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (36,'labor','LABORAL',10,11,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (37,'PROD','PRODUCCION',12,35,NULL,72,1,1,1,11,1,'/1/',NULL,0,NULL,0,1,1,1,NULL,NULL); -INSERT INTO `department` VALUES (38,'picking','SACADO',15,16,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (39,'packing','ENCAJADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (38,'picking','SACADO',15,16,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,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); INSERT INTO `department` VALUES (41,'administration','ADMINISTRACION',36,37,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (43,'VT','VENTAS',38,65,NULL,0,0,0,1,13,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (44,'management','GERENCIA',66,67,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',68,69,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (46,'delivery','REPARTO',70,71,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL); -INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',72,73,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',74,75,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',76,77,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (43,'VT','VENTAS',38,67,NULL,0,0,0,1,14,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (44,'management','GERENCIA',68,69,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',70,71,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (46,'delivery','REPARTO',72,73,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL); +INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',74,75,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',76,77,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,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); INSERT INTO `department` VALUES (55,NULL,'TALLER NATURAL',19,20,14548,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1118,NULL); INSERT INTO `department` VALUES (56,NULL,'TALLER ARTIFICIAL',21,22,8470,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1927,NULL); -INSERT INTO `department` VALUES (58,'CMP','CAMPOS',82,85,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',86,87,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL); -INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',88,89,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,1,0,0,NULL,NULL); +INSERT INTO `department` VALUES (58,'CMP','CAMPOS',84,87,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,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); +INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',39,40,NULL,72,0,0,2,0,43,'/1/43/',NULL,1,NULL,1,1,0,0,NULL,NULL); INSERT INTO `department` VALUES (61,NULL,'VNH',90,93,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',94,95,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (68,NULL,'COMPLEMENTOS',23,24,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL,NULL); INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',96,97,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (80,NULL,'EQUIPO J VALLES',39,40,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'equipojvalles@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (80,NULL,'EQUIPO J VALLES',41,42,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'equipojvalles@verdnatura.es',0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',98,99,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (89,NULL,'COORDINACION',100,101,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (90,NULL,'TRAILER',91,92,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (91,'artificial','ARTIFICIAL',25,26,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (92,NULL,'EQUIPO SILVERIO',41,42,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (94,NULL,'EQUIPO J BROCAL',43,44,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',1,'equipojbrocal@verdnatura.es',0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (95,NULL,'EQUIPO C ZAMBRANO',45,46,4667,0,0,0,2,0,43,'/1/43/','czg_equipo',1,'equipoczambrano@verdnatura.es',0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (96,NULL,'EQUIPO C LOPEZ',47,48,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (115,NULL,'EQUIPO CLAUDI',49,50,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (123,NULL,'EQUIPO ELENA BASCUÑANA',51,52,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (92,NULL,'EQUIPO SILVERIO',43,44,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (94,NULL,'EQUIPO J BROCAL',45,46,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',0,'equipojbrocal@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (95,NULL,'EQUIPO C ZAMBRANO',47,48,4667,0,0,0,2,0,43,'/1/43/','czg_equipo',0,'equipoczambrano@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (96,NULL,'EQUIPO C LOPEZ',49,50,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (115,NULL,'EQUIPO CLAUDI',51,52,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (123,NULL,'EQUIPO ELENA BASCUÑANA',53,54,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',102,103,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (125,NULL,'EQUIPO MIRIAM MAR',53,54,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',1,'equipomirgir@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (125,NULL,'EQUIPO MIRIAM MAR',55,56,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',0,'equipomirgir@verdnatura.es',0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (126,NULL,'PRESERVADO',27,28,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,NULL,NULL); INSERT INTO `department` VALUES (128,NULL,'PALETIZADO',29,30,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (130,NULL,'REVISION',31,32,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',83,84,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL); -INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',55,56,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',57,58,1731,72,0,0,2,0,43,'/1/43/','fr_equipo',1,'francia@verdnatura.es',0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (134,'portugalTeam','EQUIPO PORTUGAL',59,60,6264,0,0,0,2,0,43,'/1/43/','pt_equipo',1,'portugal@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (130,NULL,'REVISION',31,32,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,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); +INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',57,58,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',59,60,1731,72,0,0,2,0,43,'/1/43/','fr_equipo',1,'francia@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (134,'portugalTeam','EQUIPO PORTUGAL',61,62,6264,0,0,0,2,0,43,'/1/43/','pt_equipo',1,'portugal@verdnatura.es',0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (135,'routers','ENRUTADORES',104,105,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (136,'heavyVehicles','VEHICULOS PESADOS',106,107,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (137,'sorter','SORTER',108,109,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (139,NULL,'EQUIPO J SORIA ',61,62,3803,0,0,0,2,0,43,'/1/43/','jss_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (140,'hollandTeam','EQUIPO HOLANDA',63,64,NULL,0,0,0,2,0,43,'/1/43/','nl_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (141,NULL,'PREVIA',33,34,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (139,NULL,'EQUIPO J SORIA ',63,64,3803,0,0,0,2,0,43,'/1/43/','jss_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (140,'hollandTeam','EQUIPO HOLANDA',65,66,NULL,0,0,0,2,0,43,'/1/43/','nl_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (141,NULL,'PREVIA',33,34,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL); INSERT INTO `docuware` VALUES (1,'deliveryNote','Albaranes cliente','find','find','N__ALBAR_N',NULL); INSERT INTO `docuware` VALUES (2,'deliveryNote','Albaranes cliente','store','Archivar','N__ALBAR_N',NULL); diff --git a/db/dump/.dump/privileges.sql b/db/dump/.dump/privileges.sql index 4012a6406..ebc3c0dd2 100644 --- a/db/dump/.dump/privileges.sql +++ b/db/dump/.dump/privileges.sql @@ -101,18 +101,17 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','edi','buyer','value','alexm@%','00 INSERT IGNORE INTO `tables_priv` VALUES ('','mysql','developerBoss','general_log','juan@10.5.1.1','0000-00-00 00:00:00','Select,Drop',''); INSERT IGNORE INTO `tables_priv` VALUES ('','dipole','employee','expedition_PrintOut','alexm@%','0000-00-00 00:00:00','Select,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','edi','logistic','marketPlace','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','definitivo','alexm@%','0000-00-00 00:00:00','Select,Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','definitivo','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','edi','manager','item_group','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','edi','administrative','item_feature','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','edi','buyer','item_feature','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','itemTag','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','itemCategoryL10n','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','guest','warehouse','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financialBoss','credit','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','guest','Tipos','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','producer','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','mdbVersion','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','province','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','versiones','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','mistakeType','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','warehouse','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','account','itemTaxCountry','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); @@ -165,8 +164,8 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','guest','location','root@p INSERT IGNORE INTO `tables_priv` VALUES ('','account','hr','mailAliasAccount','$itBoss@10.0.2.69','2022-08-03 23:44:43','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','tag','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','guest','news','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi_k012','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','buy_edi_k012','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi_k012','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','buy_edi_k012','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','guest','myMenu','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','guest','myBasket','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','guest','message','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); @@ -177,7 +176,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','account','hr','account','$itBoss@1 INSERT IGNORE INTO `tables_priv` VALUES ('','salix','android','AccessToken','jenkins@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyerBoss','itemTag','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','itemTag','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','buy_edi_k03','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','buy_edi_k03','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','psico','hr','examQuestion','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','psico','hr','exam','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','edi','manager','exchange','alexm@%','0000-00-00 00:00:00','Select',''); @@ -221,7 +220,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','edi','salesPerson','item_groupToOf INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','account','myTicketService','root@10.2.3.180','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','sage','administrative','movConta','carlosap@172.16.5.232','2022-08-03 23:44:43','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','employee','mailConfig','jgallego@81.202.38.190','2022-08-03 23:44:43','','Select'); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','account_conciliacion','alexm@%','0000-00-00 00:00:00','Select,Insert,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','account_conciliacion','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','accion_dits','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','config','juan@%','0000-00-00 00:00:00','','Select'); INSERT IGNORE INTO `tables_priv` VALUES ('','util','account','config','$itBoss@10.0.2.69','2022-08-03 23:44:43','Select',''); @@ -243,49 +242,47 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','time','guillermo@db-p INSERT IGNORE INTO `tables_priv` VALUES ('','mysql','developer','slow_log','$itBoss@10.0.2.68','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','mysql','developer','user','$itBoss@10.0.2.68','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','mysql','developer','proc','$itBoss@10.0.2.68','2022-08-03 23:44:43','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','account_detail','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','account_detail_type','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','account_detail','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','account_detail_type','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','entryEditor','Compres','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Agencias','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','awb_component','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','awb_component','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','account','developer','emailUser','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','agencia_descuadre','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','airline','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','airline','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','airline','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','airline','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','agency_warehouse','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vncontrol','salesPerson','inter','alexm@%','0000-00-00 00:00:00','Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Articles_botanical','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran_gestdoc','alexm@%','0000-00-00 00:00:00','Select,Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran_state','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran_state','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Articles','alexm@%','0000-00-00 00:00:00','Select,Insert,Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Articles_botanical','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','awb','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb_component','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component_template','alexm@%','0000-00-00 00:00:00','Select,Insert,Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb_component_type','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','awb_gestdoc','alexm@%','0000-00-00 00:00:00','Select,Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb_gestdoc','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb_recibida','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_role','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_unit','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financialBoss','balance_nest_tree','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb_component','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component_template','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb_component_type','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','awb_gestdoc','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb_recibida','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_role','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_unit','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financialBoss','balance_nest_tree','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vncontrol','deliveryBoss','inter','juan@%','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Bancos','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','barcodes','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','barcodes','alexm@%','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vncontrol','buyer','inter','alexm@%','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vncontrol','employee','inter','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_gestdoc','alexm@%','0000-00-00 00:00:00','Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb','alexm@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','agency','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','buySource','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','buy_edi','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','buy_edi_k04','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi_k03','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi_k04','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','buy_edi_k04','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi_k03','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi_k04','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesAssistant','Clientes','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','v_empresa','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','v_empresa','alexm@%','0000-00-00 00:00:00','Select',''); @@ -293,17 +290,15 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','chanel','al INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','v_empresa','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Clientes','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','V_edi_item_track','alexm@%','0000-00-00 00:00:00','Select,Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','v_compres','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionPlus','v_botanic_export','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','manager','v_botanic_export','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionPlus','v_Articles_botanical','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Colores','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Clientes','alexm@%','0000-00-00 00:00:00','Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','recibida_vencimiento','jgallego@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','jerarquia','juan@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','warehouse','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerBusinessAgreement','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','tarifa_componentes','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','officeBoss','Vehiculos','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','tarifa_componentes_series','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','Entradas','alexm@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','itemType','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); @@ -314,31 +309,30 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','producer','alexm@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','officeBoss','ticket_observation','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Cajas','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','cmrConfig','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','awb_recibida','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','awb_recibida','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','awb','juan@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Compres','alexm@%','0000-00-00 00:00:00','Select,Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','workerDocument','alexm@%','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','buy_edi','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','salix','developer','ACL','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Vehiculos_consumo','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Vehiculos_consumo','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','palletizer','cmr','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','Colores','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','state','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Consignatarios','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','artificialBoss','travel','alexm@%','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','price_fixed','alexm@%','0000-00-00 00:00:00','Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','Vehiculos','juan@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','printQueue','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','preservedBoss','travel','alexm@%','0000-00-00 00:00:00','Insert,Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','travel','alexm@%','0000-00-00 00:00:00','Insert,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','travel','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Cubos_Retorno','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','Cubos','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyerAssistant','itemType','jgallego@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Cubos','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','Cubos','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','Cubos_Retorno','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','artificialBoss','state','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','travel','alexm@%','0000-00-00 00:00:00','Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Bancos_poliza','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Bancos_poliza','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','cmr','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','edi_bucket_type','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','edi_bucket','alexm@%','0000-00-00 00:00:00','Select',''); @@ -362,7 +356,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Entradas','ale INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','ticket_observation','juan@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Entradas_dits','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','sale','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Entradas_orden','alexm@%','0000-00-00 00:00:00','Select,Insert,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Entradas_orden','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','ticket_observation','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Entradas_turno','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','entrySource','alexm@%','0000-00-00 00:00:00','Select',''); @@ -375,11 +369,8 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','tickets_gestdoc' INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','tickets_gestdoc','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Tickets','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Entradas','root@localhost','0000-00-00 00:00:00','Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','expeditions','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Entradas','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Entradas','alexm@%','0000-00-00 00:00:00','Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','Facturas','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Facturas','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','Tintas','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','filtros','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Entradas_kop','alexm@%','0000-00-00 00:00:00','Select',''); @@ -413,17 +404,15 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','calendarHolidays' INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','mandato','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','mandato','alexm@%','0000-00-00 00:00:00','Select,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','iva_group','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','invoiceCorrection','alexm@%','0000-00-00 00:00:00','Select,Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','intrastat_data','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','intrastat_data','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','greugeType','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceInIntrastat','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','greuge','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Intrastat','alexm@%','0000-00-00 00:00:00','Select,Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Intrastat','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','integra2_province','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Grupos','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Greuges','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','gesttip','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','gestdoc','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Gastos','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','dms','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','continent','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','artificialBoss','Movimientos_componentes','alexm@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Movimientos_componentes','alexm@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','Movimientos_mark','alexm@%','0000-00-00 00:00:00','Delete',''); @@ -461,16 +450,14 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Proveedo INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','PreciosEspeciales','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','agencia_descuadre','alexm@%','0000-00-00 00:00:00','Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','price_fixed','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','gestdoc','alexm@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','iva_tipo','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','iva_codigo','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','pago','alexm@%','0000-00-00 00:00:00','Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Proveedores','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Proveedores_cargueras','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Proveedores_gestdoc','juan@%','0000-00-00 00:00:00','Select,Insert,Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','palletizer','Facturas','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Proveedores_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','expedition','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Proveedores_gestdoc','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Proveedores_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','recibida','juan@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','recibida','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','adminOfficer','recibida_iva','alexm@%','0000-00-00 00:00:00','Delete',''); @@ -481,10 +468,10 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','Recibos','a INSERT IGNORE INTO `tables_priv` VALUES ('','vn','officeBoss','bankEntity','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','agency','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','bankEntity','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','reference_min','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','versiones','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','reference_rate','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','saleComponent','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','Remesas','juan@%','0000-00-00 00:00:00','Select,Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','Remesas','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','Reservas','alexm@%','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','cmr','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Rutas','alexm@%','0000-00-00 00:00:00','Select',''); @@ -504,9 +491,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','srt','grafana','bufferState','juan INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','coolerAssist','state','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','absenceType','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','artificialBoss','Entradas_Auto','alexm@%','0000-00-00 00:00:00','Select,Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','XDiario','alexm@%','0000-00-00 00:00:00','Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','Vehiculos_consumo','alexm@%','0000-00-00 00:00:00','Insert,Update,Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','XDiario','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','Vehiculos_consumo','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','tblContadores','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','buyMark','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','calendar','juan@10.5.1.2','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); @@ -558,7 +543,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionBoss','sale','alexm INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','packingSite','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionPlus','province','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionPlus','province','alexm@%','0000-00-00 00:00:00','Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','property','juan@%','0000-00-00 00:00:00','Select,Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','pbx','grafana','sip','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','','Select'); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesAssistant','clientCredit','alexm@%','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','artificialBoss','saleTracking','alexm@%','0000-00-00 00:00:00','Delete',''); @@ -568,8 +552,8 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','saleTracking','ale INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','client','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','client','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','saleVolume','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','Proveedores_gestdoc','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','awb_gestdoc','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','Proveedores_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','awb_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','Cubos','alexm@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','routesMonitor','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','Update'); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminBoss','sale','alexm@%','0000-00-00 00:00:00','Insert',''); @@ -582,8 +566,8 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','saleComponent' INSERT IGNORE INTO `tables_priv` VALUES ('','vn','marketingBoss','saleGoal','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','saleGroup','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','saleGroupDetail','alexm@%','0000-00-00 00:00:00','Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','account_detail','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component_type','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','account_detail','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component_type','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vncontrol','employee','accion','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','volumeConfig','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','currency','alexm@%','0000-00-00 00:00:00','Select',''); @@ -592,12 +576,11 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','currency','a INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','creditClassification','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','creditInsurance','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','currency','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','dms','alexm@%','0000-00-00 00:00:00','Select,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','workerTimeControl','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','defaulter','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','deliveryMethod','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','deliveryMethod','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','dms','alexm@%','0000-00-00 00:00:00','Select,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','v_compres','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','deviceProductionUser','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','department','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','deviceProductionConfig','alexm@%','0000-00-00 00:00:00','Select',''); @@ -607,7 +590,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionBoss','absenceType' INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','deviceProductionConfig','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','deviceProductionUser','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','disabilityGrade','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','dms','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','duaInvoiceIn','alexm@%','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','dmsType','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','duaEntry','alexm@%','0000-00-00 00:00:00','Insert,Delete',''); @@ -657,7 +639,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','artificialBoss','entryObserva INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','dock','alexm@%','0000-00-00 00:00:00','Select,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','expeditionTruck','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','expeditionPallet','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','expense','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','expense','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','expeditionScan','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerBoss','entryObservation','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppeGroup','alexm@%','0000-00-00 00:00:00','Select',''); @@ -672,7 +654,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','postCode','alexm@%','000 INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','pgcMaster','alexm@%','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','itemBarcode','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','host','alexm@%','0000-00-00 00:00:00','Select,Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','Facturas','guillermo@10.5.1.4','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ticket','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceIn','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','invoiceIn','alexm@%','0000-00-00 00:00:00','Select',''); @@ -687,7 +668,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesPerson','invoiceCorrecti INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','invoiceIn','alexm@%','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceInDueDay','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','invoiceInDueDay','alexm@%','0000-00-00 00:00:00','Insert,Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','invoiceInIntrastat__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','invoiceInIntrastat__','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','invoiceInTax','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceInSage','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','invoiceInTax','alexm@%','0000-00-00 00:00:00','Select',''); @@ -728,8 +709,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','itemShelving','ale INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerBoss','itemShelvingLog','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ticketWeekly','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerAssist','itemShelvingLog','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','airport','alexm@%','0000-00-00 00:00:00','Select,Insert,Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','XDiario','alexm@%','0000-00-00 00:00:00','Select,Insert,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','airport','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','itemShelvingSale','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','Tickets','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','claimEnd','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); @@ -839,7 +819,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','recovery','al INSERT IGNORE INTO `tables_priv` VALUES ('','srt','employee','photocell','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','edi','grafana','supplyResponse','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','cache','customer','last_buy','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','Greuges_type','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesAssistant','client','carlosap@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','invoiceInTax','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesAssistant','workerTeam','juan@10.5.1.2','0000-00-00 00:00:00','Select,Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','postgresql','hr','profile_type','alexm@%','0000-00-00 00:00:00','Select',''); @@ -871,12 +851,11 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','bi','salesPerson','tarifa_componen INSERT IGNORE INTO `tables_priv` VALUES ('','srt','employee','expeditionLog','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','bs','salesPerson','clientNewBorn','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','saleItemShelving__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','XDiario','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesBoss','workerTeam','juan@10.5.1.2','0000-00-00 00:00:00','Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','srt','employee','expedition','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','itemShelvingStock','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','saleParking__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','property','juan@10.5.1.1','0000-00-00 00:00:00','Select,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','property','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','srt','employee','config','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','vehicleEvent','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','vehicle','alexm@%','0000-00-00 00:00:00','Insert,Update',''); @@ -963,6 +942,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','travel','alexm@%', INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','travelClonedWeekly','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','bi','employee','facturacion_media_anual','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','travelObservation','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','bankPolicy','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','travelThermograph','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','tillConfig','juan@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','till','juan@%','0000-00-00 00:00:00','Select',''); @@ -1013,7 +993,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerRelatives','guille INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','ticketPackagingStartingStock','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','supplierPackaging','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerDocument','alexm@%','0000-00-00 00:00:00','Select,Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','gestdoc','alexm@%','0000-00-00 00:00:00','Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ink','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','zone','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','XDiario','alexm@%','0000-00-00 00:00:00','Select',''); @@ -1028,7 +1007,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','zonePromo__','alex INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','accountingConfig','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','accountingType','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','agencyMode','alexm@%','0000-00-00 00:00:00','Insert,Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','XDiario','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','cache','employee','visible','juan@10.5.1.2','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerAssist','productionConfig','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','cache','employee','available','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); @@ -1181,8 +1159,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','packager','glsExpedition','ju INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','clientType','juan@10.5.1.2','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','expeditionMistake','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','deviceProductionLog','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesAssistant','workerTeam','juan@10.5.1.2','0000-00-00 00:00:00','Select,Insert,Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesBoss','workerTeam','juan@10.5.1.2','0000-00-00 00:00:00','Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','vehicleState','juan@10.5.1.1','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','machineDetail','juan@10.5.1.1','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','machineDms','juan@10.5.1.1','0000-00-00 00:00:00','Select',''); @@ -1258,13 +1234,12 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','salix','developer','url','juan@db- INSERT IGNORE INTO `tables_priv` VALUES ('','salix','developer','userConfigView','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','claimRedelivery','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','clientRisk','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyerBoss','itemType','carlosap@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','supplierDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','bs','buyer','sale','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','chain','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','routesMonitor','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','warehouse_pickup','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','cl_main','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','Vehiculos','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','routeAction','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','ticket_observation','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','Tickets_turno','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); @@ -1336,8 +1311,48 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','item','guillermo@db-p INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerBoss','itemShelving','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','negativeOrigin','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryBoss','Vehiculos_consumo','carlosap@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','entryOrder','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBos','project','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','ink','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','supplierDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','supplierDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','remittance','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','vehicleConsumption','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','vehicleConsumption','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','accountReconciliation','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','accountDetail','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','accountDetail','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','accountDetailType','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','airline','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','airline','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','airport','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','deliveryNote','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','deliveryNoteDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','deliveryNoteState','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','awbComponent','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','awbComponent','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','awbComponent','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','awbComponentTemplate','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','awbComponentType','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','awbComponentType','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','awbDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','awbDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','awbDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','awbDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','awbInvoiceIn','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','awbInvoiceIn','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','awbRole','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','awbUnit','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financialBoss','balanceNestTree','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','edi','buyer','ektK1','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','edi','administrative','ektK1','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','edi','buyer','ektK2','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','edi','administrative','ektK2','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','edi','buyer','ektK3','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','edi','administrative','ektK3','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','edi','buyer','ektK4','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','edi','administrative','ektK4','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','dmsStorageBox','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); /*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */; /*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */; @@ -1613,26 +1628,14 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','entry_fixMisfit','P INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','employee','buy_tarifas_entry','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_CURDATE','FUNCTION','juan@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','financial','calculoremesas','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','hr','cc_to_iban','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','financial','cc_to_iban','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','marketingBoss','clientTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','clientTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','client_checkBalance','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','addressTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesPerson','client_getSalesPersonByTicket','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','handmadeBoss','confection_control_source','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','travelDetail','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','claimManager','traslado','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','traslado','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','administrative','supplierStatement','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','supplierStatement','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','hrBoss','supplierStatement','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','hrBoss','red','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','salesPerson','red','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','administrative','intrastat_neto','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','productionAssi','confection_control_source','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','artificialBoss','confection_control_source','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','logistic','nz','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','deliveryAssistant','preordenarruta','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','financial','pay','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','bi','salesAssistant','defaultersFromDate','PROCEDURE','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); @@ -1661,7 +1664,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','tx_commit','PROCEDUR INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','hrBoss','balance_create','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','cooler','buyultimate','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','grafana','firstdayofyear','FUNCTION','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn','officeBoss','fustcontrol','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','claimManager','dayend','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','employee','log_add','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','srt','employee','moving_between','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); @@ -1814,10 +1816,8 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','logistic','travel_weeklyclone' INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPricesByBuy','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','coolerAssist','itemproposal','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','company_getsuppliersdebt','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','agency','desglose_volume','PROCEDURE','juan@10.5.1.2','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','bi','productionAssi','rutasanalyze','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','productionPlus','workerCreateExternal','PROCEDURE','juan@10.5.1.2','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','adminBoss','XDiario_Quadrator','PROCEDURE','juan@10.5.1.2','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_NOW','FUNCTION','juan@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_UNIX_TIMESTAMP','FUNCTION','juan@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_UTC_DATE','FUNCTION','juan@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); @@ -1826,7 +1826,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_UTC_TIMESTAMP','F INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_getsaledate','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','ticket_setState','PROCEDURE','guillermo@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','invoicing','invoiceout_new','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','sale_replaceItem','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','sale_replaceItem','PROCEDURE','jgallego@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','ledger_next','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','deliveryAssistant','workerjourney_replace','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','account','developerBoss','role_sync','PROCEDURE','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); @@ -1945,6 +1945,16 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','tx_start','PROCEDURE INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPrices','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPricesByAwb','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPricesByEntry','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','util','hr','accountNumberToIban','FUNCTION','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','util','financial','accountNumberToIban','FUNCTION','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','supplier_statement','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','supplier_statement','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hrBoss','supplier_statement','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','adminBoss','XDiario_check','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','travel_getDetailFromContinent','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','entry_getTransfer','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','entry_getTransfer','PROCEDURE','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'); /*!40000 ALTER TABLE `procs_priv` ENABLE KEYS */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -1958,37 +1968,38 @@ USE `mysql`; /*!40000 ALTER TABLE `global_priv` DISABLE KEYS */; INSERT IGNORE INTO `global_priv` VALUES ('','account','{\"access\": 0, \"is_role\": true,\"version_id\":100707}'); -INSERT IGNORE INTO `global_priv` VALUES ('','adminBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','adminOfficer','{\"access\": 0, \"version_id\": 100707, \"is_role\": true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','administrative','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}'); +INSERT IGNORE INTO `global_priv` VALUES ('','adminBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','adminOfficer','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','administrative','{\"access\": 0, \"is_role\": true, \"version_id\": 101106}'); INSERT IGNORE INTO `global_priv` VALUES ('','agency','{\"access\": 0, \"max_questions\": 40000, \"max_updates\": 1000, \"max_connections\": 20000, \"max_user_connections\": 50, \"max_statement_time\": 0.000000, \"is_role\": true,\"version_id\":100707}'); INSERT IGNORE INTO `global_priv` VALUES ('','android','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','artificialBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','assetManager','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','buyer','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','buyerAssistant','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','buyerBoss','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','claimManager','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','claimManager','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','cooler','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','coolerAssist','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','coolerBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','customer','{\"access\": 0, \"max_questions\": 0, \"max_updates\": 30000, \"max_connections\": 300000, \"max_user_connections\": 400, \"max_statement_time\": 0.000000, \"is_role\": true,\"version_id\":100707}'); INSERT IGNORE INTO `global_priv` VALUES ('','delivery','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','deliveryAssistant','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','deliveryAssistant','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','deliveryBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','developer','{\"access\": 5909905728, \"is_role\": true, \"version_id\": 100707}'); INSERT IGNORE INTO `global_priv` VALUES ('','developerBoss','{\"access\":33554432,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','employee','{\"access\": 0, \"is_role\": true, \"version_id\": 101106}'); INSERT IGNORE INTO `global_priv` VALUES ('','entryEditor','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','ext','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}'); -INSERT IGNORE INTO `global_priv` VALUES ('','financial','{\"access\": 0, \"version_id\": 100707, \"is_role\": true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','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 ('','grafana','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','greenhouseBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','guest','{\"access\": 0, \"max_questions\": 40000, \"max_updates\": 1000, \"max_connections\": 150000, \"max_user_connections\": 200, \"max_statement_time\": 0.000000, \"is_role\": true, \"version_id\": 101106}'); INSERT IGNORE INTO `global_priv` VALUES ('','handmadeBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','hedera-web','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','hr','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}'); -INSERT IGNORE INTO `global_priv` VALUES ('','hrBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','hr','{\"access\": 0, \"is_role\": true, \"version_id\": 101106}'); +INSERT IGNORE INTO `global_priv` VALUES ('','hrBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','invoicing','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','itBoss','{\"access\": 541165846527, \"is_role\": true, \"version_id\": 100707}'); INSERT IGNORE INTO `global_priv` VALUES ('','itManagement','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); @@ -2001,9 +2012,9 @@ INSERT IGNORE INTO `global_priv` VALUES ('','maintenanceBoss','{\"access\":0,\" INSERT IGNORE INTO `global_priv` VALUES ('','manager','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','marketing','{\"access\": 0, \"is_role\": true}'); INSERT IGNORE INTO `global_priv` VALUES ('','marketingBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','officeBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','officeBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','packager','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','palletizer','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','palletizer','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','palletizerBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','preservedBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','production','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); @@ -2011,9 +2022,9 @@ INSERT IGNORE INTO `global_priv` VALUES ('','productionAssi','{\"access\": 0, \ INSERT IGNORE INTO `global_priv` VALUES ('','productionBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','productionPlus','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','root','{\"access\": 549755781119, \"version_id\": 100705, \"is_role\": true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','salesAssistant','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','salesBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','salesPerson','{\"access\": 0, \"is_role\": true,\"version_id\":100707}'); +INSERT IGNORE INTO `global_priv` VALUES ('','salesAssistant','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','salesBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','salesPerson','{\"access\": 0, \"is_role\": true,\"version_id\":101106}'); INSERT IGNORE INTO `global_priv` VALUES ('','salesTeamBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','salix','{\"access\":33555456,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','sysadmin','{\"access\": 201326592, \"is_role\": true, \"version_id\": 100707}'); diff --git a/db/dump/.dump/structure.sql b/db/dump/.dump/structure.sql index 696cb8359..55072e639 100644 --- a/db/dump/.dump/structure.sql +++ b/db/dump/.dump/structure.sql @@ -2868,34 +2868,6 @@ SET character_set_client = @saved_cs_client; -- /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP FUNCTION IF EXISTS `nz` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `nz`(vData DOUBLE) RETURNS double - DETERMINISTIC -BEGIN -/** - * Devuelve 0, si el parámetro es NULL: - */ - DECLARE vResult DOUBLE; - - SET vResult = IFNULL(vData,0); - - RETURN vResult; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `analisis_ventas_evolution_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3223,7 +3195,7 @@ BEGIN LEFT JOIN vn.deliveryMethod dm ON dm.id = a.Vista LEFT JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = t.Id_Consigna LEFT JOIN vn2008.province p ON p.province_id = cs.province_id - LEFT JOIN vn2008.warehouse w ON w.id = t.warehouse_id + LEFT JOIN vn.warehouse w ON w.id = t.warehouse_id WHERE bt.fecha >= vLastMonth AND r.mercancia; END ;; DELIMITER ; @@ -3253,8 +3225,8 @@ BEGIN -- Reclamaciones demasiado sensibles - INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, - Importe, Greuges_type_id,Id_Ticket) + INSERT INTO vn.greuge(shipped, clientFk, description, + amount, greugeTypeFk, ticketFk) SELECT cm.Fecha , cm.Id_Cliente , concat('Claim ',cm.id,' : ', m.Concepte) @@ -3271,8 +3243,8 @@ BEGIN -- Reclamaciones que pasan a Maná - INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, - Importe , Greuges_type_id,Id_Ticket) + INSERT INTO vn.greuge(shipped, clientFk, description, + amount, greugeTypeFk, ticketFk) SELECT cm.Fecha , cm.Id_Cliente , concat('Claim_mana ',cm.id,' : ', m.Concepte) @@ -3315,12 +3287,12 @@ BEGIN AND s.alert_level >= 3; DELETE g.* - FROM vn2008.Greuges g - JOIN tmp.ticket_list t ON g.Id_Ticket = t.Id_Ticket - WHERE Greuges_type_id = 2; + FROM vn.greuge g + JOIN tmp.ticket_list t ON g.ticketFk = t.Id_Ticket + WHERE g.greugeTypeFk = 2; - INSERT INTO vn2008.Greuges (Id_Cliente,Comentario,Importe,Fecha, - Greuges_type_id, Id_Ticket) + INSERT INTO vn.greuge(clientFk, description, amount,shipped, + greugeTypeFk, ticketFk) SELECT Id_Cliente ,concat('recobro ', m.Id_Ticket), - round(SUM(mc.Valor*Cantidad),2) AS dif @@ -3372,13 +3344,13 @@ BEGIN -- Calculamos el porcentaje del recobro para añadirlo al precio de venta UPDATE bi.claims_ratio cr JOIN ( - SELECT Id_Cliente, nz(SUM(Importe)) AS Greuge - FROM vn2008.Greuges - WHERE Fecha <= util.VN_CURDATE() - GROUP BY Id_Cliente + SELECT clientFk Id_Cliente, IFNULL(SUM(amount), 0) AS Greuge + FROM vn.greuge + WHERE shipped <= util.VN_CURDATE() + GROUP BY clientFk ) g ON g.Id_Cliente = cr.Id_Cliente - SET recobro = GREATEST(0,round(nz(Greuge) / - (nz(Consumo) * vMonthToRefund / 12 ) ,3)); + SET recobro = GREATEST(0,round(IFNULL(Greuge, 0) / + (IFNULL(Consumo, 0) * vMonthToRefund / 12 ) ,3)); -- Protección neonatos UPDATE bi.claims_ratio cr @@ -3626,8 +3598,8 @@ BEGIN WHERE hasChanged AND date = vDate; DECLARE invoices CURSOR FOR - SELECT Vencimiento, importe FROM vn2008.Facturas f - WHERE f.Fecha >= '2016-01-01' AND f.Id_Cliente = vClient ORDER BY f.Fecha DESC; + SELECT dued Vencimiento, amount importe FROM vn.invoiceOut + WHERE issued >= '2016-01-01' AND clientFk = vClient ORDER BY issued DESC; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; @@ -3793,8 +3765,8 @@ BEGIN FROM vn.ticket t JOIN vn2008.Clientes cli ON cli.Id_cliente = t.clientFk - LEFT JOIN vn2008.expeditions e ON e.ticket_id = t.id - JOIN vn.expeditionBoxVol ebv ON ebv.boxFk = e.EsBulto + LEFT JOIN vn.expedition e ON e.ticketFk = t.id + JOIN vn.expeditionBoxVol ebv ON ebv.boxFk = e.freightItemFk JOIN vn.zone z ON t.zoneFk = z.id WHERE t.shipped between datSTART AND datEND @@ -3838,17 +3810,17 @@ BEGIN CREATE TEMPORARY TABLE tmp.dp_aux (PRIMARY KEY (ticketFk)) ENGINE = MEMORY - SELECT dp.ticketFk, sum(Importe) Importe + SELECT dp.ticketFk, sum(g.amount) Importe FROM tmp.dp - JOIN vn2008.Greuges g ON g.Id_Ticket = dp.ticketFk - WHERE Greuges_type_id = 1 -- dif_porte + JOIN vn.greuge g ON g.ticketFk = dp.ticketFk + WHERE g.greugeTypeFk = 1 -- dif_porte GROUP BY dp.ticketFk; UPDATE tmp.dp JOIN tmp.dp_aux USING(ticketFk) SET greuge = IFNULL(Importe,0); - INSERT INTO vn2008.Greuges (Id_Cliente,Comentario,Importe,Fecha, Greuges_type_id, Id_Ticket) + INSERT INTO vn.greuge (clientFk,description,amount,shipped,greugeTypeFk,ticketFk) SELECT dp.clientFk , concat('dif_porte ', dp.ticketFk) , round(IFNULL(dp.teorico,0) - IFNULL(dp.practico,0) - IFNULL(dp.greuge,0),2) as Importe @@ -3922,9 +3894,9 @@ BEGIN CREATE TEMPORARY TABLE maxInvoice (PRIMARY KEY (Id_Cliente)) ENGINE = MEMORY - SELECT DISTINCT Id_Cliente, max(Fecha) as maxFecha - FROM vn2008.Facturas - GROUP BY Id_Cliente + SELECT DISTINCT clientFk Id_Cliente, max(issued) as maxFecha + FROM vn.invoiceOut + GROUP BY clientFk HAVING maxFecha < timestampadd(month,-2,datFEC); WHILE datFEC < util.VN_CURDATE() DO @@ -3933,10 +3905,10 @@ BEGIN SELECT Id_Cliente, datFEC as Fecha, Greuge, Ventas, 0 FROM ( - SELECT Id_Cliente, sum(Importe) as Greuge - FROM vn2008.Greuges - where Fecha <= datFEC - group by Id_Cliente + SELECT clientFk Id_Cliente, sum(amount) as Greuge + FROM vn.greuge + where shipped <= datFEC + group by clientFk ) sub RIGHT JOIN @@ -5610,16 +5582,16 @@ BEGIN c.movil, c.POBLACION poblacion, p.`name` provincia, - vn2008.red(f.futur) futur, + ROUND(f.futur, 2) futur, c.Credito credito, pm.`name` forma_pago, - vn2008.red(c365 / 12) consumo_medio365, - vn2008.red(c365) consumo365, - vn2008.red(CmLy.peso) peso_mes_año_pasado, - vn2008.red(CmLy.peso * 1.19) objetivo, + 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, - vn2008.red(mes_actual.consumo) consumoMes, - vn2008.red(IFNULL(mes_actual.consumo, 0) - IFNULL(CmLy.peso * 1.19, 0)) como_lo_llevo, + 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, @@ -5627,9 +5599,9 @@ BEGIN FROM vn2008.Clientes c LEFT JOIN - (SELECT g.Id_Cliente, CAST( SUM(Importe) as DECIMAL(12,2)) AS Greuge - FROM vn2008.Greuges g - JOIN vn.`client` c ON c.id = g.Id_Cliente + (SELECT g.clientFk Id_Cliente, CAST( SUM(g.amount) as DECIMAL(12,2)) AS Greuge + FROM vn.greuge g + JOIN vn.`client` c ON c.id = g.clientFk LEFT JOIN vn.worker w ON c.salesPersonFk = w.id WHERE (c.salesPersonFk = vWorker OR w.bossFk = vWorker) GROUP BY Id_Cliente @@ -5688,9 +5660,9 @@ BEGIN GROUP BY c.Id_Cliente) CmLy ON CmLy.Id_Cliente = c.Id_Cliente LEFT JOIN (SELECT c.Id_Cliente, - IF(MAX(Fecha) < DATE_FORMAT(TIMESTAMPADD(MONTH, - 1, vDate), '%Y- %m-01'), TRUE, FALSE) muerto - FROM vn2008.Facturas f - JOIN vn2008.Clientes c ON c.Id_cliente = f.Id_Cliente + IF(MAX(io.issued) < DATE_FORMAT(TIMESTAMPADD(MONTH, - 1, vDate), '%Y- %m-01'), TRUE, FALSE) muerto + FROM vn.invoiceOut io + JOIN vn2008.Clientes c ON c.Id_cliente = io.clientFk LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador WHERE (c.Id_Trabajador = vWorker OR tr.boss = vWorker) GROUP BY Id_Cliente) dead ON dead.Id_Cliente = c.Id_Cliente @@ -6331,11 +6303,11 @@ BEGIN AND Fechacobro > vFromDated AND Fechacobro <= vToDated UNION ALL - SELECT g.Id_Cliente, g.Importe - FROM vn2008.Greuges g - WHERE Greuges_type_id = vManaGreugeTypeId - AND Fecha > vFromDated - AND Fecha <= vToDated + SELECT clientFk, amount + FROM vn.greuge + WHERE greugeTypeFk = vManaGreugeTypeId + AND shipped > vFromDated + AND shipped <= vToDated UNION ALL SELECT clientFk, mana FROM vn.clientManaCache @@ -7118,9 +7090,9 @@ BEGIN ENGINE = MEMORY SELECT Id_Ticket FROM vn2008.Tickets t - JOIN vn2008.Facturas f ON f.Id_Factura = t.Factura - WHERE year(f.Fecha) = vYear - AND month(f.Fecha) = vMonth; + JOIN vn.invoiceOut io ON io.id = t.Factura + WHERE year(io.issued) = vYear + AND month(io.issued) = vMonth; INSERT INTO bs.ventas_contables(year , month @@ -7250,9 +7222,9 @@ BEGIN (PRIMARY KEY (Id_Ticket)) SELECT Id_Ticket FROM vn2008.Tickets t - JOIN vn2008.Facturas f ON f.Id_Factura = t.Factura - WHERE year(f.Fecha) = vYear - AND month(f.Fecha) = vMonth; + JOIN vn.invoiceOut io ON io.id = t.Factura + WHERE year(io.issued) = vYear + AND month(io.issued) = vMonth; SELECT vYear Año, vMonth Mes, @@ -7321,20 +7293,20 @@ BEGIN WHERE date BETWEEN @datSTART AND @datEND ) tm LEFT JOIN - (SELECT DISTINCT tm.yearMonth, f.Id_Cliente , 1 as Compra - FROM vn2008.Facturas f - JOIN vn2008.time tm ON tm.date = f.Fecha - WHERE Fecha BETWEEN @datSTART + (SELECT DISTINCT tm.yearMonth, io.clientFk Id_Cliente , 1 as Compra + FROM vn.invoiceOut io + JOIN vn2008.time tm ON tm.date = io.issued + WHERE io.issued BETWEEN @datSTART AND @datEND) f ON f.yearMonth = tm.yearMonth AND f.Id_Cliente = c.Id_Cliente; UPDATE tmp.VivosMuertos vm JOIN - (SELECT MIN(tm.yearMonth) firstMonth, f.Id_Cliente - FROM vn2008.Facturas f - JOIN vn2008.time tm ON tm.date = f.Fecha - WHERE Fecha BETWEEN @datSTART AND @datEND - GROUP BY f.Id_Cliente ) fm ON fm.firstMonth = vm.yearMonth + (SELECT MIN(tm.yearMonth) firstMonth, io.clientFk Id_Cliente + FROM vn.invoiceOut io + JOIN vn2008.time tm ON tm.date = io.issued + WHERE io.issued BETWEEN @datSTART AND @datEND + GROUP BY io.clientFk) fm ON fm.firstMonth = vm.yearMonth AND fm.Id_Cliente = vm.Id_Cliente SET Nuevo = 1; @@ -7343,11 +7315,11 @@ BEGIN UPDATE tmp.VivosMuertos vm JOIN ( - SELECT MAX(tm.yearMonth) firstMonth, f.Id_Cliente - FROM vn2008.Facturas f - JOIN vn2008.time tm ON tm.date = f.Fecha - WHERE Fecha BETWEEN @datSTART AND @datEND - GROUP BY f.Id_Cliente ) fm ON fm.firstMonth = vm.yearMonth + SELECT MAX(tm.yearMonth) firstMonth, io.clientFk Id_Cliente + FROM vn.invoiceOut io + JOIN vn2008.time tm ON tm.date = io.issued + WHERE io.issued BETWEEN @datSTART AND @datEND + GROUP BY io.clientFk) fm ON fm.firstMonth = vm.yearMonth AND fm.Id_Cliente = vm.Id_Cliente SET Muerto = 1 @@ -8128,7 +8100,8 @@ proc: BEGIN DECLARE vReserveDate DATETIME; DECLARE vParams CHAR(100); DECLARE vInventoryDate DATE; - DECLARE vIsLogifloraDay BOOLEAN; + DECLARE vLifeScope DATE; + DECLARE vWarehouseFkInventory INT; DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN @@ -8149,43 +8122,42 @@ proc: BEGIN LEAVE proc; END IF; - -- Invoca al procedimiento que genera el stock virtual de Logiflora, si coincide con la peticion de refresco del disponible - IF vn.isLogifloraDay(vDated, vWarehouse) THEN - -- CALL edi.floramondo_offerRefresh; - SET vIsLogifloraDay = TRUE; - ELSE - SET vIsLogifloraDay = FALSE; - END IF; - -- Calcula algunos parámetros necesarios SET vStartDate = TIMESTAMP(vDated, '00:00:00'); SELECT inventoried INTO vInventoryDate FROM vn.config; + SELECT DATE_SUB(vStartDate, INTERVAL MAX(life) DAY) INTO vLifeScope FROM vn.itemType; SELECT SUBTIME(util.VN_NOW(), reserveTime) INTO vReserveDate FROM hedera.orderConfig; + SELECT w.id INTO vWarehouseFkInventory + FROM vn.warehouse w + WHERE w.code = 'inv'; + -- Calcula el ultimo dia de vida para cada producto DROP TEMPORARY TABLE IF EXISTS itemRange; CREATE TEMPORARY TABLE itemRange (PRIMARY KEY (itemFk)) ENGINE = MEMORY - SELECT c.itemFk, - IF(it.life IS NULL, - NULL, - TIMESTAMP(TIMESTAMPADD(DAY, it.life, c.landing), '23:59:59')) ended - FROM ( - SELECT b.itemFk, MAX(t.landed) landing - FROM vn.buy b - JOIN vn.entry e ON b.entryFk = e.id - JOIN vn.travel t ON t.id = e.travelFk - JOIN vn.warehouse w ON w.id = t.warehouseInFk - WHERE t.landed BETWEEN vInventoryDate AND vStartDate - AND t.warehouseInFk = vWarehouse - AND NOT e.isExcludedFromAvailable - GROUP BY b.itemFk - ) c - JOIN vn.item i ON i.id = c.itemFk + SELECT i.id itemFk, + util.dayEnd(DATE_ADD(c.maxLanded, INTERVAL it.life DAY)) ended, it.life + FROM vn.item i + LEFT JOIN ( + SELECT b.itemFk, MAX(t.landed) maxLanded + FROM vn.buy b + JOIN vn.entry e ON b.entryFk = e.id + JOIN vn.travel t ON t.id = e.travelFk + JOIN vn.warehouse w ON w.id = t.warehouseInFk + JOIN vn.item i ON i.id = b.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + WHERE t.landed BETWEEN vLifeScope AND vStartDate + AND t.warehouseInFk = vWarehouse + AND t.warehouseOutFk <> vWarehouseFkInventory + AND it.life + AND NOT e.isExcludedFromAvailable + GROUP BY b.itemFk + ) c ON i.id = c.itemFk JOIN vn.itemType it ON it.id = i.typeFk - HAVING ended >= vStartDate OR ended IS NULL; + HAVING ended >= vStartDate OR life IS NULL; -- Calcula el ATP DELETE FROM available WHERE calc_id = vCalc; @@ -8209,7 +8181,7 @@ proc: BEGIN WHERE i.landed >= vStartDate AND (ir.ended IS NULL OR i.landed <= ir.ended) AND i.warehouseInFk = vWarehouse - AND (ISNULL(wf.entryFk) OR vIsLogifloraDay) + AND ISNULL(wf.entryFk) UNION ALL SELECT i.itemFk, i.shipped, i.quantity FROM vn.itemEntryOut i @@ -9319,6 +9291,61 @@ CREATE TABLE `ektConfig` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `ektK1` +-- + +DROP TABLE IF EXISTS `ektK1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ektK1` ( + `id` smallint(6) unsigned NOT NULL, + `description` varchar(50) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Características negativas de los articulos de subasta'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `ektK2` +-- + +DROP TABLE IF EXISTS `ektK2`; +/*!50001 DROP VIEW IF EXISTS `ektK2`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `ektK2` AS SELECT + 1 AS `id`, + 1 AS `description` */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `ektK3` +-- + +DROP TABLE IF EXISTS `ektK3`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ektK3` ( + `id` smallint(6) unsigned NOT NULL, + `description` varchar(50) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Características fitosanitarias de los articulos de subasta'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ektK4` +-- + +DROP TABLE IF EXISTS `ektK4`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ektK4` ( + `id` smallint(6) unsigned NOT NULL, + `description` varchar(50) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Características calidad de los articulos de subasta'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Temporary table structure for view `ektRecent` -- @@ -10398,6 +10425,7 @@ proc:BEGIN DECLARE vHasItemGroup BOOL; DECLARE vDescription VARCHAR(255); DECLARE vSaleFk INT; + DECLARE vDefaultEntry INT; -- Carga los datos necesarios del EKT SELECT e.ref, qty, package, putOrderFk MOD 1000000, i2.id , NOT ISNULL(eea.addressFk), NOT ISNULL(igto.group_code), @@ -10417,6 +10445,9 @@ proc:BEGIN CALL vn.mail_insert('pako@verdnatura.es', 'nocontestar@verdnatura.es', CONCAT('Nuevo grupo en Floramondo: ', vDescription), vDescription); LEAVE proc; END IF; + + SELECT defaultEntry INTO vDefaultEntry + FROM vn.entryConfig; -- Asigna la entrada SELECT vn.ekt_getEntry(vSelf) INTO vEntryFk; @@ -10476,10 +10507,9 @@ proc:BEGIN LEFT JOIN ekt l ON l.ref = e.ref LEFT JOIN vn.buy b ON b.ektFk = l.id LEFT JOIN vn.item i ON i.id = b.itemFk - JOIN vn2008.config cfg WHERE e.id = vSelf AND l.id != vSelf - AND b.itemFk != cfg.generic_item + AND b.itemFk != vDefaultEntry AND IF(t.s1, l.s1 = e.s1, TRUE) AND IF(t.s2, l.s2 = e.s2, TRUE) AND IF(t.s3, l.s3 = e.s3, TRUE) @@ -10518,7 +10548,7 @@ proc:BEGIN SELECT vEntryFk, vSelf, (@t := IF(i.stems, i.stems, 1)) * e.pri / IFNULL(i.stemMultiplier, 1) buyingValue, - IFNULL(vItem, cfg.generic_item) itemFk, + IFNULL(vItem, vDefaultEntry) itemFk, e.qty stickers, @pac := IFNULL(i.stemMultiplier, 1) * e.pac / @t packing, IFNULL(b.`grouping`, e.pac), @@ -10529,8 +10559,7 @@ proc:BEGIN FROM ekt e LEFT JOIN vn.buy b ON b.id = vBuy LEFT JOIN vn.item i ON i.id = b.itemFk - LEFT JOIN vn.supplier s ON e.pro = s.id - JOIN vn2008.config cfg + LEFT JOIN vn.supplier s ON e.pro = s.id WHERE e.id = vSelf LIMIT 1; @@ -10761,7 +10790,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ekt_scan`(vBarcode VARCHAR(512)) BEGIN /** - * Busca transaciones a partir de un código de barras, las marca como escaneadas + * Busca transaciones a partir de un codigo de barras, las marca como escaneadas * y las devuelve. * Ver https://wiki.verdnatura.es/index.php/Ekt#Algoritmos_de_lectura * @@ -10832,7 +10861,7 @@ BEGIN INSERT INTO tmp.ekt SELECT id FROM ekt - WHERE fec = vFec + WHERE fec >= vFec - INTERVAL 1 DAY AND (( vKlo = vDefaultKlo AND (klo = vKlo OR klo IS NULL OR klo = 0) @@ -10841,7 +10870,7 @@ BEGIN AND auction = vAuction AND agj = vShortAgj) ) - ORDER BY agj DESC + ORDER BY agj DESC, fec DESC LIMIT 1; SELECT COUNT(*) FROM tmp.ekt INTO vIsFound; @@ -18516,10 +18545,11 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceIn_add`(vInvoiceInFk INT, vX BEGIN /** * Traslada la info de contabilidad relacionada con las facturas recibidas - * + * * @vInvoiceInFk Factura recibida * @vXDiarioFk Id tabla XDiario - */ + */ + DECLARE vInvoiceInOriginalFk INT; DECLARE vDone BOOL DEFAULT FALSE; DECLARE vBase DOUBLE; DECLARE vVat DOUBLE; @@ -18536,25 +18566,25 @@ BEGIN DECLARE vInvoiceTypeInformative VARCHAR(1); DECLARE vIsInformativeExportation BOOL DEFAULT FALSE; - DECLARE vCursor CURSOR FOR + DECLARE vCursor CURSOR FOR SELECT it.taxableBase, CAST((( it.taxableBase / 100) * t.PorcentajeIva) AS DECIMAL (10,2)), t.PorcentajeIva, it.transactionTypeSageFk, it.taxTypeSageFk, tty.isIntracommunity, - tt.ClaveOperacionDefecto + tt.ClaveOperacionDefecto FROM vn.invoiceIn i JOIN vn.invoiceInTax it ON it.InvoiceInFk = i.id JOIN TiposIva t ON t.CodigoIva = it.taxTypeSageFk JOIN taxType tty ON tty.id = t.CodigoIva JOIN TiposTransacciones tt ON tt.CodigoTransaccion = it.transactionTypeSageFk LEFT JOIN vn.dua d ON d.id = vInvoiceInFk - WHERE i.id = vInvoiceInFk + WHERE i.id = vInvoiceInFk AND d.id IS NULL; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + DELETE FROM movContaIVA WHERE id = vXDiarioFk; @@ -18577,22 +18607,22 @@ BEGIN vTaxCode, vIsIntracommunity, vOperationCode; - - IF vDone THEN + + IF vDone THEN LEAVE l; END IF; - SET vTransactionCodeOld = vTransactionCode; - SET vTaxCodeOld = vTaxCode; + SET vTransactionCodeOld = vTransactionCode; + SET vTaxCodeOld = vTaxCode; - IF vOperationCode IS NOT NULL THEN + IF vOperationCode IS NOT NULL THEN UPDATE movContaIVA SET ClaveOperacionFactura = vOperationCode WHERE id = vXDiarioFk; END IF; - + SET vCounter = vCounter + 1; - CASE vCounter + CASE vCounter WHEN 1 THEN UPDATE movContaIVA SET BaseIva1 = vBase, @@ -18628,31 +18658,31 @@ BEGIN WHERE id = vXDiarioFk; ELSE SELECT vXDiarioFk INTO vXDiarioFk; - END CASE; + END CASE; IF vIsIntracommunity THEN UPDATE movContaIVA SET Intracomunitaria = TRUE WHERE id = vXDiarioFk; END IF; - - SET vTransactionCodeOld = vTransactionCode; - SET vTaxCodeOld = vTaxCode; - + + SET vTransactionCodeOld = vTransactionCode; + SET vTaxCodeOld = vTaxCode; + END LOOP; CLOSE vCursor; SELECT d.ASIEN AND x.ASIEN IS NULL INTO vIsInformativeExportation FROM vn.dua d - LEFT JOIN vn.XDiario x ON x.ASIEN = d.ASIEN + LEFT JOIN vn.XDiario x ON x.ASIEN = d.ASIEN AND x.SERIE = vSerialDua COLLATE utf8mb3_unicode_ci WHERE d.ASIEN = ( SELECT ASIEN - FROM vn.XDiario + FROM vn.XDiario WHERE id = vXDiarioFk) LIMIT 1; - + UPDATE movContaIVA mci JOIN tmp.invoiceIn ii ON ii.id = vInvoiceInFk JOIN vn.XDiario x ON x.id = mci.id @@ -18664,13 +18694,13 @@ BEGIN mci.Serie = ii.serial, mci.Factura = ii.id, mci.FechaFactura = ii.issued, - mci.ImporteFactura = IFNULL(mci.BaseIva1, 0) + IFNULL(mci.CuotaIva1, 0) + - IFNULL(mci.BaseIva2, 0) + IFNULL(mci.CuotaIva2, 0) + - IFNULL(mci.BaseIva3, 0) + IFNULL(mci.CuotaIva3, 0) + + mci.ImporteFactura = IFNULL(mci.BaseIva1, 0) + IFNULL(mci.CuotaIva1, 0) + + IFNULL(mci.BaseIva2, 0) + IFNULL(mci.CuotaIva2, 0) + + IFNULL(mci.BaseIva3, 0) + IFNULL(mci.CuotaIva3, 0) + IFNULL(mci.BaseIva4, 0) + IFNULL(mci.CuotaIva4, 0), - mci.TipoFactura = IF(id.id, - IF( ii.serial = vSerialDua COLLATE utf8mb3_unicode_ci, vInvoiceTypeReceived, vInvoiceTypeInformative), - IF(vIsInformativeExportation,vInvoiceTypeInformative, vInvoiceTypeReceived)), + mci.TipoFactura = IF(id.id, + IF( ii.serial = vSerialDua COLLATE utf8mb3_unicode_ci, vInvoiceTypeReceived, vInvoiceTypeInformative), + IF(vIsInformativeExportation,vInvoiceTypeInformative, vInvoiceTypeReceived)), mci.CodigoCuentaFactura = x.SUBCTA, mci.CifDni = IF(LEFT(TRIM(s.nif), 2) = n.SiglaNacion, SUBSTRING(TRIM(s.nif), 3), s.nif), mci.Nombre = s.name, @@ -18698,7 +18728,7 @@ BEGIN JOIN (SELECT SUM(x2.BASEEURO) taxableBase, SUM(x2.EURODEBE) taxBase FROM vn.XDiario x1 JOIN vn.XDiario x2 ON x1.ASIEN = x2.ASIEN - WHERE x2.BASEEURO <> 0 + WHERE x2.BASEEURO <> 0 AND x1.id = vXDiarioFk )sub JOIN ClavesOperacion co ON co.Descripcion = 'Arrendamiento de locales de negocio' @@ -18706,11 +18736,42 @@ BEGIN mci.ClaveOperacionFactura = IF( t.Retencion = 'ARRENDAMIENTO Y SUBARRENDAMIENTO', co.ClaveOperacionFactura_, mci.ClaveOperacionFactura), mci.BaseRetencion = IF (t.Retencion = 'ACTIVIDADES AGRICOLAS O GANADERAS', sub.taxableBase + sub.taxBase, sub.taxableBase), mci.PorRetencion = t.PorcentajeRetencion, - mci.ImporteRetencion = iit.taxableBase * - 1 - WHERE mci.id = vXDiarioFk + mci.ImporteRetencion = iit.taxableBase * - 1 + WHERE mci.id = vXDiarioFk AND e.name = 'Retenciones' AND id.id IS NULL; + SELECT correctedFk INTO vInvoiceInOriginalFk + FROM vn.invoiceInCorrection + WHERE correctingFk = vInvoiceInFk; + + IF vInvoiceInOriginalFk THEN + + UPDATE movContaIVA mci + JOIN vn.invoiceInRefund iir ON iir.invoiceInRefundFk = vInvoiceInFk + JOIN (SELECT issued, + SUM(sub.taxableBase) taxableBase, + SUM(ROUND((sub.taxableBase * sub.PorcentajeIva) / 100 , 2)) vat + FROM(SELECT issued, + SUM(iit.taxableBase) taxableBase, + ti.PorcentajeIva + FROM vn.invoiceIn i + JOIN vn.invoiceInTax iit ON iit.invoiceInFk = i.id + JOIN sage.TiposIva ti ON ti.CodigoIva = iit.taxTypeSageFk + WHERE i.id = vInvoiceInOriginalFk + GROUP BY ti.CodigoIva)sub + )invoiceInOriginal + JOIN ClavesOperacion co ON co.Descripcion = 'Factura rectificativa' + SET mci.TipoRectificativa = iir.refundCategoryFk, + mci.ClaseAbonoRectificativas = iir.refundType, + mci.FechaFacturaOriginal = invoiceInOriginal.issued, + mci.FechaOperacion = invoiceInOriginal.issued, + mci.BaseImponibleOriginal = invoiceInOriginal.taxableBase, + mci.CuotaIvaOriginal = invoiceInOriginal.vat, + mci.ClaveOperacionFactura = co.ClaveOperacionFactura_ + WHERE mci.id = vXDiarioFk; + + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -24620,6 +24681,75 @@ DELIMITER ; -- /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP FUNCTION IF EXISTS `accountNumberToIban` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `accountNumberToIban`(vAccount VARCHAR(20) +) RETURNS varchar(4) CHARSET utf8mb3 COLLATE utf8mb3_general_ci + DETERMINISTIC +BEGIN +/** +* Calcula y genera el código IBAN correspondiente +* a un número de cuenta bancaria español. +* +* @param vAccount Número de cuenta bancaria +* @return vIban Código IBAN de 4 caracteres. +*/ + DECLARE vIban VARCHAR(4); + + SELECT + CONCAT('ES', + RIGHT( + CONCAT(0, + 98-MOD( + CONCAT( + MOD( + CONCAT( + MOD( + CONCAT( + MOD( + SUBSTRING(vAccount, 1, 8), + 97 + ), + SUBSTRING(vAccount,9,8) + ), + 97 + ), + SUBSTRING( + CONCAT(vAccount, 142800), + 17, + 8 + ) + ), + 97 + ), + SUBSTRING( + CONCAT(vAccount, 142800), + 25, + 2 + ) + ), + 97 + ) + ), + 2 + ) + ) INTO vIban; + + RETURN vIban; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `accountShortToStandard` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -26382,6 +26512,65 @@ CREATE TABLE `absenceType` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `accountDetail` +-- + +DROP TABLE IF EXISTS `accountDetail`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `accountDetail` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `value` varchar(50) NOT NULL, + `accountDetailTypeFk` int(11) NOT NULL, + `supplierAccountFk` mediumint(8) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `fk_account_detail_account_detail_type1_idx` (`accountDetailTypeFk`), + KEY `fk_account_detail_Proveedores_account1_idx` (`supplierAccountFk`), + CONSTRAINT `fk_account_detail_account_detail_type1` FOREIGN KEY (`accountDetailTypeFk`) REFERENCES `accountDetailType` (`id`) ON UPDATE CASCADE, + CONSTRAINT `fk_account_detail_account_id_proveedores_account` FOREIGN KEY (`supplierAccountFk`) REFERENCES `supplierAccount` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `accountDetailType` +-- + +DROP TABLE IF EXISTS `accountDetailType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `accountDetailType` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `description` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `accountReconciliation` +-- + +DROP TABLE IF EXISTS `accountReconciliation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `accountReconciliation` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `supplierAccountFk` mediumint(8) unsigned NOT NULL, + `operationDated` datetime NOT NULL, + `valueDated` datetime NOT NULL, + `amount` double NOT NULL, + `concept` varchar(255) DEFAULT NULL, + `debitCredit` smallint(6) NOT NULL, + `calculatedCode` varchar(255) DEFAULT NULL, + `created` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + UNIQUE KEY `idaccount_conciliacion_UNIQUE` (`id`), + KEY `fg_accconciliacion_key1_idx` (`supplierAccountFk`), + KEY `index_id_calculated` (`calculatedCode`), + CONSTRAINT `fg_key1_accountconc` FOREIGN KEY (`supplierAccountFk`) REFERENCES `supplierAccount` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `accounting` -- @@ -26595,15 +26784,15 @@ CREATE TABLE `agency` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(25) NOT NULL, `warehouseFk` smallint(5) unsigned DEFAULT NULL COMMENT 'A nulo si se puede enrutar desde todos los almacenes', - `warehouseAliasFk` smallint(5) unsigned DEFAULT NULL, + `warehouseAliasFk__` smallint(5) unsigned DEFAULT NULL COMMENT '@deprecated 2024-01-23 refs #5167', `isOwn` tinyint(1) NOT NULL DEFAULT 0, `workCenterFk` int(11) DEFAULT NULL, `isAnyVolumeAllowed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Permite vender productos que tengan vn.itemType.IsUnconventionalSize = TRUE', PRIMARY KEY (`id`), KEY `warehouse_id` (`warehouseFk`), - KEY `agencias_alias_idx` (`warehouseAliasFk`), + KEY `agencias_alias_idx` (`warehouseAliasFk__`), KEY `agency_ibfk_3_idx` (`workCenterFk`), - CONSTRAINT `agency_FK` FOREIGN KEY (`warehouseAliasFk`) REFERENCES `warehouseAlias` (`id`) ON UPDATE CASCADE, + CONSTRAINT `agency_FK` FOREIGN KEY (`warehouseAliasFk__`) REFERENCES `warehouseAlias__` (`id`) ON UPDATE CASCADE, CONSTRAINT `agency_ibfk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `agency_ibfk_3` FOREIGN KEY (`workCenterFk`) REFERENCES `workCenter` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; @@ -26733,18 +26922,32 @@ CREATE TABLE `agencyTermConfig` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `agencyWarehouse` +-- Table structure for table `airline` -- -DROP TABLE IF EXISTS `agencyWarehouse`; -/*!50001 DROP VIEW IF EXISTS `agencyWarehouse`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `agencyWarehouse` AS SELECT - 1 AS `agencyFk`, - 1 AS `warehouseFk`, - 1 AS `agencyType` */; -SET character_set_client = @saved_cs_client; +DROP TABLE IF EXISTS `airline`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `airline` ( + `id` smallint(2) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(20) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `airport` +-- + +DROP TABLE IF EXISTS `airport`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `airport` ( + `id` smallint(2) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(30) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `alertLevel` @@ -26956,6 +27159,154 @@ CREATE TABLE `awb` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `awbComponent` +-- + +DROP TABLE IF EXISTS `awbComponent`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `awbComponent` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `awbFk` smallint(11) unsigned DEFAULT NULL, + `supplierFk` int(11) NOT NULL, + `dated__` date NOT NULL, + `typeFk` mediumint(3) unsigned DEFAULT NULL, + `awbRoleFk` tinyint(1) unsigned NOT NULL DEFAULT 1, + `awbUnitFk` varchar(10) DEFAULT NULL, + `value` decimal(10,2) DEFAULT NULL, + `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT 2, + `invoiceInFk` mediumint(8) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `unique_idx` (`awbFk`,`supplierFk`,`typeFk`), + KEY `Id_Moneda` (`currencyFk`), + KEY `awb_component_fk` (`typeFk`), + KEY `awb_role_fk` (`awbRoleFk`), + KEY `awb_unit_fk` (`awbUnitFk`), + CONSTRAINT `Id_Monedafk` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`id`) ON DELETE CASCADE, + CONSTRAINT `awb_component_` FOREIGN KEY (`typeFk`) REFERENCES `awbComponentType` (`id`) ON UPDATE CASCADE, + CONSTRAINT `awb_role_fk` FOREIGN KEY (`awbRoleFk`) REFERENCES `awbRole` (`id`) ON UPDATE CASCADE, + CONSTRAINT `awb_unit_fk` FOREIGN KEY (`awbUnitFk`) REFERENCES `awbUnit` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `awbComponentTemplate` +-- + +DROP TABLE IF EXISTS `awbComponentTemplate`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `awbComponentTemplate` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `freightFk` int(11) DEFAULT NULL, + `airportIn` varchar(3) DEFAULT NULL, + `airportOut` varchar(3) DEFAULT NULL, + `airlineFk` smallint(2) unsigned DEFAULT NULL, + `typeFk` mediumint(3) unsigned NOT NULL, + `dated` date NOT NULL, + `awbRoleFk` tinyint(1) unsigned NOT NULL, + `awbUnit` varchar(10) DEFAULT NULL, + `value` decimal(10,3) DEFAULT NULL, + `maxValue` decimal(10,2) unsigned DEFAULT NULL, + `minValue` decimal(10,2) unsigned DEFAULT NULL, + `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT 2, + `days` varchar(7) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `carguera_id_UNIQUE` (`freightFk`,`airportIn`,`airportOut`,`airlineFk`,`typeFk`,`dated`,`days`), + KEY `Id_Moneda` (`currencyFk`), + KEY `airline_idx` (`airlineFk`), + KEY `role_idx` (`awbRoleFk`), + KEY `awb_unit_fk1` (`awbUnit`), + KEY `awb_component_template_FK` (`typeFk`), + CONSTRAINT `Id_Moneda` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`id`) ON UPDATE CASCADE, + CONSTRAINT `awb_component_template_FK` FOREIGN KEY (`typeFk`) REFERENCES `awbComponentType` (`id`) ON UPDATE CASCADE, + CONSTRAINT `awb_component_template_FK_1` FOREIGN KEY (`airlineFk`) REFERENCES `airline` (`id`) ON UPDATE CASCADE, + CONSTRAINT `awb_unit_fk1` FOREIGN KEY (`awbUnit`) REFERENCES `awbUnit` (`id`) ON UPDATE CASCADE, + CONSTRAINT `role_fk` FOREIGN KEY (`awbRoleFk`) REFERENCES `awbRole` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `awbComponentType` +-- + +DROP TABLE IF EXISTS `awbComponentType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `awbComponentType` ( + `id` mediumint(3) unsigned NOT NULL AUTO_INCREMENT, + `description` varchar(45) DEFAULT NULL, + `hasStems` tinyint(1) NOT NULL DEFAULT 1, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT=' '; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `awbDms` +-- + +DROP TABLE IF EXISTS `awbDms`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `awbDms` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `awbFk` smallint(11) unsigned NOT NULL, + `dmsFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `awb_gestdoc_awb_fk` (`awbFk`), + KEY `awb_gestdoc_gestdoc_fk` (`dmsFk`), + CONSTRAINT `awb_gestdoc_awb_fk` FOREIGN KEY (`awbFk`) REFERENCES `awb` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `awb_gestdoc_gestdoc_fk` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `awbInvoiceIn` +-- + +DROP TABLE IF EXISTS `awbInvoiceIn`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `awbInvoiceIn` ( + `awbFk` smallint(5) unsigned NOT NULL, + `invoiceInFk` mediumint(8) unsigned NOT NULL, + `sad` varchar(18) DEFAULT NULL, + PRIMARY KEY (`invoiceInFk`), + KEY `awb_id` (`awbFk`), + CONSTRAINT `awbInvoiceIn_ibfk_1` FOREIGN KEY (`awbFk`) REFERENCES `awb` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `awbInvoiceIn_ibfk_2` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `awbRole` +-- + +DROP TABLE IF EXISTS `awbRole`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `awbRole` ( + `id` tinyint(1) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(45) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT=' '; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `awbUnit` +-- + +DROP TABLE IF EXISTS `awbUnit`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `awbUnit` ( + `id` varchar(10) NOT NULL DEFAULT '', + `operation` varchar(45) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='tipos de unidades'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Temporary table structure for view `awbVolume` -- @@ -26970,6 +27321,26 @@ SET character_set_client = utf8; 1 AS `buyFk` */; SET character_set_client = @saved_cs_client; +-- +-- Table structure for table `balanceNestTree` +-- + +DROP TABLE IF EXISTS `balanceNestTree`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `balanceNestTree` ( + `lft` int(11) DEFAULT NULL, + `rgt` int(11) DEFAULT NULL, + `name` text DEFAULT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + `expenseFk` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `isSelected` tinyint(1) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `balanceNestTree_expense_FK` (`expenseFk`), + CONSTRAINT `balanceNestTree_expense_FK` FOREIGN KEY (`expenseFk`) REFERENCES `expense` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Temporary table structure for view `bank` -- @@ -27037,34 +27408,49 @@ CREATE TABLE `bankErrorCode` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `bankPolicy` +-- Table structure for table `bankPolicy` -- DROP TABLE IF EXISTS `bankPolicy`; -/*!50001 DROP VIEW IF EXISTS `bankPolicy`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `bankPolicy` AS SELECT - 1 AS `id`, - 1 AS `ref`, - 1 AS `amount`, - 1 AS `balanceInterestDrawn`, - 1 AS `commissionAvailableBalances`, - 1 AS `openingCommission`, - 1 AS `started`, - 1 AS `ended`, - 1 AS `bankFk`, - 1 AS `companyFk`, - 1 AS `supplierFk`, - 1 AS `description`, - 1 AS `hasGuarantee`, - 1 AS `dmsFk`, - 1 AS `notaryFk`, - 1 AS `currencyFk`, - 1 AS `amortizationTypeFk`, - 1 AS `periodicityTypeFk`, - 1 AS `insuranceExpired` */; -SET character_set_client = @saved_cs_client; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `bankPolicy` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ref` varchar(45) DEFAULT NULL, + `amount` double NOT NULL, + `committedFee` double DEFAULT NULL, + `nonCommittedFee` double DEFAULT NULL, + `annualFee` double DEFAULT NULL, + `started` date NOT NULL, + `ended` date DEFAULT NULL, + `accountingFk` int(11) NOT NULL, + `companyFk` int(10) unsigned NOT NULL DEFAULT 442, + `supplierFk` int(10) unsigned DEFAULT NULL, + `description` varchar(255) DEFAULT NULL, + `hasGuarantee` tinyint(1) NOT NULL DEFAULT 0, + `dmsFk` int(11) DEFAULT NULL, + `notaryFk` int(10) unsigned DEFAULT NULL, + `currencyFk` tinyint(3) unsigned DEFAULT 2, + `amortizationTypeFk` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `periodicityTypeFk` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `insuranceExpired` date DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `Id_Banco_Poliza_idx` (`accountingFk`), + KEY `Id_Poliza_Empresa_idx` (`companyFk`), + KEY `bankSupplierIdx1_idx` (`supplierFk`), + KEY `bankDmsIdx2_idx` (`dmsFk`), + KEY `bankNotaryIdx3_idx` (`notaryFk`), + KEY `asdf_idx` (`amortizationTypeFk`), + KEY `bankPeriodicityIdx4_idx` (`periodicityTypeFk`), + CONSTRAINT `Bancos_polizaCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `Bancos_poliza_notaryFk` FOREIGN KEY (`notaryFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, + CONSTRAINT `Bancos_poliza_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, + CONSTRAINT `Id_Banco_Poliza` FOREIGN KEY (`accountingFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE, + CONSTRAINT `asdf` FOREIGN KEY (`amortizationTypeFk`) REFERENCES `amortizationType` (`code`) ON UPDATE CASCADE, + CONSTRAINT `bankDmsIdx2` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON UPDATE CASCADE, + CONSTRAINT `bankPeriodicityIdx4` FOREIGN KEY (`periodicityTypeFk`) REFERENCES `periodicityType` (`code`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Lineas de credito asociadas a cuentas corrientes'; +/*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `beach` @@ -27430,7 +27816,7 @@ CREATE TABLE `buy` ( KEY `buy_itemFk_IDX` (`itemFk`) USING BTREE, KEY `buy_fk_editor` (`editorFk`), CONSTRAINT `buy_FK` FOREIGN KEY (`itemOriginalFk`) REFERENCES `item` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `buy_FK_1` FOREIGN KEY (`containerFk`) REFERENCES `vn2008`.`container` (`container_id`) ON UPDATE CASCADE, + CONSTRAINT `buy_FK_1` FOREIGN KEY (`containerFk`) REFERENCES `vn2008`.`container__` (`container_id`) ON UPDATE CASCADE, CONSTRAINT `buy_ektFk` FOREIGN KEY (`ektFk`) REFERENCES `edi`.`ekt` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `buy_fk_4` FOREIGN KEY (`deliveryFk`) REFERENCES `edi`.`deliveryInformation` (`ID`) ON DELETE SET NULL ON UPDATE SET NULL, CONSTRAINT `buy_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`), @@ -28237,22 +28623,6 @@ CREATE TABLE `clientCredit` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `clientDefaultCompany` --- - -DROP TABLE IF EXISTS `clientDefaultCompany`; -/*!50001 DROP VIEW IF EXISTS `clientDefaultCompany`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `clientDefaultCompany` AS SELECT - 1 AS `id`, - 1 AS `clientFk`, - 1 AS `companyFk`, - 1 AS `started`, - 1 AS `finished` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `clientDms` -- @@ -29249,19 +29619,6 @@ CREATE TABLE `conveyorType` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `coolerPath` --- - -DROP TABLE IF EXISTS `coolerPath`; -/*!50001 DROP VIEW IF EXISTS `coolerPath`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `coolerPath` AS SELECT - 1 AS `id`, - 1 AS `description` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `coolerPathDetail` -- @@ -29275,7 +29632,7 @@ CREATE TABLE `coolerPathDetail` ( `hallway` varchar(3) NOT NULL, PRIMARY KEY (`coolerPathFk`,`hallway`), UNIQUE KEY `cooler_path_detail_id_UNIQUE` (`id`), - CONSTRAINT `coolerPathDetail_FK` FOREIGN KEY (`coolerPathFk`) REFERENCES `vn2008`.`cooler_path` (`cooler_path_id`) ON UPDATE CASCADE + CONSTRAINT `coolerPathDetail_FK` FOREIGN KEY (`coolerPathFk`) REFERENCES `vn2008`.`cooler_path__` (`cooler_path_id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -29546,6 +29903,82 @@ CREATE TABLE `deliveryMethod` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `deliveryNote` +-- + +DROP TABLE IF EXISTS `deliveryNote`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `deliveryNote` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ref` varchar(45) DEFAULT NULL, + `note` varchar(150) DEFAULT NULL, + `shipped` date NOT NULL, + `landed` date DEFAULT NULL, + `amount` double DEFAULT NULL, + `supplierFk` int(10) unsigned NOT NULL, + `companyFk` int(10) unsigned NOT NULL, + `warehouseFk` smallint(6) unsigned NOT NULL, + `stateFk` int(11) NOT NULL, + `workerFk` int(10) unsigned NOT NULL COMMENT 'Id_Trabajador hace referencia a la persona que ha introducido el albarán', + `supervisorFk` int(10) unsigned NOT NULL, + `departmentFk` int(11) NOT NULL, + `invoiceInFk` mediumint(8) unsigned DEFAULT NULL, + `farmingFk` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `fk_albaran_Proveedores_idx` (`supplierFk`), + KEY `fk_albaran_empresa1_idx` (`companyFk`), + KEY `fk_albaran_warehouse1_idx` (`warehouseFk`), + KEY `fk_albaran_albaran_state1_idx` (`stateFk`), + KEY `fk_albaran_Trabajadores1_idx` (`workerFk`), + KEY `fk_albaran_Trabajadores2_idx` (`supervisorFk`), + KEY `fk_albaran_department1_idx` (`departmentFk`), + KEY `fk_albaran_recibida_idx` (`invoiceInFk`), + KEY `albaran_FK` (`farmingFk`), + CONSTRAINT `albaranCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `albaran_FK` FOREIGN KEY (`farmingFk`) REFERENCES `farming` (`id`), + CONSTRAINT `albaran_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, + CONSTRAINT `fk_albaran_Trabajadores1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `fk_albaran_Trabajadores2` FOREIGN KEY (`supervisorFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `fk_albaran_albaran_state1` FOREIGN KEY (`stateFk`) REFERENCES `deliveryNoteState` (`id`) ON UPDATE CASCADE, + CONSTRAINT `fk_albaran_recibida` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `fk_albaran_warehouse1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `deliveryNoteDms` +-- + +DROP TABLE IF EXISTS `deliveryNoteDms`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `deliveryNoteDms` ( + `dmsFk` int(11) NOT NULL, + `deliveryNoteFk` int(11) NOT NULL, + PRIMARY KEY (`dmsFk`,`deliveryNoteFk`), + KEY `fk_albaran_gestdoc_gestdoc1_idx` (`dmsFk`), + KEY `fk_albaran_gestdoc_albaran1_idx` (`deliveryNoteFk`), + CONSTRAINT `albaran_gestdoc_FK` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_albaran_gestdoc_albaran1` FOREIGN KEY (`deliveryNoteFk`) REFERENCES `deliveryNote` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `deliveryNoteState` +-- + +DROP TABLE IF EXISTS `deliveryNoteState`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `deliveryNoteState` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `state` varchar(45) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `deliveryPoint` -- @@ -29878,6 +30311,25 @@ CREATE TABLE `dms` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='document managment system'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `dmsStorageBox` +-- + +DROP TABLE IF EXISTS `dmsStorageBox`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `dmsStorageBox` ( + `id` int(11) NOT NULL, + `companyFk` int(10) unsigned NOT NULL, + `started` bigint(20) NOT NULL, + `ended` bigint(20) NOT NULL, + `created` timestamp NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`,`companyFk`), + KEY `dmsStorageBox_company_FK` (`companyFk`), + CONSTRAINT `dmsStorageBox_company_FK` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Caja en la que se guardan la documentacion fisica de dms'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `dmsType` -- @@ -29902,27 +30354,6 @@ CREATE TABLE `dmsType` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `doc` --- - -DROP TABLE IF EXISTS `doc`; -/*!50001 DROP VIEW IF EXISTS `doc`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `doc` AS SELECT - 1 AS `id`, - 1 AS `sref`, - 1 AS `brief`, - 1 AS `companyFk`, - 1 AS `order`, - 1 AS `file`, - 1 AS `original`, - 1 AS `workerFk`, - 1 AS `created`, - 1 AS `warehouseFk` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `dock` -- @@ -30366,6 +30797,21 @@ CREATE TABLE `entryObservation` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `entryOrder` +-- + +DROP TABLE IF EXISTS `entryOrder`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `entryOrder` ( + `entryFk` int(11) NOT NULL, + `order` int(11) NOT NULL DEFAULT 1 COMMENT '1.- Ordenar por articulo\n2.- Ordenar por compra\n', + PRIMARY KEY (`entryFk`), + CONSTRAINT `entradas_entradas_orden` FOREIGN KEY (`entryFk`) REFERENCES `entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `entryType` -- @@ -31211,6 +31657,29 @@ CREATE TABLE `floramondoConfig` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `forecastedBalance` +-- + +DROP TABLE IF EXISTS `forecastedBalance`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `forecastedBalance` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `description` varchar(45) DEFAULT NULL, + `amount` double NOT NULL DEFAULT 0, + `dated` date NOT NULL, + `accountingFk` int(11) DEFAULT NULL, + `companyFk` int(10) unsigned NOT NULL DEFAULT 442, + PRIMARY KEY (`id`), + KEY `Fecha_indice` (`dated`), + KEY `banco_prevision_idx` (`accountingFk`), + KEY `empresa_prevision_idx` (`companyFk`), + CONSTRAINT `Saldos_PrevisionCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `banco_prevision` FOREIGN KEY (`accountingFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Aqui ponemos los gastos e ingresos pendientes de introducir '; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `franceExpressConfig` -- @@ -31347,20 +31816,6 @@ CREATE TABLE `glsExpedition` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `grantGroup` --- - -DROP TABLE IF EXISTS `grantGroup`; -/*!50001 DROP VIEW IF EXISTS `grantGroup`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `grantGroup` AS SELECT - 1 AS `id`, - 1 AS `description`, - 1 AS `observationTypeFk` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `greuge` -- @@ -31788,6 +32243,32 @@ CREATE TABLE `invoiceInConfig` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `invoiceInCorrection` +-- + +DROP TABLE IF EXISTS `invoiceInCorrection`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `invoiceInCorrection` ( + `correctingFk` mediumint(8) unsigned NOT NULL COMMENT 'Factura rectificativa', + `correctedFk` mediumint(8) unsigned NOT NULL COMMENT 'Factura rectificada', + `cplusRectificationTypeFk` int(10) unsigned NOT NULL, + `siiTypeInvoiceOutFk` int(10) unsigned NOT NULL, + `invoiceCorrectionTypeFk` int(11) NOT NULL DEFAULT 3, + PRIMARY KEY (`correctingFk`), + KEY `invoiceInCorrection_correctedFk` (`correctedFk`), + KEY `invoiceInCorrection_cplusRectificationTypeFk` (`cplusRectificationTypeFk`), + KEY `invoiceInCorrection_siiTypeInvoiceOut` (`siiTypeInvoiceOutFk`), + KEY `invoiceInCorrection_invoiceCorrectionTypeFk` (`invoiceCorrectionTypeFk`), + CONSTRAINT `invoiceInCorrection_correctedFk` FOREIGN KEY (`correctedFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `invoiceInCorrection_correctingFk` FOREIGN KEY (`correctingFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `invoiceInCorrection_cplusRectificationTypeFk` FOREIGN KEY (`cplusRectificationTypeFk`) REFERENCES `cplusRectificationType` (`id`) ON UPDATE CASCADE, + CONSTRAINT `invoiceInCorrection_invoiceCorrectionTypeFk` FOREIGN KEY (`invoiceCorrectionTypeFk`) REFERENCES `invoiceCorrectionType` (`id`) ON UPDATE CASCADE, + CONSTRAINT `invoiceInCorrection_siiTypeInvoiceOut` FOREIGN KEY (`siiTypeInvoiceOutFk`) REFERENCES `siiTypeInvoiceOut` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `invoiceInDueDay` -- @@ -33801,6 +34282,24 @@ CREATE TABLE `mrw` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `mrwConfig` +-- + +DROP TABLE IF EXISTS `mrwConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mrwConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `url` varchar(100) DEFAULT NULL, + `user` varchar(100) DEFAULT NULL, + `password` varchar(100) DEFAULT NULL, + `franchiseCode` varchar(100) DEFAULT NULL, + `subscriberCode` varchar(100) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `mrwService` -- @@ -34284,6 +34783,7 @@ CREATE TABLE `packingSite` ( `scannerFk` int(11) DEFAULT NULL, `screenFk` int(11) DEFAULT NULL, `editorFk` int(10) unsigned DEFAULT NULL, + `hasNewLabelMrwMethod` tinyint(1) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `packingSite_UN` (`code`), UNIQUE KEY `printerRfidFk` (`printerRfidFk`), @@ -35238,6 +35738,7 @@ CREATE TABLE `professionalCategory` ( `name` varchar(50) NOT NULL, `level` int(11) unsigned DEFAULT NULL, `dayBreak` int(11) unsigned DEFAULT NULL, + `code` varchar(25) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `prefessionalCategory_UN` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; @@ -35325,18 +35826,22 @@ CREATE TABLE `projectState` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `promissoryNote` +-- Table structure for table `promissoryNote` -- DROP TABLE IF EXISTS `promissoryNote`; -/*!50001 DROP VIEW IF EXISTS `promissoryNote`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `promissoryNote` AS SELECT - 1 AS `id`, - 1 AS `Concept`, - 1 AS `paymentFk` */; -SET character_set_client = @saved_cs_client; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `promissoryNote` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `issued` timestamp NOT NULL DEFAULT current_timestamp(), + `Concept` varchar(50) DEFAULT NULL, + `paymentFk` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `pago_id` (`paymentFk`), + CONSTRAINT `promissoryNote_ibfk_2` FOREIGN KEY (`paymentFk`) REFERENCES `payment` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `property` @@ -35724,6 +36229,26 @@ CREATE TABLE `referenceRateConfig` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `remittance` +-- + +DROP TABLE IF EXISTS `remittance`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `remittance` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `dated` datetime DEFAULT NULL, + `accountingFk` int(11) DEFAULT 0, + `companyFk` int(10) unsigned NOT NULL DEFAULT 442, + PRIMARY KEY (`id`), + KEY `Id_Banco` (`accountingFk`), + KEY `empresa_id` (`companyFk`), + CONSTRAINT `RemesasCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `remittance_ibfk_2` FOREIGN KEY (`accountingFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `report` -- @@ -36845,7 +37370,7 @@ DROP TABLE IF EXISTS `sectorType`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `sectorType` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `description` varchar(100) NOT NULL, + `code` varchar(100) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -37325,6 +37850,24 @@ CREATE TABLE `specieGeoInvasive` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Esta tabla recoge las prohibiciones de comerciar con especies invasoras de acuerdo con el Catálogo de Especies Exóticas Invasoras publicado por el Estado Español'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `split` +-- + +DROP TABLE IF EXISTS `split`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `split` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ticketFk` int(11) DEFAULT NULL, + `entryFk` int(11) DEFAULT NULL, + `dated` datetime DEFAULT NULL, + `note` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `Id_Entrada` (`entryFk`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `splitFilter` -- @@ -37347,6 +37890,26 @@ CREATE TABLE `splitFilter` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='define los clientes que tienen split y el nombre a mostrar en la etiqueta'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `splitLine` +-- + +DROP TABLE IF EXISTS `splitLine`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `splitLine` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `splitFk` int(11) NOT NULL, + `itemFk` int(11) DEFAULT NULL, + `buyFk` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `Id_Split` (`splitFk`), + KEY `Id_Compra` (`buyFk`), + CONSTRAINT `Id_Compra` FOREIGN KEY (`buyFk`) REFERENCES `buy` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `splitLine_ibfk_1` FOREIGN KEY (`splitFk`) REFERENCES `split` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `starredModule` -- @@ -37661,6 +38224,20 @@ CREATE TABLE `supplierDebtConfig` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `supplierDms` +-- + +DROP TABLE IF EXISTS `supplierDms`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `supplierDms` ( + `supplierFk` int(11) NOT NULL, + `dmsFk` int(11) NOT NULL, + PRIMARY KEY (`supplierFk`,`dmsFk`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `supplierExpense` -- @@ -38869,22 +39446,6 @@ CREATE TABLE `time` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Tabla de referencia para las semanas, años y meses'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Table structure for table `timeControlDevice` --- - -DROP TABLE IF EXISTS `timeControlDevice`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `timeControlDevice` ( - `id` int(10) NOT NULL AUTO_INCREMENT, - `name` varchar(255) DEFAULT NULL, - `key` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `name_UNIQUE` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Table structure for table `town` -- @@ -39440,6 +40001,11 @@ CREATE TABLE `vehicle` ( `ppeFk` int(11) DEFAULT NULL, `countryCodeFk` varchar(2) DEFAULT 'ES', `leasing` varchar(50) DEFAULT NULL COMMENT 'Id de arrendamiento', + `supplierFk` int(10) unsigned DEFAULT NULL COMMENT 'supplier from whom the vehicle was purchased', + `import` decimal(10,2) DEFAULT NULL, + `supplierCoolerFk` int(10) unsigned DEFAULT NULL, + `vin` varchar(50) DEFAULT NULL, + `bankPolicyFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `vehicle_UN` (`numberPlate`), KEY `empresa_id` (`companyFk`), @@ -39447,11 +40013,17 @@ CREATE TABLE `vehicle` ( KEY `vehicle_deliveryPointFk_idx` (`deliveryPointFk`), KEY `vehicle_FK` (`fuelTypeFk`), KEY `vehicle_FK_1` (`ppeFk`), + KEY `vehicle_supplierFk` (`supplierFk`), + KEY `vehicle_supplierCoolerFk` (`supplierCoolerFk`), + KEY `vehicle_bankPolicyFk` (`bankPolicyFk`), CONSTRAINT `provinceFk` FOREIGN KEY (`warehouseFk`) REFERENCES `province` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `vehicleCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `vehicle_FK` FOREIGN KEY (`fuelTypeFk`) REFERENCES `fuelType` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `vehicle_FK_1` FOREIGN KEY (`ppeFk`) REFERENCES `ppe` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `vehicle_deliveryPointFk` FOREIGN KEY (`deliveryPointFk`) REFERENCES `deliveryPoint` (`id`) ON UPDATE CASCADE + CONSTRAINT `vehicle_bankPolicyFk` FOREIGN KEY (`bankPolicyFk`) REFERENCES `bankPolicy` (`id`) ON UPDATE CASCADE, + CONSTRAINT `vehicle_deliveryPointFk` FOREIGN KEY (`deliveryPointFk`) REFERENCES `deliveryPoint` (`id`) ON UPDATE CASCADE, + CONSTRAINT `vehicle_supplierCoolerFk` FOREIGN KEY (`supplierCoolerFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, + CONSTRAINT `vehicle_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -39467,6 +40039,40 @@ CREATE TABLE `vehicleConfig` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `vehicleConsumption` +-- + +DROP TABLE IF EXISTS `vehicleConsumption`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vehicleConsumption` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `vehicleFk` int(10) unsigned NOT NULL, + `dated` date NOT NULL, + `km` int(20) unsigned NOT NULL, + `liters` double unsigned NOT NULL, + `price` double unsigned NOT NULL, + `adblue` decimal(10,2) NOT NULL DEFAULT 0.00, + `tolls` double DEFAULT NULL, + `discount` double DEFAULT NULL, + `silla` int(11) NOT NULL DEFAULT 0 COMMENT 'indica si han repostado en la gasolinera de la rotonda', + `created` timestamp NULL DEFAULT current_timestamp(), + `others` double DEFAULT NULL, + `fuelTypeFk` varchar(45) DEFAULT NULL, + `supplierFk` int(10) unsigned DEFAULT NULL, + `liters100km` decimal(10,2) DEFAULT NULL COMMENT 'se rellena en Vehiculos_consumo_beforeInsert y son los litros consumidos a los 100 kilometros', + `gasoline` decimal(10,2) NOT NULL DEFAULT 0.00, + PRIMARY KEY (`id`,`vehicleFk`), + KEY `fk_Vehiculos_consumo_Vehiculos_idx` (`vehicleFk`), + KEY `fuelTypeFk_idx` (`fuelTypeFk`), + KEY `proveedoresFk_idx` (`supplierFk`), + CONSTRAINT `Vehiculos_consumo_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `fk_Vehiculos_consumo_Vehiculos` FOREIGN KEY (`vehicleFk`) REFERENCES `vehicle` (`id`) ON UPDATE CASCADE, + CONSTRAINT `fuelTypeFk` FOREIGN KEY (`fuelTypeFk`) REFERENCES `fuelType` (`code`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='En esta tabla apuntan el importe de los tickets de la gasolinera solred, con quien tenemos un contrato y nos facturan mensualmente'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `vehicleDms` -- @@ -39763,7 +40369,7 @@ CREATE TABLE `warehouse` ( `hasDms` tinyint(1) NOT NULL DEFAULT 0, `pickUpAgencyModeFk` int(11) DEFAULT NULL, `isBuyerToBeEmailed` tinyint(2) NOT NULL DEFAULT 0, - `aliasFk` smallint(5) unsigned DEFAULT NULL, + `aliasFk__` smallint(5) unsigned DEFAULT NULL COMMENT '@deprecated 2024-01-23 refs #5167', `labelReport` int(11) DEFAULT NULL, `hasUbications` tinyint(1) NOT NULL DEFAULT 1, `hasProduction` tinyint(1) NOT NULL DEFAULT 0, @@ -39778,44 +40384,31 @@ CREATE TABLE `warehouse` ( UNIQUE KEY `name_UNIQUE` (`name`), KEY `Id_Paises` (`countryFk`), KEY `isComparativeIdx` (`isComparative`), - KEY `warehouse_ibfk_1_idx` (`aliasFk`), + KEY `warehouse_ibfk_1_idx` (`aliasFk__`), KEY `warehouse_FK` (`addressFk`), KEY `warehouse_FK_1` (`pickUpAgencyModeFk`), CONSTRAINT `warehouse_FK` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `warehouse_FK_1` FOREIGN KEY (`pickUpAgencyModeFk`) REFERENCES `agencyMode` (`id`) ON UPDATE CASCADE, CONSTRAINT `warehouse_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`), - CONSTRAINT `warehouse_ibfk_2` FOREIGN KEY (`aliasFk`) REFERENCES `warehouseAlias` (`id`) ON DELETE SET NULL ON UPDATE CASCADE + CONSTRAINT `warehouse_ibfk_2` FOREIGN KEY (`aliasFk__`) REFERENCES `warehouseAlias__` (`id`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `warehouseAlias` +-- Table structure for table `warehouseAlias__` -- -DROP TABLE IF EXISTS `warehouseAlias`; +DROP TABLE IF EXISTS `warehouseAlias__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `warehouseAlias` ( +CREATE TABLE `warehouseAlias__` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(15) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name_UNIQUE` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='@deprecated 2024-01-23 refs #5167'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `warehouseJoined` --- - -DROP TABLE IF EXISTS `warehouseJoined`; -/*!50001 DROP VIEW IF EXISTS `warehouseJoined`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `warehouseJoined` AS SELECT - 1 AS `warehouseFk`, - 1 AS `warehouseAliasFk` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `workCenter` -- @@ -43460,6 +44053,49 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP FUNCTION IF EXISTS `intrastat_estimateNet` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `intrastat_estimateNet`(vSelf INT, + vStems INT +) RETURNS double + DETERMINISTIC +BEGIN +/** +* Calcula un valor neto estimado en función de +* datos históricos de facturas intrastat. +* +* @param vSelf Id de intrastat +* @param vStems Número de unidades +* @return vNet +*/ + DECLARE vNet DOUBLE; + + SELECT ROUND(vStems / (SUM(average) / COUNT(average)), 2) INTO vNet + FROM ( + SELECT *, stems / net average + FROM invoiceInIntrastat + WHERE intrastatFk = vSelf + AND net + AND stems > 0 + ORDER BY dated DESC + LIMIT 20 + ) sub; + + RETURN vNet/2; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `invoiceOutAmount` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -43750,8 +44386,8 @@ BEGIN FROM ( SELECT DISTINCT t.Id_Ruta FROM vn2008.scan_line sl - JOIN vn2008.expeditions e ON e.expeditions_id = sl.code - JOIN vn2008.Tickets t ON t.Id_Ticket = e.ticket_id + JOIN expedition e ON e.id = sl.code + JOIN vn2008.Tickets t ON t.Id_Ticket = e.ticketFk WHERE sl.scan_id = vScanId AND t.Id_Ruta ) t1; @@ -44210,32 +44846,6 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP FUNCTION IF EXISTS `nz` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `nz`(vQuantity DOUBLE) RETURNS double - DETERMINISTIC -BEGIN - - DECLARE vResult DOUBLE; - - SET vResult = IFNULL(vQuantity,0); - - RETURN vResult; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `orderTotalVolume` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46408,7 +47018,7 @@ BEGIN LEFT JOIN vn.supplier s ON s.id = bp.supplierFk LEFT JOIN vn.bank b - ON b.id = bp.bankFk + ON b.id = bp.accountingFk WHERE bp.insuranceExpired = util.VN_CURDATE(); END ;; DELIMITER ; @@ -46619,14 +47229,14 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `buy_afterUpsert` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_afterUpsert`(vSelf INT) BEGIN @@ -46703,7 +47313,9 @@ BEGIN WHERE b.id = vSelf; END IF; - + CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck + SELECT vSelf id; + CALL buy_checkItem(); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -46739,6 +47351,47 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `buy_checkItem` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_checkItem`() +BEGIN +/** + * Checks if the item has weightByPiece or size null on any buy. + * + * @param tmp.buysToCheck(id as INT). + */ + DECLARE hasVolumetricAgency INT; + + SELECT a.hasWeightVolumetric INTO hasVolumetricAgency + FROM entry e + JOIN travel t ON t.id = e.travelFk + JOIN agencyMode a ON a.id = t.agencyModeFk + JOIN buy b ON b.entryFk = e.id + JOIN item i ON i.id = b.itemFk + JOIN tmp.buysToCheck bt ON bt.id = b.id + WHERE (i.weightByPiece IS NULL OR i.`size` IS NULL) + AND a.hasWeightVolumetric + LIMIT 1; + + DROP TEMPORARY TABLE IF EXISTS tmp.buysToCheck; + + IF hasVolumetricAgency THEN + CALL util.throw('Some purchase line has an item without size or weight per stem in the volumetric agency.'); + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `buy_getSplit` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47970,6 +48623,7 @@ BEGIN FROM vn.expeditionTruck WHERE eta < v3Month; + DELETE FROM XDiario WHERE FECHA < v3Month OR FECHA IS NULL; -- borrar travels sin entradas DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete; CREATE TEMPORARY TABLE tmp.thermographToDelete @@ -48800,7 +49454,7 @@ BEGIN SELECT lc.companyFk, c.id, 0, - - (NZ(lc.credit) - NZ(lc.debit)) + - (IFNULL(lc.credit, 0) - IFNULL(lc.debit, 0)) FROM tmp.ledgerComparative lc JOIN client c ON c.accountingAccount = lc.account WHERE lc.`date` BETWEEN vDateFrom AND vDateTo @@ -49333,9 +49987,9 @@ BEGIN ish.created, ish.visible, IFNULL( - IF(st.description = 'previousByPacking', ish.packing, g.`grouping`), + IF(st.code = 'previousByPacking', ish.packing, g.`grouping`), 1) `grouping`, - st.description = 'previousPrepared' isPreviousPrepared, + st.code = 'previousPrepared' isPreviousPrepared, iss.id itemShelvingSaleFk, ts.ticketFk, iss.id, @@ -49818,14 +50472,14 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `collection_new` */; /*!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 collation_connection = utf8mb4_general_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_new`(vUserFk INT, OUT vCollectionFk INT) proc:BEGIN @@ -50033,7 +50687,8 @@ proc:BEGIN UPDATE tmp.productionBuffer pb JOIN ( SELECT SUM(litros) liters, - @lines:= COUNT(*) + @lines `lines`, + @lines:= COUNT(*) + @lines, + COUNT(*) `lines`, MAX(i.`size`) height, @volume := SUM(sv.volume) + @volume volume FROM saleVolume sv @@ -51385,7 +52040,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `duaInvoiceInBooking`(vDuaFk INT) BEGIN /** * Genera el asiento de un DUA y marca las entradas como confirmadas - * + * * @param vDuaFk Id del dua a recalcular */ DECLARE done BOOL DEFAULT FALSE; @@ -51405,7 +52060,7 @@ BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; OPEN rs; - + UPDATE invoiceIn ii JOIN entry e ON e.invoiceInFk = ii.id JOIN duaEntry de ON de.entryFk = e.id @@ -51423,35 +52078,35 @@ BEGIN WHERE id = vDuaFk; FETCH rs INTO vInvoiceFk; - + WHILE NOT done DO CALL invoiceIn_booking(vInvoiceFk); - + IF vCounter > 0 OR vASIEN > 0 THEN - - UPDATE vn2008.XDiario x + + UPDATE XDiario x JOIN ledgerConfig lc ON lc.lastBookEntry = x.ASIEN SET x.ASIEN = vASIEN; - + ELSE - + SELECT lastBookEntry INTO vASIEN FROM ledgerConfig; - + END IF; - + SET vCounter = vCounter + 1; - + FETCH rs INTO vInvoiceFk; END WHILE; CLOSE rs; - UPDATE dua + UPDATE dua SET ASIEN = vASIEN WHERE id = vDuaFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -52344,6 +52999,230 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `entry_getTransfer` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_getTransfer`( + vSelf INT +) +BEGIN +/** + * Retorna los artículos trasladables a partir de una entrada. + * + * @param vSelf Id de entrada + */ + DECLARE vDateShipped DATE; + DECLARE vDateLanded DATE; + DECLARE vWarehouseIn INT; + DECLARE vWarehouseOut INT; + DECLARE vCalcVisible INT; + DECLARE vInventoryDate DATE DEFAULT vn.getInventoryDate(); + + SELECT shipped, landed, warehouseInFk, warehouseOutFk + INTO vDateShipped, vDateLanded, vWarehouseIn, vWarehouseOut + FROM vn.travel t + JOIN vn.entry e ON e.travelFk = t.id + WHERE e.id = vSelf; + + CALL vn.rate_getPrices(vDateShipped, vWarehouseIn); + + -- Traslado en almacen origen + CREATE OR REPLACE TEMPORARY TABLE tBuy + (PRIMARY KEY (itemFk), INDEX(buyFk)) + ENGINE = MEMORY + SELECT * + FROM ( + SELECT b.itemFk, b.id buyFk + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE t.landed BETWEEN vInventoryDate AND vDateShipped + AND NOT b.isIgnored + AND b.price2 >= 0 + ORDER BY (vWarehouseOut = t.warehouseInFk) DESC, t.landed DESC + LIMIT 10000000000000000000 + ) sub + GROUP BY itemFk; + + IF vDateShipped >= util.VN_CURDATE() THEN + CALL `cache`.visible_refresh(vCalcVisible, TRUE, vWarehouseOut); + + CREATE OR REPLACE TEMPORARY TABLE tItem ( + `itemFk` int(10) unsigned NOT NULL, + `visible` int(11) NOT NULL DEFAULT 0, + `available` int(11) NOT NULL DEFAULT 0, + `visibleLanding` int(11) NOT NULL DEFAULT 0, + `availableLanding` int(11) NOT NULL DEFAULT 0, + UNIQUE INDEX i USING HASH (itemFk) + ) ENGINE = MEMORY; + + INSERT INTO tItem(itemFk, visible) + SELECT item_id itemFk, visible + FROM `cache`.visible + WHERE calc_id = vCalcVisible + AND visible; + + CALL `cache`.visible_refresh(vCalcVisible, TRUE, vWarehouseIn); + + INSERT INTO tItem(itemFk, visibleLanding) + SELECT item_id, `visible` + FROM `cache`.`visible` v + WHERE v.calc_id = vCalcVisible + AND v.`visible` + ON DUPLICATE KEY UPDATE visibleLanding = v.`visible`; + + CALL vn2008.availableTraslate(vWarehouseOut, vDateShipped, NULL); + + INSERT INTO tItem(itemFk, available) + SELECT a.item_id, a.available + FROM vn2008.availableTraslate a + WHERE a.available + ON DUPLICATE KEY UPDATE available = a.available; + + CALL vn2008.availableTraslate(vWarehouseIn, vDateLanded, vWarehouseOut); + + INSERT INTO tItem(itemFk, availableLanding) + SELECT a.item_id, a.available + FROM vn2008.availableTraslate a + WHERE a.available + ON DUPLICATE KEY UPDATE availableLanding = a.available; + ELSE + CALL vn.item_getStock(vWarehouseOut, vDateShipped, NULL); + + CREATE OR REPLACE TEMPORARY TABLE tItem + (UNIQUE INDEX i USING HASH (itemFk)) + ENGINE = MEMORY + SELECT itemFk, + `visible`, + available, + 0 visibleLanding, + 0 availableLanding + FROM tmp.itemList; + END IF; + + CALL vn.buyUltimateFromInterval(vWarehouseIn,vInventoryDate, vDateLanded); + + CREATE OR REPLACE TEMPORARY TABLE tTransfer + ENGINE = MEMORY + SELECT it.code `type`, + it.categoryFk, + i.typeFk, + i.id itemFk, + i.name item, + i.`size`, + i.category, + i.inkFk, + o.code originCode, + b2.quantity, + i.stems, + CAST(ti.visible AS DECIMAL(10,0)) vis1, + CAST(ti.available AS DECIMAL(10,0)) ava1, + CAST(ti.visibleLanding AS DECIMAL(10,0)) vis2, + CAST(ti.availableLanding AS DECIMAL(10,0)) ava2, + COALESCE(b2.`grouping`, b.`grouping`) `grouping`, + COALESCE(b2.packing, b.packing) packing, + COALESCE(b3.groupingMode, b2.groupingMode, b.groupingMode) package, + IFNULL(p.name, s.nickname) productor, + TRUE tinta, + b.packagingFk, + b2.id buyFk, + b2.stickers, + b.ektFk, + it.workerFk, + pa.volume, + IFNULL(pa.width, 0) width, + IFNULL(pa.`depth`, 0) `depth`, + IFNULL(pa.height, 0) height, + IFNULL(b.buyingValue, 0) buyingValue, + IFNULL(b.comissionValue, 0) comissionValue, + IFNULL(b.freightValue, 0) freightValue, + am.m3, + e.commission, + pa.isPackageReturnable, + IFNULL(pa2.value, pa.value) `value`, + r.rate3 r3, + r.rate2 r2, + it.promo, + b.`grouping` groupingOrigin, + b.packing packingOrigin, + b.id buyFkOrigin, + pa.returnCost, + b.weight + FROM vn.item i + JOIN tItem ti ON ti.itemFk = i.id + LEFT JOIN vn.producer p ON p.id = i.producerFk + LEFT JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN vn.origin o ON o.id = i.originFk + LEFT JOIN tBuy lb ON lb.itemFk = i.id + LEFT JOIN vn.buy b ON b.id = lb.buyFk + LEFT JOIN vn.packaging pa ON pa.id = b.packagingFk + LEFT JOIN vn.entry e2 ON e2.id = b.entryFk + LEFT JOIN vn.supplier s ON s.id = e2.supplierFk + LEFT JOIN vn.entry e ON e.id = vSelf + LEFT JOIN vn.travel tr ON tr.id = e.travelFk + LEFT JOIN vn.agencyMode am ON am.id = tr.agencyModeFk + LEFT JOIN vn.buy b2 ON b2.itemFk = i.id + AND b2.entryFk = vSelf + LEFT JOIN vn.packaging pa2 ON pa2.id = b.packagingFk + LEFT JOIN tmp.rate r ON TRUE + LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = i.id + LEFT JOIN vn.buy b3 ON b3.id = bufi.buyFk + WHERE ic.display + AND NOT e.isRaid + AND (ti.visible OR ti.available) + ORDER BY i.typeFk, i.name, i.id, i.size, i.category, o.name; + + CREATE INDEX tIndex USING HASH ON tTransfer (itemFk); + + SET @carriage := 0; + SET @comission := 0; + SET @packaging := 0; + SET @rate3 := 0; + SET @cost := 0; + SELECT *, + quantity - MOD(quantity , `grouping`) subQuantity, + MOD(quantity, `grouping`) soll, + ROUND((IF(volume > 0,volume, width * `depth` * + IF(height = 0, `size` + 10, height))) / + packing, 0) cm3, + buyingValue + comissionValue + freightValue cost, + @carriage := ROUND((IF(volume > 0, volume, width * `depth` * + IF(height = 0, `size` + 10, height))) * + m3 / 1000000 / Packing, 3) carriage, + @comission := ROUND((buyingValue + comissionValue + freightValue) * + commission / 100, 3) commission, + ROUND(@packaging := (returnCost + IF(isPackageReturnable, 0, value)) + / packing, 3) packaging, + @cost := IFNULL((buyingValue + comissionValue + freightValue), 0) + + IFNULL(@packaging, 0) + + IFNULL(@carriage, 0) + + IFNULL(@comission, 0) expense, + @rate3 := ROUND(@cost / ( (100 - r3 - promo) / 100), 2) rate3, + ROUND(@rate3 * (1 + ((r2 - r3)/100)), 2) rate2, + FALSE selected + FROM tTransfer; + + DROP TEMPORARY TABLE IF EXISTS + tTransfer, + tItem, + tBuy, + tmp.buyUltimateFromInterval, + tmp.rate, + tmp.itemList; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `entry_lock` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53785,147 +54664,6 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `fustControl` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `fustControl`(vFromDated DATE, vToDated DATE) -BEGIN - - DECLARE vSijsnerClientFk INT DEFAULT 19752; - - DECLARE vDateStart DATETIME; - DECLARE vDateEnd DATETIME; - - SET vDateStart = vFromDated; - SET vDateEnd = util.Dayend(vToDated); - - SELECT p.id FustCode, - CAST(sent.stucks AS DECIMAL(10,0)) FH, - CAST(tp.stucks AS DECIMAL(10,0)) Tickets, - CAST(-sj.stucks AS DECIMAL(10,0)) Sijsner, - CAST(IFNULL(sent.stucks,0) - IFNULL(tp.stucks,0) + IFNULL(sj.stucks,0) AS DECIMAL(10,0)) saldo - FROM vn.packaging p - LEFT JOIN ( - SELECT FustCode, sum(fustQuantity) stucks - FROM ( - SELECT IFNULL(pe.equivalentFk ,b.packagingFk) FustCode, s.quantity / b.packing AS fustQuantity - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk - JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND lb.warehouse_id = t.warehouseFk - JOIN vn.buy b ON b.id = lb.buy_id - JOIN vn.packaging p ON p.id = b.packagingFk - LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p2 ON p2.id = a.provinceFk - JOIN vn.country c ON c.id = p2.countryFk - WHERE t.shipped BETWEEN vDateStart AND vDateEnd - AND wa.name = 'VNH' - AND p.isPackageReturnable - AND c.country = 'FRANCIA') sub - GROUP BY FustCode) sent ON sent.FustCode = p.id - LEFT JOIN ( - SELECT FustCode, sum(quantity) stucks - FROM ( - SELECT IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, tp.quantity - FROM vn.ticketPackaging tp - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk - JOIN vn.packaging p ON p.id = tp.packagingFk - LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p2 ON p2.id = a.provinceFk - JOIN vn.country c ON c.id = p2.countryFk - WHERE t.shipped BETWEEN vDateStart AND vDateEnd - AND wa.name = 'VNH' - AND p.isPackageReturnable - AND c.country = 'FRANCIA' - AND t.clientFk != vSijsnerClientFk - AND tp.quantity > 0) sub - GROUP BY FustCode) tp ON tp.FustCode = p.id - LEFT JOIN ( - SELECT FustCode, sum(quantity) stucks - FROM ( - SELECT IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, tp.quantity - FROM vn.ticketPackaging tp - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk - JOIN vn.packaging p ON p.id = tp.packagingFk - LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id - WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, 1, vDateStart ) AND TIMESTAMPADD(DAY, 1, vDateEnd ) - AND wa.name = 'VNH' - AND p.isPackageReturnable - AND t.clientFk = vSijsnerClientFk) sub - GROUP BY FustCode) sj ON sj.FustCode = p.id - WHERE sent.stucks - OR tp.stucks - OR sj.stucks; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `fustControlDetail` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `fustControlDetail`(vFromDated DATE, vToDated DATE) -BEGIN - - DECLARE vSijsnerClientFk INT DEFAULT 19752; - - DECLARE vDateStart DATETIME; - DECLARE vDateEnd DATETIME; - - SET vDateStart = vFromDated; - SET vDateEnd = util.Dayend(vToDated); - - SELECT a.nickname shopName, - a.city , - IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, - tp.quantity, - tp.ticketFk, - CONCAT('From ', vFromDated,' to ', vToDated) AS dateRange - FROM vn.ticketPackaging tp - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk - JOIN vn.packaging p ON p.id = tp.packagingFk - LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p2 ON p2.id = a.provinceFk - JOIN vn.country c ON c.id = p2.countryFk - WHERE t.shipped BETWEEN vFromDated AND util.dayend(vToDated) - AND wa.name = 'VNH' - AND p.isPackageReturnable - AND c.country = 'FRANCIA' - AND t.clientFk != vSijsnerClientFk - AND tp.quantity > 0; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `fv_pca` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -54053,13 +54791,13 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `getDayExpeditions`() BEGIN SELECT - e.expeditions_id as expeditionFk, - date_format(e.odbc_date,'%Y-%m-%d') as expeditionDate, - e.ticket_id as ticketFk, + e.id as expeditionFk, + date_format(e.created,'%Y-%m-%d') as expeditionDate, + e.ticketFk, t.routeFk as routeFk - FROM vn2008.expeditions e - INNER JOIN vn.ticket t ON t.id = e.ticket_id - WHERE DATE(odbc_date) = util.VN_CURDATE(); + FROM expedition e + INNER JOIN ticket t ON t.id = e.ticketFk + WHERE DATE(e.created) = util.VN_CURDATE(); END ;; DELIMITER ; @@ -56564,31 +57302,30 @@ BEGIN ) alb ON alb.itemFk = i.id LEFT JOIN cache.stock v ON i.id = v.item_id AND v.warehouse_id = vWarehouseFk LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as venta - FROM vn2008.item_out - WHERE dat BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) - AND warehouse_id = vWarehouseFk - GROUP BY item_id + SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as venta + FROM itemTicketOut + WHERE shipped BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) + AND warehouseFk = vWarehouseFk + GROUP BY itemFk ) sale ON sale.item_id = i.id LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as compra - FROM vn2008.item_entry_in - WHERE dat BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) - AND warehouse_id = vWarehouseFk + SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as compra + FROM itemEntryIn + WHERE landed BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) + AND warehouseInFk = vWarehouseFk AND isVirtualStock = FALSE - GROUP BY item_id + GROUP BY itemFk ) buy ON buy.item_id = i.id LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as traslado - FROM vn2008.item_entry_out - WHERE dat BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) - AND warehouse_id = vWarehouseFk - GROUP BY item_id + SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as traslado + FROM itemEntryOut + WHERE shipped BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) + AND warehouseOutFk = vWarehouseFk + GROUP BY itemFk ) mov ON mov.item_id = i.id WHERE (v.amount OR fue.Fuentes OR alb.Albenfruit) AND i.itemPackingTypeFk = 'H' - AND ic.shortLife - ; + AND ic.shortLife; END ;; DELIMITER ; @@ -56768,28 +57505,23 @@ BEGIN * @param vItemFk Identificador de vn.item * @param vSectorFk Identificador de vn.sector */ - DECLARE vWarehouseAliasFk INT; - - SELECT w.aliasFk INTO vWarehouseAliasFk - FROM vn.sector s - JOIN vn.warehouse w ON w.id = s.warehouseFk - WHERE s.id = vSectorFk; - SELECT ish.shelvingFk shelving, - p.code parking, - sum(ish.visible) as stockTotal, - ish.created, - p.pickingOrder + p.code parking, + SUM(ish.visible) stockTotal, + ish.created, + p.pickingOrder FROM vn.itemShelving ish JOIN vn.shelving sh ON sh.code = ish.shelvingFk JOIN vn.parking p ON p.id = sh.parkingFk JOIN vn.sector sc ON sc.id = p.sectorFk JOIN vn.warehouse w ON w.id = sc.warehouseFk - WHERE w.aliasFk = vWarehouseAliasFk - AND ish.visible > 0 - AND ish.itemFk = vItemFk + WHERE sc.id = vSectorFk + AND ish.visible > 0 + AND ish.itemFk = vItemFk GROUP BY ish.id - ORDER BY (sc.id = vSectorFk) DESC, sh.priority DESC, ish.created, p.pickingOrder; + ORDER BY sh.priority DESC, + ish.created, + p.pickingOrder; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -57640,12 +58372,12 @@ proc:BEGIN CREATE TEMPORARY TABLE tmp.itemOutTime SELECT *,SUM(amount) quantity FROM - (SELECT item_id itemFk, - amount, + (SELECT io.itemFk, + io.quantity amount, IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) as hours, IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) as minutes - FROM vn2008.item_out io - JOIN tmp.itemShelvingRadar isr ON isr.itemFk = io.item_id + FROM itemTicketOut io + JOIN tmp.itemShelvingRadar isr ON isr.itemFk = io.itemFk JOIN vn.ticket t on t.id= io.ticketFk JOIN vn.ticketState ts on ts.ticketFk = io.ticketFk JOIN vn.state s ON s.id = ts.stateFk @@ -57657,10 +58389,10 @@ proc:BEGIN ) stPrevious ON `stPrevious`.`saleFk` = io.saleFk WHERE t.warehouseFk = vWarehouseFk AND s.isPicked = 0 - AND NOT io.Reservado + AND NOT io.reserved AND stPrevious.saleFk IS NULL - AND io.dat >= util.VN_CURDATE() - AND io.dat < util.VN_CURDATE() + INTERVAL 1 DAY + AND io.shipped >= util.VN_CURDATE() + AND io.shipped < util.VN_CURDATE() + INTERVAL 1 DAY ) sub GROUP BY itemFk, hours, minutes; @@ -58525,11 +59257,13 @@ BEGIN p.code, ish.id, s.priority, - ish.isChecked + ish.isChecked, + ic.url FROM itemShelving ish JOIN item i ON i.id = ish.itemFk JOIN shelving s ON vSelf = s.code COLLATE utf8_unicode_ci LEFT JOIN parking p ON s.parkingFk = p.id + JOIN hedera.imageConfig ic WHERE ish.shelvingFk COLLATE utf8_unicode_ci = vSelf; END ;; DELIMITER ; @@ -60379,7 +61113,8 @@ BEGIN SUM(IFNULL(sub.amount,0)) lack, i.inkFk, IFNULL(im.timed, util.midnight()) timed, - IFNULL(izc.timed, util.midnight()) minTimed + IFNULL(izc.timed, util.midnight()) minTimed, + o.name originFk FROM (SELECT item_id, warehouse_id, amount @@ -60398,6 +61133,7 @@ BEGIN JOIN itemCategory ic ON ic.id = it.categoryFk LEFT JOIN tmp.itemMinETD im ON im.itemFk = i.id LEFT JOIN tmp.itemZoneClosure izc ON izc.itemFk = i.id + JOIN origin o ON o.id = i.originFk WHERE w.isForTicket AND ic.display AND it.code != 'GEN' @@ -63407,7 +64143,7 @@ proc: BEGIN ENGINE = MEMORY SELECT ish.itemFk, p.sectorFk, - st.description = 'previousPrepared' isPreviousPrepared, + st.code = 'previousPrepared' isPreviousPrepared, sc.itemPackingTypeFk FROM itemShelving ish JOIN shelving sh ON sh.code = ish.shelvingFk @@ -63792,7 +64528,7 @@ BEGIN JOIN client c ON c.id = t.clientFk JOIN tmp.productionBuffer pb ON pb.ticketFk = t.id JOIN packagingConfig pc - WHERE IF(st.description = 'previousByPacking', + WHERE IF(st.code = 'previousByPacking', i.`size` > pc.previousPreparationMinimumSize AND (MOD(TRUNCATE(isa.quantity,0), isa.packing)= 0 ), TRUE) @@ -66235,14 +66971,14 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sale_replaceItem` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_replaceItem`(vSaleFk INT, vNewItemFk INT, vQuantity INT) BEGIN @@ -66266,11 +67002,8 @@ BEGIN DECLARE vAgencyModeFk INT; DECLARE vNewPrice DECIMAL(10,2); DECLARE vOldPrice DECIMAL(10,2); - DECLARE vOption INT DEFAULT NULL; + DECLARE vOption VARCHAR(255); DECLARE vNewSaleFk INT; - DECLARE vChangePrice INT DEFAULT 1; - DECLARE vBuyerDiscount INT DEFAULT 4; - DECLARE vManaDiscount INT DEFAULT 3; DECLARE vForceToGrouping INT DEFAULT 1; DECLARE vForceToPacking INT DEFAULT 2; DECLARE vFinalPrice DECIMAL(10,2); @@ -66330,16 +67063,13 @@ BEGIN IF vNewPrice IS NULL THEN CALL util.throw('price retrieval failed'); END IF; + IF vNewPrice > vOldPrice THEN SET vFinalPrice = vOldPrice; - IF worker_isInDepartment('vt') THEN - SET vOption = vManaDiscount; - ELSE - SET vOption = vBuyerDiscount; - END IF; + SET vOption = 'substitution'; ELSE SET vFinalPrice = vNewPrice; - SET vOption = vChangePrice; + SET vOption = 'renewPrices'; END IF; START TRANSACTION; @@ -66972,26 +67702,26 @@ BEGIN ) fue ON fue.itemFk = i.id LEFT JOIN cache.stock v ON i.id = v.item_id AND v.warehouse_id = vWarehouseFk LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as venta - FROM vn2008.item_out - WHERE dat BETWEEN util.VN_CURDATE() AND util.dayend(vDated) - AND warehouse_id = vWarehouseFk - GROUP BY item_id + SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as venta + FROM itemTicketOut + WHERE shipped BETWEEN util.VN_CURDATE() AND util.dayend(vDated) + AND warehouseFk = vWarehouseFk + GROUP BY itemFk ) sale ON sale.item_id = i.id LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as compra - FROM vn2008.item_entry_in - WHERE dat BETWEEN util.VN_CURDATE() AND util.dayend(vDated) - AND warehouse_id = vWarehouseFk + SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as compra + FROM itemEntryIn + WHERE landed BETWEEN util.VN_CURDATE() AND util.dayend(vDated) + AND warehouseInFk = vWarehouseFk AND isVirtualStock = FALSE - GROUP BY item_id + GROUP BY itemFk ) buy ON buy.item_id = i.id LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as traslado - FROM vn2008.item_entry_out - WHERE dat BETWEEN util.VN_CURDATE() AND util.dayend(vDated) - AND warehouse_id = vWarehouseFk - GROUP BY item_id + SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as traslado + FROM itemEntryOut + WHERE shipped BETWEEN util.VN_CURDATE() AND util.dayend(vDated) + AND warehouseOutFk = vWarehouseFk + GROUP BY itemFk ) mov ON mov.item_id = i.id WHERE v.amount; @@ -67671,7 +68401,7 @@ BEGIN SELECT lc.companyFk, s.id, 0, - - (NZ(lc.debit) - NZ(lc.credit)) + - (IFNULL(lc.debit, 0) - IFNULL(lc.credit, 0)) FROM tmp.ledgerComparative lc JOIN supplier s ON s.account = lc.account WHERE lc.`date` BETWEEN vDateFrom AND vDateTo @@ -67756,6 +68486,158 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `supplier_statement` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `supplier_statement`( + vSupplierFk INT, + vCurrencyFk INT, + vCompanyFk INT, + vOrderBy VARCHAR(15), + vIsConciliated BOOL +) +BEGIN +/** + * Crea un estado de cuenta de proveedores calculando + * los saldos en euros y en la moneda especificada. + * + * @param vSupplierFk Id del proveedor + * @param vCurrencyFk Id de la moneda + * @param vCompanyFk Id de la empresa + * @param vOrderBy Criterio de ordenación + * @param vIsConciliated Indica si está conciliado o no + * @return tmp.supplierStatement + */ + SET @euroBalance:= 0; + SET @currencyBalance:= 0; + + CREATE OR REPLACE TEMPORARY TABLE tmp.supplierStatement + ENGINE = MEMORY + SELECT *, + @euroBalance:= ROUND( + @euroBalance + IFNULL(paymentEuros, 0) - + IFNULL(invoiceEuros, 0), 2 + ) euroBalance, + @currencyBalance:= ROUND( + @currencyBalance + IFNULL(paymentCurrency, 0) - + IFNULL(invoiceCurrency, 0), 2 + ) currencyBalance + FROM ( + SELECT * FROM + ( + SELECT NULL bankFk, + ii.companyFk, + ii.serial, + ii.id, + CASE + WHEN vOrderBy = 'issued' THEN ii.issued + WHEN vOrderBy = 'bookEntried' THEN ii.bookEntried + WHEN vOrderBy = 'booked' THEN ii.booked + WHEN vOrderBy = 'dueDate' THEN iid.dueDated + END dated, + CONCAT('S/Fra ', ii.supplierRef) sref, + IF(ii.currencyFk > 1, + ROUND(SUM(iid.foreignValue) / SUM(iid.amount), 3), + NULL + ) changeValue, + CAST(SUM(iid.amount) AS DECIMAL(10,2)) invoiceEuros, + CAST(SUM(iid.foreignValue) AS DECIMAL(10,2)) invoiceCurrency, + NULL paymentEuros, + NULL paymentCurrency, + ii.currencyFk, + ii.isBooked, + c.code, + 'invoiceIn' statementType + FROM invoiceIn ii + JOIN invoiceInDueDay iid ON iid.invoiceInFk = ii.id + JOIN currency c ON c.id = ii.currencyFk + WHERE ii.issued > '2014-12-31' + AND ii.supplierFk = vSupplierFk + AND vCurrencyFk IN (ii.currencyFk, 0) + AND vCompanyFk IN (ii.companyFk, 0) + AND (vIsConciliated = ii.isBooked OR NOT vIsConciliated) + GROUP BY iid.id + UNION ALL + SELECT p.bankFk, + p.companyFk, + NULL, + p.id, + CASE + WHEN vOrderBy = 'issued' THEN p.received + WHEN vOrderBy = 'bookEntried' THEN p.received + WHEN vOrderBy = 'booked' THEN p.received + WHEN vOrderBy = 'dueDate' THEN p.dueDated + END, + CONCAT(IFNULL(pm.name, ''), + IF(pn.concept <> '', + CONCAT(' : ', pn.concept), + '') + ), + IF(p.currencyFk > 1, p.divisa / p.amount, NULL), + NULL, + NULL, + p.amount, + p.divisa, + p.currencyFk, + p.isConciliated, + c.code, + 'payment' + FROM payment p + LEFT JOIN currency c ON c.id = p.currencyFk + LEFT JOIN bank b ON b.id = p.bankFk + LEFT JOIN payMethod pm ON pm.id = p.payMethodFk + LEFT JOIN promissoryNote pn ON pn.paymentFk = p.id + WHERE p.received > '2014-12-31' + AND p.supplierFk = vSupplierFk + AND vCurrencyFk IN (p.currencyFk, 0) + AND vCompanyFk IN (p.companyFk, 0) + AND (vIsConciliated = p.isConciliated OR NOT vIsConciliated) + UNION ALL + SELECT NULL, + companyFk, + NULL, + se.id, + CASE + WHEN vOrderBy = 'issued' THEN se.dated + WHEN vOrderBy = 'bookEntried' THEN se.dated + WHEN vOrderBy = 'booked' THEN se.dated + WHEN vOrderBy = 'dueDate' THEN se.dueDated + END, + se.description, + 1, + amount, + NULL, + NULL, + NULL, + currencyFk, + isConciliated, + c.`code`, + 'expense' + FROM supplierExpense se + JOIN currency c ON c.id = se.currencyFk + WHERE se.supplierFk = vSupplierFk + AND vCurrencyFk IN (se.currencyFk,0) + AND vCompanyFk IN (se.companyFk,0) + AND (vIsConciliated = se.isConciliated OR NOT vIsConciliated) + ) sub + ORDER BY (dated IS NULL AND NOT isBooked), + dated, + IF(vOrderBy = 'dueDate', id, NULL) + LIMIT 10000000000000000000 + ) t; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketBoxesView` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -71766,14 +72648,14 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_setState` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setState`( vSelf INT, @@ -71807,8 +72689,8 @@ BEGIN CALL util.throw('ASSIGN_ZONE_FIRST'); END IF; - SET vCanChangeState = ( - vStateCode <> 'ON_CHECKING' OR + SET vCanChangeState = (( + vStateCode <> 'ON_CHECKING' AND vStateCode <> 'CHECKED') OR vticketAlertLevel < vPackedAlertLevel )AND NOT ( vTicketStateCode IN ('CHECKED', 'CHECKING') @@ -71827,6 +72709,7 @@ BEGIN ELSE CALL util.throw('INCORRECT_TICKET_STATE'); END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -73242,6 +74125,128 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `travel_getDetailFromContinent` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_getDetailFromContinent`( + vContinentFk INT +) +BEGIN +/** + * Devuelve los detalles de los vuelos que tienen + * un almacén de salida de un continente. + * + * @param vContinentFk Id de continente + */ + DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL 12 WEEK; + SELECT IFNULL(CONCAT(" ", entryFk), travelFk) travelAndEntry, + sub.* + FROM ( + SELECT tr.id travelFk, + NULL entryFk, + TRUE isTravel, + am.name agency, + tr.ref, + tr.shipped, + wOut.name originBoxes, + tr.landed, + wIn.name destination, + SUM(b.stickers) stickers, + NULL evaNotes, + tr.kg, + CAST(SUM(b.weight * b.stickers) AS INT) loadedkg, + CAST( + SUM(vc.aerealVolumetricDensity * + b.stickers * + IF(p.volume, + p.volume, + p.width * p.depth * p.height + ) / 1000000 + ) AS INT + ) volumeKg, + NULL loadPriority, + NULL invoiceAmount, + s.nickname freighter, + NULL reference + FROM travel tr + LEFT JOIN supplier s ON s.id = tr.cargoSupplierFk + LEFT JOIN entry e ON e.travelFk = tr.id + LEFT JOIN buy b ON b.entryFk = e.id + LEFT JOIN packaging p ON p.id = b.packagingFk + LEFT JOIN item i ON i.id = b.itemFk + LEFT JOIN itemType it ON it.id = i.typeFk + JOIN warehouse wIn ON wIn.id = tr.warehouseInFk + JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk + JOIN country co ON co.id = wOut.countryFk + JOIN agencyMode am ON am.id = tr.agencyModeFk + JOIN volumeConfig vc + WHERE tr.landed >= vDateFrom + AND co.continentFk = vContinentFk + GROUP BY tr.id + UNION ALL + SELECT e.travelFk, + e.id, + FALSE, + s.name, + e.invoiceNumber, + tr.shipped, + wOut.name, + tr.landed, + wIn.name, + SUM(b.stickers), + e.evaNotes, + NULL, + CAST(SUM(b.weight * b.stickers) AS INT), + CAST( + SUM(vc.aerealVolumetricDensity * + b.stickers * + IF(p.volume, + p.volume, + p.width * p.depth * p.height + ) / 1000000 + ) AS INT + ), + loadPriority, + e.invoiceAmount, + s2.nickname, + e.reference + FROM entry e + JOIN buy b ON b.entryFk = e.id + JOIN packaging p ON p.id = b.packagingFk + JOIN item i ON i.id = b.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN supplier s ON s.id = e.supplierFk + JOIN travel tr ON tr.id = e.travelFk + LEFT JOIN supplier s2 ON s2.id = tr.cargoSupplierFk + JOIN warehouse wIn ON wIn.id = tr.warehouseInFk + JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk + JOIN country co ON co.id = wOut.countryFk + JOIN volumeConfig vc + WHERE tr.landed >= vDateFrom + AND co.continentFk = vContinentFk + GROUP BY e.id + ) sub + ORDER BY landed ASC, + shipped ASC, + travelFk, + isTravel DESC, + (loadPriority > 0) DESC, + loadPriority, + agency, + evaNotes; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `travel_getEntriesMissingPackage` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -75208,7 +76213,7 @@ BEGIN SET vDated = DATE(vTimed); - SELECT IF(pc.name = 'Conductor +3500kg', + SELECT IF(pc.code = 'driveCE', wc.dayBreakDriver, wc.dayBreak), wc.shortWeekBreak, @@ -76384,6 +77389,60 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `XDiario_check` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `XDiario_check`() +BEGIN +/** + * Realiza la revisión diaria de los asientos contables, + * identificando y notificando los asientos descuadrados + * y ajustando los saldos en caso necesario. + */ + INSERT INTO mail (receiver, subject, body) + SELECT 'cau@verdnatura.es', + 'Asientos descuadrados', + GROUP_CONCAT(CONCAT(' Asiento: ', ASIEN, ' - Importe:', recon) SEPARATOR ' | \n') + FROM ( + SELECT ASIEN, + SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) recon + FROM XDiario + WHERE NOT enlazado + GROUP BY ASIEN + HAVING ABS(SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0))) > 0.01 + ) sub + HAVING COUNT(*); + + UPDATE XDiario xd + JOIN ( + SELECT xd.id, SUBCTA, recon + FROM XDiario xd + JOIN ( + SELECT ASIEN, + SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) recon + FROM XDiario + WHERE NOT enlazado + GROUP BY ASIEN + HAVING recon + ) sub ON sub.ASIEN = xd.ASIEN + WHERE xd.SUBCTA > '5999999999' + GROUP BY xd.ASIEN + ) sub ON sub.id = xd.id + SET xd.Eurohaber = IF(IFNULL(xd.Eurohaber, 0) = 0, xd.Eurohaber, xd.Eurohaber + sub.recon), + xd.Eurodebe = IF(IFNULL(xd.Eurodebe, 0) = 0, xd.Eurodebe, xd.Eurodebe - sub.recon); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `XDiario_checkDate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77965,13 +79024,13 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Agencias_province` +-- Table structure for table `Agencias_province__` -- -DROP TABLE IF EXISTS `Agencias_province`; +DROP TABLE IF EXISTS `Agencias_province__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Agencias_province` ( +CREATE TABLE `Agencias_province__` ( `province_id` smallint(6) unsigned NOT NULL, `agency_id` smallint(5) unsigned NOT NULL, `zona` tinyint(4) NOT NULL, @@ -77981,10 +79040,10 @@ CREATE TABLE `Agencias_province` ( PRIMARY KEY (`province_id`,`agency_id`,`warehouse_id`), KEY `warehouse_id` (`warehouse_id`), KEY `agency_id` (`agency_id`), - CONSTRAINT `Agencias_province_ibfk_1` FOREIGN KEY (`province_id`) REFERENCES `vn`.`province` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `Agencias_province_ibfk_2` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `Agencias_province_ibfk_3` FOREIGN KEY (`agency_id`) REFERENCES `vn`.`agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + CONSTRAINT `Agencias_province___ibfk_1` FOREIGN KEY (`province_id`) REFERENCES `vn`.`province` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `Agencias_province___ibfk_2` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `Agencias_province___ibfk_3` FOREIGN KEY (`agency_id`) REFERENCES `vn`.`agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78047,32 +79106,18 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Temporary table structure for view `Articles_botanical` +-- Table structure for table `Baldas__` -- -DROP TABLE IF EXISTS `Articles_botanical`; -/*!50001 DROP VIEW IF EXISTS `Articles_botanical`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Articles_botanical` AS SELECT - 1 AS `Id_Article`, - 1 AS `genus_id`, - 1 AS `specie_id` */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `Baldas` --- - -DROP TABLE IF EXISTS `Baldas`; +DROP TABLE IF EXISTS `Baldas__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Baldas` ( +CREATE TABLE `Baldas__` ( `Id_Estanterias` int(11) NOT NULL, `Id_Baldas` int(11) NOT NULL, `h` int(11) NOT NULL, PRIMARY KEY (`Id_Estanterias`,`Id_Baldas`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78094,58 +79139,43 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Bancos_poliza` +-- Temporary table structure for view `Bancos_poliza` -- DROP TABLE IF EXISTS `Bancos_poliza`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Bancos_poliza` ( - `poliza_id` int(11) NOT NULL AUTO_INCREMENT, - `referencia` varchar(45) DEFAULT NULL, - `importe` double NOT NULL, - `com_dispuesto` double DEFAULT NULL, - `com_no_dispuesto` double DEFAULT NULL, - `com_anual` double DEFAULT NULL, - `apertura` date NOT NULL, - `cierre` date DEFAULT NULL, - `Id_Banco` int(11) NOT NULL, - `empresa_id` int(10) unsigned NOT NULL DEFAULT 442, - `supplierFk` int(10) unsigned DEFAULT NULL, - `description` varchar(255) DEFAULT NULL, - `hasGuarantee` tinyint(1) NOT NULL DEFAULT 0, - `dmsFk` int(11) DEFAULT NULL, - `notaryFk` int(10) unsigned DEFAULT NULL, - `currencyFk` tinyint(3) unsigned DEFAULT 2, - `amortizationTypeFk` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, - `periodicityTypeFk` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, - `insuranceExpired` date DEFAULT NULL, - PRIMARY KEY (`poliza_id`), - KEY `Id_Banco_Poliza_idx` (`Id_Banco`), - KEY `Id_Poliza_Empresa_idx` (`empresa_id`), - KEY `bankSupplierIdx1_idx` (`supplierFk`), - KEY `bankDmsIdx2_idx` (`dmsFk`), - KEY `bankNotaryIdx3_idx` (`notaryFk`), - KEY `asdf_idx` (`amortizationTypeFk`), - KEY `bankPeriodicityIdx4_idx` (`periodicityTypeFk`), - CONSTRAINT `Bancos_polizaCompany_Fk` FOREIGN KEY (`empresa_id`) REFERENCES `vn`.`company` (`id`) ON UPDATE CASCADE, - CONSTRAINT `Bancos_poliza_notaryFk` FOREIGN KEY (`notaryFk`) REFERENCES `vn`.`supplier` (`id`) ON UPDATE CASCADE, - CONSTRAINT `Bancos_poliza_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `vn`.`supplier` (`id`) ON UPDATE CASCADE, - CONSTRAINT `Id_Banco_Poliza` FOREIGN KEY (`Id_Banco`) REFERENCES `vn`.`accounting` (`id`) ON UPDATE CASCADE, - CONSTRAINT `asdf` FOREIGN KEY (`amortizationTypeFk`) REFERENCES `vn`.`amortizationType` (`code`) ON UPDATE CASCADE, - CONSTRAINT `bankDmsIdx2` FOREIGN KEY (`dmsFk`) REFERENCES `vn`.`dms` (`id`) ON UPDATE CASCADE, - CONSTRAINT `bankPeriodicityIdx4` FOREIGN KEY (`periodicityTypeFk`) REFERENCES `vn`.`periodicityType` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Lineas de credito asociadas a cuentas corrientes'; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `Bancos_poliza`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `Bancos_poliza` AS SELECT + 1 AS `poliza_id`, + 1 AS `referencia`, + 1 AS `importe`, + 1 AS `com_dispuesto`, + 1 AS `com_no_dispuesto`, + 1 AS `com_anual`, + 1 AS `apertura`, + 1 AS `cierre`, + 1 AS `Id_Banco`, + 1 AS `empresa_id`, + 1 AS `supplierFk`, + 1 AS `description`, + 1 AS `hasGuarantee`, + 1 AS `dmsFk`, + 1 AS `notaryFk`, + 1 AS `currencyFk`, + 1 AS `amortizationTypeFk`, + 1 AS `periodicityTypeFk`, + 1 AS `insuranceExpired` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `Brasa` +-- Table structure for table `Brasa__` -- -DROP TABLE IF EXISTS `Brasa`; +DROP TABLE IF EXISTS `Brasa__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Brasa` ( +CREATE TABLE `Brasa__` ( `Id_Cliente` int(10) unsigned NOT NULL DEFAULT 0, `Cliente` varchar(50) NOT NULL, `Vista` int(10) unsigned NOT NULL DEFAULT 0, @@ -78154,7 +79184,7 @@ CREATE TABLE `Brasa` ( `Grupo` int(10) unsigned NOT NULL, PRIMARY KEY (`Id_Cliente`), KEY `Index_1` (`Id_Cliente`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78189,17 +79219,17 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Clases` +-- Table structure for table `Clases__` -- -DROP TABLE IF EXISTS `Clases`; +DROP TABLE IF EXISTS `Clases__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Clases` ( +CREATE TABLE `Clases__` ( `Id_Clase` int(11) NOT NULL DEFAULT 0, `Clase` varchar(50) DEFAULT NULL, PRIMARY KEY (`Id_Clase`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78259,13 +79289,13 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Clientes_dits` +-- Table structure for table `Clientes_dits__` -- -DROP TABLE IF EXISTS `Clientes_dits`; +DROP TABLE IF EXISTS `Clientes_dits__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Clientes_dits` ( +CREATE TABLE `Clientes_dits__` ( `idClientes_dits` int(11) NOT NULL AUTO_INCREMENT, `idaccion_dits` int(11) NOT NULL, `ODBC_DATE` timestamp NOT NULL DEFAULT current_timestamp(), @@ -78275,18 +79305,18 @@ CREATE TABLE `Clientes_dits` ( `value_new` varchar(100) DEFAULT NULL, PRIMARY KEY (`idClientes_dits`), KEY `idaccion_dits` (`idaccion_dits`), - CONSTRAINT `Clientes_dits_ibfk_1` FOREIGN KEY (`idaccion_dits`) REFERENCES `accion_dits` (`idaccion_dits`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + CONSTRAINT `Clientes_dits___ibfk_1` FOREIGN KEY (`idaccion_dits`) REFERENCES `accion_dits__` (`idaccion_dits`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Clientes_empresa` +-- Table structure for table `Clientes_empresa__` -- -DROP TABLE IF EXISTS `Clientes_empresa`; +DROP TABLE IF EXISTS `Clientes_empresa__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Clientes_empresa` ( +CREATE TABLE `Clientes_empresa__` ( `Id_Clientes_empresa` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `Id_Cliente` int(11) NOT NULL, `empresa_id` int(10) unsigned NOT NULL, @@ -78295,33 +79325,33 @@ CREATE TABLE `Clientes_empresa` ( PRIMARY KEY (`Id_Clientes_empresa`), KEY `empresa_id_idx` (`empresa_id`), CONSTRAINT `Clientes_empresaCompany_Fk` FOREIGN KEY (`empresa_id`) REFERENCES `vn`.`company` (`id`) ON DELETE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Empresa por defecto para crear los tickets'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Clientes_event` +-- Table structure for table `Clientes_event__` -- -DROP TABLE IF EXISTS `Clientes_event`; +DROP TABLE IF EXISTS `Clientes_event__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Clientes_event` ( +CREATE TABLE `Clientes_event__` ( `Id_Cliente` int(11) NOT NULL, `quantity` tinyint(3) unsigned NOT NULL, `odbc_date` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`Id_Cliente`), - CONSTRAINT `Clientes_event_ibfk_1` FOREIGN KEY (`Id_Cliente`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + CONSTRAINT `Clientes_event___ibfk_1` FOREIGN KEY (`Id_Cliente`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Clientes_potenciales` +-- Table structure for table `Clientes_potenciales__` -- -DROP TABLE IF EXISTS `Clientes_potenciales`; +DROP TABLE IF EXISTS `Clientes_potenciales__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Clientes_potenciales` ( +CREATE TABLE `Clientes_potenciales__` ( `id` int(11) NOT NULL, `PAIS` varchar(12) DEFAULT NULL, `ACTIVIDAD` varchar(10) DEFAULT NULL, @@ -78341,21 +79371,7 @@ CREATE TABLE `Clientes_potenciales` ( `Notas` varchar(255) DEFAULT NULL, `odbc_date` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`NOMBRE`,`POBLACION`,`DIR_POSTAL`,`TELEFONO`,`TELEFONO2`,`FAX`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Colores__` --- - -DROP TABLE IF EXISTS `Colores__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Colores__` ( - `Id_Color` int(11) NOT NULL DEFAULT 0, - `Color` varchar(50) DEFAULT NULL, - PRIMARY KEY (`Id_Color`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #5903 deprecated 2023-06-30'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78375,23 +79391,6 @@ SET character_set_client = utf8; 1 AS `countryFk` */; SET character_set_client = @saved_cs_client; --- --- Table structure for table `Comparativa__` --- - -DROP TABLE IF EXISTS `Comparativa__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Comparativa__` ( - `Periodo` int(11) NOT NULL, - `Id_Article` bigint(20) NOT NULL, - `warehouse_id` int(11) NOT NULL, - `Cantidad` mediumint(9) NOT NULL DEFAULT 0, - `price` mediumint(8) unsigned NOT NULL DEFAULT 0, - PRIMARY KEY (`Periodo`,`Id_Article`,`warehouse_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='20/11/2023'; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Temporary table structure for view `Compres` -- @@ -78448,13 +79447,13 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Compres_ok` +-- Table structure for table `Compres_ok__` -- -DROP TABLE IF EXISTS `Compres_ok`; +DROP TABLE IF EXISTS `Compres_ok__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Compres_ok` ( +CREATE TABLE `Compres_ok__` ( `Id_Compra` int(11) NOT NULL, `valor` tinyint(3) unsigned NOT NULL DEFAULT 0, `odbc_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), @@ -78467,8 +79466,8 @@ CREATE TABLE `Compres_ok` ( KEY `Id_Accion` (`Id_Accion`), KEY `Compres_ok_Id_Trabajador_idx` (`Id_Trabajador`), CONSTRAINT `Compres_ok_Id_Trabajador` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn`.`worker` (`id`), - CONSTRAINT `Compres_ok_ibfk_1` FOREIGN KEY (`Id_Compra`) REFERENCES `vn`.`buy` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + CONSTRAINT `Compres_ok___ibfk_1` FOREIGN KEY (`Id_Compra`) REFERENCES `vn`.`buy` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78498,36 +79497,36 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Consignatarios_devices` +-- Table structure for table `Consignatarios_devices__` -- -DROP TABLE IF EXISTS `Consignatarios_devices`; +DROP TABLE IF EXISTS `Consignatarios_devices__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Consignatarios_devices` ( +CREATE TABLE `Consignatarios_devices__` ( `Id_Consigna` int(11) NOT NULL, `serialNumber` varchar(45) NOT NULL, `notas` varchar(45) DEFAULT NULL, PRIMARY KEY (`Id_Consigna`,`serialNumber`), CONSTRAINT `Condigna_devices` FOREIGN KEY (`Id_Consigna`) REFERENCES `vn`.`address` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Conteo` +-- Table structure for table `Conteo__` -- -DROP TABLE IF EXISTS `Conteo`; +DROP TABLE IF EXISTS `Conteo__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Conteo` ( +CREATE TABLE `Conteo__` ( `Id_Conteo` int(11) NOT NULL AUTO_INCREMENT, `Id_Article` int(11) NOT NULL, `Fecha` timestamp NOT NULL DEFAULT current_timestamp(), `dispositivo` varchar(15) DEFAULT NULL, `warehouse_id` int(10) unsigned NOT NULL DEFAULT 1, PRIMARY KEY (`Id_Conteo`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78573,31 +79572,6 @@ SET character_set_client = utf8; 1 AS `Lleno` */; SET character_set_client = @saved_cs_client; --- --- Table structure for table `Enlaces Facturas__` --- - -DROP TABLE IF EXISTS `Enlaces Facturas__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Enlaces Facturas__` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `Asiento` int(11) DEFAULT 0, - `Apunte` int(11) DEFAULT 0, - `Data` datetime DEFAULT NULL, - `Concepto` varchar(40) DEFAULT NULL, - `Cuenta` varchar(10) DEFAULT NULL, - `Debe` double DEFAULT NULL, - `Haber` double DEFAULT NULL, - `Contrapartida` varchar(10) DEFAULT NULL, - `Contabilizado` tinyint(1) NOT NULL DEFAULT 0, - `empresa_id` int(10) unsigned NOT NULL DEFAULT 442, - PRIMARY KEY (`id`), - KEY `empresa_id` (`empresa_id`), - CONSTRAINT `EnlacesFacturas__Company_Fk` FOREIGN KEY (`empresa_id`) REFERENCES `vn`.`company` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Deprecated 27-02-2023'; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Temporary table structure for view `Entradas` -- @@ -78647,38 +79621,13 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Entradas_dits__` +-- Table structure for table `Entradas_kop__` -- -DROP TABLE IF EXISTS `Entradas_dits__`; +DROP TABLE IF EXISTS `Entradas_kop__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Entradas_dits__` ( - `idEntrada_dits` int(11) NOT NULL AUTO_INCREMENT, - `idaccion_dits` int(11) NOT NULL, - `ODBC_DATE` timestamp NOT NULL DEFAULT current_timestamp(), - `Id_Ticket` int(11) NOT NULL, - `Id_Trabajador` int(10) unsigned DEFAULT NULL, - `value_old` varchar(100) DEFAULT NULL, - `value_new` varchar(100) DEFAULT NULL, - PRIMARY KEY (`idEntrada_dits`), - KEY `fgkey_entradas_1_idx` (`idaccion_dits`), - KEY `fgkey_entradas_2_idx` (`Id_Ticket`), - KEY `fgkey_entradas_3_idx` (`Id_Trabajador`), - CONSTRAINT `Entradas_dits___ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `vn`.`entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fgkey_entradas_1` FOREIGN KEY (`idaccion_dits`) REFERENCES `accion_dits` (`idaccion_dits`) ON DELETE NO ACTION ON UPDATE CASCADE, - CONSTRAINT `fgkey_entradas_3` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn`.`worker` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6039 @deprecated 2023-08-04'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Entradas_kop` --- - -DROP TABLE IF EXISTS `Entradas_kop`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Entradas_kop` ( +CREATE TABLE `Entradas_kop__` ( `Id_Entradas_kop` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `Id_Entrada` int(11) NOT NULL, `kop` int(11) DEFAULT NULL, @@ -78686,97 +79635,30 @@ CREATE TABLE `Entradas_kop` ( PRIMARY KEY (`Id_Entradas_kop`), KEY `entradas_entradas_kop_idx` (`Id_Entrada`), CONSTRAINT `entradas_entradas_kop` FOREIGN KEY (`Id_Entrada`) REFERENCES `vn`.`entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Relaciona las entradas con los origenes de compra'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Entradas_orden` +-- Temporary table structure for view `Entradas_orden` -- DROP TABLE IF EXISTS `Entradas_orden`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Entradas_orden` ( - `Id_Entrada` int(11) NOT NULL, - `orden` int(11) NOT NULL DEFAULT 1 COMMENT '1.- Ordenar por articulo\n2.- Ordenar por compra\n', - PRIMARY KEY (`Id_Entrada`), - CONSTRAINT `entradas_entradas_orden` FOREIGN KEY (`Id_Entrada`) REFERENCES `vn`.`entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Entradas_stack__` --- - -DROP TABLE IF EXISTS `Entradas_stack__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Entradas_stack__` ( - `Id_Entrada` int(11) NOT NULL, - `label_number` smallint(6) DEFAULT 0, - PRIMARY KEY (`Id_Entrada`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Deprecated 27-02-2023'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Entradas_turno__` --- - -DROP TABLE IF EXISTS `Entradas_turno__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Entradas_turno__` ( - `Id_Entrada` int(11) NOT NULL, - `weekDay` tinyint(2) NOT NULL DEFAULT 0, - PRIMARY KEY (`Id_Entrada`), - CONSTRAINT `entrada_entrada_turno` FOREIGN KEY (`Id_Entrada`) REFERENCES `vn`.`entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Deprecated 27-02-2023'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `EnvioMasivo__` --- - -DROP TABLE IF EXISTS `EnvioMasivo__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `EnvioMasivo__` ( - `Id` int(11) NOT NULL AUTO_INCREMENT, - `Cliente` varchar(40) NOT NULL, - `Direccion` varchar(80) NOT NULL, - `CP` varchar(5) NOT NULL, - `Poblacion` varchar(40) NOT NULL, - `Telefono` varchar(9) NOT NULL, - `Bultos` int(11) NOT NULL, - `Observaciones` varchar(40) DEFAULT NULL, - `IdTicket` int(11) NOT NULL, - PRIMARY KEY (`Id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Deprecated 27-02-2023'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `Equipos` --- - -DROP TABLE IF EXISTS `Equipos`; -/*!50001 DROP VIEW IF EXISTS `Equipos`*/; +/*!50001 DROP VIEW IF EXISTS `Entradas_orden`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `Equipos` AS SELECT - 1 AS `alias`, - 1 AS `descripcion`, - 1 AS `trabajador_id`, - 1 AS `windowsSerial` */; +/*!50001 CREATE VIEW `Entradas_orden` AS SELECT + 1 AS `Id_Entrada`, + 1 AS `orden` */; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Espionajes` +-- Table structure for table `Espionajes__` -- -DROP TABLE IF EXISTS `Espionajes`; +DROP TABLE IF EXISTS `Espionajes__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Espionajes` ( +CREATE TABLE `Espionajes__` ( `idEspionaje` int(11) NOT NULL AUTO_INCREMENT, `Id_Trabajador` varchar(45) DEFAULT NULL, `Fecha` date DEFAULT NULL, @@ -78785,188 +79667,67 @@ CREATE TABLE `Espionajes` ( `Id_Equipo` int(11) DEFAULT NULL, PRIMARY KEY (`idEspionaje`), KEY `index` (`Id_Trabajador`,`Fecha`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Estados` +-- Table structure for table `Estados__` -- -DROP TABLE IF EXISTS `Estados`; +DROP TABLE IF EXISTS `Estados__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Estados` ( +CREATE TABLE `Estados__` ( `Id_Estado` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `Estado` varchar(50) DEFAULT NULL, PRIMARY KEY (`Id_Estado`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Estanterias__` +-- Table structure for table `Familias__` -- -DROP TABLE IF EXISTS `Estanterias__`; +DROP TABLE IF EXISTS `Familias__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Estanterias__` ( - `Id_Estanterias` int(11) NOT NULL AUTO_INCREMENT, - `w` int(11) DEFAULT NULL, - `d` int(11) DEFAULT NULL, - `modelo` varchar(255) DEFAULT NULL, - PRIMARY KEY (`Id_Estanterias`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Deprecated 27-02-2023'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Estanterias_distri__` --- - -DROP TABLE IF EXISTS `Estanterias_distri__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Estanterias_distri__` ( - `idEstanterias_distri` int(11) NOT NULL, - `posinicial` int(11) NOT NULL, - `posfinal` int(11) NOT NULL, - `Id_Estanterias` int(11) NOT NULL, - PRIMARY KEY (`Id_Estanterias`,`idEstanterias_distri`), - KEY `Estanterias_fgkey1_idx` (`Id_Estanterias`), - KEY `est_distrib_fgkey1_idx` (`idEstanterias_distri`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Deprecated 27-02-2023'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Estanterias_distri_name__` --- - -DROP TABLE IF EXISTS `Estanterias_distri_name__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Estanterias_distri_name__` ( - `idEstanterias_distri` int(11) NOT NULL AUTO_INCREMENT, - `Descripcion` varchar(255) NOT NULL, - PRIMARY KEY (`idEstanterias_distri`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Deprecated 27-02-2023'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `Facturas` --- - -DROP TABLE IF EXISTS `Facturas`; -/*!50001 DROP VIEW IF EXISTS `Facturas`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Facturas` AS SELECT - 1 AS `factura_id`, - 1 AS `Id_Factura`, - 1 AS `Serie`, - 1 AS `Fecha`, - 1 AS `Importe`, - 1 AS `Id_Cliente`, - 1 AS `odbc_date`, - 1 AS `empresa_id`, - 1 AS `Vencimiento`, - 1 AS `booked`, - 1 AS `Id_Banco`, - 1 AS `siiTypeInvoiceOutFk`, - 1 AS `cplusTaxBreakFk`, - 1 AS `cplusSubjectOpFk`, - 1 AS `siiTrascendencyInvoiceOutFk`, - 1 AS `pdf` */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `Familias` --- - -DROP TABLE IF EXISTS `Familias`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Familias` ( +CREATE TABLE `Familias__` ( `Familia` varchar(3) NOT NULL, `Subcuenta` varchar(10) DEFAULT NULL, `Descripcion` varchar(50) DEFAULT NULL, PRIMARY KEY (`Familia`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Forms` +-- Table structure for table `Forms__` -- -DROP TABLE IF EXISTS `Forms`; +DROP TABLE IF EXISTS `Forms__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Forms` ( +CREATE TABLE `Forms__` ( `id` int(11) NOT NULL AUTO_INCREMENT, `titulo` varchar(50) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `Gastos` +-- Table structure for table `Grupos__` -- -DROP TABLE IF EXISTS `Gastos`; -/*!50001 DROP VIEW IF EXISTS `Gastos`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Gastos` AS SELECT - 1 AS `Id_Gasto`, - 1 AS `Gasto`, - 1 AS `isWithheld` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `Greuges` --- - -DROP TABLE IF EXISTS `Greuges`; -/*!50001 DROP VIEW IF EXISTS `Greuges`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Greuges` AS SELECT - 1 AS `Id`, - 1 AS `Id_Cliente`, - 1 AS `Comentario`, - 1 AS `Importe`, - 1 AS `Fecha`, - 1 AS `odbc_date`, - 1 AS `Greuges_type_id`, - 1 AS `Id_Ticket` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `Greuges_type` --- - -DROP TABLE IF EXISTS `Greuges_type`; -/*!50001 DROP VIEW IF EXISTS `Greuges_type`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Greuges_type` AS SELECT - 1 AS `Greuges_type_id`, - 1 AS `name` */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `Grupos` --- - -DROP TABLE IF EXISTS `Grupos`; +DROP TABLE IF EXISTS `Grupos__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Grupos` ( +CREATE TABLE `Grupos__` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, `Grupo` varchar(45) NOT NULL, `observation_type_id` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78986,34 +79747,19 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Informes` +-- Table structure for table `Informes__` -- -DROP TABLE IF EXISTS `Informes`; +DROP TABLE IF EXISTS `Informes__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Informes` ( +CREATE TABLE `Informes__` ( `Id_Informe` tinyint(3) unsigned NOT NULL, `Informe` varchar(50) DEFAULT NULL, PRIMARY KEY (`Id_Informe`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `Intrastat` --- - -DROP TABLE IF EXISTS `Intrastat`; -/*!50001 DROP VIEW IF EXISTS `Intrastat`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Intrastat` AS SELECT - 1 AS `Codintrastat`, - 1 AS `Definicion`, - 1 AS `iva_group_id`, - 1 AS `iva_codigo_id` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `Jefes__` -- @@ -79048,13 +79794,13 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Monitoring` +-- Table structure for table `Monitoring__` -- -DROP TABLE IF EXISTS `Monitoring`; +DROP TABLE IF EXISTS `Monitoring__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Monitoring` ( +CREATE TABLE `Monitoring__` ( `id` int(11) NOT NULL AUTO_INCREMENT, `equipo_id` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `user_id` int(10) unsigned NOT NULL, @@ -79069,9 +79815,9 @@ CREATE TABLE `Monitoring` ( KEY `cliente_id` (`cliente_id`), KEY `ticket_id` (`ticket_id`), CONSTRAINT `Monitoring_FK` FOREIGN KEY (`equipo_id`) REFERENCES `vn`.`host` (`code`) ON UPDATE CASCADE, - CONSTRAINT `Monitoring_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `vn`.`worker` (`id`), - CONSTRAINT `Monitoring_ibfk_3` FOREIGN KEY (`form_id`) REFERENCES `Forms` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + CONSTRAINT `Monitoring___ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `vn`.`worker` (`id`), + CONSTRAINT `Monitoring___ibfk_3` FOREIGN KEY (`form_id`) REFERENCES `Forms__` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -79100,20 +79846,20 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Movimientos_avisar` +-- Table structure for table `Movimientos_avisar__` -- -DROP TABLE IF EXISTS `Movimientos_avisar`; +DROP TABLE IF EXISTS `Movimientos_avisar__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Movimientos_avisar` ( +CREATE TABLE `Movimientos_avisar__` ( `Id_Movimiento` int(11) NOT NULL, `Id_Remitente` int(11) DEFAULT NULL, PRIMARY KEY (`Id_Movimiento`), KEY `Movimiento` (`Id_Movimiento`), KEY `Remitente` (`Id_Remitente`), CONSTRAINT `Id_Movimientos_avisar_fk` FOREIGN KEY (`Id_Movimiento`) REFERENCES `vn`.`sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -79151,13 +79897,13 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Movimientos_revisar` +-- Table structure for table `Movimientos_revisar__` -- -DROP TABLE IF EXISTS `Movimientos_revisar`; +DROP TABLE IF EXISTS `Movimientos_revisar__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Movimientos_revisar` ( +CREATE TABLE `Movimientos_revisar__` ( `Id_Movimiento` int(11) NOT NULL, `Comentario` varchar(255) DEFAULT NULL, `Revisado` tinyint(1) NOT NULL DEFAULT 0, @@ -79166,8 +79912,8 @@ CREATE TABLE `Movimientos_revisar` ( PRIMARY KEY (`Id_Movimiento`), KEY `Remitente` (`Id_Remitente`), KEY `Destinatario` (`Id_Destinatario`), - CONSTRAINT `Movimientos_revisar_ibfk_1` FOREIGN KEY (`Id_Movimiento`) REFERENCES `vn`.`sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + CONSTRAINT `Movimientos_revisar___ibfk_1` FOREIGN KEY (`Id_Movimiento`) REFERENCES `vn`.`sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -79231,27 +79977,19 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Pagares` +-- Temporary table structure for view `Pagares` -- DROP TABLE IF EXISTS `Pagares`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Pagares` ( - `kk_Vencimiento` datetime DEFAULT NULL, - `kk_Importe` double DEFAULT 0, - `Fechaemision` timestamp NOT NULL DEFAULT current_timestamp(), - `Id_Pagare` int(11) NOT NULL AUTO_INCREMENT, - `Concepto` varchar(50) DEFAULT NULL, - `kk_id_proveedor` int(11) DEFAULT NULL, - `kk_empresa_id` smallint(5) unsigned DEFAULT NULL, - `pago_id` int(10) unsigned DEFAULT NULL, - PRIMARY KEY (`Id_Pagare`), - KEY `empresa_id` (`kk_empresa_id`), - KEY `pago_id` (`pago_id`), - CONSTRAINT `Pagares_ibfk_2` FOREIGN KEY (`pago_id`) REFERENCES `vn`.`payment` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `Pagares`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `Pagares` AS SELECT + 1 AS `Id_Pagare`, + 1 AS `Fechaemision`, + 1 AS `Concepto`, + 1 AS `pago_id` */; +SET character_set_client = @saved_cs_client; -- -- Temporary table structure for view `Paises` @@ -79288,7 +80026,7 @@ CREATE TABLE `Permisos__` ( KEY `empresa_id` (`empresa_id`), KEY `Permisos_ibfk_3_idx` (`Id_Trabajador`), CONSTRAINT `PermisosCompany_Fk` FOREIGN KEY (`empresa_id`) REFERENCES `vn`.`company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `Permisos___ibfk_2` FOREIGN KEY (`Id_Grupo`) REFERENCES `Grupos` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `Permisos___ibfk_2` FOREIGN KEY (`Id_Grupo`) REFERENCES `Grupos__` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `Permisos___ibfk_3` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn`.`worker` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -79308,19 +80046,6 @@ SET character_set_client = utf8; 1 AS `PrecioEspecial` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `Prioridades` --- - -DROP TABLE IF EXISTS `Prioridades`; -/*!50001 DROP VIEW IF EXISTS `Prioridades`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Prioridades` AS SELECT - 1 AS `Id_Prioridad`, - 1 AS `Prioridad` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `Proveedores` -- @@ -79378,13 +80103,13 @@ CREATE TABLE `Proveedores_cargueras` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Proveedores_comunicados` +-- Table structure for table `Proveedores_comunicados__` -- -DROP TABLE IF EXISTS `Proveedores_comunicados`; +DROP TABLE IF EXISTS `Proveedores_comunicados__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Proveedores_comunicados` ( +CREATE TABLE `Proveedores_comunicados__` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `Id_Proveedor` int(10) unsigned NOT NULL, `escrito_id` int(11) NOT NULL, @@ -79392,39 +80117,38 @@ CREATE TABLE `Proveedores_comunicados` ( PRIMARY KEY (`id`), KEY `Proveedor` (`Id_Proveedor`), KEY `Escrito` (`escrito_id`), - CONSTRAINT `Proveedores_comunicados_ibfk_4` FOREIGN KEY (`escrito_id`) REFERENCES `Proveedores_escritos` (`id`) ON UPDATE CASCADE, + CONSTRAINT `Proveedores_comunicados___ibfk_4` FOREIGN KEY (`escrito_id`) REFERENCES `Proveedores_escritos__` (`id`) ON UPDATE CASCADE, CONSTRAINT `Proveedores_comunicados_supplierFk` FOREIGN KEY (`Id_Proveedor`) REFERENCES `vn`.`supplier` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Proveedores_escritos` +-- Table structure for table `Proveedores_escritos__` -- -DROP TABLE IF EXISTS `Proveedores_escritos`; +DROP TABLE IF EXISTS `Proveedores_escritos__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Proveedores_escritos` ( +CREATE TABLE `Proveedores_escritos__` ( `id` int(11) NOT NULL AUTO_INCREMENT, `escrito` varchar(45) NOT NULL, `informe` varchar(45) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Proveedores_gestdoc` +-- Temporary table structure for view `Proveedores_gestdoc` -- DROP TABLE IF EXISTS `Proveedores_gestdoc`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Proveedores_gestdoc` ( - `Id_Proveedor` int(11) NOT NULL, - `gestdoc_id` int(11) NOT NULL, - PRIMARY KEY (`Id_Proveedor`,`gestdoc_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `Proveedores_gestdoc`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `Proveedores_gestdoc` AS SELECT + 1 AS `Id_Proveedor`, + 1 AS `gestdoc_id` */; +SET character_set_client = @saved_cs_client; -- -- Temporary table structure for view `Recibos` @@ -79463,24 +80187,19 @@ CREATE TABLE `Recibos_recorded__` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Remesas` +-- Temporary table structure for view `Remesas` -- DROP TABLE IF EXISTS `Remesas`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Remesas` ( - `Id_Remesa` int(11) NOT NULL AUTO_INCREMENT, - `Fecha Remesa` datetime DEFAULT NULL, - `Banco` int(11) DEFAULT 0, - `empresa_id` int(10) unsigned NOT NULL DEFAULT 442, - PRIMARY KEY (`Id_Remesa`), - KEY `Id_Banco` (`Banco`), - KEY `empresa_id` (`empresa_id`), - CONSTRAINT `RemesasCompany_Fk` FOREIGN KEY (`empresa_id`) REFERENCES `vn`.`company` (`id`) ON UPDATE CASCADE, - CONSTRAINT `Remesas_ibfk_2` FOREIGN KEY (`Banco`) REFERENCES `vn`.`accounting` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `Remesas`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `Remesas` AS SELECT + 1 AS `Id_Remesa`, + 1 AS `Fecha Remesa`, + 1 AS `Banco`, + 1 AS `empresa_id` */; +SET character_set_client = @saved_cs_client; -- -- Table structure for table `Reservas__` @@ -79537,80 +80256,67 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Saldos_Prevision` +-- Temporary table structure for view `Saldos_Prevision` -- DROP TABLE IF EXISTS `Saldos_Prevision`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Saldos_Prevision` ( - `Saldos_Prevision_id` int(11) NOT NULL AUTO_INCREMENT, - `Descripcion` varchar(45) DEFAULT NULL, - `Importe` double NOT NULL DEFAULT 0, - `Fecha` date NOT NULL, - `Id_Banco` int(11) DEFAULT NULL, - `empresa_id` int(10) unsigned NOT NULL DEFAULT 442, - PRIMARY KEY (`Saldos_Prevision_id`), - KEY `Fecha_indice` (`Fecha`), - KEY `banco_prevision_idx` (`Id_Banco`), - KEY `empresa_prevision_idx` (`empresa_id`), - CONSTRAINT `Saldos_PrevisionCompany_Fk` FOREIGN KEY (`empresa_id`) REFERENCES `vn`.`company` (`id`) ON UPDATE CASCADE, - CONSTRAINT `banco_prevision` FOREIGN KEY (`Id_Banco`) REFERENCES `vn`.`accounting` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Aqui ponemos los gastos e ingresos pendientes de introducir '; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `Saldos_Prevision`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `Saldos_Prevision` AS SELECT + 1 AS `Saldos_Prevision_id`, + 1 AS `Descripcion`, + 1 AS `Importe`, + 1 AS `Fecha`, + 1 AS `Id_Banco`, + 1 AS `empresa_id` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `Series` +-- Table structure for table `Series__` -- -DROP TABLE IF EXISTS `Series`; +DROP TABLE IF EXISTS `Series__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Series` ( +CREATE TABLE `Series__` ( `Id_Serie` varchar(2) NOT NULL, `Serie` varchar(30) DEFAULT NULL, `Cuenta` varchar(10) DEFAULT NULL, PRIMARY KEY (`Id_Serie`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Split_lines` +-- Temporary table structure for view `Split_lines` -- DROP TABLE IF EXISTS `Split_lines`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Split_lines` ( - `Id_Split_lines` int(11) NOT NULL AUTO_INCREMENT, - `Id_Split` int(11) NOT NULL, - `Id_Article` int(11) DEFAULT NULL, - `Id_Compra` int(11) DEFAULT NULL, - PRIMARY KEY (`Id_Split_lines`), - KEY `Id_Split` (`Id_Split`), - KEY `Id_Compra` (`Id_Compra`), - CONSTRAINT `Id_Compra` FOREIGN KEY (`Id_Compra`) REFERENCES `vn`.`buy` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `Split_lines_ibfk_1` FOREIGN KEY (`Id_Split`) REFERENCES `Splits` (`Id_Split`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `Split_lines`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `Split_lines` AS SELECT + 1 AS `Id_Split_lines`, + 1 AS `Id_Split`, + 1 AS `Id_Article`, + 1 AS `Id_Compra` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `Splits` +-- Temporary table structure for view `Splits` -- DROP TABLE IF EXISTS `Splits`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Splits` ( - `Id_Split` int(11) NOT NULL AUTO_INCREMENT, - `Id_Ticket` int(11) DEFAULT NULL, - `Id_Entrada` int(11) DEFAULT NULL, - `Fecha` datetime DEFAULT NULL, - `Notas` varchar(255) DEFAULT NULL, - PRIMARY KEY (`Id_Split`), - KEY `Id_Entrada` (`Id_Entrada`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `Splits`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `Splits` AS SELECT + 1 AS `Id_Split`, + 1 AS `Id_Ticket`, + 1 AS `Id_Entrada`, + 1 AS `Fecha`, + 1 AS `Notas` */; +SET character_set_client = @saved_cs_client; -- -- Temporary table structure for view `Tickets` @@ -79653,19 +80359,19 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Tickets_stack` +-- Table structure for table `Tickets_stack__` -- -DROP TABLE IF EXISTS `Tickets_stack`; +DROP TABLE IF EXISTS `Tickets_stack__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Tickets_stack` ( +CREATE TABLE `Tickets_stack__` ( `Id_Ticket` int(11) NOT NULL, `orden` smallint(5) unsigned NOT NULL, `label_number` smallint(6) DEFAULT 0, `preparado` tinyint(4) DEFAULT 0, PRIMARY KEY (`Id_Ticket`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Orden para imprimir los F5.Se borra autom. lo de 2 meses'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -79743,17 +80449,17 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Tipos_f11` +-- Table structure for table `Tipos_f11__` -- -DROP TABLE IF EXISTS `Tipos_f11`; +DROP TABLE IF EXISTS `Tipos_f11__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Tipos_f11` ( +CREATE TABLE `Tipos_f11__` ( `f11_id` tinyint(4) NOT NULL AUTO_INCREMENT, `description` varchar(15) NOT NULL, PRIMARY KEY (`f11_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -79780,18 +80486,18 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Tramos` +-- Table structure for table `Tramos__` -- -DROP TABLE IF EXISTS `Tramos`; +DROP TABLE IF EXISTS `Tramos__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Tramos` ( +CREATE TABLE `Tramos__` ( `id` int(11) NOT NULL AUTO_INCREMENT, `Tramo` time NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `Tramo` (`Tramo`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -79821,205 +80527,103 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Temporary table structure for view `Vehiculos` --- - -DROP TABLE IF EXISTS `Vehiculos`; -/*!50001 DROP VIEW IF EXISTS `Vehiculos`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Vehiculos` AS SELECT - 1 AS `Id_Vehiculo`, - 1 AS `Matricula`, - 1 AS `Marca`, - 1 AS `Modelo`, - 1 AS `empresa_id`, - 1 AS `warehouseFk`, - 1 AS `description`, - 1 AS `m3`, - 1 AS `active`, - 1 AS `deliveryPointFk` */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `Vehiculos_consumo` +-- Temporary table structure for view `Vehiculos_consumo` -- DROP TABLE IF EXISTS `Vehiculos_consumo`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Vehiculos_consumo` ( - `Vehiculos_consumo_id` int(11) NOT NULL AUTO_INCREMENT, - `Id_Vehiculo` int(10) unsigned NOT NULL, - `fecha` date NOT NULL, - `km` int(20) unsigned NOT NULL, - `litros` double unsigned NOT NULL, - `precio` double unsigned NOT NULL, - `adblue` decimal(10,2) NOT NULL DEFAULT 0.00, - `peajes` double DEFAULT NULL, - `descuento` double DEFAULT NULL, - `silla` int(11) NOT NULL DEFAULT 0 COMMENT 'indica si han repostado en la gasolinera de la rotonda', - `odbc_date` timestamp NULL DEFAULT current_timestamp(), - `otros` double DEFAULT NULL, - `fuelTypeFk` varchar(45) DEFAULT NULL, - `proveedoresFk` int(10) unsigned DEFAULT NULL, - `liters100km` decimal(10,2) DEFAULT NULL COMMENT 'se rellena en Vehiculos_consumo_beforeInsert y son los litros consumidos a los 100 kilometros', - `gasoline` decimal(10,2) NOT NULL DEFAULT 0.00, - PRIMARY KEY (`Vehiculos_consumo_id`,`Id_Vehiculo`), - KEY `fk_Vehiculos_consumo_Vehiculos_idx` (`Id_Vehiculo`), - KEY `fuelTypeFk_idx` (`fuelTypeFk`), - KEY `proveedoresFk_idx` (`proveedoresFk`), - CONSTRAINT `Vehiculos_consumo_supplierFk` FOREIGN KEY (`proveedoresFk`) REFERENCES `vn`.`supplier` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `fk_Vehiculos_consumo_Vehiculos` FOREIGN KEY (`Id_Vehiculo`) REFERENCES `vn`.`vehicle` (`id`) ON UPDATE CASCADE, - CONSTRAINT `fuelTypeFk` FOREIGN KEY (`fuelTypeFk`) REFERENCES `vn`.`fuelType` (`code`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='En esta tabla apuntan el importe de los tickets de la gasolinera solred, con quien tenemos un contrato y nos facturan mensualmente'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `XDiario` --- - -DROP TABLE IF EXISTS `XDiario`; -/*!50001 DROP VIEW IF EXISTS `XDiario`*/; +/*!50001 DROP VIEW IF EXISTS `Vehiculos_consumo`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `XDiario` AS SELECT - 1 AS `id`, - 1 AS `ASIEN`, - 1 AS `FECHA`, - 1 AS `SUBCTA`, - 1 AS `CONTRA`, - 1 AS `CONCEPTO`, - 1 AS `EURODEBE`, - 1 AS `EUROHABER`, - 1 AS `BASEEURO`, - 1 AS `SERIE`, - 1 AS `FACTURA`, - 1 AS `IVA`, - 1 AS `RECEQUIV`, - 1 AS `CLAVE`, - 1 AS `CAMBIO`, - 1 AS `DEBEME`, - 1 AS `HABERME`, - 1 AS `AUXILIAR`, - 1 AS `MONEDAUSO`, - 1 AS `TIPOOPE`, - 1 AS `NFACTICK`, - 1 AS `TERIDNIF`, - 1 AS `TERNIF`, - 1 AS `TERNOM`, - 1 AS `OPBIENES`, - 1 AS `L340`, - 1 AS `enlazado`, - 1 AS `FECHA_EX`, - 1 AS `LRECT349`, - 1 AS `empresa_id`, - 1 AS `LDIFADUAN`, - 1 AS `METAL`, - 1 AS `METALIMP`, - 1 AS `CLIENTE`, - 1 AS `METALEJE`, - 1 AS `FECHA_OP`, - 1 AS `FACTURAEX`, - 1 AS `TIPOCLAVE`, - 1 AS `TIPOEXENCI`, - 1 AS `TIPONOSUJE`, - 1 AS `TIPOFACT`, - 1 AS `TIPORECTIF`, - 1 AS `SERIE_RT`, - 1 AS `FACTU_RT`, - 1 AS `BASEIMP_RT`, - 1 AS `BASEIMP_RF`, - 1 AS `RECTIFICA`, - 1 AS `FECHA_RT`, - 1 AS `created`, - 1 AS `updated`, - 1 AS `FECREGCON`, - 1 AS `enlazadoSage` */; +/*!50001 CREATE VIEW `Vehiculos_consumo` AS SELECT + 1 AS `Vehiculos_consumo_id`, + 1 AS `Id_Vehiculo`, + 1 AS `fecha`, + 1 AS `km`, + 1 AS `litros`, + 1 AS `precio`, + 1 AS `adblue`, + 1 AS `peajes`, + 1 AS `descuento`, + 1 AS `silla`, + 1 AS `odbc_date`, + 1 AS `otros`, + 1 AS `fuelTypeFk`, + 1 AS `proveedoresFk`, + 1 AS `liters100km`, + 1 AS `gasoline` */; SET character_set_client = @saved_cs_client; -- --- Table structure for table `accion_dits` +-- Table structure for table `accion_dits__` -- -DROP TABLE IF EXISTS `accion_dits`; +DROP TABLE IF EXISTS `accion_dits__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `accion_dits` ( +CREATE TABLE `accion_dits__` ( `idaccion_dits` int(11) NOT NULL AUTO_INCREMENT, `accion` varchar(255) DEFAULT NULL, PRIMARY KEY (`idaccion_dits`), UNIQUE KEY `accion_UNIQUE` (`accion`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `account_conciliacion` +-- Temporary table structure for view `account_conciliacion` -- DROP TABLE IF EXISTS `account_conciliacion`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `account_conciliacion` ( - `idaccount_conciliacion` int(11) NOT NULL AUTO_INCREMENT, - `Id_Proveedores_account` mediumint(8) unsigned NOT NULL, - `Fechaoperacion` datetime NOT NULL, - `FechaValor` datetime NOT NULL, - `importe` double NOT NULL, - `Concepto` varchar(255) DEFAULT NULL, - `DebeHaber` smallint(6) NOT NULL, - `id_calculated` varchar(255) DEFAULT NULL, - `odbc_date` timestamp NULL DEFAULT current_timestamp(), - PRIMARY KEY (`idaccount_conciliacion`), - UNIQUE KEY `idaccount_conciliacion_UNIQUE` (`idaccount_conciliacion`), - KEY `fg_accconciliacion_key1_idx` (`Id_Proveedores_account`), - KEY `index_id_calculated` (`id_calculated`), - CONSTRAINT `fg_key1_accountconc` FOREIGN KEY (`Id_Proveedores_account`) REFERENCES `vn`.`supplierAccount` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `account_conciliacion`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `account_conciliacion` AS SELECT + 1 AS `idaccount_conciliacion`, + 1 AS `Id_Proveedores_account`, + 1 AS `Fechaoperacion`, + 1 AS `FechaValor`, + 1 AS `importe`, + 1 AS `Concepto`, + 1 AS `DebeHaber`, + 1 AS `id_calculated`, + 1 AS `odbc_date` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `account_detail` +-- Temporary table structure for view `account_detail` -- DROP TABLE IF EXISTS `account_detail`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `account_detail` ( - `account_detail_id` int(11) NOT NULL AUTO_INCREMENT, - `value` varchar(50) NOT NULL, - `account_detail_type_id` int(11) NOT NULL, - `Id_Proveedores_account` mediumint(8) unsigned NOT NULL, - PRIMARY KEY (`account_detail_id`), - KEY `fk_account_detail_account_detail_type1_idx` (`account_detail_type_id`), - KEY `fk_account_detail_Proveedores_account1_idx` (`Id_Proveedores_account`), - CONSTRAINT `fk_account_detail_account_detail_type1` FOREIGN KEY (`account_detail_type_id`) REFERENCES `account_detail_type` (`account_detail_type_id`) ON UPDATE CASCADE, - CONSTRAINT `fk_account_detail_account_id_proveedores_account` FOREIGN KEY (`Id_Proveedores_account`) REFERENCES `vn`.`supplierAccount` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `account_detail`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `account_detail` AS SELECT + 1 AS `account_detail_id`, + 1 AS `value`, + 1 AS `account_detail_type_id`, + 1 AS `Id_Proveedores_account` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `account_detail_type` +-- Temporary table structure for view `account_detail_type` -- DROP TABLE IF EXISTS `account_detail_type`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `account_detail_type` ( - `account_detail_type_id` int(11) NOT NULL AUTO_INCREMENT, - `description` varchar(255) DEFAULT NULL, - PRIMARY KEY (`account_detail_type_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `account_detail_type`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `account_detail_type` AS SELECT + 1 AS `account_detail_type_id`, + 1 AS `description` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `agencia_descuadre` +-- Table structure for table `agencia_descuadre__` -- -DROP TABLE IF EXISTS `agencia_descuadre`; +DROP TABLE IF EXISTS `agencia_descuadre__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `agencia_descuadre` ( +CREATE TABLE `agencia_descuadre__` ( `agencia_descuadre_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `Id_Ticket` int(11) NOT NULL, `date` date NOT NULL, @@ -80027,7 +80631,7 @@ CREATE TABLE `agencia_descuadre` ( `Consignatario` varchar(50) NOT NULL, `Tipo` varchar(30) NOT NULL, PRIMARY KEY (`agencia_descuadre_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -80042,19 +80646,18 @@ SET character_set_client = utf8; 1 AS `agency_id`, 1 AS `name`, 1 AS `warehouse_id`, - 1 AS `warehouse_alias_id`, 1 AS `propios`, 1 AS `workCenterFk` */; SET character_set_client = @saved_cs_client; -- --- Table structure for table `agency_hour` +-- Table structure for table `agency_hour__` -- -DROP TABLE IF EXISTS `agency_hour`; +DROP TABLE IF EXISTS `agency_hour__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `agency_hour` ( +CREATE TABLE `agency_hour__` ( `agency_hour_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `week_day` tinyint(3) unsigned DEFAULT NULL COMMENT 'funcion de mysql Lunes = 0, Domingo = 6', `agency_id` smallint(5) unsigned DEFAULT NULL, @@ -80067,133 +80670,107 @@ CREATE TABLE `agency_hour` ( KEY `agency_id` (`agency_id`), KEY `warehouse_id` (`warehouse_id`), KEY `province_id` (`province_id`), - CONSTRAINT `agency_hour_ibfk_1` FOREIGN KEY (`agency_id`) REFERENCES `vn`.`agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `agency_hour_ibfk_2` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `agency_hour_ibfk_3` FOREIGN KEY (`province_id`) REFERENCES `vn`.`province` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + CONSTRAINT `agency_hour___ibfk_1` FOREIGN KEY (`agency_id`) REFERENCES `vn`.`agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `agency_hour___ibfk_2` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `agency_hour___ibfk_3` FOREIGN KEY (`province_id`) REFERENCES `vn`.`province` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `agency_warehouse` +-- Table structure for table `agency_warehouse__` -- -DROP TABLE IF EXISTS `agency_warehouse`; +DROP TABLE IF EXISTS `agency_warehouse__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `agency_warehouse` ( +CREATE TABLE `agency_warehouse__` ( `agency_id` smallint(5) unsigned NOT NULL, `warehouse_id` smallint(5) unsigned NOT NULL DEFAULT 1, `Vista` tinyint(3) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`agency_id`,`warehouse_id`), KEY `warehouse_id` (`warehouse_id`), - CONSTRAINT `agency_warehouse_ibfk_1` FOREIGN KEY (`agency_id`) REFERENCES `vn`.`agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `agency_warehouse_ibfk_2` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Indica la vista para cada agencia'; + CONSTRAINT `agency_warehouse___ibfk_1` FOREIGN KEY (`agency_id`) REFERENCES `vn`.`agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `agency_warehouse___ibfk_2` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `airline` +-- Temporary table structure for view `airline` -- DROP TABLE IF EXISTS `airline`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `airline` ( - `airline_id` smallint(2) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(20) NOT NULL, - PRIMARY KEY (`airline_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `airline`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `airline` AS SELECT + 1 AS `airline_id`, + 1 AS `name` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `airport` +-- Temporary table structure for view `airport` -- DROP TABLE IF EXISTS `airport`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `airport` ( - `airport_id` varchar(3) NOT NULL, - `name` varchar(30) DEFAULT NULL, - PRIMARY KEY (`airport_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `airport`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `airport` AS SELECT + 1 AS `airport_id`, + 1 AS `name` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `albaran` +-- Temporary table structure for view `albaran` -- DROP TABLE IF EXISTS `albaran`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `albaran` ( - `albaran_id` int(11) NOT NULL AUTO_INCREMENT, - `ref` varchar(45) DEFAULT NULL, - `note` varchar(150) DEFAULT NULL, - `fecha` date NOT NULL, - `fecha_entrega` date DEFAULT NULL, - `valor` double DEFAULT NULL, - `Id_Proveedor` int(10) unsigned NOT NULL, - `empresa_id` int(10) unsigned NOT NULL, - `warehouse_id` smallint(6) unsigned NOT NULL, - `albaran_state_id` int(11) NOT NULL, - `Id_Trabajador` int(10) unsigned NOT NULL COMMENT 'Id_Trabajador hace referencia a la persona que ha introducido el albarán', - `Id_Responsable` int(10) unsigned NOT NULL, - `department_id` int(11) NOT NULL, - `recibida_id` mediumint(8) unsigned DEFAULT NULL, - `farmingFk` int(10) unsigned DEFAULT NULL, - PRIMARY KEY (`albaran_id`), - KEY `fk_albaran_Proveedores_idx` (`Id_Proveedor`), - KEY `fk_albaran_empresa1_idx` (`empresa_id`), - KEY `fk_albaran_warehouse1_idx` (`warehouse_id`), - KEY `fk_albaran_albaran_state1_idx` (`albaran_state_id`), - KEY `fk_albaran_Trabajadores1_idx` (`Id_Trabajador`), - KEY `fk_albaran_Trabajadores2_idx` (`Id_Responsable`), - KEY `fk_albaran_department1_idx` (`department_id`), - KEY `fk_albaran_recibida_idx` (`recibida_id`), - KEY `albaran_FK` (`farmingFk`), - CONSTRAINT `albaranCompany_Fk` FOREIGN KEY (`empresa_id`) REFERENCES `vn`.`company` (`id`) ON UPDATE CASCADE, - CONSTRAINT `albaran_FK` FOREIGN KEY (`farmingFk`) REFERENCES `vn`.`farming` (`id`), - CONSTRAINT `albaran_supplierFk` FOREIGN KEY (`Id_Proveedor`) REFERENCES `vn`.`supplier` (`id`) ON UPDATE CASCADE, - CONSTRAINT `fk_albaran_Trabajadores1` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `fk_albaran_Trabajadores2` FOREIGN KEY (`Id_Responsable`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `fk_albaran_albaran_state1` FOREIGN KEY (`albaran_state_id`) REFERENCES `albaran_state` (`albaran_state_id`) ON UPDATE CASCADE, - CONSTRAINT `fk_albaran_recibida` FOREIGN KEY (`recibida_id`) REFERENCES `vn`.`invoiceIn` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `fk_albaran_warehouse1` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `albaran`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `albaran` AS SELECT + 1 AS `albaran_id`, + 1 AS `ref`, + 1 AS `note`, + 1 AS `fecha`, + 1 AS `fecha_entrega`, + 1 AS `valor`, + 1 AS `Id_Proveedor`, + 1 AS `empresa_id`, + 1 AS `warehouse_id`, + 1 AS `albaran_state_id`, + 1 AS `Id_Trabajador`, + 1 AS `Id_Responsable`, + 1 AS `department_id`, + 1 AS `recibida_id`, + 1 AS `farmingFk` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `albaran_gestdoc` +-- Temporary table structure for view `albaran_gestdoc` -- DROP TABLE IF EXISTS `albaran_gestdoc`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `albaran_gestdoc` ( - `gestdoc_id` int(11) NOT NULL, - `albaran_id` int(11) NOT NULL, - PRIMARY KEY (`gestdoc_id`,`albaran_id`), - KEY `fk_albaran_gestdoc_gestdoc1_idx` (`gestdoc_id`), - KEY `fk_albaran_gestdoc_albaran1_idx` (`albaran_id`), - CONSTRAINT `albaran_gestdoc_FK` FOREIGN KEY (`gestdoc_id`) REFERENCES `vn`.`dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_albaran_gestdoc_albaran1` FOREIGN KEY (`albaran_id`) REFERENCES `albaran` (`albaran_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `albaran_gestdoc`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `albaran_gestdoc` AS SELECT + 1 AS `gestdoc_id`, + 1 AS `albaran_id` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `albaran_state` +-- Temporary table structure for view `albaran_state` -- DROP TABLE IF EXISTS `albaran_state`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `albaran_state` ( - `albaran_state_id` int(11) NOT NULL AUTO_INCREMENT, - `state` varchar(45) NOT NULL, - PRIMARY KEY (`albaran_state_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `albaran_state`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `albaran_state` AS SELECT + 1 AS `albaran_state_id`, + 1 AS `state` */; +SET character_set_client = @saved_cs_client; -- -- Temporary table structure for view `awb` @@ -80236,170 +80813,134 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `awb_component` +-- Temporary table structure for view `awb_component` -- DROP TABLE IF EXISTS `awb_component`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `awb_component` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `awb_id` smallint(11) unsigned DEFAULT NULL, - `Id_Proveedor` int(11) NOT NULL, - `Fecha` date DEFAULT NULL, - `awb_component_type_id` mediumint(3) unsigned DEFAULT NULL, - `awb_role_id` tinyint(1) unsigned NOT NULL DEFAULT 1, - `awb_unit_id` varchar(10) DEFAULT NULL, - `value` decimal(10,2) DEFAULT NULL, - `Id_Moneda` tinyint(3) unsigned NOT NULL DEFAULT 2, - `recibida_id` mediumint(8) unsigned DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `unique_idx` (`awb_id`,`Id_Proveedor`,`awb_component_type_id`), - KEY `Id_Moneda` (`Id_Moneda`), - KEY `awb_component_fk` (`awb_component_type_id`), - KEY `awb_role_fk` (`awb_role_id`), - KEY `awb_unit_fk` (`awb_unit_id`), - CONSTRAINT `Id_Monedafk` FOREIGN KEY (`Id_Moneda`) REFERENCES `vn`.`currency` (`id`) ON DELETE CASCADE, - CONSTRAINT `awb_component_` FOREIGN KEY (`awb_component_type_id`) REFERENCES `awb_component_type` (`awb_component_type_id`) ON UPDATE CASCADE, - CONSTRAINT `awb_role_fk` FOREIGN KEY (`awb_role_id`) REFERENCES `awb_role` (`awb_role_id`) ON UPDATE CASCADE, - CONSTRAINT `awb_unit_fk` FOREIGN KEY (`awb_unit_id`) REFERENCES `awb_unit` (`awb_unit_id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `awb_component`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `awb_component` AS SELECT + 1 AS `id`, + 1 AS `awb_id`, + 1 AS `Id_Proveedor`, + 1 AS `awb_component_type_id`, + 1 AS `awb_role_id`, + 1 AS `awb_unit_id`, + 1 AS `value`, + 1 AS `Id_Moneda`, + 1 AS `recibida_id` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `awb_component_template` +-- Temporary table structure for view `awb_component_template` -- DROP TABLE IF EXISTS `awb_component_template`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `awb_component_template` ( - `awb_component_template_id` int(11) NOT NULL AUTO_INCREMENT, - `carguera_id` int(11) DEFAULT NULL, - `airport_in` varchar(3) DEFAULT NULL, - `airport_out` varchar(3) DEFAULT NULL, - `airline_id` smallint(2) unsigned DEFAULT NULL, - `awb_component_type_id` mediumint(3) unsigned NOT NULL, - `Fecha` date NOT NULL, - `awb_role_id` tinyint(1) unsigned NOT NULL, - `awb_unit_id` varchar(10) DEFAULT NULL, - `value` decimal(10,3) DEFAULT NULL, - `max_value` decimal(10,2) unsigned DEFAULT NULL, - `min_value` decimal(10,2) unsigned DEFAULT NULL, - `Id_Moneda` tinyint(3) unsigned NOT NULL DEFAULT 2, - `days` varchar(7) DEFAULT NULL, - PRIMARY KEY (`awb_component_template_id`), - UNIQUE KEY `carguera_id_UNIQUE` (`carguera_id`,`airport_in`,`airport_out`,`airline_id`,`awb_component_type_id`,`Fecha`,`days`), - KEY `Id_Moneda` (`Id_Moneda`), - KEY `airline_idx` (`airline_id`), - KEY `role_idx` (`awb_role_id`), - KEY `awb_unit_fk1` (`awb_unit_id`), - KEY `awb_component_template_FK` (`awb_component_type_id`), - CONSTRAINT `Id_Moneda` FOREIGN KEY (`Id_Moneda`) REFERENCES `vn`.`currency` (`id`) ON UPDATE CASCADE, - CONSTRAINT `awb_component_template_FK` FOREIGN KEY (`awb_component_type_id`) REFERENCES `awb_component_type` (`awb_component_type_id`) ON UPDATE CASCADE, - CONSTRAINT `awb_component_template_FK_1` FOREIGN KEY (`airline_id`) REFERENCES `airline` (`airline_id`) ON UPDATE CASCADE, - CONSTRAINT `awb_unit_fk1` FOREIGN KEY (`awb_unit_id`) REFERENCES `awb_unit` (`awb_unit_id`) ON UPDATE CASCADE, - CONSTRAINT `role_fk` FOREIGN KEY (`awb_role_id`) REFERENCES `awb_role` (`awb_role_id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `awb_component_template`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `awb_component_template` AS SELECT + 1 AS `awb_component_template_id`, + 1 AS `carguera_id`, + 1 AS `airport_in`, + 1 AS `airport_out`, + 1 AS `airline_id`, + 1 AS `awb_component_type_id`, + 1 AS `Fecha`, + 1 AS `awb_role_id`, + 1 AS `awb_unit_id`, + 1 AS `value`, + 1 AS `max_value`, + 1 AS `min_value`, + 1 AS `Id_Moneda`, + 1 AS `days` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `awb_component_type` +-- Temporary table structure for view `awb_component_type` -- DROP TABLE IF EXISTS `awb_component_type`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `awb_component_type` ( - `awb_component_type_id` mediumint(3) unsigned NOT NULL AUTO_INCREMENT, - `description` varchar(45) DEFAULT NULL, - `hasStems` tinyint(1) NOT NULL DEFAULT 1, - PRIMARY KEY (`awb_component_type_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT=' '; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `awb_component_type`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `awb_component_type` AS SELECT + 1 AS `awb_component_type_id`, + 1 AS `description`, + 1 AS `hasStems` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `awb_gestdoc` +-- Temporary table structure for view `awb_gestdoc` -- DROP TABLE IF EXISTS `awb_gestdoc`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `awb_gestdoc` ( - `awb_gestdoc_id` int(11) NOT NULL AUTO_INCREMENT, - `awb_id` smallint(11) unsigned NOT NULL, - `gestdoc_id` int(11) NOT NULL, - PRIMARY KEY (`awb_gestdoc_id`), - KEY `awb_gestdoc_awb_fk` (`awb_id`), - KEY `awb_gestdoc_gestdoc_fk` (`gestdoc_id`), - CONSTRAINT `awb_gestdoc_awb_fk` FOREIGN KEY (`awb_id`) REFERENCES `vn`.`awb` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `awb_gestdoc_gestdoc_fk` FOREIGN KEY (`gestdoc_id`) REFERENCES `vn`.`dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `awb_gestdoc`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `awb_gestdoc` AS SELECT + 1 AS `awb_gestdoc_id`, + 1 AS `awb_id`, + 1 AS `gestdoc_id` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `awb_recibida` +-- Temporary table structure for view `awb_recibida` -- DROP TABLE IF EXISTS `awb_recibida`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `awb_recibida` ( - `awb_id` smallint(5) unsigned NOT NULL, - `recibida_id` mediumint(8) unsigned NOT NULL, - `dua` varchar(18) DEFAULT NULL, - PRIMARY KEY (`recibida_id`), - KEY `awb_id` (`awb_id`), - CONSTRAINT `awb_recibida_ibfk_1` FOREIGN KEY (`awb_id`) REFERENCES `vn`.`awb` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `awb_recibida_ibfk_2` FOREIGN KEY (`recibida_id`) REFERENCES `vn`.`invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `awb_recibida`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `awb_recibida` AS SELECT + 1 AS `awb_id`, + 1 AS `recibida_id`, + 1 AS `dua` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `awb_role` +-- Temporary table structure for view `awb_role` -- DROP TABLE IF EXISTS `awb_role`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `awb_role` ( - `awb_role_id` tinyint(1) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(45) DEFAULT NULL, - PRIMARY KEY (`awb_role_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT=' '; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `awb_role`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `awb_role` AS SELECT + 1 AS `awb_role_id`, + 1 AS `name` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `awb_unit` +-- Temporary table structure for view `awb_unit` -- DROP TABLE IF EXISTS `awb_unit`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `awb_unit` ( - `awb_unit_id` varchar(10) NOT NULL DEFAULT '', - `operation` varchar(45) DEFAULT NULL, - PRIMARY KEY (`awb_unit_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='tipos de unidades'; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `awb_unit`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `awb_unit` AS SELECT + 1 AS `awb_unit_id`, + 1 AS `operation` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `balance_nest_tree` +-- Temporary table structure for view `balance_nest_tree` -- DROP TABLE IF EXISTS `balance_nest_tree`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `balance_nest_tree` ( - `lft` int(11) DEFAULT NULL, - `rgt` int(11) DEFAULT NULL, - `name` text DEFAULT NULL, - `id` int(11) NOT NULL AUTO_INCREMENT, - `Id_Gasto` varchar(10) DEFAULT NULL, - `isSelected` tinyint(1) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `balance_nest_tree`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `balance_nest_tree` AS SELECT + 1 AS `lft`, + 1 AS `rgt`, + 1 AS `name`, + 1 AS `id`, + 1 AS `Id_Gasto`, + 1 AS `isSelected` */; +SET character_set_client = @saved_cs_client; -- -- Temporary table structure for view `barcodes` @@ -80415,32 +80956,6 @@ SET character_set_client = utf8; 1 AS `code` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `bionic_updating_options` --- - -DROP TABLE IF EXISTS `bionic_updating_options`; -/*!50001 DROP VIEW IF EXISTS `bionic_updating_options`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `bionic_updating_options` AS SELECT - 1 AS `buo_id`, - 1 AS `description` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `businessReasonEnd` --- - -DROP TABLE IF EXISTS `businessReasonEnd`; -/*!50001 DROP VIEW IF EXISTS `businessReasonEnd`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `businessReasonEnd` AS SELECT - 1 AS `id`, - 1 AS `reason` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `buySource` -- @@ -80556,76 +81071,73 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `buy_edi_k012` +-- Temporary table structure for view `buy_edi_k012` -- DROP TABLE IF EXISTS `buy_edi_k012`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `buy_edi_k012` ( - `buy_edi_k012_id` smallint(6) unsigned NOT NULL, - `description` varchar(50) NOT NULL, - PRIMARY KEY (`buy_edi_k012_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Características negativas de los articulos de subasta'; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `buy_edi_k012`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `buy_edi_k012` AS SELECT + 1 AS `buy_edi_k012_id`, + 1 AS `description` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `buy_edi_k03` +-- Temporary table structure for view `buy_edi_k03` -- DROP TABLE IF EXISTS `buy_edi_k03`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `buy_edi_k03` ( - `buy_edi_k03_id` tinyint(3) unsigned NOT NULL, - `description` varchar(50) NOT NULL, - PRIMARY KEY (`buy_edi_k03_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Características fitosanitarias de los articulos de subasta'; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `buy_edi_k03`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `buy_edi_k03` AS SELECT + 1 AS `buy_edi_k03_id`, + 1 AS `description` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `buy_edi_k04` +-- Temporary table structure for view `buy_edi_k04` -- DROP TABLE IF EXISTS `buy_edi_k04`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `buy_edi_k04` ( - `buy_edi_k04_id` tinyint(3) unsigned NOT NULL, - `description` varchar(50) NOT NULL, - PRIMARY KEY (`buy_edi_k04_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Características calidad de los articulos de subasta'; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `buy_edi_k04`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `buy_edi_k04` AS SELECT + 1 AS `buy_edi_k04_id`, + 1 AS `description` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `call_information` +-- Table structure for table `call_information__` -- -DROP TABLE IF EXISTS `call_information`; +DROP TABLE IF EXISTS `call_information__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `call_information` ( +CREATE TABLE `call_information__` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `Descripcio` text NOT NULL, `Conclusio` tinyint(3) unsigned NOT NULL, `Id_Cliente` int(11) NOT NULL, `fecha` date NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `call_option` +-- Table structure for table `call_option__` -- -DROP TABLE IF EXISTS `call_option`; +DROP TABLE IF EXISTS `call_option__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `call_option` ( +CREATE TABLE `call_option__` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `descripcion` varchar(20) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -80718,17 +81230,17 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `cl_dep` +-- Table structure for table `cl_dep__` -- -DROP TABLE IF EXISTS `cl_dep`; +DROP TABLE IF EXISTS `cl_dep__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `cl_dep` ( +CREATE TABLE `cl_dep__` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `departamento` varchar(20) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='ELIMINAR Departamentos para las quejas'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -80746,33 +81258,6 @@ SET character_set_client = utf8; 1 AS `numero` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `cl_dev` --- - -DROP TABLE IF EXISTS `cl_dev`; -/*!50001 DROP VIEW IF EXISTS `cl_dev`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `cl_dev` AS SELECT - 1 AS `id`, - 1 AS `devolucion` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `cl_est` --- - -DROP TABLE IF EXISTS `cl_est`; -/*!50001 DROP VIEW IF EXISTS `cl_est`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `cl_est` AS SELECT - 1 AS `id`, - 1 AS `estado`, - 1 AS `roleFk` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `cl_main` -- @@ -80808,31 +81293,31 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `cl_pet` +-- Table structure for table `cl_pet__` -- -DROP TABLE IF EXISTS `cl_pet`; +DROP TABLE IF EXISTS `cl_pet__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `cl_pet` ( +CREATE TABLE `cl_pet__` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `peticion` varchar(15) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='ELIMINAR Peticiones de los cliente en relacion a las quejas'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `cl_que` +-- Table structure for table `cl_que__` -- -DROP TABLE IF EXISTS `cl_que`; +DROP TABLE IF EXISTS `cl_que__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `cl_que` ( +CREATE TABLE `cl_que__` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `queja` varchar(25) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='ELIMINAR Queja por linea de las reclamaciones'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -80864,28 +81349,28 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `commission` +-- Table structure for table `commission__` -- -DROP TABLE IF EXISTS `commission`; +DROP TABLE IF EXISTS `commission__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `commission` ( +CREATE TABLE `commission__` ( `commisision_id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `percentage` tinyint(3) unsigned NOT NULL, `value` float unsigned NOT NULL, PRIMARY KEY (`commisision_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `config` +-- Table structure for table `config__` -- -DROP TABLE IF EXISTS `config`; +DROP TABLE IF EXISTS `config__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `config` ( +CREATE TABLE `config__` ( `id` int(11) NOT NULL, `generic_item` int(11) NOT NULL COMMENT 'Id del artículo genérico', `edi_entry` int(11) NOT NULL COMMENT 'Entrada usada para los EKTs', @@ -80893,7 +81378,7 @@ CREATE TABLE `config` ( `lastNicho` varchar(10) DEFAULT NULL, `lastReserve` varchar(10) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -80915,13 +81400,13 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `config_host_forms` +-- Table structure for table `config_host_forms__` -- -DROP TABLE IF EXISTS `config_host_forms`; +DROP TABLE IF EXISTS `config_host_forms__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `config_host_forms` ( +CREATE TABLE `config_host_forms__` ( `config_host_id` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `formname` varchar(56) NOT NULL, `x` int(8) NOT NULL, @@ -80931,7 +81416,7 @@ CREATE TABLE `config_host_forms` ( `odbc_date` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`config_host_id`,`formname`), CONSTRAINT `config_host_forms_FK` FOREIGN KEY (`config_host_id`) REFERENCES `vn`.`host` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Registra las posiciones de los formularios'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -80950,58 +81435,74 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `container` +-- Table structure for table `container__` -- -DROP TABLE IF EXISTS `container`; +DROP TABLE IF EXISTS `container__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `container` ( +CREATE TABLE `container__` ( `container_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `Continente` varchar(10) DEFAULT NULL, PRIMARY KEY (`container_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `cooler_path` +-- Table structure for table `cooler_path__` -- -DROP TABLE IF EXISTS `cooler_path`; +DROP TABLE IF EXISTS `cooler_path__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `cooler_path` ( +CREATE TABLE `cooler_path__` ( `cooler_path_id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(45) DEFAULT NULL, PRIMARY KEY (`cooler_path_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Define el orden en que se imprimen los F5'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `cp` +-- Table structure for table `cp__` -- -DROP TABLE IF EXISTS `cp`; +DROP TABLE IF EXISTS `cp__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `cp` ( +CREATE TABLE `cp__` ( `cp_id` int(11) NOT NULL AUTO_INCREMENT, `cpd` int(11) NOT NULL, `cph` int(11) NOT NULL, `zone_id` smallint(6) DEFAULT NULL, `town` varchar(45) NOT NULL, PRIMARY KEY (`cp_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Relacio de codis postals i el municipi al qual se asigna'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `credit_card` +-- Temporary table structure for view `credit` -- -DROP TABLE IF EXISTS `credit_card`; +DROP TABLE IF EXISTS `credit`; +/*!50001 DROP VIEW IF EXISTS `credit`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `credit` AS SELECT + 1 AS `id`, + 1 AS `Id_Cliente`, + 1 AS `Id_Trabajador`, + 1 AS `amount`, + 1 AS `odbc_date` */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `credit_card__` +-- + +DROP TABLE IF EXISTS `credit_card__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `credit_card` ( +CREATE TABLE `credit_card__` ( `credit_card_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `Id_Cliente` int(10) NOT NULL, `number` varchar(20) NOT NULL, @@ -81011,18 +81512,18 @@ CREATE TABLE `credit_card` ( `obs` varchar(45) DEFAULT NULL, PRIMARY KEY (`credit_card_id`), KEY `Id_Cliente` (`Id_Cliente`), - CONSTRAINT `credit_card_ibfk_1` FOREIGN KEY (`Id_Cliente`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + CONSTRAINT `credit_card___ibfk_1` FOREIGN KEY (`Id_Cliente`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `cyc` +-- Table structure for table `cyc__` -- -DROP TABLE IF EXISTS `cyc`; +DROP TABLE IF EXISTS `cyc__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `cyc` ( +CREATE TABLE `cyc__` ( `Id_Cliente` int(11) NOT NULL, `Riesgo` double DEFAULT NULL, `Fecha` timestamp NOT NULL DEFAULT current_timestamp(), @@ -81030,99 +81531,71 @@ CREATE TABLE `cyc` ( PRIMARY KEY (`cyc_id`), KEY `Cliente` (`Id_Cliente`), CONSTRAINT `Cliente` FOREIGN KEY (`Id_Cliente`) REFERENCES `vn`.`client` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Detalla los clientes que estan clasificados en Credito y Cau'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `cyc_declaration` +-- Table structure for table `cyc_declaration__` -- -DROP TABLE IF EXISTS `cyc_declaration`; +DROP TABLE IF EXISTS `cyc_declaration__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `cyc_declaration` ( +CREATE TABLE `cyc_declaration__` ( `factura_id` int(10) unsigned NOT NULL, `Riesgo` double DEFAULT NULL, `Fecha` date NOT NULL, `Vencimiento` int(10) NOT NULL DEFAULT 0, PRIMARY KEY (`factura_id`), CONSTRAINT `Factura` FOREIGN KEY (`factura_id`) REFERENCES `vn`.`invoiceOut` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Registro de las facturas declaradas a cyc'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `definitivo` +-- Temporary table structure for view `definitivo` -- DROP TABLE IF EXISTS `definitivo`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `definitivo` ( - `definitivo_id` int(11) NOT NULL, - `empresa_id` int(11) NOT NULL, - `desde` bigint(20) NOT NULL, - `hasta` bigint(20) NOT NULL, - `fecha` timestamp NOT NULL DEFAULT current_timestamp(), - PRIMARY KEY (`definitivo_id`,`empresa_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `deliveryPoint` --- - -DROP TABLE IF EXISTS `deliveryPoint`; -/*!50001 DROP VIEW IF EXISTS `deliveryPoint`*/; +/*!50001 DROP VIEW IF EXISTS `definitivo`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `deliveryPoint` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `ubication` */; +/*!50001 CREATE VIEW `definitivo` AS SELECT + 1 AS `definitivo_id`, + 1 AS `empresa_id`, + 1 AS `desde`, + 1 AS `hasta`, + 1 AS `fecha` */; SET character_set_client = @saved_cs_client; -- --- Temporary table structure for view `device_user` +-- Table structure for table `dock__` -- -DROP TABLE IF EXISTS `device_user`; -/*!50001 DROP VIEW IF EXISTS `device_user`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `device_user` AS SELECT - 1 AS `device_id`, - 1 AS `user_id` */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `dock` --- - -DROP TABLE IF EXISTS `dock`; +DROP TABLE IF EXISTS `dock__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `dock` ( +CREATE TABLE `dock__` ( `id` int(11) NOT NULL AUTO_INCREMENT, `code` varchar(5) NOT NULL, `xPos` int(11) DEFAULT NULL, `yPos` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Soporta la estructura de muelles de paletizacion'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `duaDismissed` +-- Table structure for table `duaDismissed__` -- -DROP TABLE IF EXISTS `duaDismissed`; +DROP TABLE IF EXISTS `duaDismissed__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `duaDismissed` ( +CREATE TABLE `duaDismissed__` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ticketFk` varchar(45) NOT NULL, PRIMARY KEY (`id`,`ticketFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -81180,74 +81653,6 @@ SET character_set_client = utf8; 1 AS `change_date_time` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `edi_feature` --- - -DROP TABLE IF EXISTS `edi_feature`; -/*!50001 DROP VIEW IF EXISTS `edi_feature`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `edi_feature` AS SELECT - 1 AS `item_id`, - 1 AS `feature_type_id`, - 1 AS `feature_value`, - 1 AS `entry_date`, - 1 AS `expiry_date`, - 1 AS `change_date_time` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `edi_genus` --- - -DROP TABLE IF EXISTS `edi_genus`; -/*!50001 DROP VIEW IF EXISTS `edi_genus`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `edi_genus` AS SELECT - 1 AS `genus_id`, - 1 AS `latin_genus_name`, - 1 AS `entry_date`, - 1 AS `expiry_date`, - 1 AS `change_date_time` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `edi_item_feature` --- - -DROP TABLE IF EXISTS `edi_item_feature`; -/*!50001 DROP VIEW IF EXISTS `edi_item_feature`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `edi_item_feature` AS SELECT - 1 AS `item_id`, - 1 AS `presentation_order`, - 1 AS `feature`, - 1 AS `regulation_type`, - 1 AS `entry_date`, - 1 AS `expiry_date`, - 1 AS `change_date_time` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `edi_plant` --- - -DROP TABLE IF EXISTS `edi_plant`; -/*!50001 DROP VIEW IF EXISTS `edi_plant`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `edi_plant` AS SELECT - 1 AS `plant_id`, - 1 AS `genus_id`, - 1 AS `specie_id`, - 1 AS `entry_date`, - 1 AS `expiry_date`, - 1 AS `change_date_time` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `edi_specie` -- @@ -81279,67 +81684,33 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `edi_testigos` +-- Table structure for table `edi_testigos__` -- -DROP TABLE IF EXISTS `edi_testigos`; +DROP TABLE IF EXISTS `edi_testigos__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `edi_testigos` ( +CREATE TABLE `edi_testigos__` ( `id` smallint(6) NOT NULL AUTO_INCREMENT, `table` varchar(25) NOT NULL, `field` varchar(32) NOT NULL, `testigo` varchar(5) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `edi_type` +-- Table structure for table `emp_day_pay__` -- -DROP TABLE IF EXISTS `edi_type`; -/*!50001 DROP VIEW IF EXISTS `edi_type`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `edi_type` AS SELECT - 1 AS `type_id`, - 1 AS `type_group_id`, - 1 AS `description`, - 1 AS `entry_date`, - 1 AS `expiry_date`, - 1 AS `change_date_time` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `edi_value` --- - -DROP TABLE IF EXISTS `edi_value`; -/*!50001 DROP VIEW IF EXISTS `edi_value`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `edi_value` AS SELECT - 1 AS `type_id`, - 1 AS `type_value`, - 1 AS `type_description`, - 1 AS `entry_date`, - 1 AS `expiry_date`, - 1 AS `change_date_time` */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `emp_day_pay` --- - -DROP TABLE IF EXISTS `emp_day_pay`; +DROP TABLE IF EXISTS `emp_day_pay__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `emp_day_pay` ( +CREATE TABLE `emp_day_pay__` ( `id` smallint(5) unsigned NOT NULL, `emp_day_pay` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`id`,`emp_day_pay`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -81428,49 +81799,13 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Temporary table structure for view `escritos` +-- Table structure for table `expeditions_deleted__` -- -DROP TABLE IF EXISTS `escritos`; -/*!50001 DROP VIEW IF EXISTS `escritos`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `escritos` AS SELECT - 1 AS `id`, - 1 AS `abrev`, - 1 AS `descripcion`, - 1 AS `visible`, - 1 AS `hasCompany` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `expeditions` --- - -DROP TABLE IF EXISTS `expeditions`; -/*!50001 DROP VIEW IF EXISTS `expeditions`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `expeditions` AS SELECT - 1 AS `expeditions_id`, - 1 AS `agency_id`, - 1 AS `ticket_id`, - 1 AS `EsBulto`, - 1 AS `odbc_date`, - 1 AS `counter`, - 1 AS `workerFk`, - 1 AS `externalId`, - 1 AS `Id_article` */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `expeditions_deleted` --- - -DROP TABLE IF EXISTS `expeditions_deleted`; +DROP TABLE IF EXISTS `expeditions_deleted__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `expeditions_deleted` ( +CREATE TABLE `expeditions_deleted__` ( `expeditions_id` int(11) NOT NULL AUTO_INCREMENT, `agency_id` int(11) NOT NULL, `ticket_id` int(10) NOT NULL, @@ -81489,21 +81824,21 @@ CREATE TABLE `expeditions_deleted` ( KEY `index2` (`EsBulto`), KEY `index3` (`odbc_date`), KEY `index4` (`ticket_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `expeditions_pictures` +-- Table structure for table `expeditions_pictures__` -- -DROP TABLE IF EXISTS `expeditions_pictures`; +DROP TABLE IF EXISTS `expeditions_pictures__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `expeditions_pictures` ( +CREATE TABLE `expeditions_pictures__` ( `Id_Article` int(11) NOT NULL, `NoImprimirEtiqueta` bit(1) DEFAULT b'0', PRIMARY KEY (`Id_Article`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -81591,45 +81926,6 @@ CREATE TABLE `gastos_resumen` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Sirve para resumir los gastos que se ponen a mano en el contaplus'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `gestdoc` --- - -DROP TABLE IF EXISTS `gestdoc`; -/*!50001 DROP VIEW IF EXISTS `gestdoc`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `gestdoc` AS SELECT - 1 AS `id`, - 1 AS `gesttip_id`, - 1 AS `file`, - 1 AS `contentType`, - 1 AS `trabajador_id`, - 1 AS `warehouse_id`, - 1 AS `emp_id`, - 1 AS `orden`, - 1 AS `original`, - 1 AS `sref`, - 1 AS `brief`, - 1 AS `odbc_date` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `gesttip` --- - -DROP TABLE IF EXISTS `gesttip`; -/*!50001 DROP VIEW IF EXISTS `gesttip`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `gesttip` AS SELECT - 1 AS `id`, - 1 AS `tipo`, - 1 AS `readRoleFk`, - 1 AS `writeRoleFk`, - 1 AS `code` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `guillen` -- @@ -81725,42 +82021,6 @@ CREATE TABLE `intervalos__` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Deprecated 27-02-2023'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `intrastat_data` --- - -DROP TABLE IF EXISTS `intrastat_data`; -/*!50001 DROP VIEW IF EXISTS `intrastat_data`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `intrastat_data` AS SELECT - 1 AS `id`, - 1 AS `recibida_id`, - 1 AS `neto`, - 1 AS `intrastat_id`, - 1 AS `importe`, - 1 AS `unidades`, - 1 AS `Paises_Id`, - 1 AS `odbc_date`, - 1 AS `valorestadistico` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `invoiceCorrection` --- - -DROP TABLE IF EXISTS `invoiceCorrection`; -/*!50001 DROP VIEW IF EXISTS `invoiceCorrection`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `invoiceCorrection` AS SELECT - 1 AS `correctingFk`, - 1 AS `correctedFk`, - 1 AS `cplusRectificationTypeFk`, - 1 AS `siiTypeInvoiceOutFk`, - 1 AS `invoiceCorrectionTypeFk` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `invoice_observation` -- @@ -81779,78 +82039,6 @@ CREATE TABLE `invoice_observation` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `itemTag` --- - -DROP TABLE IF EXISTS `itemTag`; -/*!50001 DROP VIEW IF EXISTS `itemTag`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `itemTag` AS SELECT - 1 AS `id`, - 1 AS `itemFk`, - 1 AS `tagFk`, - 1 AS `value`, - 1 AS `priority` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `item_entry_in` --- - -DROP TABLE IF EXISTS `item_entry_in`; -/*!50001 DROP VIEW IF EXISTS `item_entry_in`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `item_entry_in` AS SELECT - 1 AS `warehouse_id`, - 1 AS `warehouse_id_out`, - 1 AS `dat`, - 1 AS `item_id`, - 1 AS `amount`, - 1 AS `received`, - 1 AS `isVirtualStock`, - 1 AS `entryFk` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `item_entry_out` --- - -DROP TABLE IF EXISTS `item_entry_out`; -/*!50001 DROP VIEW IF EXISTS `item_entry_out`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `item_entry_out` AS SELECT - 1 AS `warehouse_id`, - 1 AS `dat`, - 1 AS `item_id`, - 1 AS `amount`, - 1 AS `delivered`, - 1 AS `entryFk` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `item_out` --- - -DROP TABLE IF EXISTS `item_out`; -/*!50001 DROP VIEW IF EXISTS `item_out`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `item_out` AS SELECT - 1 AS `warehouse_id`, - 1 AS `dat`, - 1 AS `item_id`, - 1 AS `amount`, - 1 AS `ok`, - 1 AS `Reservado`, - 1 AS `invoice`, - 1 AS `saleFk`, - 1 AS `ticketFk` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `jerarquia` -- @@ -82294,35 +82482,6 @@ CREATE TABLE `payrroll_apEmpresarial` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `person_user` --- - -DROP TABLE IF EXISTS `person_user`; -/*!50001 DROP VIEW IF EXISTS `person_user`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `person_user` AS SELECT - 1 AS `id`, - 1 AS `mysql_user_id`, - 1 AS `name`, - 1 AS `password`, - 1 AS `active`, - 1 AS `last_pass_change` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `person_user_idtrabajador` --- - -DROP TABLE IF EXISTS `person_user_idtrabajador`; -/*!50001 DROP VIEW IF EXISTS `person_user_idtrabajador`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `person_user_idtrabajador` AS SELECT - 1 AS `Id_Trabajador` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `plantpassport` -- @@ -82572,20 +82731,6 @@ SET character_set_client = utf8; 1 AS `period` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `reference_min` --- - -DROP TABLE IF EXISTS `reference_min`; -/*!50001 DROP VIEW IF EXISTS `reference_min`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `reference_min` AS SELECT - 1 AS `date`, - 1 AS `rate`, - 1 AS `moneda_id` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `reference_rate` -- @@ -83420,72 +83565,6 @@ SET character_set_client = utf8; 1 AS `boss_id` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `v_ventes` --- - -DROP TABLE IF EXISTS `v_ventes`; -/*!50001 DROP VIEW IF EXISTS `v_ventes`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_ventes` AS SELECT - 1 AS `Agencia`, - 1 AS `Categoria`, - 1 AS `tipo_id`, - 1 AS `Medida`, - 1 AS `Article`, - 1 AS `Color`, - 1 AS `Id_Cliente`, - 1 AS `Tipo`, - 1 AS `Factura`, - 1 AS `warehouse_id`, - 1 AS `Id_Movimiento`, - 1 AS `Id_Article`, - 1 AS `Familia`, - 1 AS `Id_Ticket`, - 1 AS `Concepte`, - 1 AS `Cantidad`, - 1 AS `quantity`, - 1 AS `Preu`, - 1 AS `Descuento`, - 1 AS `CostFixat`, - 1 AS `Reservado`, - 1 AS `OK`, - 1 AS `PrecioFijado`, - 1 AS `odbc_date`, - 1 AS `Fecha`, - 1 AS `FechaCompleta`, - 1 AS `Alias`, - 1 AS `Id_Consigna`, - 1 AS `Importe`, - 1 AS `Origen`, - 1 AS `reino_id`, - 1 AS `invoice`, - 1 AS `producer_id` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `v_xsubcuentas` --- - -DROP TABLE IF EXISTS `v_xsubcuentas`; -/*!50001 DROP VIEW IF EXISTS `v_xsubcuentas`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_xsubcuentas` AS SELECT - 1 AS `COD`, - 1 AS `TITULO`, - 1 AS `NIF`, - 1 AS `DOMICILIO`, - 1 AS `POBLACION`, - 1 AS `PROVINCIA`, - 1 AS `CODPOSTAL`, - 1 AS `country_code`, - 1 AS `empresa_id`, - 1 AS `EMAIL`, - 1 AS `IDNIF` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `versiones` -- @@ -83517,34 +83596,6 @@ CREATE TABLE `viaxpress` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `warehouse` --- - -DROP TABLE IF EXISTS `warehouse`; -/*!50001 DROP VIEW IF EXISTS `warehouse`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `warehouse` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `inventario`, - 1 AS `fuente`, - 1 AS `is_comparative`, - 1 AS `comisionantes`, - 1 AS `reserve`, - 1 AS `isManaged`, - 1 AS `tpv`, - 1 AS `hasStowaway`, - 1 AS `hasDms`, - 1 AS `address_name`, - 1 AS `delay`, - 1 AS `Id_Paises`, - 1 AS `zone_label`, - 1 AS `valuatedInventory`, - 1 AS `hasConfectionTeam` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `warehouse_filtro` -- @@ -83574,7 +83625,7 @@ CREATE TABLE `warehouse_group` ( PRIMARY KEY (`warehouse_alias_id`,`warehouse_id`), KEY `warehosue_group_ware_idx` (`warehouse_id`), CONSTRAINT `warehosue_group_ware` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `warehouse_group_alias` FOREIGN KEY (`warehouse_alias_id`) REFERENCES `vn`.`warehouseAlias` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `warehouse_group_alias` FOREIGN KEY (`warehouse_alias_id`) REFERENCES `vn`.`warehouseAlias__` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Agrupa warehouses '; /*!40101 SET character_set_client = @saved_cs_client */; @@ -83679,35 +83730,6 @@ CREATE TABLE `wks` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `workerDocument` --- - -DROP TABLE IF EXISTS `workerDocument`; -/*!50001 DROP VIEW IF EXISTS `workerDocument`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `workerDocument` AS SELECT - 1 AS `id`, - 1 AS `worker`, - 1 AS `document`, - 1 AS `isReadableByWorker` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `workerTeam` --- - -DROP TABLE IF EXISTS `workerTeam`; -/*!50001 DROP VIEW IF EXISTS `workerTeam`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `workerTeam` AS SELECT - 1 AS `team`, - 1 AS `id`, - 1 AS `user` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `zones` -- @@ -83753,151 +83775,6 @@ DELIMITER ; -- /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP FUNCTION IF EXISTS `cc_to_iban` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `cc_to_iban`(cc VARCHAR(20)) RETURNS varchar(4) CHARSET utf8mb3 COLLATE utf8mb3_general_ci - DETERMINISTIC -BEGIN - DECLARE iban VARCHAR(4); - select - CONCAT('ES', - RIGHT( - concat(0, - 98- - mod( - concat( - mod( - concat( - mod( - concat( - mod( - substring(cc,1,8), - 97), - substring(cc,9,8) - ), - 97), - substring( - concat( - cc, - 142800 - ), - 17, - 8 - ) - ), - 97), - substring( - concat( - cc, - 142800 - ), - 25, - 2 - ) - ), - 97) - ) - ,2) - )into iban; -RETURN iban; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP FUNCTION IF EXISTS `intrastat_neto` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `intrastat_neto`(intINSTRASTAT INTEGER,intUNIDADES INTEGER) RETURNS double - DETERMINISTIC -BEGIN - - DECLARE n DOUBLE; - - SELECT ROUND(intUNIDADES / (SUM(MEDIA) / COUNT(media)), 2) INTO n FROM - (SELECT *, unidades / neto MEDIA - FROM intrastat_data - WHERE intrastat_id = intINSTRASTAT AND neto - AND unidades > 0 - ORDER BY odbc_date DESC - LIMIT 20) t; - -- JGF 01/06 per a evitar Kg en negatiu - RETURN n/2; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP FUNCTION IF EXISTS `nz` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `nz`(dblCANTIDAD DOUBLE) RETURNS double - DETERMINISTIC -BEGIN - - DECLARE dblRESULT DOUBLE; - - SET dblRESULT = IFNULL(dblCANTIDAD,0); - - RETURN dblRESULT; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP FUNCTION IF EXISTS `red` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `red`(intCANTIDAD DOUBLE) RETURNS double - DETERMINISTIC -BEGIN - - DECLARE n DOUBLE; - - SET n = SIGN(intCANTIDAD) * TRUNCATE( (ABS(intCANTIDAD) * 100) + 0.5001 ,0) /100 ; - - RETURN n; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `account_conciliacion_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -84283,12 +84160,12 @@ proc: BEGIN CREATE TEMPORARY TABLE tmp.itemCalc (INDEX (itemFk,warehouseFk)) ENGINE = MEMORY - SELECT i.item_id itemFk, vWarehouseLanding warehouseFk, i.dat dated, i.amount quantity - FROM item_out i - JOIN itemRangeLive ir ON ir.itemFK = i.item_id - WHERE i.dat >= vDatedFrom - AND (ir.dated IS NULL OR i.dat <= ir.dated) - AND i.warehouse_id = vWarehouseLanding + SELECT i.itemFk, vWarehouseLanding warehouseFk, i.shipped dated, i.quantity + FROM vn.itemTicketOut i + JOIN itemRangeLive ir ON ir.itemFK = i.itemFk + WHERE i.shipped >= vDatedFrom + AND (ir.dated IS NULL OR i.shipped <= ir.dated) + AND i.warehouseFk = vWarehouseLanding UNION ALL SELECT b.itemFk, vWarehouseLanding, t.landed, b.quantity FROM vn.buy b @@ -84302,12 +84179,12 @@ proc: BEGIN AND t.landed >= vDatedFrom AND (ir.dated IS NULL OR t.landed <= ir.dated) UNION ALL - SELECT i.item_id, vWarehouseLanding, i.dat, i.amount - FROM item_entry_out i - JOIN itemRangeLive ir ON ir.itemFk = i.item_id - WHERE i.dat >= vDatedFrom - AND (ir.dated IS NULL OR i.dat <= ir.dated) - AND i.warehouse_id = vWarehouseLanding + SELECT i.itemFk, vWarehouseLanding, i.shipped, i.quantity + FROM vn.itemEntryOut i + JOIN itemRangeLive ir ON ir.itemFk = i.itemFk + WHERE i.shipped >= vDatedFrom + AND (ir.dated IS NULL OR i.shipped <= ir.dated) + AND i.warehouseOutFk = vWarehouseLanding UNION ALL SELECT r.item_id, vWarehouseLanding, r.shipment, -r.amount FROM hedera.order_row r @@ -84477,9 +84354,9 @@ BEGIN -- Añadimos los gastos, para facilitar el formulario UPDATE tmp.balance b JOIN vn2008.balance_nest_tree bnt on bnt.id = b.id - JOIN (SELECT Id_Gasto, Gasto - FROM vn2008.Gastos - GROUP BY Id_Gasto) g ON g.Id_Gasto = bnt.Id_Gasto COLLATE utf8_general_ci + JOIN (SELECT id Id_Gasto, name Gasto + FROM vn.expense + GROUP BY id) g ON g.Id_Gasto = bnt.Id_Gasto COLLATE utf8_general_ci SET b.Id_Gasto = g.Id_Gasto COLLATE utf8_general_ci , b.Gasto = g.Gasto COLLATE utf8_general_ci ; @@ -84689,13 +84566,13 @@ BEGIN UNION ALL - SELECT empresa_id, Id_Cliente, - Importe - FROM Facturas f - JOIN Clientes c using(Id_Cliente) + SELECT io.companyFk, io.clientFk Id_Cliente, - io.amount + FROM vn.invoiceOut io + JOIN Clientes c ON c.Id_Cliente = io.clientFk JOIN pay_met pm on pm.id = pay_met_id - WHERE f.Vencimiento > vFechaRemesa + WHERE io.dued > vFechaRemesa AND pay_met_id = 4 AND pm.deudaviva - AND Importe > 0 + AND io.amount > 0 ) risk ON c.Id_Cliente = risk.clientFk GROUP BY risk.companyFk, Id_Cliente @@ -84778,19 +84655,10 @@ proc: BEGIN SET vRangeDeleteTicket = 60; DELETE FROM cdr WHERE calldate < vDate18; - DELETE FROM Monitoring WHERE ODBC_TIME < vDate; - DELETE FROM Conteo WHERE Fecha < vDate; - DELETE FROM XDiario WHERE FECHA < vDate3 OR FECHA IS NULL; DELETE FROM mail WHERE DATE_ODBC < vDate; - DELETE FROM expeditions_deleted WHERE odbc_date < vDate26; DELETE FROM Movimientos_mark WHERE odbc_date < vDate; DELETE FROM Splits WHERE Fecha < vDate18; - DELETE ts - FROM Tickets_stack ts - JOIN Tickets t ON ts.Id_Ticket = t.Id_Ticket - WHERE t.Fecha < vDate; - DELETE tobs FROM ticket_observation tobs JOIN Tickets t ON tobs.Id_Ticket = t.Id_Ticket @@ -84822,13 +84690,6 @@ proc: BEGIN JOIN travel t ON t.id = e.travel_id WHERE t.landing <= vDate; - DELETE co - FROM Compres_ok co JOIN Compres c ON c.Id_Compra = co.Id_Compra - JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada - JOIN travel t ON t.id = e.travel_id - WHERE t.landing <= vDate; - DELETE FROM scan WHERE odbc_date < vDate6 AND id <> 1; - IF v_full THEN CREATE OR REPLACE TEMPORARY TABLE tTicketDelete SELECT DISTINCT tl.originFk ticketFk @@ -84915,7 +84776,7 @@ BEGIN FROM Clientes WHERE Id_Cliente = idCLI; CALL vn.ledger_next(max_asien); - INSERT INTO XDiario (ASIEN,FECHA,SUBCTA,CONTRA,CONCEPTO,EURODEBE,EUROHABER,empresa_id) + INSERT INTO vn.XDiario (ASIEN,FECHA,SUBCTA,CONTRA,CONCEPTO,EURODEBE,EUROHABER,empresa_id) SELECT max_asien,datFEC,SUBCTA,CONTRA,strCONCEPTO,EURODEBE,EUROHABER,idEMP FROM(SELECT cuenta_banco SUBCTA, cuenta_cliente CONTRA, 0 EURODEBE, dblIMPORTE EUROHABER UNION ALL @@ -85013,7 +84874,7 @@ BEGIN stock.available FROM vn2008.Tickets t JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia - JOIN vn2008.warehouse wh ON wh.id = t.warehouse_id + JOIN vn.warehouse wh ON wh.id = t.warehouse_id JOIN vn2008.Movimientos m ON m.Id_Ticket = t.Id_Ticket JOIN vn2008.Articles i ON i.Id_Article = m.Id_Article JOIN vn2008.Tipos tp ON tp.tipo_id = i.tipo_id @@ -85070,8 +84931,8 @@ BEGIN FROM vn2008.Compres c JOIN vn2008.Entradas e ON e.Id_Entrada = c.Id_Entrada JOIN vn2008.travel tr ON tr.id = e.travel_id - JOIN vn2008.warehouse whi ON whi.id = tr.warehouse_id - JOIN vn2008.warehouse who ON who.id = tr.warehouse_id_out + JOIN vn.warehouse whi ON whi.id = tr.warehouse_id + JOIN vn.warehouse who ON who.id = tr.warehouse_id_out JOIN vn2008.Articles a ON a.Id_Article = c.Id_Article JOIN vn2008.Tipos tp ON tp.tipo_id = a.tipo_id JOIN vn.confectionType ct ON ct.id = tp.confeccion @@ -85118,11 +84979,11 @@ SELECT * FROM WHERE Id_Cliente = vCustomer AND Fechacobro >= '2017-01-01' UNION ALL - SELECT vn.getDueDate(f.Fecha,c.Vencimiento), - Importe - FROM Facturas f - JOIN Clientes c ON f.Id_Cliente = c.Id_Cliente - WHERE f.Id_Cliente = vCustomer - AND Fecha >= '2017-01-01' + SELECT vn.getDueDate(io.issued,c.Vencimiento), - io.amount + FROM vn.invoiceOut io + JOIN Clientes c ON io.clientFk = c.Id_Cliente + WHERE io.clientFk = vCustomer + AND io.issued >= '2017-01-01' UNION ALL SELECT '2016-12-31', Debt FROM bi.customerDebtInventory @@ -85145,101 +85006,6 @@ SELECT * FROM ; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `desglose_volume` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `desglose_volume`(IN vAgencyFk INT) -BEGIN - - DECLARE vStarted DATETIME DEFAULT TIMESTAMP(util.VN_CURDATE()); - DECLARE vEnded DATETIME DEFAULT TIMESTAMP(util.VN_CURDATE(), '23:59:59'); - DECLARE vIsHolland BOOL; - - SELECT (wa.name = 'Holanda') INTO vIsHolland - FROM vn.agency a - JOIN vn.warehouseAlias wa ON wa.id = a.warehouseAliasFk - WHERE a.id = vAgencyFk; - - IF vIsHolland THEN - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket_PackagingEstimated; - CREATE TEMPORARY TABLE tmp.ticket_PackagingEstimated - ( - ticketFk INT PRIMARY KEY - ,carros DECIMAL(5,1) DEFAULT 0 - ); - - INSERT INTO tmp.ticket_PackagingEstimated(ticketFk, carros) - SELECT sv.ticketFk, ROUND(vc.dutchCompressionRate * sum(sv.volume) / vc.trolleyM3,0) - FROM vn.ticket t - JOIN vn.saleVolume sv ON sv.ticketFk = t.id - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN vn.volumeConfig vc - WHERE t.shipped BETWEEN vStarted AND vEnded - AND am.agencyFk = vAgencyFk - GROUP BY t.id; - - SELECT a.nickname Provincia, - count(*) expediciones, - 0 Bultos, - sum(tpe.carros) Prevision - FROM vn.ticket t - JOIN vn.address a ON a.id = t.addressFk - JOIN tmp.ticket_PackagingEstimated tpe ON tpe.ticketFk = t.id - GROUP BY a.nickname; - - ELSE - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket_PackagingEstimated; - CREATE TEMPORARY TABLE tmp.ticket_PackagingEstimated - ( - ticketFk INT PRIMARY KEY - ,boxes INT DEFAULT 0 - ); - - INSERT INTO tmp.ticket_PackagingEstimated(ticketFk, boxes) - SELECT sv.ticketFk, CEIL(1000 * sum(sv.volume) / vc.standardFlowerBox) - FROM vn.ticket t - JOIN vn.saleVolume sv ON sv.ticketFk = t.id - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN vn.volumeConfig vc - WHERE t.shipped BETWEEN vStarted AND vEnded - AND IFNULL(t.packages,0) = 0 - AND am.agencyFk = vAgencyFk - GROUP BY t.id; - - - SELECT p.name Provincia, - count(*) expediciones, - sum(t.packages) Bultos, - sum(tpe.boxes) Prevision - FROM vn.ticket t - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p ON a.provinceFk = p.id - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN tmp.ticket_PackagingEstimated tpe ON tpe.ticketFk = t.id - WHERE t.warehouseFk = 60 - AND t.shipped BETWEEN vStarted AND vEnded - AND am.agencyFk = vAgencyFk - GROUP BY p.name; - - END IF; - SELECT * FROM tmp.ticket_PackagingEstimated; - DROP TEMPORARY TABLE tmp.ticket_PackagingEstimated; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -85901,9 +85667,9 @@ SELECT Agencia, FROM Tickets ti INNER JOIN Consignatarios ON ti.Id_Consigna = Consignatarios.Id_consigna INNER JOIN Agencias ON ti.Id_Agencia = Agencias.Id_Agencia - LEFT JOIN (SELECT Ticket_Id,count(*) AS ncajas FROM expeditions WHERE Id_Article=94 GROUP BY ticket_id) sub1 ON ti.Id_Ticket=sub1.Ticket_Id - LEFT JOIN (SELECT Ticket_Id,count(*) AS nbultos FROM expeditions WHERE Id_Article IS NULL GROUP BY ticket_id) sub2 ON ti.Id_Ticket=sub2.Ticket_Id - LEFT JOIN (SELECT Ticket_Id,count(*) AS notros FROM expeditions WHERE Id_Article >0 GROUP BY ticket_id) sub3 ON ti.Id_Ticket=sub3.Ticket_Id + LEFT JOIN (SELECT ticketFk,count(*) AS ncajas FROM vn.expedition WHERE packagingFk=94 GROUP BY ticketFk) sub1 ON ti.Id_Ticket=sub1.ticketFk + LEFT JOIN (SELECT ticketFk,count(*) AS nbultos FROM vn.expedition WHERE packagingFk IS NULL GROUP BY ticketFk) sub2 ON ti.Id_Ticket=sub2.ticketFk + LEFT JOIN (SELECT ticketFk,count(*) AS notros FROM vn.expedition WHERE packagingFk >0 GROUP BY ticketFk) sub3 ON ti.Id_Ticket=sub3.ticketFk INNER JOIN vn.ticketState ts ON ti.Id_ticket = ts.ticketFk WHERE ti.Fecha=util.VN_CURDATE() AND ts.userFk=intId_Trabajador @@ -86473,16 +86239,10 @@ BEGIN END; START TRANSACTION; - INSERT INTO vn.clientCredit(clientFk, amount) - SELECT c.id, 0 - FROM vn.`client` c - JOIN vn.payMethod pm ON pm.id = c.payMethodFk - WHERE c.credit <> 0 AND pm.`code` = 'card'; - UPDATE vn.`client` c - JOIN vn.payMethod pm ON pm.id = c.payMethodFk + JOIN vn.payMethod pm ON pm.id = c.payMethodFk SET credit = 0 - WHERE pm.`code` = 'card'; + WHERE pm.`code` = 'card'; DROP TEMPORARY TABLE IF EXISTS clientes_credit; CREATE TEMPORARY TABLE clientes_credit @@ -86509,10 +86269,6 @@ BEGIN UPDATE Clientes JOIN clientes_credit USING(Id_Cliente) SET Clientes.Credito = newCredit; - - INSERT INTO credit(Id_Cliente, amount, Id_Trabajador) - SELECT Id_Cliente, newCredit, NULL - FROM clientes_credit; DROP TEMPORARY TABLE clientes_credit; COMMIT; @@ -86621,463 +86377,6 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `supplierStatement` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `supplierStatement`(vSupplierFk INT, vCurrencyFk INT, vCompanyFk INT, vOrderBy VARCHAR(15), vOnlyConciliated BIT) -BEGIN - SET @saldo_eur:= 0; - SET @saldo_div:= 0; -select vOnlyConciliated; - DROP TEMPORARY TABLE IF EXISTS tmp.supplierStatement; - - CREATE TEMPORARY TABLE tmp.supplierStatement ENGINE = MEMORY - SELECT - *, - @saldo_eur:= round(@saldo_eur + IFNULL(Pago_Euros, 0) - IFNULL(Fac_Euros, 0) ,2 ) AS saldo_eur, - @saldo_div:= round(@saldo_div + IFNULL(Pago_Divisas, 0) - IFNULL(Fac_Divisas, 0) ,2 ) AS saldo_div - FROM - (SELECT * FROM - (SELECT - NULL as banco_id, - r.empresa_id, - r.serie, - r.id, - CASE - WHEN vOrderBy = 'issued' THEN r.fecha - WHEN vOrderBy = 'bookEntried' THEN r.bookEntried - WHEN vOrderBy = 'booked' THEN r.dateBooking - WHEN vOrderBy = 'dueDate' THEN rv.fecha - END AS fecha, - CONCAT('S/Fra ', r.sref) sref, - if(r.moneda_id > 1,round(sum(divisa) / sum(cantidad),3),NULL) val_cambio, - CAST(sum(cantidad) as DECIMAL(10,2)) as Fac_Euros, - CAST(sum(divisa) as DECIMAL(10,2)) as Fac_Divisas, - NULL AS Pago_Euros, - NULL AS Pago_Divisas, - r.moneda_id, - r.contabilizada, - Moneda, - NULL as pago_sdc_id, - 'invoiceIn' statementType - FROM - recibida r - JOIN recibida_vencimiento rv on rv.recibida_id = r.id - JOIN Monedas m on m.Id_Moneda = r.moneda_id - WHERE - r.fecha > '2014-12-31' - AND r.proveedor_id = vSupplierFk - AND vCurrencyFk IN (r.moneda_id, 0) - AND vCompanyFk IN (r.empresa_id,0) - AND (vOnlyConciliated = r.contabilizada OR NOT vOnlyConciliated) - GROUP BY rv.id - - UNION ALL - SELECT - p.id_banco, - p.empresa_id, - NULL, - p.id, - CASE - WHEN vOrderBy = 'issued' THEN p.Fecha - WHEN vOrderBy = 'bookEntried' THEN p.Fecha - WHEN vOrderBy = 'booked' THEN p.Fecha - WHEN vOrderBy = 'dueDate' THEN p.dueDated - END AS fecha, - CONCAT(IFNULL(name, ''), IF(pre.concepto <> '', CONCAT(' : ', pre.concepto), '')), - if(p.id_moneda > 1, p.divisa / importe, NULL) tip_cambio, - NULL, - NULL, - p.importe, - p.divisa, - p.id_moneda, - p.conciliado, - Moneda, - NULL as pago_sdc_id, - 'payment' statementType - FROM - pago p - LEFT JOIN Monedas ON Monedas.Id_Moneda = p.id_moneda - LEFT JOIN Bancos ON p.id_banco = Bancos.Id_banco - LEFT JOIN pay_met pm ON p.pay_met_id = pm.id - LEFT JOIN Pagares pre ON pre.pago_id = p.id - WHERE - Fecha > '2014-12-31' - AND p.Id_Proveedor = vSupplierFk - AND vCurrencyFk IN (p.id_moneda,0) - AND vCompanyFk IN (p.empresa_id,0) - AND (vOnlyConciliated = p.conciliado OR NOT vOnlyConciliated) - UNION ALL - SELECT - NULL, - companyFk, - NULL, - se.id, - CASE - WHEN vOrderBy = 'issued' THEN se.dated - WHEN vOrderBy = 'bookEntried' THEN se.dated - WHEN vOrderBy = 'booked' THEN se.dated - WHEN vOrderBy = 'dueDate' THEN se.dueDated - END AS fecha, - se.description, - 1 tip_cambio, - amount, - NULL, - NULL, - NULL, - currencyFk, - isConciliated, - c.`code`, - NULL, - 'expense' statementType - FROM vn.supplierExpense se - JOIN vn.currency c on c.id= se.currencyFk - WHERE se.supplierFk = vSupplierFk - AND vCurrencyFk IN (se.currencyFk,0) - AND vCompanyFk IN (se.companyFk,0) - AND (vOnlyConciliated = se.isConciliated OR NOT vOnlyConciliated) - ) AS SUB - ORDER BY (fecha is null and NOT contabilizada),fecha, IF(vOrderBy = 'dueDate', id, NULL) LIMIT 10000000000000000000) t; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `traslado` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `traslado`(IN i_entrada INTEGER) -BEGIN - DECLARE dateShipment DATE; - DECLARE dateLanding DATE; - DECLARE warehouseShipment INTEGER; - DECLARE warehouseLanding INTEGER; - DECLARE v_calc_visible INTEGER; - DECLARE vInventoryDate DATE; - - SET vInventoryDate := vn.getInventoryDate(); - SELECT shipment, landing, warehouse_id_out, warehouse_id - INTO dateShipment, dateLanding, warehouseShipment, warehouseLanding - FROM travel t JOIN Entradas e ON t.id = e.travel_id - WHERE Id_Entrada = i_entrada; - - CALL vn.rate_getPrices(dateShipment, warehouseLanding); - - -- Traslado en almacen origen - - DROP TEMPORARY TABLE IF EXISTS buy_edi_temp; - CREATE TEMPORARY TABLE buy_edi_temp - (KEY (Id_Article), INDEX(Id_Compra)) ENGINE = MEMORY - SELECT * - FROM (SELECT c.Id_Article, c.Id_Compra - FROM Compres c INNER JOIN Entradas e USING(Id_Entrada) - INNER JOIN travel t ON t.id = e.travel_id - WHERE t.landing BETWEEN vInventoryDate AND dateShipment - AND c.Novincular = FALSE - AND c.Tarifa2 >= 0 - ORDER BY (warehouseShipment = t.warehouse_id) DESC, t.landing DESC - LIMIT 10000000000000000000) t - GROUP BY Id_Article; - - IF dateShipment >= util.VN_CURDATE() THEN - CALL `cache`.visible_refresh(v_calc_visible, TRUE, warehouseShipment); - - DROP TEMPORARY TABLE IF EXISTS tmp.item; - - CREATE TEMPORARY TABLE tmp.item ( - `itemFk` int(10) unsigned NOT NULL, - `visible` int(11) NOT NULL DEFAULT 0, - `available` int(11) NOT NULL DEFAULT 0, - `visibleLanding` int(11) NOT NULL DEFAULT 0, - `availableLanding` int(11) NOT NULL DEFAULT 0, - UNIQUE INDEX i USING HASH (itemFk) - ) ENGINE = MEMORY; - - INSERT INTO tmp.item(itemFk, visible) - SELECT item_id itemFk, visible - FROM `cache`.visible - WHERE calc_id = v_calc_visible - AND visible; - - CALL `cache`.visible_refresh(v_calc_visible, TRUE, warehouseLanding); - - INSERT INTO tmp.item(itemFk, visibleLanding) - SELECT item_id, `visible` - FROM `cache`.`visible` v - WHERE v.calc_id = v_calc_visible - AND v.`visible` - ON DUPLICATE KEY UPDATE visibleLanding = v.`visible`; - - CALL availableTraslate(warehouseShipment, dateShipment, NULL); - - INSERT INTO tmp.item(itemFk, available) - SELECT a.item_id, a.available - FROM availableTraslate a - WHERE a.available - ON DUPLICATE KEY UPDATE available = a.available; - - CALL availableTraslate(warehouseLanding, dateLanding, warehouseShipment); - - INSERT INTO tmp.item(itemFk, availableLanding) - SELECT a.item_id, a.available - FROM availableTraslate a - WHERE a.available - ON DUPLICATE KEY UPDATE availableLanding = a.available; - ELSE - CALL vn.item_getStock(warehouseShipment, dateShipment, NULL); - - DROP TEMPORARY TABLE IF EXISTS tmp.item; - CREATE TEMPORARY TABLE tmp.item (UNIQUE INDEX i USING HASH (itemFk)) ENGINE = MEMORY - SELECT itemFk, `visible`, available , 0 visibleLanding, 0 availableLanding - FROM tmp.itemList; - - DROP TEMPORARY TABLE tmp.itemList; - END IF; - - CALL vn.buyUltimateFromInterval(warehouseLanding,vInventoryDate, dateLanding); - - DROP TEMPORARY TABLE IF EXISTS Traslados; - CREATE TEMPORARY TABLE Traslados ENGINE = MEMORY - SELECT tp.Id_Tipo AS Tipo, - tp.reino_id, - ar.tipo_id, - ar.Id_Article AS article_id, - ar.Article, - ar.Medida, - ar.Categoria, - ar.Color, - Origen.abreviatura as Origen, - CE.Cantidad, - ar.Tallos, - CAST(AIM.visible AS DECIMAL(10,0)) as vis1, - CAST(AIM.available AS DECIMAL(10,0)) as dis1, - CAST(AIM.visibleLanding AS DECIMAL(10,0)) as vis2, - CAST(AIM.availableLanding AS DECIMAL(10,0)) as dis2, - COALESCE(CE.`grouping`, C.`grouping`) as `grouping`, - COALESCE(CE.Packing, C.Packing) as Packing, - COALESCE(cl.caja, CE.caja, C.caja) as caja, - IFNULL(p.name, P2.Alias) AS Productor, - C.Id_Cubo, - 1 Tinta, - CE.Id_Compra, - CE.Etiquetas, - C.buy_edi_id, - tp.Id_Trabajador, - CB.Volumen, - IFNULL(CB.x,0) x, - IFNULL(CB.y,0) y, - IFNULL(CB.z,0) z, - IFNULL(C.Costefijo,0) Costefijo, - IFNULL(C.Comisionfija,0) Comisionfija, - IFNULL(C.Portefijo,0) Portefijo, - A.m3, - E.comision, - CB.Retornable, - IFNULL(CEB.Valor,CB.Valor) Valor, - r.rate3 t3, r.rate2 t2, tp.promo, - C.`grouping` groupingOrigin, - C.Packing PackingOrigin, - C.Id_Compra CompraOrigin, - CB.costeRetorno, - C.weight - FROM Articles ar - JOIN tmp.item AIM ON AIM.itemFk = ar.Id_Article - LEFT JOIN producer p ON p.producer_id = ar.producer_id - LEFT JOIN Tipos tp ON tp.tipo_id = ar.tipo_id - JOIN vn.itemCategory ic ON ic.id = tp.reino_id - LEFT JOIN Origen ON Origen.id = ar.id_origen - LEFT JOIN buy_edi_temp lb ON lb.Id_Article = ar.Id_Article - LEFT JOIN Compres C ON C.Id_Compra = lb.Id_Compra - LEFT JOIN Cubos CB ON CB.Id_Cubo = C.Id_Cubo - LEFT JOIN Entradas E2 ON E2.Id_Entrada = C.Id_Entrada - LEFT JOIN Proveedores P2 ON P2.Id_Proveedor = E2.Id_Proveedor - LEFT JOIN Entradas E ON E.Id_Entrada = i_entrada - LEFT JOIN travel TR ON TR.id = E.travel_id - LEFT JOIN Agencias A ON A.Id_Agencia = TR.agency_id - LEFT JOIN Compres CE ON CE.Id_Article = ar.Id_Article AND CE.Id_Entrada = i_entrada - LEFT JOIN Cubos CEB ON CEB.Id_Cubo = CE.Id_Cubo - LEFT JOIN tmp.rate r ON TRUE - LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = ar.Id_Article - LEFT JOIN Compres cl ON cl.Id_Compra = bufi.buyFk - WHERE ic.display - AND E.Redada = FALSE - AND (AIM.visible != 0 OR AIM.available != 0) - ORDER BY tipo_id, Article, article_id, Medida, Categoria, Origen; - - CREATE INDEX tindex USING HASH ON Traslados (article_id); - - SELECT t.*, - Cantidad - MOD(Cantidad , `grouping`) as Subcantidad, - MOD(Cantidad , `grouping`) as Soll, - ROUND((IF(Volumen > 0,Volumen,x * y * IF(z = 0, Medida + 10, z))) / Packing,0) as cm3, - Costefijo + Comisionfija + Portefijo AS Cost, - @porte := ROUND((IF(Volumen > 0,Volumen,x * y * IF(z = 0, Medida + 10, z))) * m3 / 1000000 / Packing ,3) AS Porte, - @comision := ROUND((Costefijo + Comisionfija + Portefijo) * comision / 100 ,3) AS Comision, - ROUND(@embalaje := (costeRetorno + IF(Retornable != 0, 0, Valor)) / packing ,3) AS Embalaje, - @coste := IFNULL((Costefijo + Comisionfija + Portefijo),0) + IFNULL(@embalaje,0) + IFNULL(@porte,0) + IFNULL(@comision,0) AS Coste, - @t3 := ROUND(@coste / ( (100 - t3 - t.promo)/100),2) AS Tarifa3, - ROUND(@t3 * (1 + ((t2 - t3)/100)),2) AS Tarifa2, - 0 selected - FROM Traslados t; - - DROP TEMPORARY TABLE Traslados; - DROP TEMPORARY TABLE tmp.item; - DROP TEMPORARY TABLE buy_edi_temp; - DROP TEMPORARY TABLE tmp.buyUltimateFromInterval; - DROP TEMPORARY TABLE tmp.rate; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `travelDetail` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `travelDetail`() -BEGIN -/** - * Returns the details of the travels that have a departure warehouse in Ecuador or Colombia. - */ - DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL 12 WEEK; - SELECT IFNULL(CONCAT(" ",Entrada),travel) travelAndEntry, - travel, - Entrada, - IsTravel, - Agencia, - ref, - shipment, - OrigenCajas, - landing, - Destino, - Etiquetas, - Notas_Eva, - kg, - loadedKg, - volumeKg, - loadPriority, - invoiceAmount, - Carguera, - reference - FROM - (SELECT TRUE IsTravel, - tr.id travel, - NULL Entrada, - ag.Agencia, - tr.ref, - tr.shipment, - wo.name OrigenCajas, - tr.landing, - w.name Destino, - SUM(c.Etiquetas) Etiquetas, - NULL Notas_Eva, - tr.kg, - CAST(SUM(c.weight * c.Etiquetas) AS INT) loadedkg, - CAST( - SUM(vc.aerealVolumetricDensity * - c.Etiquetas * - IF(cb.Volumen, - cb.Volumen, - cb.X * cb.Y * cb.Z - ) / 1000000 - ) AS INT - ) volumeKg, - NULL loadPriority, - NULL invoiceAmount, - pc.Alias Carguera, - NULL reference - FROM travel tr - LEFT JOIN Proveedores pc ON pc.Id_Proveedor = tr.cargoSupplierFk - LEFT JOIN Entradas e ON e.travel_id = tr.id - LEFT JOIN Compres c ON c.Id_Entrada = e.Id_Entrada - LEFT JOIN Cubos cb ON cb.Id_Cubo = c.Id_Cubo - LEFT JOIN Articles a ON a.Id_Article = c.Id_Article - LEFT JOIN Tipos tp ON tp.tipo_id = a.tipo_id - JOIN warehouse w ON w.id = tr.warehouse_id - JOIN warehouse wo ON wo.id = tr.warehouse_id_out - JOIN Agencias ag ON ag.Id_Agencia = tr.agency_id - JOIN vn.volumeConfig vc - WHERE tr.landing >= vDateFrom - AND (wo.name="Colombia" OR wo.name="Ecuador") - GROUP BY tr.id - UNION ALL - SELECT 0 IsTravel, - e.travel_id travel, - e.Id_Entrada, - p.Proveedor, - e.Referencia, - tr.shipment, - wo.name OrigenCajas, - tr.landing, - w.name Destino, - SUM(Etiquetas) Etiquetas, - e.Notas_Eva, - NULL kg, - CAST(SUM(c.weight * c.Etiquetas) AS INT) loadedkg, - CAST( - SUM(vc.aerealVolumetricDensity * - c.Etiquetas * - IF(cb.Volumen, - cb.Volumen, - cb.X * cb.Y * cb.Z - ) / 1000000 - ) AS INT - ) volumeKg, - loadPriority, - e.invoiceAmount, - pc.Alias carguera, - e.reference - FROM Entradas e - JOIN Compres c ON c.Id_Entrada = e.Id_Entrada - JOIN Cubos cb ON cb.Id_Cubo = c.Id_Cubo - JOIN Articles a ON a.Id_Article = c.Id_Article - JOIN Tipos tp ON tp.tipo_id = a.tipo_id - JOIN Proveedores p ON p.Id_Proveedor = e.Id_Proveedor - JOIN travel tr ON tr.id = e.travel_id - LEFT JOIN Proveedores pc ON pc.Id_Proveedor = tr.cargoSupplierFk - JOIN warehouse w ON w.id = tr.warehouse_id - JOIN warehouse wo ON wo.id = tr.warehouse_id_out - JOIN vn.volumeConfig vc - WHERE tr.landing >= vDateFrom - AND (wo.name="Colombia" OR wo.name="Ecuador") - GROUP BY e.Id_Entrada - ) sub - ORDER BY landing ASC, - shipment ASC, - travel, - IsTravel DESC, - (loadPriority > 0) DESC, - loadPriority, - Agencia, - Notas_Eva; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `unary_leaves` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -87173,53 +86472,6 @@ BEGIN INNER JOIN `unary` u ON s.unary_id = u.id WHERE u.parent IS NULL; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `XDiario_Quadrator` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `XDiario_Quadrator`() -BEGIN - INSERT INTO vn.mail (receiver, subject, body) - SELECT 'cau@verdnatura.es', - 'asientos descuadrados', - group_concat(CONCAT(' Asiento: ', ASIEN, '- importe:', quadre) SEPARATOR ' \r\n ') - FROM ( - SELECT ASIEN, SUM(IFNULL(ROUND(Eurodebe,2),0))- SUM(IFNULL(ROUND(EUROHABER,2),0)) quadre - FROM XDiario - WHERE enlazado = FALSE - GROUP BY ASIEN - HAVING ABS(SUM(IFNULL(ROUND(Eurodebe,2),0))- SUM(IFNULL(ROUND(EUROHABER,2),0))) > 0.01 - ) t - HAVING count(*) > 0; - - UPDATE XDiario XD - INNER JOIN( - SELECT XD.id, SUBCTA, Quadre FROM XDiario XD - INNER JOIN ( - SELECT ASIEN, SUM(IFNULL(ROUND(Eurodebe,2),0))- SUM(IFNULL(ROUND(EUROHABER,2),0)) as Quadre - FROM XDiario - WHERE enlazado = FALSE - GROUP BY ASIEN - HAVING Quadre != 0 - ) sub USING(ASIEN) - WHERE SUBCTA > '5999999999' - GROUP BY ASIEN - ) sub2 USING(id) - SET Eurohaber = IF(IFNULL(Eurohaber,0) = 0, Eurohaber, Eurohaber + Quadre), - Eurodebe = IF(IFNULL(Eurodebe,0) = 0, Eurodebe, Eurodebe - Quadre); - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -87714,6 +86966,24 @@ USE `dipole`; USE `edi`; +-- +-- Final view structure for view `ektK2` +-- + +/*!50001 DROP VIEW IF EXISTS `ektK2`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `ektK2` AS select `eek`.`id` AS `id`,`eek`.`description` AS `description` from `ektK1` `eek` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `ektRecent` -- @@ -88614,24 +87884,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `agencyWarehouse` --- - -/*!50001 DROP VIEW IF EXISTS `agencyWarehouse`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `agencyWarehouse` AS select `a`.`agency_id` AS `agencyFk`,`a`.`warehouse_id` AS `warehouseFk`,`a`.`Vista` AS `agencyType` from `vn2008`.`agency_warehouse` `a` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `annualAverageInvoiced` -- @@ -88686,24 +87938,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `bankPolicy` --- - -/*!50001 DROP VIEW IF EXISTS `bankPolicy`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `bankPolicy` AS select `bp`.`poliza_id` AS `id`,`bp`.`referencia` AS `ref`,`bp`.`importe` AS `amount`,`bp`.`com_dispuesto` AS `balanceInterestDrawn`,`bp`.`com_no_dispuesto` AS `commissionAvailableBalances`,`bp`.`com_anual` AS `openingCommission`,`bp`.`apertura` AS `started`,`bp`.`cierre` AS `ended`,`bp`.`Id_Banco` AS `bankFk`,`bp`.`empresa_id` AS `companyFk`,`bp`.`supplierFk` AS `supplierFk`,`bp`.`description` AS `description`,`bp`.`hasGuarantee` AS `hasGuarantee`,`bp`.`dmsFk` AS `dmsFk`,`bp`.`notaryFk` AS `notaryFk`,`bp`.`currencyFk` AS `currencyFk`,`bp`.`amortizationTypeFk` AS `amortizationTypeFk`,`bp`.`periodicityTypeFk` AS `periodicityTypeFk`,`bp`.`insuranceExpired` AS `insuranceExpired` from `vn2008`.`Bancos_poliza` `bp` order by `bp`.`poliza_id` desc */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `businessCalendar` -- @@ -88758,24 +87992,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `clientDefaultCompany` --- - -/*!50001 DROP VIEW IF EXISTS `clientDefaultCompany`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientDefaultCompany` AS select `t`.`Id_Clientes_empresa` AS `id`,`t`.`Id_Cliente` AS `clientFk`,`t`.`empresa_id` AS `companyFk`,`t`.`fecha_ini` AS `started`,`t`.`fecha_fin` AS `finished` from `vn2008`.`Clientes_empresa` `t` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `clientLost` -- @@ -88830,24 +88046,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `coolerPath` --- - -/*!50001 DROP VIEW IF EXISTS `coolerPath`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `coolerPath` AS select `c`.`cooler_path_id` AS `id`,`c`.`description` AS `description` from `vn2008`.`cooler_path` `c` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `defaulter` -- @@ -88884,24 +88082,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `doc` --- - -/*!50001 DROP VIEW IF EXISTS `doc`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `doc` AS select `g`.`id` AS `id`,`g`.`sref` AS `sref`,`g`.`brief` AS `brief`,`g`.`emp_id` AS `companyFk`,`g`.`orden` AS `order`,`g`.`file` AS `file`,`g`.`original` AS `original`,`g`.`trabajador_id` AS `workerFk`,`g`.`odbc_date` AS `created`,`g`.`warehouse_id` AS `warehouseFk` from `vn2008`.`gestdoc` `g` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `ediGenus` -- @@ -89334,24 +88514,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `grantGroup` --- - -/*!50001 DROP VIEW IF EXISTS `grantGroup`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `grantGroup` AS select `vn2008`.`Grupos`.`id` AS `id`,`vn2008`.`Grupos`.`Grupo` AS `description`,`vn2008`.`Grupos`.`observation_type_id` AS `observationTypeFk` from `vn2008`.`Grupos` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `inkL10n` -- @@ -89635,7 +88797,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingStock` AS select `ish`.`itemFk` AS `itemFk`,sum(`ish`.`visible`) AS `visible`,min(`ish`.`packing`) AS `packing`,min(`ish`.`grouping`) AS `grouping`,`s`.`description` AS `sector`,sum(`ish`.`visible`) AS `visibleOriginal`,0 AS `removed`,`p`.`sectorFk` AS `sectorFk`,`s`.`warehouseFk` AS `warehouseFk`,`ish`.`shelvingFk` AS `shelvingFk`,`p`.`code` AS `parkingCode`,`sh`.`parkingFk` AS `parkingFk`,`ish`.`id` AS `itemShelvingFk`,`ish`.`created` AS `created`,`st`.`description` = 'previousPrepared' AS `isPreviousPrepared` from ((((`itemShelving` `ish` left join `shelving` `sh` on(`sh`.`code` = `ish`.`shelvingFk`)) left join `parking` `p` on(`p`.`id` = `sh`.`parkingFk`)) left join `sector` `s` on(`s`.`id` = `p`.`sectorFk`)) left join `sectorType` `st` on(`st`.`id` = `s`.`typeFk`)) where `ish`.`visible` <> 0 and `p`.`sectorFk` <> 0 group by `ish`.`itemFk`,`p`.`sectorFk` */; +/*!50001 VIEW `itemShelvingStock` AS select `ish`.`itemFk` AS `itemFk`,sum(`ish`.`visible`) AS `visible`,min(`ish`.`packing`) AS `packing`,min(`ish`.`grouping`) AS `grouping`,`s`.`description` AS `sector`,sum(`ish`.`visible`) AS `visibleOriginal`,0 AS `removed`,`p`.`sectorFk` AS `sectorFk`,`s`.`warehouseFk` AS `warehouseFk`,`ish`.`shelvingFk` AS `shelvingFk`,`p`.`code` AS `parkingCode`,`sh`.`parkingFk` AS `parkingFk`,`ish`.`id` AS `itemShelvingFk`,`ish`.`created` AS `created`,`st`.`code` = 'previousPrepared' AS `isPreviousPrepared` from ((((`itemShelving` `ish` left join `shelving` `sh` on(`sh`.`code` = `ish`.`shelvingFk`)) left join `parking` `p` on(`p`.`id` = `sh`.`parkingFk`)) left join `sector` `s` on(`s`.`id` = `p`.`sectorFk`)) left join `sectorType` `st` on(`st`.`id` = `s`.`typeFk`)) where `ish`.`visible` <> 0 and `p`.`sectorFk` <> 0 group by `ish`.`itemFk`,`p`.`sectorFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -90072,24 +89234,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `promissoryNote` --- - -/*!50001 DROP VIEW IF EXISTS `promissoryNote`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `promissoryNote` AS select `p`.`Id_Pagare` AS `id`,`p`.`Concepto` AS `Concept`,`p`.`pago_id` AS `paymentFk` from `vn2008`.`Pagares` `p` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `role` -- @@ -90720,24 +89864,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `warehouseJoined` --- - -/*!50001 DROP VIEW IF EXISTS `warehouseJoined`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `warehouseJoined` AS select `wj`.`warehouse_id` AS `warehouseFk`,`wj`.`warehouse_alias_id` AS `warehouseAliasFk` from `vn2008`.`warehouse_joined` `wj` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `workerBusinessDated` -- @@ -90931,7 +90057,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `zoneEstimatedDelivery` AS select `t`.`zoneFk` AS `zoneFk`,`zc`.`hour` AS `zoneClosureHour`,`z`.`hour` AS `zoneHour`,`sv`.`volume` AS `volume`,`al`.`hasToRecalcPrice` AS `hasToRecalcPrice`,`lhp`.`m3` AS `m3`,`dl`.`minSpeed` AS `minSpeed` from ((((((((((`vn`.`ticket` `t` join `vn`.`ticketStateToday` `tst` on(`tst`.`ticketFk` = `t`.`id`)) join `vn`.`state` `s` on(`s`.`id` = `tst`.`state`)) join `vn`.`saleVolume` `sv` on(`sv`.`ticketFk` = `t`.`id`)) left join `vn`.`lastHourProduction` `lhp` on(`lhp`.`warehouseFk` = `t`.`warehouseFk`)) join `vn`.`warehouse` `w` on(`w`.`id` = `t`.`warehouseFk`)) join `vn`.`warehouseAlias` `wa` on(`wa`.`id` = `w`.`aliasFk`)) straight_join `vn`.`zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `vn`.`zoneClosure` `zc` on(`zc`.`zoneFk` = `t`.`zoneFk` and `zc`.`dated` = `util`.`VN_CURDATE`())) left join `cache`.`departure_limit` `dl` on(`dl`.`warehouse_id` = `t`.`warehouseFk` and `dl`.`fecha` = `util`.`VN_CURDATE`())) join `vn`.`alertLevel` `al` on(`al`.`id` = `s`.`alertLevel`)) where `w`.`hasProduction` <> 0 and cast(`t`.`shipped` as date) = `util`.`VN_CURDATE`() */; +/*!50001 VIEW `zoneEstimatedDelivery` AS select `t`.`zoneFk` AS `zoneFk`,`zc`.`hour` AS `zoneClosureHour`,`z`.`hour` AS `zoneHour`,`sv`.`volume` AS `volume`,`al`.`hasToRecalcPrice` AS `hasToRecalcPrice`,`lhp`.`m3` AS `m3`,`dl`.`minSpeed` AS `minSpeed` from (((((((((`vn`.`ticket` `t` join `vn`.`ticketStateToday` `tst` on(`tst`.`ticketFk` = `t`.`id`)) join `vn`.`state` `s` on(`s`.`id` = `tst`.`state`)) join `vn`.`saleVolume` `sv` on(`sv`.`ticketFk` = `t`.`id`)) left join `vn`.`lastHourProduction` `lhp` on(`lhp`.`warehouseFk` = `t`.`warehouseFk`)) join `vn`.`warehouse` `w` on(`w`.`id` = `t`.`warehouseFk`)) straight_join `vn`.`zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `vn`.`zoneClosure` `zc` on(`zc`.`zoneFk` = `t`.`zoneFk` and `zc`.`dated` = `util`.`VN_CURDATE`())) left join `cache`.`departure_limit` `dl` on(`dl`.`warehouse_id` = `t`.`warehouseFk` and `dl`.`fecha` = `util`.`VN_CURDATE`())) join `vn`.`alertLevel` `al` on(`al`.`id` = `s`.`alertLevel`)) where `w`.`hasProduction` <> 0 and cast(`t`.`shipped` as date) = `util`.`VN_CURDATE`() */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -90978,24 +90104,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `Articles_botanical` --- - -/*!50001 DROP VIEW IF EXISTS `Articles_botanical`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Articles_botanical` AS select `ab`.`itemFk` AS `Id_Article`,`ab`.`genusFk` AS `genus_id`,`ab`.`specieFk` AS `specie_id` from `vn`.`itemBotanical` `ab` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `Bancos` -- @@ -91014,6 +90122,24 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `Bancos_poliza` +-- + +/*!50001 DROP VIEW IF EXISTS `Bancos_poliza`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `Bancos_poliza` AS select `bp`.`id` AS `poliza_id`,`bp`.`ref` AS `referencia`,`bp`.`amount` AS `importe`,`bp`.`committedFee` AS `com_dispuesto`,`bp`.`nonCommittedFee` AS `com_no_dispuesto`,`bp`.`annualFee` AS `com_anual`,`bp`.`started` AS `apertura`,`bp`.`ended` AS `cierre`,`bp`.`accountingFk` AS `Id_Banco`,`bp`.`companyFk` AS `empresa_id`,`bp`.`supplierFk` AS `supplierFk`,`bp`.`description` AS `description`,`bp`.`hasGuarantee` AS `hasGuarantee`,`bp`.`dmsFk` AS `dmsFk`,`bp`.`notaryFk` AS `notaryFk`,`bp`.`currencyFk` AS `currencyFk`,`bp`.`amortizationTypeFk` AS `amortizationTypeFk`,`bp`.`periodicityTypeFk` AS `periodicityTypeFk`,`bp`.`insuranceExpired` AS `insuranceExpired` from `vn`.`bankPolicy` `bp` order by `bp`.`id` desc */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `Cajas` -- @@ -91195,10 +90321,10 @@ USE `vn2008`; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `Equipos` +-- Final view structure for view `Entradas_orden` -- -/*!50001 DROP VIEW IF EXISTS `Equipos`*/; +/*!50001 DROP VIEW IF EXISTS `Entradas_orden`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -91207,79 +90333,7 @@ USE `vn2008`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Equipos` AS select `h`.`code` AS `alias`,`h`.`description` AS `descripcion`,`h`.`workerFk` AS `trabajador_id`,`h`.`windowsSerial` AS `windowsSerial` from `vn`.`host` `h` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `Facturas` --- - -/*!50001 DROP VIEW IF EXISTS `Facturas`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Facturas` AS select `io`.`id` AS `factura_id`,`io`.`ref` AS `Id_Factura`,`io`.`serial` AS `Serie`,`io`.`issued` AS `Fecha`,`io`.`amount` AS `Importe`,`io`.`clientFk` AS `Id_Cliente`,`io`.`created` AS `odbc_date`,`io`.`companyFk` AS `empresa_id`,`io`.`dued` AS `Vencimiento`,`io`.`booked` AS `booked`,`io`.`bankFk` AS `Id_Banco`,`io`.`siiTypeInvoiceOutFk` AS `siiTypeInvoiceOutFk`,`io`.`cplusTaxBreakFk` AS `cplusTaxBreakFk`,`io`.`cplusSubjectOpFk` AS `cplusSubjectOpFk`,`io`.`siiTrascendencyInvoiceOutFk` AS `siiTrascendencyInvoiceOutFk`,`io`.`hasPdf` AS `pdf` from `vn`.`invoiceOut` `io` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `Gastos` --- - -/*!50001 DROP VIEW IF EXISTS `Gastos`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Gastos` AS select `e`.`id` AS `Id_Gasto`,`e`.`name` AS `Gasto`,`e`.`isWithheld` AS `isWithheld` from `vn`.`expense` `e` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `Greuges` --- - -/*!50001 DROP VIEW IF EXISTS `Greuges`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Greuges` AS select `g`.`Id` AS `Id`,`g`.`clientFk` AS `Id_Cliente`,`g`.`description` AS `Comentario`,`g`.`amount` AS `Importe`,`g`.`shipped` AS `Fecha`,`g`.`created` AS `odbc_date`,`g`.`greugeTypeFk` AS `Greuges_type_id`,`g`.`ticketFk` AS `Id_Ticket` from `vn`.`greuge` `g` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `Greuges_type` --- - -/*!50001 DROP VIEW IF EXISTS `Greuges_type`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Greuges_type` AS select `gt`.`id` AS `Greuges_type_id`,`gt`.`name` AS `name` from `vn`.`greugeType` `gt` */; +/*!50001 VIEW `Entradas_orden` AS select `eo`.`entryFk` AS `Id_Entrada`,`eo`.`order` AS `orden` from `vn`.`entryOrder` `eo` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -91302,24 +90356,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `Intrastat` --- - -/*!50001 DROP VIEW IF EXISTS `Intrastat`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Intrastat` AS select `i`.`id` AS `Codintrastat`,`i`.`description` AS `Definicion`,`i`.`taxClassFk` AS `iva_group_id`,`i`.`taxCodeFk` AS `iva_codigo_id` from `vn`.`intrastat` `i` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `Monedas` -- @@ -91428,6 +90464,24 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `Pagares` +-- + +/*!50001 DROP VIEW IF EXISTS `Pagares`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `Pagares` AS select `p`.`id` AS `Id_Pagare`,`p`.`issued` AS `Fechaemision`,`p`.`Concept` AS `Concepto`,`p`.`paymentFk` AS `pago_id` from `vn`.`promissoryNote` `p` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `Paises` -- @@ -91464,24 +90518,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `Prioridades` --- - -/*!50001 DROP VIEW IF EXISTS `Prioridades`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Prioridades` AS select `qp`.`id` AS `Id_Prioridad`,`qp`.`priority` AS `Prioridad` from `vn`.`queuePriority` `qp` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `Proveedores` -- @@ -91500,6 +90536,24 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `Proveedores_gestdoc` +-- + +/*!50001 DROP VIEW IF EXISTS `Proveedores_gestdoc`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `Proveedores_gestdoc` AS select `sd`.`supplierFk` AS `Id_Proveedor`,`sd`.`dmsFk` AS `gestdoc_id` from `vn`.`supplierDms` `sd` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `Recibos` -- @@ -91518,6 +90572,24 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `Remesas` +-- + +/*!50001 DROP VIEW IF EXISTS `Remesas`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `Remesas` AS select `r`.`id` AS `Id_Remesa`,`r`.`dated` AS `Fecha Remesa`,`r`.`accountingFk` AS `Banco`,`r`.`companyFk` AS `empresa_id` from `vn`.`remittance` `r` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `Rutas` -- @@ -91536,6 +90608,60 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `Saldos_Prevision` +-- + +/*!50001 DROP VIEW IF EXISTS `Saldos_Prevision`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `Saldos_Prevision` AS select `fb`.`id` AS `Saldos_Prevision_id`,`fb`.`description` AS `Descripcion`,`fb`.`amount` AS `Importe`,`fb`.`dated` AS `Fecha`,`fb`.`accountingFk` AS `Id_Banco`,`fb`.`companyFk` AS `empresa_id` from `vn`.`forecastedBalance` `fb` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `Split_lines` +-- + +/*!50001 DROP VIEW IF EXISTS `Split_lines`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `Split_lines` AS select `sl`.`id` AS `Id_Split_lines`,`sl`.`splitFk` AS `Id_Split`,`sl`.`itemFk` AS `Id_Article`,`sl`.`buyFk` AS `Id_Compra` from `vn`.`splitLine` `sl` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `Splits` +-- + +/*!50001 DROP VIEW IF EXISTS `Splits`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `Splits` AS select `s`.`id` AS `Id_Split`,`s`.`ticketFk` AS `Id_Ticket`,`s`.`entryFk` AS `Id_Entrada`,`s`.`dated` AS `Fecha`,`s`.`note` AS `Notas` from `vn`.`split` `s` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `Tickets` -- @@ -91663,10 +90789,10 @@ USE `vn2008`; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `Vehiculos` +-- Final view structure for view `Vehiculos_consumo` -- -/*!50001 DROP VIEW IF EXISTS `Vehiculos`*/; +/*!50001 DROP VIEW IF EXISTS `Vehiculos_consumo`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -91675,16 +90801,16 @@ USE `vn2008`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Vehiculos` AS select `v`.`id` AS `Id_Vehiculo`,`v`.`numberPlate` AS `Matricula`,`v`.`tradeMark` AS `Marca`,`v`.`model` AS `Modelo`,`v`.`companyFk` AS `empresa_id`,`v`.`warehouseFk` AS `warehouseFk`,`v`.`description` AS `description`,`v`.`m3` AS `m3`,`v`.`isActive` AS `active`,`v`.`deliveryPointFk` AS `deliveryPointFk` from `vn`.`vehicle` `v` */; +/*!50001 VIEW `Vehiculos_consumo` AS select `vc`.`id` AS `Vehiculos_consumo_id`,`vc`.`vehicleFk` AS `Id_Vehiculo`,`vc`.`dated` AS `fecha`,`vc`.`km` AS `km`,`vc`.`liters` AS `litros`,`vc`.`price` AS `precio`,`vc`.`adblue` AS `adblue`,`vc`.`tolls` AS `peajes`,`vc`.`discount` AS `descuento`,`vc`.`silla` AS `silla`,`vc`.`created` AS `odbc_date`,`vc`.`others` AS `otros`,`vc`.`fuelTypeFk` AS `fuelTypeFk`,`vc`.`supplierFk` AS `proveedoresFk`,`vc`.`liters100km` AS `liters100km`,`vc`.`gasoline` AS `gasoline` from `vn`.`vehicleConsumption` `vc` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `XDiario` +-- Final view structure for view `account_conciliacion` -- -/*!50001 DROP VIEW IF EXISTS `XDiario`*/; +/*!50001 DROP VIEW IF EXISTS `account_conciliacion`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -91693,7 +90819,43 @@ USE `vn2008`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `XDiario` AS select `d`.`id` AS `id`,`d`.`ASIEN` AS `ASIEN`,`d`.`FECHA` AS `FECHA`,`d`.`SUBCTA` AS `SUBCTA`,`d`.`CONTRA` AS `CONTRA`,`d`.`CONCEPTO` AS `CONCEPTO`,`d`.`EURODEBE` AS `EURODEBE`,`d`.`EUROHABER` AS `EUROHABER`,`d`.`BASEEURO` AS `BASEEURO`,`d`.`SERIE` AS `SERIE`,`d`.`FACTURA` AS `FACTURA`,`d`.`IVA` AS `IVA`,`d`.`RECEQUIV` AS `RECEQUIV`,`d`.`CLAVE` AS `CLAVE`,`d`.`CAMBIO` AS `CAMBIO`,`d`.`DEBEME` AS `DEBEME`,`d`.`HABERME` AS `HABERME`,`d`.`AUXILIAR` AS `AUXILIAR`,`d`.`MONEDAUSO` AS `MONEDAUSO`,`d`.`TIPOOPE` AS `TIPOOPE`,`d`.`NFACTICK` AS `NFACTICK`,`d`.`TERIDNIF` AS `TERIDNIF`,`d`.`TERNIF` AS `TERNIF`,`d`.`TERNOM` AS `TERNOM`,`d`.`OPBIENES` AS `OPBIENES`,`d`.`L340` AS `L340`,`d`.`enlazado` AS `enlazado`,`d`.`FECHA_EX` AS `FECHA_EX`,`d`.`LRECT349` AS `LRECT349`,`d`.`empresa_id` AS `empresa_id`,`d`.`LDIFADUAN` AS `LDIFADUAN`,`d`.`METAL` AS `METAL`,`d`.`METALIMP` AS `METALIMP`,`d`.`CLIENTE` AS `CLIENTE`,`d`.`METALEJE` AS `METALEJE`,`d`.`FECHA_OP` AS `FECHA_OP`,`d`.`FACTURAEX` AS `FACTURAEX`,`d`.`TIPOCLAVE` AS `TIPOCLAVE`,`d`.`TIPOEXENCI` AS `TIPOEXENCI`,`d`.`TIPONOSUJE` AS `TIPONOSUJE`,`d`.`TIPOFACT` AS `TIPOFACT`,`d`.`TIPORECTIF` AS `TIPORECTIF`,`d`.`SERIE_RT` AS `SERIE_RT`,`d`.`FACTU_RT` AS `FACTU_RT`,`d`.`BASEIMP_RT` AS `BASEIMP_RT`,`d`.`BASEIMP_RF` AS `BASEIMP_RF`,`d`.`RECTIFICA` AS `RECTIFICA`,`d`.`FECHA_RT` AS `FECHA_RT`,`d`.`created` AS `created`,`d`.`updated` AS `updated`,`d`.`FECREGCON` AS `FECREGCON`,`d`.`enlazadoSage` AS `enlazadoSage` from `vn`.`XDiario` `d` */; +/*!50001 VIEW `account_conciliacion` AS select `ar`.`id` AS `idaccount_conciliacion`,`ar`.`supplierAccountFk` AS `Id_Proveedores_account`,`ar`.`operationDated` AS `Fechaoperacion`,`ar`.`valueDated` AS `FechaValor`,`ar`.`amount` AS `importe`,`ar`.`concept` AS `Concepto`,`ar`.`debitCredit` AS `DebeHaber`,`ar`.`calculatedCode` AS `id_calculated`,`ar`.`created` AS `odbc_date` from `vn`.`accountReconciliation` `ar` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `account_detail` +-- + +/*!50001 DROP VIEW IF EXISTS `account_detail`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `account_detail` AS select `ac`.`id` AS `account_detail_id`,`ac`.`value` AS `value`,`ac`.`accountDetailTypeFk` AS `account_detail_type_id`,`ac`.`supplierAccountFk` AS `Id_Proveedores_account` from `vn`.`accountDetail` `ac` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `account_detail_type` +-- + +/*!50001 DROP VIEW IF EXISTS `account_detail_type`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `account_detail_type` AS select `adt`.`id` AS `account_detail_type_id`,`adt`.`description` AS `description` from `vn`.`accountDetailType` `adt` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -91711,7 +90873,97 @@ USE `vn2008`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `agency` AS select `a`.`id` AS `agency_id`,`a`.`name` AS `name`,`a`.`warehouseFk` AS `warehouse_id`,`a`.`warehouseAliasFk` AS `warehouse_alias_id`,`a`.`isOwn` AS `propios`,`a`.`workCenterFk` AS `workCenterFk` from `vn`.`agency` `a` */; +/*!50001 VIEW `agency` AS select `a`.`id` AS `agency_id`,`a`.`name` AS `name`,`a`.`warehouseFk` AS `warehouse_id`,`a`.`isOwn` AS `propios`,`a`.`workCenterFk` AS `workCenterFk` from `vn`.`agency` `a` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `airline` +-- + +/*!50001 DROP VIEW IF EXISTS `airline`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `airline` AS select `a`.`id` AS `airline_id`,`a`.`name` AS `name` from `vn`.`airline` `a` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `airport` +-- + +/*!50001 DROP VIEW IF EXISTS `airport`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `airport` AS select `a`.`id` AS `airport_id`,`a`.`name` AS `name` from `vn`.`airport` `a` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `albaran` +-- + +/*!50001 DROP VIEW IF EXISTS `albaran`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `albaran` AS select `dn`.`id` AS `albaran_id`,`dn`.`ref` AS `ref`,`dn`.`note` AS `note`,`dn`.`shipped` AS `fecha`,`dn`.`landed` AS `fecha_entrega`,`dn`.`amount` AS `valor`,`dn`.`supplierFk` AS `Id_Proveedor`,`dn`.`companyFk` AS `empresa_id`,`dn`.`warehouseFk` AS `warehouse_id`,`dn`.`stateFk` AS `albaran_state_id`,`dn`.`workerFk` AS `Id_Trabajador`,`dn`.`supervisorFk` AS `Id_Responsable`,`dn`.`departmentFk` AS `department_id`,`dn`.`invoiceInFk` AS `recibida_id`,`dn`.`farmingFk` AS `farmingFk` from `vn`.`deliveryNote` `dn` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `albaran_gestdoc` +-- + +/*!50001 DROP VIEW IF EXISTS `albaran_gestdoc`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `albaran_gestdoc` AS select `dnd`.`dmsFk` AS `gestdoc_id`,`dnd`.`deliveryNoteFk` AS `albaran_id` from `vn`.`deliveryNoteDms` `dnd` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `albaran_state` +-- + +/*!50001 DROP VIEW IF EXISTS `albaran_state`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `albaran_state` AS select `dn`.`id` AS `albaran_state_id`,`dn`.`state` AS `state` from `vn`.`deliveryNoteState` `dn` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -91734,6 +90986,150 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `awb_component` +-- + +/*!50001 DROP VIEW IF EXISTS `awb_component`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `awb_component` AS select `ac`.`id` AS `id`,`ac`.`awbFk` AS `awb_id`,`ac`.`supplierFk` AS `Id_Proveedor`,`ac`.`typeFk` AS `awb_component_type_id`,`ac`.`awbRoleFk` AS `awb_role_id`,`ac`.`awbUnitFk` AS `awb_unit_id`,`ac`.`value` AS `value`,`ac`.`currencyFk` AS `Id_Moneda`,`ac`.`invoiceInFk` AS `recibida_id` from `vn`.`awbComponent` `ac` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `awb_component_template` +-- + +/*!50001 DROP VIEW IF EXISTS `awb_component_template`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `awb_component_template` AS select `act`.`id` AS `awb_component_template_id`,`act`.`freightFk` AS `carguera_id`,`act`.`airportIn` AS `airport_in`,`act`.`airportOut` AS `airport_out`,`act`.`airlineFk` AS `airline_id`,`act`.`typeFk` AS `awb_component_type_id`,`act`.`dated` AS `Fecha`,`act`.`awbRoleFk` AS `awb_role_id`,`act`.`awbUnit` AS `awb_unit_id`,`act`.`value` AS `value`,`act`.`maxValue` AS `max_value`,`act`.`minValue` AS `min_value`,`act`.`currencyFk` AS `Id_Moneda`,`act`.`days` AS `days` from `vn`.`awbComponentTemplate` `act` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `awb_component_type` +-- + +/*!50001 DROP VIEW IF EXISTS `awb_component_type`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `awb_component_type` AS select `act`.`id` AS `awb_component_type_id`,`act`.`description` AS `description`,`act`.`hasStems` AS `hasStems` from `vn`.`awbComponentType` `act` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `awb_gestdoc` +-- + +/*!50001 DROP VIEW IF EXISTS `awb_gestdoc`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `awb_gestdoc` AS select `ad`.`id` AS `awb_gestdoc_id`,`ad`.`awbFk` AS `awb_id`,`ad`.`dmsFk` AS `gestdoc_id` from `vn`.`awbDms` `ad` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `awb_recibida` +-- + +/*!50001 DROP VIEW IF EXISTS `awb_recibida`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `awb_recibida` AS select `aii`.`awbFk` AS `awb_id`,`aii`.`invoiceInFk` AS `recibida_id`,`aii`.`sad` AS `dua` from `vn`.`awbInvoiceIn` `aii` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `awb_role` +-- + +/*!50001 DROP VIEW IF EXISTS `awb_role`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `awb_role` AS select `ar`.`id` AS `awb_role_id`,`ar`.`name` AS `name` from `vn`.`awbRole` `ar` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `awb_unit` +-- + +/*!50001 DROP VIEW IF EXISTS `awb_unit`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `awb_unit` AS select `au`.`id` AS `awb_unit_id`,`au`.`operation` AS `operation` from `vn`.`awbUnit` `au` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `balance_nest_tree` +-- + +/*!50001 DROP VIEW IF EXISTS `balance_nest_tree`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `balance_nest_tree` AS select `bnt`.`lft` AS `lft`,`bnt`.`rgt` AS `rgt`,`bnt`.`name` AS `name`,`bnt`.`id` AS `id`,`bnt`.`expenseFk` AS `Id_Gasto`,`bnt`.`isSelected` AS `isSelected` from `vn`.`balanceNestTree` `bnt` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `barcodes` -- @@ -91752,42 +91148,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `bionic_updating_options` --- - -/*!50001 DROP VIEW IF EXISTS `bionic_updating_options`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `bionic_updating_options` AS select `t`.`id` AS `buo_id`,`t`.`description` AS `description` from `vn`.`ticketUpdateAction` `t` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `businessReasonEnd` --- - -/*!50001 DROP VIEW IF EXISTS `businessReasonEnd`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `businessReasonEnd` AS select `b`.`id` AS `id`,`b`.`reason` AS `reason` from `vn`.`businessReasonEnd` `b` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `buySource` -- @@ -91824,6 +91184,60 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `buy_edi_k012` +-- + +/*!50001 DROP VIEW IF EXISTS `buy_edi_k012`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `buy_edi_k012` AS select `eek`.`id` AS `buy_edi_k012_id`,`eek`.`description` AS `description` from `edi`.`ektK1` `eek` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `buy_edi_k03` +-- + +/*!50001 DROP VIEW IF EXISTS `buy_edi_k03`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `buy_edi_k03` AS select `eek`.`id` AS `buy_edi_k03_id`,`eek`.`description` AS `description` from `edi`.`ektK3` `eek` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `buy_edi_k04` +-- + +/*!50001 DROP VIEW IF EXISTS `buy_edi_k04`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `buy_edi_k04` AS select `eek`.`id` AS `buy_edi_k04_id`,`eek`.`description` AS `description` from `edi`.`ektK4` `eek` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `cdr` -- @@ -91932,42 +91346,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `cl_dev` --- - -/*!50001 DROP VIEW IF EXISTS `cl_dev`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `cl_dev` AS select `c`.`id` AS `id`,`c`.`description` AS `devolucion` from `vn`.`claimRedelivery` `c` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `cl_est` --- - -/*!50001 DROP VIEW IF EXISTS `cl_est`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `cl_est` AS select `c`.`id` AS `id`,`c`.`description` AS `estado`,`c`.`roleFk` AS `roleFk` from `vn`.`claimState` `c` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `cl_main` -- @@ -92077,10 +91455,10 @@ USE `vn2008`; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `deliveryPoint` +-- Final view structure for view `credit` -- -/*!50001 DROP VIEW IF EXISTS `deliveryPoint`*/; +/*!50001 DROP VIEW IF EXISTS `credit`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -92089,16 +91467,16 @@ USE `vn2008`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `deliveryPoint` AS select `dp`.`id` AS `id`,`dp`.`name` AS `name`,`dp`.`ubication` AS `ubication` from `vn`.`deliveryPoint` `dp` */; +/*!50001 VIEW `credit` AS select `c`.`id` AS `id`,`c`.`clientFk` AS `Id_Cliente`,`c`.`workerFk` AS `Id_Trabajador`,`c`.`amount` AS `amount`,`c`.`created` AS `odbc_date` from `vn`.`clientCredit` `c` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `device_user` +-- Final view structure for view `definitivo` -- -/*!50001 DROP VIEW IF EXISTS `device_user`*/; +/*!50001 DROP VIEW IF EXISTS `definitivo`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -92107,7 +91485,7 @@ USE `vn2008`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `device_user` AS select `dpu`.`deviceProductionFk` AS `device_id`,`dpu`.`userFk` AS `user_id` from `vn`.`deviceProductionUser` `dpu` */; +/*!50001 VIEW `definitivo` AS select `d`.`id` AS `definitivo_id`,`d`.`companyFk` AS `empresa_id`,`d`.`started` AS `desde`,`d`.`ended` AS `hasta`,`d`.`created` AS `fecha` from `vn`.`dmsStorageBox` `d` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -92166,78 +91544,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `edi_feature` --- - -/*!50001 DROP VIEW IF EXISTS `edi_feature`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `edi_feature` AS select `edi`.`feature`.`item_id` AS `item_id`,`edi`.`feature`.`feature_type_id` AS `feature_type_id`,`edi`.`feature`.`feature_value` AS `feature_value`,`edi`.`feature`.`entry_date` AS `entry_date`,`edi`.`feature`.`expiry_date` AS `expiry_date`,`edi`.`feature`.`change_date_time` AS `change_date_time` from `edi`.`feature` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `edi_genus` --- - -/*!50001 DROP VIEW IF EXISTS `edi_genus`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `edi_genus` AS select `edi`.`genus`.`genus_id` AS `genus_id`,`edi`.`genus`.`latin_genus_name` AS `latin_genus_name`,`edi`.`genus`.`entry_date` AS `entry_date`,`edi`.`genus`.`expiry_date` AS `expiry_date`,`edi`.`genus`.`change_date_time` AS `change_date_time` from `edi`.`genus` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `edi_item_feature` --- - -/*!50001 DROP VIEW IF EXISTS `edi_item_feature`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `edi_item_feature` AS select `edi`.`item_feature`.`item_id` AS `item_id`,`edi`.`item_feature`.`presentation_order` AS `presentation_order`,`edi`.`item_feature`.`feature` AS `feature`,`edi`.`item_feature`.`regulation_type` AS `regulation_type`,`edi`.`item_feature`.`entry_date` AS `entry_date`,`edi`.`item_feature`.`expiry_date` AS `expiry_date`,`edi`.`item_feature`.`change_date_time` AS `change_date_time` from `edi`.`item_feature` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `edi_plant` --- - -/*!50001 DROP VIEW IF EXISTS `edi_plant`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `edi_plant` AS select `edi`.`plant`.`plant_id` AS `plant_id`,`edi`.`plant`.`genus_id` AS `genus_id`,`edi`.`plant`.`specie_id` AS `specie_id`,`edi`.`plant`.`entry_date` AS `entry_date`,`edi`.`plant`.`expiry_date` AS `expiry_date`,`edi`.`plant`.`change_date_time` AS `change_date_time` from `edi`.`plant` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `edi_specie` -- @@ -92274,42 +91580,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `edi_type` --- - -/*!50001 DROP VIEW IF EXISTS `edi_type`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `edi_type` AS select `edi`.`type`.`type_id` AS `type_id`,`edi`.`type`.`type_group_id` AS `type_group_id`,`edi`.`type`.`description` AS `description`,`edi`.`type`.`entry_date` AS `entry_date`,`edi`.`type`.`expiry_date` AS `expiry_date`,`edi`.`type`.`change_date_time` AS `change_date_time` from `edi`.`type` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `edi_value` --- - -/*!50001 DROP VIEW IF EXISTS `edi_value`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `edi_value` AS select `edi`.`value`.`type_id` AS `type_id`,`edi`.`value`.`type_value` AS `type_value`,`edi`.`value`.`type_description` AS `type_description`,`edi`.`value`.`entry_date` AS `entry_date`,`edi`.`value`.`expiry_date` AS `expiry_date`,`edi`.`value`.`change_date_time` AS `change_date_time` from `edi`.`value` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `empresa` -- @@ -92364,186 +91634,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `escritos` --- - -/*!50001 DROP VIEW IF EXISTS `escritos`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `escritos` AS select `s`.`id` AS `id`,`s`.`code` AS `abrev`,`s`.`description` AS `descripcion`,`s`.`isVisible` AS `visible`,`s`.`hasCompany` AS `hasCompany` from `vn`.`sample` `s` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `expeditions` --- - -/*!50001 DROP VIEW IF EXISTS `expeditions`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditions` AS select `e`.`id` AS `expeditions_id`,`e`.`agencyModeFk` AS `agency_id`,`e`.`ticketFk` AS `ticket_id`,`e`.`freightItemFk` AS `EsBulto`,`e`.`created` AS `odbc_date`,`e`.`counter` AS `counter`,`e`.`workerFk` AS `workerFk`,`e`.`externalId` AS `externalId`,`p`.`itemFk` AS `Id_article` from (`vn`.`expedition` `e` left join `vn`.`packaging` `p` on(`p`.`id` = `e`.`packagingFk`)) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `gestdoc` --- - -/*!50001 DROP VIEW IF EXISTS `gestdoc`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `gestdoc` AS select `d`.`id` AS `id`,`d`.`dmsTypeFk` AS `gesttip_id`,`d`.`file` AS `file`,`d`.`contentType` AS `contentType`,`d`.`workerFk` AS `trabajador_id`,`d`.`warehouseFk` AS `warehouse_id`,`d`.`companyFk` AS `emp_id`,`d`.`hardCopyNumber` AS `orden`,`d`.`hasFile` AS `original`,`d`.`reference` AS `sref`,`d`.`description` AS `brief`,`d`.`created` AS `odbc_date` from `vn`.`dms` `d` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `gesttip` --- - -/*!50001 DROP VIEW IF EXISTS `gesttip`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `gesttip` AS select `g`.`id` AS `id`,`g`.`name` AS `tipo`,`g`.`readRoleFk` AS `readRoleFk`,`g`.`writeRoleFk` AS `writeRoleFk`,`g`.`code` AS `code` from `vn`.`dmsType` `g` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `intrastat_data` --- - -/*!50001 DROP VIEW IF EXISTS `intrastat_data`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `intrastat_data` AS select `ii`.`id` AS `id`,`ii`.`invoiceInFk` AS `recibida_id`,`ii`.`net` AS `neto`,`ii`.`intrastatFk` AS `intrastat_id`,`ii`.`amount` AS `importe`,`ii`.`stems` AS `unidades`,`ii`.`countryFk` AS `Paises_Id`,`ii`.`dated` AS `odbc_date`,`ii`.`statisticalValue` AS `valorestadistico` from `vn`.`invoiceInIntrastat` `ii` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `invoiceCorrection` --- - -/*!50001 DROP VIEW IF EXISTS `invoiceCorrection`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `invoiceCorrection` AS select `ic`.`correctingFk` AS `correctingFk`,`ic`.`correctedFk` AS `correctedFk`,`ic`.`cplusRectificationTypeFk` AS `cplusRectificationTypeFk`,`ic`.`siiTypeInvoiceOutFk` AS `siiTypeInvoiceOutFk`,`ic`.`invoiceCorrectionTypeFk` AS `invoiceCorrectionTypeFk` from `vn`.`invoiceCorrection` `ic` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `itemTag` --- - -/*!50001 DROP VIEW IF EXISTS `itemTag`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemTag` AS select `i`.`id` AS `id`,`i`.`itemFk` AS `itemFk`,`i`.`tagFk` AS `tagFk`,`i`.`value` AS `value`,`i`.`priority` AS `priority` from `vn`.`itemTag` `i` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `item_entry_in` --- - -/*!50001 DROP VIEW IF EXISTS `item_entry_in`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `item_entry_in` AS select `t`.`warehouse_id` AS `warehouse_id`,`t`.`warehouse_id_out` AS `warehouse_id_out`,`t`.`landing` AS `dat`,`m`.`Id_Article` AS `item_id`,`m`.`Cantidad` AS `amount`,`t`.`received` AS `received`,`e`.`Redada` AS `isVirtualStock`,`e`.`Id_Entrada` AS `entryFk` from ((`vn2008`.`Compres` `m` join `vn2008`.`Entradas` `e` on(`m`.`Id_Entrada` = `e`.`Id_Entrada`)) join `vn2008`.`travel` `t` on(`e`.`travel_id` = `t`.`id`)) where `e`.`Inventario` = 0 and `m`.`Cantidad` <> 0 */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `item_entry_out` --- - -/*!50001 DROP VIEW IF EXISTS `item_entry_out`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `item_entry_out` AS select `t`.`warehouse_id_out` AS `warehouse_id`,`t`.`shipment` AS `dat`,`m`.`Id_Article` AS `item_id`,-`m`.`Cantidad` AS `amount`,`t`.`delivered` <> 0 or ifnull(`co`.`valor`,0) AS `delivered`,`e`.`Id_Entrada` AS `entryFk` from (((`vn2008`.`Compres` `m` join `vn2008`.`Entradas` `e` on(`m`.`Id_Entrada` = `e`.`Id_Entrada`)) join `vn2008`.`travel` `t` on(`e`.`travel_id` = `t`.`id`)) left join `vn2008`.`Compres_ok` `co` on(`co`.`Id_Compra` = `m`.`Id_Compra` and `co`.`Id_Accion` = 3 and `co`.`valor` <> 0)) where `e`.`Inventario` = 0 and `e`.`Redada` = 0 and `m`.`Cantidad` <> 0 */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `item_out` --- - -/*!50001 DROP VIEW IF EXISTS `item_out`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `item_out` AS select `t`.`warehouse_id` AS `warehouse_id`,`t`.`Fecha` AS `dat`,`m`.`Id_Article` AS `item_id`,-`m`.`Cantidad` AS `amount`,`m`.`OK` AS `ok`,`m`.`Reservado` AS `Reservado`,`t`.`Factura` AS `invoice`,`m`.`Id_Movimiento` AS `saleFk`,`m`.`Id_Ticket` AS `ticketFk` from (`vn2008`.`Movimientos` `m` join `vn2008`.`Tickets` `t` on(`m`.`Id_Ticket` = `t`.`Id_Ticket`)) where `m`.`Cantidad` <> 0 */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `mail` -- @@ -92688,42 +91778,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `person_user` --- - -/*!50001 DROP VIEW IF EXISTS `person_user`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `person_user` AS select `u`.`id` AS `id`,`u`.`role` AS `mysql_user_id`,`u`.`name` AS `name`,`u`.`password` AS `password`,`u`.`active` AS `active`,`u`.`lastPassChange` AS `last_pass_change` from `account`.`user` `u` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `person_user_idtrabajador` --- - -/*!50001 DROP VIEW IF EXISTS `person_user_idtrabajador`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `person_user_idtrabajador` AS select `t`.`Id_Trabajador` AS `Id_Trabajador` from (`vn2008`.`person_user` `p` join `vn2008`.`Trabajadores` `t` on(`p`.`id` = `t`.`user_id`)) where `t`.`user_id` = `account`.`myUser_getId`() */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `plantpassport` -- @@ -92922,24 +91976,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `reference_min` --- - -/*!50001 DROP VIEW IF EXISTS `reference_min`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `reference_min` AS select `rc`.`dated` AS `date`,`rc`.`value` AS `rate`,`rc`.`currencyFk` AS `moneda_id` from `vn`.`referenceCurrent` `rc` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `reference_rate` -- @@ -93187,7 +92223,7 @@ USE `vn2008`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_compres` AS select `TP`.`Id_Tipo` AS `Familia`,`RN`.`id` AS `reino_id`,`C`.`Id_Compra` AS `Id_Compra`,`C`.`Id_Entrada` AS `Id_Entrada`,`C`.`Id_Article` AS `Id_Article`,`C`.`Cantidad` AS `Cantidad`,`C`.`Costefijo` AS `Costefijo`,`C`.`Portefijo` AS `Portefijo`,`C`.`Novincular` AS `Novincular`,`C`.`Etiquetas` AS `Etiquetas`,`C`.`Packing` AS `Packing`,`C`.`grouping` AS `grouping`,`C`.`Comisionfija` AS `Comisionfija`,`C`.`Embalajefijo` AS `Embalajefijo`,`C`.`Id_Cubo` AS `Id_Cubo`,`C`.`Tarifa1` AS `Tarifa1`,`C`.`Tarifa2` AS `Tarifa2`,`C`.`Tarifa3` AS `Tarifa3`,`C`.`PVP` AS `PVP`,`C`.`Vida` AS `Vida`,`C`.`Id_Trabajador` AS `Id_Trabajador`,`C`.`punteo` AS `punteo`,`C`.`odbc_date` AS `odbc_date`,`E`.`Inventario` AS `Inventario`,`E`.`Id_Proveedor` AS `Id_Proveedor`,`E`.`Fecha` AS `Fecha`,`E`.`Confirmada` AS `Confirmada`,`E`.`Redada` AS `Redada`,`E`.`empresa_id` AS `empresa_id`,`E`.`travel_id` AS `travel_id`,`E`.`Pedida` AS `Pedida`,`E`.`recibida_id` AS `recibida_id`,`TR`.`id` AS `id`,`TR`.`shipment` AS `shipment`,`TR`.`landing` AS `landing`,`TR`.`warehouse_id` AS `warehouse_id`,`TR`.`warehouse_id_out` AS `warehouse_id_out`,`TR`.`agency_id` AS `agency_id`,`TR`.`ref` AS `ref`,`TR`.`delivered` AS `delivered`,`TR`.`received` AS `received`,`A`.`Article` AS `Article`,`A`.`Medida` AS `Medida`,`A`.`Tallos` AS `Tallos`,`C`.`caja` AS `caja`,`A`.`Categoria` AS `Categoria`,`A`.`id_origen` AS `id_origen`,`TP`.`Id_Tipo` AS `Tipo`,`A`.`tipo_id` AS `tipo_id`,`A`.`Color` AS `Color`,`A`.`Min` AS `Min`,`C`.`Costefijo` + `C`.`Embalajefijo` + `C`.`Comisionfija` + `C`.`Portefijo` AS `Coste`,`W_OUT`.`fuente` AS `fuente`,if(`cb`.`Volumen` > 0,`cb`.`Volumen`,`cb`.`X` * `cb`.`Y` * if(`cb`.`Z` = 0,`A`.`Medida` + 10,`cb`.`Z`)) * `C`.`Etiquetas` AS `cm3`,`A`.`producer_id` AS `producer_id` from ((((((((`vn2008`.`Compres` `C` join `vn2008`.`Entradas` `E` on(`C`.`Id_Entrada` = `E`.`Id_Entrada`)) join `vn2008`.`travel` `TR` on(`TR`.`id` = `E`.`travel_id`)) join `vn2008`.`warehouse` `W_IN` on(`W_IN`.`id` = `TR`.`warehouse_id`)) join `vn2008`.`warehouse` `W_OUT` on(`W_OUT`.`id` = `TR`.`warehouse_id_out`)) join `vn2008`.`Articles` `A` on(`C`.`Id_Article` = `A`.`Id_Article`)) join `vn2008`.`Tipos` `TP` on(`A`.`tipo_id` = `TP`.`tipo_id`)) join `vn2008`.`reinos` `RN` on(`RN`.`id` = `TP`.`reino_id`)) join `vn2008`.`Cubos` `cb` on(`cb`.`Id_Cubo` = `C`.`Id_Cubo`)) where `W_IN`.`fuente` = 0 and `E`.`Inventario` = 0 and `E`.`Redada` = 0 */; +/*!50001 VIEW `v_compres` AS select `TP`.`Id_Tipo` AS `Familia`,`RN`.`id` AS `reino_id`,`C`.`Id_Compra` AS `Id_Compra`,`C`.`Id_Entrada` AS `Id_Entrada`,`C`.`Id_Article` AS `Id_Article`,`C`.`Cantidad` AS `Cantidad`,`C`.`Costefijo` AS `Costefijo`,`C`.`Portefijo` AS `Portefijo`,`C`.`Novincular` AS `Novincular`,`C`.`Etiquetas` AS `Etiquetas`,`C`.`Packing` AS `Packing`,`C`.`grouping` AS `grouping`,`C`.`Comisionfija` AS `Comisionfija`,`C`.`Embalajefijo` AS `Embalajefijo`,`C`.`Id_Cubo` AS `Id_Cubo`,`C`.`Tarifa1` AS `Tarifa1`,`C`.`Tarifa2` AS `Tarifa2`,`C`.`Tarifa3` AS `Tarifa3`,`C`.`PVP` AS `PVP`,`C`.`Vida` AS `Vida`,`C`.`Id_Trabajador` AS `Id_Trabajador`,`C`.`punteo` AS `punteo`,`C`.`odbc_date` AS `odbc_date`,`E`.`Inventario` AS `Inventario`,`E`.`Id_Proveedor` AS `Id_Proveedor`,`E`.`Fecha` AS `Fecha`,`E`.`Confirmada` AS `Confirmada`,`E`.`Redada` AS `Redada`,`E`.`empresa_id` AS `empresa_id`,`E`.`travel_id` AS `travel_id`,`E`.`Pedida` AS `Pedida`,`E`.`recibida_id` AS `recibida_id`,`TR`.`id` AS `id`,`TR`.`shipment` AS `shipment`,`TR`.`landing` AS `landing`,`TR`.`warehouse_id` AS `warehouse_id`,`TR`.`warehouse_id_out` AS `warehouse_id_out`,`TR`.`agency_id` AS `agency_id`,`TR`.`ref` AS `ref`,`TR`.`delivered` AS `delivered`,`TR`.`received` AS `received`,`A`.`Article` AS `Article`,`A`.`Medida` AS `Medida`,`A`.`Tallos` AS `Tallos`,`C`.`caja` AS `caja`,`A`.`Categoria` AS `Categoria`,`A`.`id_origen` AS `id_origen`,`TP`.`Id_Tipo` AS `Tipo`,`A`.`tipo_id` AS `tipo_id`,`A`.`Color` AS `Color`,`A`.`Min` AS `Min`,`C`.`Costefijo` + `C`.`Embalajefijo` + `C`.`Comisionfija` + `C`.`Portefijo` AS `Coste`,`W_OUT`.`isFeedStock` AS `fuente`,if(`cb`.`Volumen` > 0,`cb`.`Volumen`,`cb`.`X` * `cb`.`Y` * if(`cb`.`Z` = 0,`A`.`Medida` + 10,`cb`.`Z`)) * `C`.`Etiquetas` AS `cm3`,`A`.`producer_id` AS `producer_id` from ((((((((`vn2008`.`Compres` `C` join `vn2008`.`Entradas` `E` on(`C`.`Id_Entrada` = `E`.`Id_Entrada`)) join `vn2008`.`travel` `TR` on(`TR`.`id` = `E`.`travel_id`)) join `vn`.`warehouse` `W_IN` on(`W_IN`.`id` = `TR`.`warehouse_id`)) join `vn`.`warehouse` `W_OUT` on(`W_OUT`.`id` = `TR`.`warehouse_id_out`)) join `vn2008`.`Articles` `A` on(`C`.`Id_Article` = `A`.`Id_Article`)) join `vn2008`.`Tipos` `TP` on(`A`.`tipo_id` = `TP`.`tipo_id`)) join `vn2008`.`reinos` `RN` on(`RN`.`id` = `TP`.`reino_id`)) join `vn2008`.`Cubos` `cb` on(`cb`.`Id_Cubo` = `C`.`Id_Cubo`)) where `W_IN`.`isFeedStock` = 0 and `E`.`Inventario` = 0 and `E`.`Redada` = 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -93228,42 +92264,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `v_ventes` --- - -/*!50001 DROP VIEW IF EXISTS `v_ventes`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_ventes` AS select `Agencias`.`Agencia` AS `Agencia`,`A`.`Categoria` AS `Categoria`,`A`.`tipo_id` AS `tipo_id`,`A`.`Medida` AS `Medida`,`A`.`Article` AS `Article`,`A`.`Color` AS `Color`,`CS`.`Id_cliente` AS `Id_Cliente`,`TP`.`Id_Tipo` AS `Tipo`,`T`.`Factura` AS `Factura`,`T`.`warehouse_id` AS `warehouse_id`,`M`.`Id_Movimiento` AS `Id_Movimiento`,`M`.`Id_Article` AS `Id_Article`,`TP`.`Id_Tipo` AS `Familia`,`M`.`Id_Ticket` AS `Id_Ticket`,`M`.`Concepte` AS `Concepte`,`M`.`Cantidad` AS `Cantidad`,`M`.`quantity` AS `quantity`,`M`.`Preu` AS `Preu`,`M`.`Descuento` AS `Descuento`,if(`T`.`Fecha` >= '2015-10-01',`M`.`CostFixat`,`M`.`Preu` * (100 - `M`.`Descuento`) / 100) AS `CostFixat`,`M`.`Reservado` AS `Reservado`,`M`.`OK` AS `OK`,`M`.`PrecioFijado` AS `PrecioFijado`,`M`.`odbc_date` AS `odbc_date`,cast(`T`.`Fecha` as date) AS `Fecha`,`T`.`Fecha` AS `FechaCompleta`,`CS`.`consignatario` AS `Alias`,`T`.`Id_Consigna` AS `Id_Consigna`,`M`.`Cantidad` * `M`.`Preu` * (100 - `M`.`Descuento`) / 100 AS `Importe`,`O`.`Origen` AS `Origen`,`TP`.`reino_id` AS `reino_id`,`C`.`invoice` AS `invoice`,`A`.`producer_id` AS `producer_id` from ((((((((`vn2008`.`Movimientos` `M` join `vn2008`.`Tickets` `T` on(`M`.`Id_Ticket` = `T`.`Id_Ticket`)) join `vn2008`.`Consignatarios` `CS` on(`CS`.`id_consigna` = `T`.`Id_Consigna`)) join `vn2008`.`Clientes` `C` on(`CS`.`Id_cliente` = `C`.`id_cliente`)) join `vn2008`.`Articles` `A` on(`M`.`Id_Article` = `A`.`Id_Article`)) join `vn2008`.`Origen` `O` on(`O`.`id` = `A`.`id_origen`)) join `vn2008`.`Tipos` `TP` on(`A`.`tipo_id` = `TP`.`tipo_id`)) join `vn2008`.`reinos` `r` on(`TP`.`reino_id` = `r`.`id`)) join `vn2008`.`Agencias` on(`Agencias`.`Id_Agencia` = `T`.`Id_Agencia`)) where `T`.`Fecha` >= '2013-01-01' and `C`.`real` > 0 and `r`.`id` <> 6 */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_xsubcuentas` --- - -/*!50001 DROP VIEW IF EXISTS `v_xsubcuentas`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_xsubcuentas` AS select `Clientes`.`Cuenta` AS `COD`,`Clientes`.`razonSocial` AS `TITULO`,concat(if(`p`.`CEE` = 1 and ascii(left(`Clientes`.`if`,1)) < 58,`p`.`Codigo`,''),`Clientes`.`if`) AS `NIF`,`Clientes`.`domicilio` AS `DOMICILIO`,`Clientes`.`poblacion` AS `POBLACION`,`province`.`name` AS `PROVINCIA`,`Clientes`.`codPostal` AS `CODPOSTAL`,`p`.`Codigo` AS `country_code`,`sub`.`empresa_id` AS `empresa_id`,substr(`Clientes`.`e-mail`,1,coalesce(nullif(locate(',',`Clientes`.`e-mail`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0 or `p`.`CEE` = 1 and `Clientes`.`vies` = 0,1,if(`p`.`CEE` = 1 and `Clientes`.`vies` <> 0,2,4)) AS `IDNIF` from (((`vn2008`.`Clientes` join (select distinct `Facturas`.`Id_Cliente` AS `Id_Cliente`,`Facturas`.`empresa_id` AS `empresa_id` from `vn2008`.`Facturas` where `Facturas`.`Fecha` > `util`.`VN_CURDATE`() + interval -2 month union select `Recibos`.`Id_Cliente` AS `Id_Cliente`,`Recibos`.`empresa_id` AS `empresa_id` from `vn2008`.`Recibos` where `Recibos`.`Fechacobro` > `util`.`VN_CURDATE`() + interval -2 month) `sub` on(`Clientes`.`id_cliente` = `sub`.`Id_Cliente`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Clientes`.`Id_Pais`)) join `vn2008`.`province` on(`Clientes`.`province_id` = `province`.`province_id`)) group by `Clientes`.`id_cliente`,`sub`.`empresa_id` union all select `Proveedores`.`cuenta` AS `Cuenta`,`Proveedores`.`Proveedor` AS `Proveedor`,concat(if(`p`.`CEE` = 1 and ascii(left(`Proveedores`.`NIF`,1)) < 58,`p`.`Codigo`,''),`Proveedores`.`NIF`) AS `NIF`,`Proveedores`.`Domicilio` AS `Domicilio`,`Proveedores`.`Localidad` AS `Localidad`,`prov`.`name` AS `Provincia`,`Proveedores`.`codpos` AS `CP`,`p`.`Codigo` AS `country_code`,`sub`.`empresa_id` AS `empresa_id`,substr(`c`.`email`,1,coalesce(nullif(locate(',',`c`.`email`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0,1,if(`p`.`CEE` = 1,2,4)) AS `IDNIF` from ((((`vn2008`.`Proveedores` join (select `recibida`.`proveedor_id` AS `proveedor_id`,`recibida`.`empresa_id` AS `empresa_id` from `vn2008`.`recibida` where `recibida`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `recibida`.`proveedor_id`,`recibida`.`empresa_id` union all select `pago`.`id_proveedor` AS `id_proveedor`,`pago`.`empresa_id` AS `empresa_id` from `vn2008`.`pago` where `pago`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `pago`.`id_proveedor`,`pago`.`empresa_id`) `sub` on(`Proveedores`.`Id_Proveedor` = `sub`.`proveedor_id`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Proveedores`.`pais_id`)) left join `vn2008`.`province` `prov` on(`prov`.`province_id` = `Proveedores`.`province_id`)) left join `vn`.`supplierContact` `c` on(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`)) where `Proveedores`.`oficial` <> 0 group by `sub`.`proveedor_id`,`sub`.`empresa_id` union all select `Gastos`.`Id_Gasto` collate utf8mb3_unicode_ci AS `Id_Gasto`,`Gastos`.`Gasto` collate utf8mb3_unicode_ci AS `Gasto`,NULL AS `NULL`,NULL AS `My_exp_NULL`,NULL AS `My_exp_1_NULL`,NULL AS `My_exp_2_NULL`,NULL AS `My_exp_3_NULL`,NULL AS `country_code`,`e`.`id` AS `id`,NULL AS `EMAIL`,1 AS `IDNIF` from (`vn2008`.`Gastos` join `vn2008`.`empresa` `e` on(`e`.`id` = 442)) union all select `Bancos`.`Cuenta` AS `Cuenta`,`Bancos`.`Banco` AS `Banco`,NULL AS `NULL`,NULL AS `My_exp_NULL`,NULL AS `My_exp_1_NULL`,NULL AS `My_exp_2_NULL`,NULL AS `My_exp_3_NULL`,NULL AS `country_code`,`e`.`id` AS `id`,NULL AS `EMAIL`,1 AS `IDNIF` from (`vn2008`.`Bancos` join `vn2008`.`empresa` `e` on(`e`.`id` = 442)) union all select lpad(right(`Proveedores`.`cuenta`,5),10,'47510000') AS `Cuenta`,`Proveedores`.`Proveedor` AS `Proveedor`,`Proveedores`.`NIF` AS `NIF`,`Proveedores`.`Domicilio` AS `Domicilio`,`Proveedores`.`Localidad` AS `Localidad`,`prov`.`name` AS `Provincia`,`Proveedores`.`codpos` AS `CP`,`p`.`Codigo` AS `country_code`,`sub`.`empresa_id` AS `empresa_id`,substr(`c`.`email`,1,coalesce(nullif(locate(',',`c`.`email`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0,1,if(`p`.`CEE` = 1,2,4)) AS `IDNIF` from ((((`vn2008`.`Proveedores` join (select `recibida`.`proveedor_id` AS `proveedor_id`,`recibida`.`empresa_id` AS `empresa_id` from `vn2008`.`recibida` where `recibida`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `recibida`.`proveedor_id`,`recibida`.`empresa_id` union all select `pago`.`id_proveedor` AS `id_proveedor`,`pago`.`empresa_id` AS `empresa_id` from `vn2008`.`pago` where `pago`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `pago`.`id_proveedor`,`pago`.`empresa_id`) `sub` on(`Proveedores`.`Id_Proveedor` = `sub`.`proveedor_id`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Proveedores`.`pais_id`)) left join `vn2008`.`province` `prov` on(`prov`.`province_id` = `Proveedores`.`province_id`)) left join `vn`.`supplierContact` `c` on(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`)) where (`Proveedores`.`cuenta` like '_____3____' or `Proveedores`.`cuenta` like '_____2____') and `Proveedores`.`oficial` = 1 group by `sub`.`proveedor_id`,`sub`.`empresa_id` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `versiones` -- @@ -93281,60 +92281,6 @@ USE `vn2008`; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `warehouse` --- - -/*!50001 DROP VIEW IF EXISTS `warehouse`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `warehouse` AS select `w`.`id` AS `id`,`w`.`name` AS `name`,`w`.`isInventory` AS `inventario`,`w`.`isFeedStock` AS `fuente`,`w`.`isComparative` AS `is_comparative`,`w`.`hasComission` AS `comisionantes`,`w`.`hasAvailable` AS `reserve`,`w`.`isManaged` AS `isManaged`,`w`.`isForTicket` AS `tpv`,`w`.`hasStowaway` AS `hasStowaway`,`w`.`hasDms` AS `hasDms`,`w`.`addressName` AS `address_name`,`w`.`delay` AS `delay`,`w`.`countryFk` AS `Id_Paises`,`w`.`labelZone` AS `zone_label`,`w`.`valuatedInventory` AS `valuatedInventory`,`w`.`hasConfectionTeam` AS `hasConfectionTeam` from `vn`.`warehouse` `w` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `workerDocument` --- - -/*!50001 DROP VIEW IF EXISTS `workerDocument`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerDocument` AS select `vn`.`workerDocument`.`id` AS `id`,`vn`.`workerDocument`.`worker` AS `worker`,`vn`.`workerDocument`.`document` AS `document`,`vn`.`workerDocument`.`isReadableByWorker` AS `isReadableByWorker` from `vn`.`workerDocument` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `workerTeam` --- - -/*!50001 DROP VIEW IF EXISTS `workerTeam`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTeam` AS select `wt`.`team` AS `team`,`wt`.`id` AS `id`,`wt`.`workerFk` AS `user` from `vn`.`workerTeam` `wt` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -93345,4 +92291,4 @@ USE `vn2008`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-02-15 10:21:18 +-- Dump completed on 2024-02-23 11:43:22 diff --git a/db/dump/.dump/triggers.sql b/db/dump/.dump/triggers.sql index 2da83db43..9da5f32fc 100644 --- a/db/dump/.dump/triggers.sql +++ b/db/dump/.dump/triggers.sql @@ -1735,6 +1735,33 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`accountReconciliation_beforeInsert` + BEFORE INSERT ON `accountReconciliation` + FOR EACH ROW + + SET NEW.calculatedCode = REPLACE( + REPLACE( + REPLACE( + REPLACE( + CONCAT(NEW.supplierAccountFk,NEW.operationDated,NEW.amount,NEW.concept,NEW.debitCredit) + ,' ','') + ,":",'') + ,'-','') + ,'.','') */;; +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`.`address_beforeInsert` BEFORE INSERT ON `address` FOR EACH ROW @@ -2002,6 +2029,33 @@ BEGIN SET NEW.year= year(util.VN_CURDATE()); +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`.`awbInvoiceIn_afterDelete` + AFTER DELETE ON `awbInvoiceIn` + FOR EACH ROW +BEGIN + IF (NOT(SELECT COUNT(*) FROM invoiceInTax where invoiceInFk = OLD.invoiceInFk)) + AND + (NOT(SELECT COUNT(*) FROM invoiceInDueDay where invoiceInFk = OLD.invoiceInFk)) + AND + (NOT(SELECT isBooked FROM invoiceIn WHERE id = OLD.invoiceInFk) ) + THEN + DELETE FROM invoiceIn WHERE id = OLD.invoiceInFk; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -2389,8 +2443,8 @@ trig:BEGIN FROM genericAllocation ga JOIN entry e ON e.id = NEW.entryFk JOIN travel tr on tr.id = e.travelFk - WHERE ga.itemFk = vGenericFk - AND tr.landed BETWEEN ga.startDated AND ga.endDated; + WHERE ga.itemFk = vGenericFk + AND tr.landed BETWEEN ga.startDated AND ga.endDated; IF vGenericInDate THEN SET NEW.itemOriginalFk = NEW.itemFk; SET NEW.itemFk = vGenericFk; @@ -2412,6 +2466,13 @@ trig:BEGIN IF NEW.quantity < 0 THEN SET NEW.isIgnored = TRUE; END IF; + + IF NOT (NEW.itemFk <=> OLD.itemFk) OR + NOT (OLD.entryFk <=> NEW.entryFk) THEN + CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck + SELECT NEW.id; + CALL buy_checkItem(); + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -4681,6 +4742,16 @@ BEGIN CALL travel_requestRecalc(OLD.travelFk); CALL travel_requestRecalc(NEW.travelFk); END IF; + + + IF NOT (NEW.travelFk <=> OLD.travelFk) THEN + CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck + SELECT b.id + FROM buy b + WHERE b.entryFk = NEW.id; + + CALL buy_checkItem(); + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -4800,33 +4871,33 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expedition_beforeInsert` BEFORE INSERT ON `expedition` FOR EACH ROW BEGIN DECLARE intcounter INT; - DECLARE vShipFk INT; + DECLARE vShipFk INT; SET NEW.editorFk = account.myUser_getId(); IF NEW.freightItemFk IS NOT NULL THEN - UPDATE ticket SET packages = nz(packages) + 1 WHERE id = NEW.ticketFk; + UPDATE ticket SET packages = IFNULL(packages, 0) + 1 WHERE id = NEW.ticketFk; SELECT IFNULL(MAX(counter),0) +1 INTO intcounter - FROM expedition e + FROM expedition e INNER JOIN ticket t1 ON e.ticketFk = t1.id - LEFT JOIN ticketState ts ON ts.ticketFk = t1.id + LEFT JOIN ticketState ts ON ts.ticketFk = t1.id INNER JOIN ticket t2 ON t2.addressFk = t1.addressFk AND DATE(t2.shipped) = DATE(t1.shipped) - AND t1.warehouseFk = t2.warehouseFk + AND t1.warehouseFk = t2.warehouseFk WHERE t2.id = NEW.ticketFk AND ts.alertLevel < 3 AND t1.companyFk = t2.companyFk - AND t1.agencyModeFk = t2.agencyModeFk; + AND t1.agencyModeFk = t2.agencyModeFk; SET NEW.`counter` = intcounter; END IF; @@ -9807,15 +9878,7 @@ DELIMITER ;; FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); -/* - IF ((NOT NEW.shipped <=> OLD.shipped ) - OR (NOT NEW.landed <=> OLD.landed ) - OR (NOT NEW.warehouseInFk <=> OLD.warehouseInFk ) - OR (NOT NEW.warehouseOutFk <=> OLD.warehouseOutFk )) - AND (OLD.totalEntries AND OLD.landed < CURDATE()) THEN - CALL util.throw("Cannot past travels with entries"); - END IF; -*/ + IF NOT (NEW.landed <=> OLD.landed) OR NOT (NEW.shipped <=> OLD.shipped) THEN CALL travel_checkDates(NEW.shipped, NEW.landed); @@ -9854,6 +9917,19 @@ BEGIN SET commission = entry_getCommission(travelFk, currencyFk,supplierFk) WHERE travelFk = NEW.id; END IF; + + IF NOT (NEW.agencyModeFk <=> OLD.agencyModeFk) THEN + IF (SELECT hasWeightVolumetric FROM agencyMode WHERE id = NEW.agencyModeFk) THEN + CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck + SELECT b.id + FROM entry e + JOIN buy b ON b.entryFk = e.id + JOIN item i ON i.id = b.itemFk + WHERE e.travelFk = NEW.id; + + CALL buy_checkItem(); + END IF; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10019,30 +10095,6 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`warehouse_afterUpdate` - AFTER UPDATE ON `warehouse` - FOR EACH ROW -BEGIN - IF NEW.isFeedStock IS TRUE AND OLD.isFeedStock IS FALSE THEN - INSERT IGNORE INTO warehouseAlias(`name`) VALUES(NEW.`name`); - INSERT IGNORE INTO warehouseJoined(warehouseFk, warehouseAliasFk) - VALUES(NEW.id,LAST_INSERT_ID()); - 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`.`worker_beforeInsert` BEFORE INSERT ON `worker` FOR EACH ROW @@ -10713,146 +10765,6 @@ USE `vn2008`; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`Conteo_afterInsert` - AFTER INSERT ON `Conteo` - FOR EACH ROW -BEGIN - DECLARE intTravel INTEGER; - SELECT t.id INTO intTravel FROM Compres c JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada - JOIN travel t ON t.id = e.travel_id - WHERE landing = util.VN_CURDATE() AND c.Id_Article = NEW.Id_Article AND warehouse_id = NEW.warehouse_id AND received <> TRUE LIMIT 1; - IF (intTravel) then - UPDATE travel SET received = TRUE WHERE id = intTravel; - 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 `vn2008`.`account_conciliacion_beforeInsert` - BEFORE INSERT ON `account_conciliacion` - FOR EACH ROW -set new.id_calculated = replace( - replace( - replace( - replace( - concat(new.Id_Proveedores_account,new.Fechaoperacion,new.importe,new.Concepto,new.DebeHaber) - ,' ','') - ,":",'') - ,'-','') - ,'.','') */;; -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 `vn2008`.`agency_hour_beforeInsert` - BEFORE INSERT ON `agency_hour` - FOR EACH ROW -BEGIN - DECLARE vAlreadyExists BOOLEAN DEFAULT FALSE; - IF NEW.week_day IS NULL AND NEW.province_id IS NULL AND NEW.subtract_day = 0 AND NEW.max_hour = 0 THEN - CALL util.throw ('FILL_MORE_FIELDS'); - END IF; - - SELECT COUNT(*) INTO vAlreadyExists - FROM vn2008.agency_hour - WHERE NEW.week_day <=> week_day AND NEW.province_id <=> province_id - AND NEW.warehouse_id <=> warehouse_id AND NEW.max_hour <=> max_hour - AND NEW.agency_id <=> agency_id; - - IF vAlreadyExists > 1 THEN - CALL util.throw('ALREADY_EXISTS'); - 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 `vn2008`.`agency_hour_afterUpdate` - AFTER UPDATE ON `agency_hour` - FOR EACH ROW -BEGIN -DECLARE vAlreadyExists BOOLEAN DEFAULT FALSE; - - SELECT COUNT(*) INTO vAlreadyExists - FROM vn2008.agency_hour - WHERE NEW.week_day <=> week_day AND NEW.province_id <=> province_id - AND NEW.warehouse_id <=> warehouse_id AND NEW.max_hour <=> max_hour - AND NEW.agency_id <=> agency_id; - - IF vAlreadyExists > 1 THEN - CALL util.throw('ALREADY_EXISTS'); - 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 `vn2008`.`awb_recibida_afterDelete` - AFTER DELETE ON `awb_recibida` - FOR EACH ROW -IF (SELECT COUNT(*) FROM recibida_iva where recibida_id = OLD.recibida_id) = 0 - AND - (SELECT COUNT(*) FROM recibida_vencimiento where recibida_id = OLD.recibida_id) = 0 - AND - (SELECT contabilizada FROM recibida WHERE id = OLD.recibida_id) = 0 -THEN - DELETE FROM recibida WHERE id = OLD.recibida_id; -END IF */;; -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 `vn2008`.`movement_label_afterUpdate` AFTER UPDATE ON `movement_label` FOR EACH ROW @@ -10870,4 +10782,4 @@ DELIMITER ; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-02-15 10:21:45 +-- Dump completed on 2024-02-23 11:43:46 diff --git a/db/dump/fixtures.after.sql b/db/dump/fixtures.after.sql index 4c5f89d97..bda625a96 100644 --- a/db/dump/fixtures.after.sql +++ b/db/dump/fixtures.after.sql @@ -137,9 +137,6 @@ INSERT INTO vn.ticket (clientFk, warehouseFk, shipped, nickname, refFk, addressF INSERT INTO vn.sale (itemFk, ticketFk, concept, quantity, originalQuantity, price, discount, priceFixed, reserved, isPicked, isPriceFixed, created, isAdded) VALUES (1, 24, 'Ranged weapon longbow 2m', 1.00, NULL, 8.07, 0, 0.00, 0, 0, 0, '2022-07-06 00:00:00', 0); */ -INSERT INTO vn2008.zones (zone_id,name,printingOrder) - VALUES (1,'zone Test',1); - -- XXX: lab INSERT INTO `vn`.`businessReasonEnd` (`id`, `reason`) diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 43293c9ea..1d59c7ac0 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -352,12 +352,12 @@ INSERT INTO `vn`.`postCode`(`code`, `townFk`, `geoFk`) ('46600', 4, 7), ('EC170150', 5, 8); -INSERT INTO `vn`.`clientType`(`id`, `code`, `type`) +INSERT INTO `vn`.`clientType`(`code`, `type`) VALUES - (1, 'normal', 'Normal'), - (2, 'internalUse', 'Autoconsumo'), - (3, 'handMaking', 'Confección'), - (4, 'loses', 'Mermas'); + ('normal', 'Normal'), + ('internalUse', 'Autoconsumo'), + ('handMaking', 'Confección'), + ('loses', 'Mermas'); INSERT INTO `vn`.`cplusTerIdNif`(`id`, `description`) VALUES @@ -371,23 +371,23 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`) (4, 'GCN Channel'), (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`,`clientTypeFk`, `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`,`eypbc`, `businessTypeFk`,`typeFk`) 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, 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, 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, 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, 1, 0, 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, 1, NULL, 0, 0, 18, 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, 1, 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, 1, 0, 0, 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, 1, NULL, 0, 0, 19, 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, 1, 0, 0, NULL, 0, 0, 9, 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, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, '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', 4, 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', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses'); + (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'), + (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'), + (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'), + (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'), + (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'), + (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'), + (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'), + (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'), + (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'), + (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'), + (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'), + (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'); 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'), 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 FROM `account`.`role` `r` WHERE `r`.`hasLogin` = 1; @@ -2409,7 +2409,8 @@ INSERT INTO `vn`.`dmsType`(`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`) (17, 'cmr', 1, 1, 'cmr'), (18, 'dua', NULL, NULL, 'dua'), (19, 'inmovilizado', NULL, NULL, 'fixedAssets'), - (20, 'Reclamación', 1, 1, 'claim'); + (20, 'Reclamación', 1, 1, 'claim'), + (21, 'Entrada', 1, 1, 'entry'); INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`) VALUES @@ -2420,7 +2421,8 @@ INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `wa (5, 5, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', util.VN_CURDATE()), (6, 5, '6.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'NotExists', 'DoesNotExists', util.VN_CURDATE()), (7, 20, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()), - (8, 20, '8.mp4', 'video/mp4', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()); + (8, 20, '8.mp4', 'video/mp4', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()), + (9, 21, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'ENTRADA ID 1', util.VN_CURDATE()); INSERT INTO `vn`.`claimDms`(`claimFk`, `dmsFk`) VALUES @@ -3064,7 +3066,14 @@ INSERT INTO `vn`.`clientSms` (`id`, `clientFk`, `smsFk`, `ticketFk`) (13, 1101, 1, NULL), (14, 1101, 4, 27); +INSERT INTO `vn`.`entryDms`(`entryFk`, `dmsFk`, `editorFk`) + VALUES + (1, 9, 9); + INSERT INTO `vn`.`cmr` (id,truckPlate,observations,senderInstruccions,paymentInstruccions,specialAgreements,companyFk,addressToFk,addressFromFk,supplierFk,packagesList,merchandiseDetail,state) VALUES (1,'123456A','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',442,1,2,1,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'), (2,'123456N','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',69,3,4,2,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'), (3,'123456B','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',567,5,6,69,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'); + +UPDATE vn.department + SET workerFk = null; diff --git a/db/routines/bs/procedures/waste_addSales.sql b/db/routines/bs/procedures/waste_addSales.sql index ac6690129..0ab328b49 100644 --- a/db/routines/bs/procedures/waste_addSales.sql +++ b/db/routines/bs/procedures/waste_addSales.sql @@ -19,7 +19,7 @@ BEGIN itemFk, itemTypeFk, floor(sum(value)) as total, - floor(sum(IF(clientTypeFk = 'loses', value, 0))) as mermas + floor(sum(IF(typeFk = 'loses', value, 0))) as mermas FROM vn.saleValue where year = vYear and week = vWeek diff --git a/db/routines/util/functions/checkPrintableChars.sql b/db/routines/util/functions/checkPrintableChars.sql new file mode 100644 index 000000000..a4addce24 --- /dev/null +++ b/db/routines/util/functions/checkPrintableChars.sql @@ -0,0 +1,15 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`checkPrintableChars`( + vString VARCHAR(255) +) RETURNS tinyint(1) + DETERMINISTIC +BEGIN +/** + * Validates whether the input string contains only printable characters + * and Spanish special characters (such as ¡, ÿ, etc.). + * + * @vString string to check + */ + RETURN vString REGEXP '^[ -~¡-ÿ]*$'; +END$$ +DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/functions/isPalletHomogeneus.sql b/db/routines/vn/functions/isPalletHomogeneus.sql deleted file mode 100644 index b38fdcc5e..000000000 --- a/db/routines/vn/functions/isPalletHomogeneus.sql +++ /dev/null @@ -1,27 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`isPalletHomogeneus`(vExpedition INT) - RETURNS tinyint(1) - NOT DETERMINISTIC - READS SQL DATA -BEGIN - DECLARE vScanId INT; - DECLARE vDistinctRoutesInThePallet INT; - - SELECT scan_id INTO vScanId - FROM vn2008.scan_line - WHERE code = vExpedition - LIMIT 1; - - SELECT COUNT(*) INTO vDistinctRoutesInThePallet - FROM ( - SELECT DISTINCT t.Id_Ruta - FROM vn2008.scan_line sl - JOIN expedition e ON e.id = sl.code - JOIN vn2008.Tickets t ON t.Id_Ticket = e.ticketFk - WHERE sl.scan_id = vScanId - AND t.Id_Ruta - ) t1; - - RETURN vDistinctRoutesInThePallet = 1; -END$$ -DELIMITER ; diff --git a/db/routines/vn/procedures/bankPolicy_notifyExpired.sql b/db/routines/vn/procedures/bankPolicy_notifyExpired.sql index 6bdc6f759..52b747659 100644 --- a/db/routines/vn/procedures/bankPolicy_notifyExpired.sql +++ b/db/routines/vn/procedures/bankPolicy_notifyExpired.sql @@ -16,7 +16,7 @@ BEGIN LEFT JOIN vn.supplier s ON s.id = bp.supplierFk LEFT JOIN vn.bank b - ON b.id = bp.bankFk + ON b.id = bp.accountingFk WHERE bp.insuranceExpired = util.VN_CURDATE(); END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/clean.sql b/db/routines/vn/procedures/clean.sql index 7b561cfe0..06f36afce 100644 --- a/db/routines/vn/procedures/clean.sql +++ b/db/routines/vn/procedures/clean.sql @@ -22,6 +22,7 @@ BEGIN SET v2Years = util.VN_CURDATE() - INTERVAL 2 YEAR; SET v5Years = util.VN_CURDATE() - INTERVAL 5 YEAR; + DELETE FROM workerActivity WHERE created < v2Years; DELETE FROM ticketParking WHERE created < vDateShort; DELETE FROM routesMonitor WHERE dated < vDateShort; DELETE FROM workerTimeControlLog WHERE created < vDateShort; @@ -37,7 +38,8 @@ BEGIN DELETE FROM saleTracking WHERE created < vOneYearAgo; DELETE FROM ticketTracking WHERE created < v18Month; DELETE tobs FROM ticketObservation tobs - JOIN ticket t ON tobs.ticketFk = t.id WHERE t.shipped < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE()); + JOIN ticket t ON tobs.ticketFk = t.id + WHERE t.shipped < v5Years; DELETE sc.* FROM saleCloned sc JOIN sale s ON s.id = sc.saleClonedFk JOIN ticket t ON t.id = s.ticketFk WHERE t.shipped < vOneYearAgo; DELETE FROM sharingCart where ended < vDateShort; DELETE FROM sharingClient where ended < vDateShort; diff --git a/db/routines/vn/procedures/comparative_add.sql b/db/routines/vn/procedures/comparative_add.sql index 756096e54..44f9686aa 100644 --- a/db/routines/vn/procedures/comparative_add.sql +++ b/db/routines/vn/procedures/comparative_add.sql @@ -47,12 +47,11 @@ BEGIN JOIN itemCategory ic ON ic.id = tp.categoryFk JOIN ticket t ON t.id = s.ticketFk JOIN client c ON c.id = t.clientFk - JOIN clientType ct ON ct.id = c.clientTypeFk JOIN warehouse w ON w.id = t.warehouseFk JOIN address ad ON ad.id = t.addressFk LEFT JOIN province p ON p.id = ad.provinceFk WHERE tm.period BETWEEN vMaxPeriod AND vPeriod - AND ct.code <> 'loses' + AND c.typeFk <> 'loses' AND NOT w.code = 'inv' GROUP BY p.countryFk, s.itemFk, tm.period, t.warehouseFk; END IF; diff --git a/db/routines/vn/procedures/duaInvoiceInBooking.sql b/db/routines/vn/procedures/duaInvoiceInBooking.sql index b68d23f9d..26580907c 100644 --- a/db/routines/vn/procedures/duaInvoiceInBooking.sql +++ b/db/routines/vn/procedures/duaInvoiceInBooking.sql @@ -48,7 +48,7 @@ BEGIN IF vCounter > 0 OR vASIEN > 0 THEN - UPDATE vn2008.XDiario x + UPDATE XDiario x JOIN ledgerConfig lc ON lc.lastBookEntry = x.ASIEN SET x.ASIEN = vASIEN; diff --git a/db/routines/vn/procedures/invoiceInTax_afterUpsert.sql b/db/routines/vn/procedures/invoiceInTax_afterUpsert.sql index 77e989630..60ec34696 100644 --- a/db/routines/vn/procedures/invoiceInTax_afterUpsert.sql +++ b/db/routines/vn/procedures/invoiceInTax_afterUpsert.sql @@ -8,6 +8,7 @@ BEGIN */ DECLARE vTaxRowLimit INT; DECLARE vLines INT; + DECLARE vHasDistinctTransactions INT; SELECT taxRowLimit INTO vTaxRowLimit FROM invoiceInConfig; @@ -18,6 +19,18 @@ BEGIN IF vLines >= vTaxRowLimit THEN CALL util.throw (CONCAT('The maximum number of lines is ', vTaxRowLimit)); - END IF; + END IF; + + SELECT COUNT(DISTINCT transactionTypeSageFk) INTO vHasDistinctTransactions + FROM invoiceIn ii + JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id + JOIN invoiceInSerial iis ON iis.code = ii.serial + WHERE ii.id = vInvoiceInFk + AND iis.taxAreaFk = 'CEE' + AND transactionTypeSageFk; + + IF vHasDistinctTransactions > 1 THEN + CALL util.throw ('This invoice does not allow different types of transactions'); + END IF; END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/itemShelving_filterBuyer.sql b/db/routines/vn/procedures/itemShelving_filterBuyer.sql index a232139d3..7112aa48e 100644 --- a/db/routines/vn/procedures/itemShelving_filterBuyer.sql +++ b/db/routines/vn/procedures/itemShelving_filterBuyer.sql @@ -44,10 +44,9 @@ proc:BEGIN LEFT JOIN saleTracking st ON st.saleFk = s.id JOIN ticket t ON t.id = s.ticketFk JOIN client c on c.id = t.clientFk - JOIN clientType ct ON ct.id = c.clientTypeFk WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND st.saleFk IS NULL - AND ct.code IN ('normal', 'trust') + AND c.typeFk IN ('normal', 'trust') GROUP BY s.itemFk ) sub2 ON sub2.itemFk = sub.itemFk UNION ALL @@ -70,10 +69,9 @@ proc:BEGIN LEFT JOIN saleTracking st ON st.saleFk = s.id JOIN ticket t ON t.id = s.ticketFk JOIN client c on c.id = t.clientFk - JOIN clientType ct ON ct.id = c.clientTypeFk WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND st.saleFk IS NULL - AND ct.code IN ('normal', 'trust') + AND c.typeFk IN ('normal', 'trust') GROUP BY s.itemFk ) sub5 ON sub5.itemFk = v.item_id WHERE v.calc_id = vCalcVisibleFk diff --git a/db/routines/vn/procedures/item_getBalance.sql b/db/routines/vn/procedures/item_getBalance.sql index 5fe57f2a4..95596d3bc 100644 --- a/db/routines/vn/procedures/item_getBalance.sql +++ b/db/routines/vn/procedures/item_getBalance.sql @@ -120,7 +120,7 @@ BEGIN TRUE, s.id, st.`order`, - ct.`code`, + c.typeFk, cb.claimFk, NULL FROM sale s @@ -128,7 +128,6 @@ BEGIN LEFT JOIN ticketState ts ON ts.ticketFk = t.id LEFT JOIN state st ON st.`code` = ts.`code` JOIN client c ON c.id = t.clientFk - JOIN clientType ct ON ct.id = c.clientTypeFk JOIN state st2 ON st2.`code` = IF(t.shipped < util.VN_CURDATE(), 'DELIVERED', IF (t.shipped > util.dayEnd(util.VN_CURDATE()), diff --git a/db/routines/vn/procedures/workerTimeControl_clockIn.sql b/db/routines/vn/procedures/workerTimeControl_clockIn.sql index 23739a515..e58528487 100644 --- a/db/routines/vn/procedures/workerTimeControl_clockIn.sql +++ b/db/routines/vn/procedures/workerTimeControl_clockIn.sql @@ -75,7 +75,7 @@ BEGIN SET vDated = DATE(vTimed); - SELECT IF(pc.name = 'Conductor +3500kg', + SELECT IF(pc.code = 'driverCE', wc.dayBreakDriver, wc.dayBreak), wc.shortWeekBreak, diff --git a/db/routines/vn/procedures/worker_updateBusiness.sql b/db/routines/vn/procedures/worker_updateBusiness.sql index 274bc3ec0..76c8c9cbb 100644 --- a/db/routines/vn/procedures/worker_updateBusiness.sql +++ b/db/routines/vn/procedures/worker_updateBusiness.sql @@ -23,6 +23,12 @@ BEGIN IF vOldBusinessFk IS NULL THEN CALL account.account_enable(vSelf); + + UPDATE client c + JOIN payMethod pm ON pm.code = 'bankDraft' + SET c.payMethodFk = pm.id + WHERE c.id = vSelf + AND c.iban; END IF; END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/entryDms_afterDelete.sql b/db/routines/vn/triggers/entryDms_afterDelete.sql new file mode 100644 index 000000000..9ae8e7058 --- /dev/null +++ b/db/routines/vn/triggers/entryDms_afterDelete.sql @@ -0,0 +1,12 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_afterDelete` + AFTER DELETE ON `entryDms` + FOR EACH ROW +BEGIN + INSERT INTO entryLog + SET `action` = 'delete', + `changedModel` = 'EntryDms', + `changedModelId` = OLD.entryFk, + `userFk` = account.myUser_getId(); +END$$ +DELIMITER ; diff --git a/db/routines/vn/triggers/entryDms_beforeInsert.sql b/db/routines/vn/triggers/entryDms_beforeInsert.sql new file mode 100644 index 000000000..4f9550f48 --- /dev/null +++ b/db/routines/vn/triggers/entryDms_beforeInsert.sql @@ -0,0 +1,8 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeInsert` + BEFORE INSERT ON `entryDms` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END$$ +DELIMITER ; diff --git a/db/routines/vn/triggers/entryDms_beforeUpdate.sql b/db/routines/vn/triggers/entryDms_beforeUpdate.sql new file mode 100644 index 000000000..ecc047029 --- /dev/null +++ b/db/routines/vn/triggers/entryDms_beforeUpdate.sql @@ -0,0 +1,8 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeUpdate` + BEFORE UPDATE ON `entryDms` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END$$ +DELIMITER ; diff --git a/db/routines/vn/triggers/entry_beforeUpdate.sql b/db/routines/vn/triggers/entry_beforeUpdate.sql index 91d490b21..60b83002c 100644 --- a/db/routines/vn/triggers/entry_beforeUpdate.sql +++ b/db/routines/vn/triggers/entry_beforeUpdate.sql @@ -43,9 +43,9 @@ BEGIN SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk); END IF; - IF NOT (NEW.travelFk <=> OLD.travelFk) - OR NOT (NEW.currencyFk <=> OLD.currencyFk) THEN - SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk); + IF NOT (NEW.travelFk <=> OLD.travelFk) + OR NOT (NEW.currencyFk <=> OLD.currencyFk) THEN + SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk); END IF; END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/invoiceIn_beforeInsert.sql b/db/routines/vn/triggers/invoiceIn_beforeInsert.sql index c09e71ba1..2b80f2534 100644 --- a/db/routines/vn/triggers/invoiceIn_beforeInsert.sql +++ b/db/routines/vn/triggers/invoiceIn_beforeInsert.sql @@ -9,6 +9,10 @@ BEGIN DECLARE vActive TINYINT; DECLARE vWithholdingSageFk INT; + IF NOT util.checkPrintableChars(NEW.supplierRef) THEN + CALL util.throw('The invoiceIn reference contains invalid characters'); + END IF; + SET NEW.editorFk = account.myUser_getId(); SELECT withholdingSageFk INTO vWithholdingSageFk diff --git a/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql b/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql index ae69ad379..4503c7dbd 100644 --- a/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql +++ b/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql @@ -3,9 +3,12 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceIn_beforeUpdat BEFORE UPDATE ON `invoiceIn` FOR EACH ROW BEGIN - DECLARE vWithholdingSageFk INT; + IF NOT (NEW.supplierRef <=> OLD.supplierRef) AND NOT util.checkPrintableChars(NEW.supplierRef) THEN + CALL util.throw('The invoiceIn reference contains invalid characters'); + END IF; + SET NEW.editorFk = account.myUser_getId(); IF (SELECT COUNT(*) FROM vn.invoiceIn diff --git a/db/routines/vn/triggers/saleLabel_afterUpdate.sql b/db/routines/vn/triggers/saleLabel_afterUpdate.sql new file mode 100644 index 000000000..ff3787358 --- /dev/null +++ b/db/routines/vn/triggers/saleLabel_afterUpdate.sql @@ -0,0 +1,8 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleLabel_afterUpdate` + AFTER UPDATE ON `vn`.`saleLabel` + FOR EACH ROW +IF NEW.stem >= (SELECT s.quantity FROM sale s WHERE s.id = NEW.saleFk) THEN + UPDATE sale s SET s.isPicked = TRUE WHERE s.id = NEW.saleFk; +END IF$$ +DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/triggers/supplierDms_afterDelete.sql b/db/routines/vn/triggers/supplierDms_afterDelete.sql new file mode 100644 index 000000000..482decbb6 --- /dev/null +++ b/db/routines/vn/triggers/supplierDms_afterDelete.sql @@ -0,0 +1,12 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierDms_afterDelete` + AFTER DELETE ON `supplierDms` + FOR EACH ROW +BEGIN + INSERT INTO clientLog + SET `action` = 'delete', + `changedModel` = 'supplierDms', + `changedModelId` = OLD.dmsFk, + `userFk` = account.myUser_getId(); +END$$ +DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/triggers/supplierDms_beforeInsert.sql b/db/routines/vn/triggers/supplierDms_beforeInsert.sql new file mode 100644 index 000000000..130428d1e --- /dev/null +++ b/db/routines/vn/triggers/supplierDms_beforeInsert.sql @@ -0,0 +1,8 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierDms_beforeInsert` + BEFORE INSERT ON `supplierDms` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END$$ +DELIMITER ; diff --git a/db/routines/vn/triggers/supplierDms_beforeUpdate.sql b/db/routines/vn/triggers/supplierDms_beforeUpdate.sql new file mode 100644 index 000000000..54dcef049 --- /dev/null +++ b/db/routines/vn/triggers/supplierDms_beforeUpdate.sql @@ -0,0 +1,8 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierDms_beforeUpdate` + BEFORE UPDATE ON `supplierDms` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END$$ +DELIMITER ; diff --git a/db/routines/vn/triggers/travel_beforeUpdate.sql b/db/routines/vn/triggers/travel_beforeUpdate.sql index 2079cd21e..7cc198e3c 100644 --- a/db/routines/vn/triggers/travel_beforeUpdate.sql +++ b/db/routines/vn/triggers/travel_beforeUpdate.sql @@ -3,9 +3,11 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travel_beforeUpdate` BEFORE UPDATE ON `travel` FOR EACH ROW BEGIN + DECLARE vHasAnyInvoiceBooked BOOL; + SET NEW.editorFk = account.myUser_getId(); - IF NOT (NEW.landed <=> OLD.landed) + IF NOT (NEW.landed <=> OLD.landed) OR NOT (NEW.shipped <=> OLD.shipped) THEN CALL travel_checkDates(NEW.shipped, NEW.landed); END IF; @@ -17,5 +19,18 @@ BEGIN IF NOT (NEW.warehouseInFk <=> OLD.warehouseInFk) THEN CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk); END IF; + + IF NOT (NEW.awbFk <=> OLD.awbFk)THEN + SELECT COUNT(*) INTO vHasAnyInvoiceBooked + FROM travel t + JOIN entry e ON e.travelFk = t.id + JOIN invoiceIn ii ON ii.id = e.invoiceInFk + WHERE t.id = NEW.id + AND ii.isBooked; + + IF vHasAnyInvoiceBooked THEN + CALL util.throw('The travel has entries with booked invoices'); + END IF; + END IF; END$$ DELIMITER ; diff --git a/db/routines/vn/views/doc.sql b/db/routines/vn/views/doc.sql deleted file mode 100644 index 31ac20640..000000000 --- a/db/routines/vn/views/doc.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn`.`doc` -AS SELECT `g`.`id` AS `id`, - `g`.`sref` AS `sref`, - `g`.`brief` AS `brief`, - `g`.`emp_id` AS `companyFk`, - `g`.`orden` AS `order`, - `g`.`file` AS `file`, - `g`.`original` AS `original`, - `g`.`trabajador_id` AS `workerFk`, - `g`.`odbc_date` AS `created`, - `g`.`warehouse_id` AS `warehouseFk` -FROM `vn2008`.`gestdoc` `g` diff --git a/db/routines/vn/views/exchangeInsuranceInPrevious.sql b/db/routines/vn/views/exchangeInsuranceInPrevious.sql deleted file mode 100644 index 097728bc7..000000000 --- a/db/routines/vn/views/exchangeInsuranceInPrevious.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn`.`exchangeInsuranceInPrevious` -AS SELECT `ei`.`finished` AS `dated`, - `ei`.`amount` AS `amount`, - `ei`.`rate` AS `rate` -FROM `vn`.`exchangeInsurance` `ei` -WHERE `ei`.`amount` <> 0 - AND `ei`.`financialProductTypefk` = 'SC' diff --git a/db/routines/vn/views/saleValue.sql b/db/routines/vn/views/saleValue.sql index 4394769d1..2dee4695e 100644 --- a/db/routines/vn/views/saleValue.sql +++ b/db/routines/vn/views/saleValue.sql @@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` VIEW `vn`.`saleValue` AS SELECT `wh`.`name` AS `warehouse`, `c`.`name` AS `client`, - `c`.`typeFk` AS `clientTypeFk`, + `c`.`typeFk` AS `typeFk`, `u`.`name` AS `buyer`, `it`.`id` AS `itemTypeFk`, `it`.`name` AS `family`, diff --git a/db/routines/vn/views/unaryScanLineBuy.sql b/db/routines/vn/views/unaryScanLineBuy.sql deleted file mode 100644 index 26f178a45..000000000 --- a/db/routines/vn/views/unaryScanLineBuy.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn`.`unaryScanLineBuy` -AS SELECT `u`.`scan_line_id` AS `unaryScanLineFk`, - `u`.`Id_Article` AS `itemFk` -FROM `vn2008`.`unary_scan_line_buy` `u` diff --git a/db/routines/vn/views/unaryScanLineExpedition.sql b/db/routines/vn/views/unaryScanLineExpedition.sql deleted file mode 100644 index e71c2423e..000000000 --- a/db/routines/vn/views/unaryScanLineExpedition.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn`.`unaryScanLineExpedition` -AS SELECT `u`.`scan_line_id` AS `unaryScanLineFk`, - `u`.`expedition_id` AS `expeditionFk` -FROM `vn2008`.`unary_scan_line_expedition` `u` diff --git a/db/routines/vn2008/procedures/clean.sql b/db/routines/vn2008/procedures/clean.sql index 0ff185c46..946157fa0 100644 --- a/db/routines/vn2008/procedures/clean.sql +++ b/db/routines/vn2008/procedures/clean.sql @@ -25,11 +25,6 @@ proc: BEGIN DELETE FROM Movimientos_mark WHERE odbc_date < vDate; DELETE FROM Splits WHERE Fecha < vDate18; - DELETE tobs - FROM ticket_observation tobs - JOIN Tickets t ON tobs.Id_Ticket = t.Id_Ticket - WHERE t.Fecha < vDate; - DELETE tobs FROM movement_label tobs JOIN Movimientos m ON tobs.Id_Movimiento = m.Id_Movimiento @@ -45,7 +40,6 @@ proc: BEGIN DELETE FROM cl_main WHERE Fecha < vDate18; DELETE FROM hedera.`order` WHERE date_send < vDate18; DELETE FROM vn.message WHERE sendDate < vDate; - DELETE FROM travel_reserve WHERE odbc_date < vDate; DELETE FROM cache.departure_limit WHERE Fecha < util.VN_CURDATE() - INTERVAL 1 MONTH; diff --git a/db/routines/vn2008/triggers/movement_label_afterUpdate.sql b/db/routines/vn2008/triggers/movement_label_afterUpdate.sql deleted file mode 100644 index 364568fb3..000000000 --- a/db/routines/vn2008/triggers/movement_label_afterUpdate.sql +++ /dev/null @@ -1,8 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn2008`.`movement_label_afterUpdate` - AFTER UPDATE ON `movement_label` - FOR EACH ROW -IF NEW.stem >= (SELECT Cantidad FROM Movimientos WHERE Id_Movimiento = NEW.Id_Movimiento) THEN - UPDATE Movimientos SET OK = 1 WHERE Id_Movimiento = NEW.Id_Movimiento; -END IF$$ -DELIMITER ; diff --git a/db/routines/vn2008/views/Clientes.sql b/db/routines/vn2008/views/Clientes.sql index 12583915a..a696cb6e0 100644 --- a/db/routines/vn2008/views/Clientes.sql +++ b/db/routines/vn2008/views/Clientes.sql @@ -34,7 +34,6 @@ AS SELECT `c`.`id` AS `id_cliente`, `c`.`hasLcr` AS `hasLcr`, `c`.`defaultAddressFk` AS `default_address`, `c`.`riskCalculated` AS `risk_calculated`, - `c`.`clientTypeFk` AS `clientes_tipo_id`, `c`.`hasToInvoiceByAddress` AS `invoiceByAddress`, `c`.`isTaxDataChecked` AS `contabilizado`, `c`.`isFreezed` AS `congelado`, diff --git a/db/routines/vn2008/views/credit.sql b/db/routines/vn2008/views/credit.sql index 4bd3cef39..0de60b967 100644 --- a/db/routines/vn2008/views/credit.sql +++ b/db/routines/vn2008/views/credit.sql @@ -1,9 +1,11 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`credit` -AS SELECT `c`.`id` AS `id`, - `c`.`clientFk` AS `Id_Cliente`, - `c`.`workerFk` AS `Id_Trabajador`, - `c`.`amount` AS `amount`, - `c`.`created` AS `odbc_date` -FROM `vn`.`clientCredit` `c` \ No newline at end of file + SQL SECURITY DEFINER + VIEW `vn2008`.`credit` +AS SELECT + `c`.`id` AS `id`, + `c`.`clientFk` AS `Id_Cliente`, + `c`.`workerFk` AS `Id_Trabajador`, + `c`.`amount` AS `amount`, + `c`.`created` AS `odbc_date` +FROM + `vn`.`clientCredit` `c` diff --git a/db/routines/vn2008/views/financialProductType.sql b/db/routines/vn2008/views/financialProductType.sql new file mode 100644 index 000000000..89a063856 --- /dev/null +++ b/db/routines/vn2008/views/financialProductType.sql @@ -0,0 +1,4 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER +VIEW `vn2008`.`financialProductType`AS + SELECT * FROM vn.financialProductType; \ No newline at end of file diff --git a/db/routines/vn2008/views/flight.sql b/db/routines/vn2008/views/flight.sql new file mode 100644 index 000000000..2df5362f7 --- /dev/null +++ b/db/routines/vn2008/views/flight.sql @@ -0,0 +1,13 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`flight` +AS SELECT + `f`.`id` AS `flight_id`, + `f`.`duration` AS `duration`, + `f`.`flightPath` AS `route`, + `f`.`days` AS `days`, + `f`.`airlineFk` AS `airline_id`, + `f`.`airportArrivalFk` AS `airport_out`, + `f`.`airportDepartureFk` AS `airport_in` +FROM + `vn`.`flight` `f`; \ No newline at end of file diff --git a/db/routines/vn2008/views/gastos_resumen.sql b/db/routines/vn2008/views/gastos_resumen.sql new file mode 100644 index 000000000..02231bcbf --- /dev/null +++ b/db/routines/vn2008/views/gastos_resumen.sql @@ -0,0 +1,11 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`gastos_resumen` +AS SELECT + `es`.`expenseFk` AS `Id_Gasto`, + `es`.`year` AS `year`, + `es`.`month` AS `month`, + `es`.`amount` AS `importe`, + `es`.`companyFk` AS `empresa_id` +FROM + `vn`.`expenseManual` `es`; \ No newline at end of file diff --git a/db/routines/vn2008/views/integra2.sql b/db/routines/vn2008/views/integra2.sql new file mode 100644 index 000000000..05840d6bb --- /dev/null +++ b/db/routines/vn2008/views/integra2.sql @@ -0,0 +1,9 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`integra2` +AS SELECT + `i2`.`postCode` AS `postal_code`, + `i2`.`frequency` AS `frequency`, + `i2`.`warehouseFk` AS `warehouse_id` +FROM + `vn`.`integra2` `i2`; \ No newline at end of file diff --git a/db/routines/vn2008/views/integra2_province.sql b/db/routines/vn2008/views/integra2_province.sql new file mode 100644 index 000000000..bc099adb3 --- /dev/null +++ b/db/routines/vn2008/views/integra2_province.sql @@ -0,0 +1,8 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`integra2_province` +AS SELECT + `ip`.`provinceFk` AS `province_id`, + `ip`.`franchise` AS `franquicia` +FROM + `vn`.`integra2Province` `ip`; \ No newline at end of file diff --git a/db/routines/vn2008/views/pago_sdc.sql b/db/routines/vn2008/views/pago_sdc.sql new file mode 100644 index 000000000..29480e376 --- /dev/null +++ b/db/routines/vn2008/views/pago_sdc.sql @@ -0,0 +1,16 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`pago_sdc` +AS SELECT `ei`.`id` AS `pago_sdc_id`, + `ei`.`amount` AS `importe`, + `ei`.`dated` AS `fecha`, + `ei`.`dueDated` AS `vencimiento`, + `ei`.`entityFk` AS `entity_id`, + `ei`.`ref` AS `ref`, + `ei`.`rate` AS `rate`, + `ei`.`companyFk` AS `empresa_id`, + `ei`.`financialProductTypefk` AS `financialProductTypefk`, + `ei`.`upperBarrier` AS `upperBarrier`, + `ei`.`lowerBarrier` AS `lowerBarrier`, + `ei`.`strike` AS `strike` +FROM `vn`.`exchangeInsurance` `ei` \ No newline at end of file diff --git a/db/routines/vn2008/views/versiones.sql b/db/routines/vn2008/views/versiones.sql new file mode 100644 index 000000000..3d27f4f92 --- /dev/null +++ b/db/routines/vn2008/views/versiones.sql @@ -0,0 +1,8 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`versiones` +AS SELECT `m`.`app` AS `programa`, + `m`.`version` AS `version`, + 0 AS `critical` +FROM `vn`.`mdbVersion` `m` +WHERE `m`.`branchFk` = 'master' \ No newline at end of file diff --git a/db/routines/vn2008/views/warehouse_pickup.sql b/db/routines/vn2008/views/warehouse_pickup.sql new file mode 100644 index 000000000..c3a7268a1 --- /dev/null +++ b/db/routines/vn2008/views/warehouse_pickup.sql @@ -0,0 +1,9 @@ + +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`warehouse_pickup` +AS SELECT + `wp`.`warehouseFk` AS `warehouse_id`, + `wp`.`agencyModeFk` AS `agency_id` +FROM + `vn`.`warehousePickup` `wp`; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/00-firstScript.sql b/db/versions/10835-brownCarnation/00-firstScript.sql index 977e20905..be53d866c 100644 --- a/db/versions/10835-brownCarnation/00-firstScript.sql +++ b/db/versions/10835-brownCarnation/00-firstScript.sql @@ -81,10 +81,6 @@ ALTER TABLE IF EXISTS vn2008.MovimienRENAMEs_avisar__ COMMENT='refs #6371 deprec ALTER TABLE IF EXISTS vn2008.MovimienRENAMEs_revisar RENAME vn2008.MovimienRENAMEs_revisar__; ALTER TABLE IF EXISTS vn2008.MovimienRENAMEs_revisar__ COMMENT='refs #6371 deprecated 2024-01-11'; --- Para la tabla Proveedores_cargueras -ALTER TABLE IF EXISTS vn2008.Proveedores_cargueras RENAME vn2008.Proveedores_cargueras__; -ALTER TABLE IF EXISTS vn2008.Proveedores_cargueras__ COMMENT='refs #6371 deprecated 2024-01-11'; - -- Para la tabla Proveedores_comunicados ALTER TABLE IF EXISTS vn2008.Proveedores_comunicados RENAME vn2008.Proveedores_comunicados__; ALTER TABLE IF EXISTS vn2008.Proveedores_comunicados__ COMMENT='refs #6371 deprecated 2024-01-11'; @@ -101,10 +97,6 @@ ALTER TABLE IF EXISTS vn2008.Tickets_stack__ COMMENT='refs #6371 deprecated 2024 ALTER TABLE IF EXISTS vn2008.Tipos_f11 RENAME vn2008.Tipos_f11__; ALTER TABLE IF EXISTS vn2008.Tipos_f11__ COMMENT='refs #6371 deprecated 2024-01-11'; --- Para la tabla Tramos -ALTER TABLE IF EXISTS vn2008.Tramos RENAME vn2008.Tramos__; -ALTER TABLE IF EXISTS vn2008.Tramos__ COMMENT='refs #6371 deprecated 2024-01-11'; - -- Para la tabla accion_dits ALTER TABLE IF EXISTS vn2008.accion_dits RENAME vn2008.accion_dits__; ALTER TABLE IF EXISTS vn2008.accion_dits__ COMMENT='refs #6371 deprecated 2024-01-11'; @@ -165,10 +157,6 @@ ALTER TABLE IF EXISTS vn2008.cyc__ COMMENT='refs #6371 deprecated 2024-01-11'; ALTER TABLE IF EXISTS vn2008.cyc_declaration RENAME vn2008.cyc_declaration__; ALTER TABLE IF EXISTS vn2008.cyc_declaration__ COMMENT='refs #6371 deprecated 2024-01-11'; --- Para la tabla dock -ALTER TABLE IF EXISTS vn2008.dock RENAME vn2008.dock__; -ALTER TABLE IF EXISTS vn2008.dock__ COMMENT='refs #6371 deprecated 2024-01-11'; - -- Para la tabla edi_testigos ALTER TABLE IF EXISTS vn2008.edi_testigos RENAME vn2008.edi_testigos__; ALTER TABLE IF EXISTS vn2008.edi_testigos__ COMMENT='refs #6371 deprecated 2024-01-11'; diff --git a/db/versions/10841-orangeGalax/00-entryDms.sql b/db/versions/10841-orangeGalax/00-entryDms.sql new file mode 100644 index 000000000..33ec1e3af --- /dev/null +++ b/db/versions/10841-orangeGalax/00-entryDms.sql @@ -0,0 +1,15 @@ +CREATE OR REPLACE TABLE `vn`.`entryDms` ( + `entryFk` int(11) NOT NULL, + `dmsFk` int(11) NOT NULL, + `editorFk` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`entryFk`,`dmsFk`), + KEY `gestdoc_id` (`dmsFk`), + KEY `entryDms_editor` (`editorFk`), + CONSTRAINT `entryDms_dms` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `entryDms_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`), + CONSTRAINT `entryDms_entry` FOREIGN KEY (`entryFk`) REFERENCES `entry` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('EntryDms', '*', '*', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/versions/10841-orangeGalax/00-entryDmsType.vn.sql b/db/versions/10841-orangeGalax/00-entryDmsType.vn.sql new file mode 100644 index 000000000..d408ab827 --- /dev/null +++ b/db/versions/10841-orangeGalax/00-entryDmsType.vn.sql @@ -0,0 +1,2 @@ +INSERT INTO `vn`.`dmsType` (code, name, path__, writeRoleFk, readRoleFk, monthToDelete) + VALUES('entry', 'Entrada', '', 1, 1, NULL); diff --git a/db/versions/10888-brownBirch/00-firstScript.sql b/db/versions/10888-brownBirch/00-firstScript.sql new file mode 100644 index 000000000..7c8f96339 --- /dev/null +++ b/db/versions/10888-brownBirch/00-firstScript.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER +VIEW `vn2008`.`credit`AS + SELECT 1; + +GRANT SELECT ON TABLE vn2008.credit TO financialBoss; diff --git a/db/versions/10889-redMedeola/00-firstScript.sql b/db/versions/10889-redMedeola/00-firstScript.sql new file mode 100644 index 000000000..ecae0234f --- /dev/null +++ b/db/versions/10889-redMedeola/00-firstScript.sql @@ -0,0 +1,24 @@ +-- Place your SQL code here +CREATE TABLE IF NOT EXISTS `vn`.`mrwConfig` ( + `id` INT auto_increment NULL, + `url` varchar(100) NULL, + `user` varchar(100) NULL, + `password` varchar(100) NULL, + `franchiseCode` varchar(100) NULL, + `subscriberCode` varchar(100) NULL, + CONSTRAINT mrwConfig_pk PRIMARY KEY (id) +) +ENGINE=InnoDB +DEFAULT CHARSET=utf8mb3 +COLLATE=utf8mb3_unicode_ci; + +ALTER TABLE `vn`.`packingSite` ADD `hasNewLabelMrwMethod` BOOL NULL; + +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES('MrwConfig', 'cancelShipment', 'WRITE', 'ALLOW', 'ROLE', 'employee'); + +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) + VALUES ('MrwConfig','createShipment','WRITE','ALLOW','ROLE','employee'); + + + diff --git a/db/versions/10891-chocolateRuscus/00-firstScript.sql b/db/versions/10891-chocolateRuscus/00-firstScript.sql new file mode 100644 index 000000000..711850323 --- /dev/null +++ b/db/versions/10891-chocolateRuscus/00-firstScript.sql @@ -0,0 +1,6 @@ +ALTER TABLE vn.client DROP FOREIGN KEY tipos_de_cliente; +ALTER TABLE vn.client CHANGE COLUMN clientTypeFk clientTypeFk__ INT NOT NULL DEFAULT 1 COMMENT '@deprecated 2024-02-20 refs #6784'; +ALTER TABLE vn.clientType CHANGE COLUMN id id__ INT NOT NULL COMMENT '@deprecated 2024-02-20 refs #6784'; +ALTER TABLE vn.clientType DROP PRIMARY KEY; +ALTER TABLE vn.clientType ADD PRIMARY KEY (code); + diff --git a/db/versions/10896-salmonOrchid/01-financialProductType.sql b/db/versions/10896-salmonOrchid/01-financialProductType.sql new file mode 100644 index 000000000..c5d51e015 --- /dev/null +++ b/db/versions/10896-salmonOrchid/01-financialProductType.sql @@ -0,0 +1 @@ +ALTER TABLE IF EXISTS `vn2008`.`financialProductType` RENAME `vn`.`financialProductType`; diff --git a/db/versions/10896-salmonOrchid/02-flight.sql b/db/versions/10896-salmonOrchid/02-flight.sql new file mode 100644 index 000000000..657fa2aa1 --- /dev/null +++ b/db/versions/10896-salmonOrchid/02-flight.sql @@ -0,0 +1,8 @@ +ALTER TABLE IF EXISTS `vn2008`.`flight` RENAME `vn`.`flight`; + +ALTER TABLE IF EXISTS `vn`.`flight` +CHANGE COLUMN IF EXISTS `flight_id` `id` varchar(10) NOT NULL, +CHANGE COLUMN IF EXISTS `airline_id` `airlineFk` smallint(2) unsigned DEFAULT NULL, +CHANGE COLUMN IF EXISTS `route` `flightPath` varchar(20) DEFAULT NULL, +CHANGE COLUMN IF EXISTS `airport_out` `airportArrivalFk` varchar(3) NOT NULL, +CHANGE COLUMN IF EXISTS `airport_in` `airportDepartureFk` varchar(3) NOT NULL; \ No newline at end of file diff --git a/db/versions/10896-salmonOrchid/03-gastos_resumen.sql b/db/versions/10896-salmonOrchid/03-gastos_resumen.sql new file mode 100644 index 000000000..1f5101df5 --- /dev/null +++ b/db/versions/10896-salmonOrchid/03-gastos_resumen.sql @@ -0,0 +1,32 @@ +DELETE FROM vn2008.gastos_resumen + WHERE Id_Gasto IN ( + SELECT DISTINCT g.Id_Gasto + FROM vn2008.gastos_resumen g + LEFT JOIN vn.expense e ON e.id = g.Id_Gasto COLLATE utf8mb3_general_ci + WHERE e.id IS NULL + ); + +ALTER TABLE `vn2008`.`gastos_resumen` DROP FOREIGN KEY gastos_resumen_expense_FK; +ALTER TABLE IF EXISTS `vn2008`.`gastos_resumen` RENAME `vn`.`expenseManual`; +ALTER TABLE `vn`.`expenseManual` +CHANGE COLUMN IF EXISTS `Id_Gasto` `expenseFk` varchar(10) NOT NULL, +CHANGE COLUMN IF EXISTS `importe` `amount` decimal(10,2) DEFAULT NULL, +CHANGE COLUMN IF EXISTS `empresa_id` `companyFk` int(11) NOT NULL; + +ALTER TABLE `vn`.`expenseManual` MODIFY COLUMN IF EXISTS expenseFk varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL; + +ALTER TABLE `vn`.`expenseManual` DROP PRIMARY KEY; + +ALTER TABLE `vn`.`expenseManual` MODIFY COLUMN companyFk int(10) unsigned NULL; + +ALTER TABLE `vn`.`expenseManual` ADD CONSTRAINT expenseManual_expense_FK FOREIGN KEY IF NOT EXISTS (expenseFk) REFERENCES vn.expense(id) ON DELETE CASCADE ON UPDATE CASCADE; + +UPDATE `vn`.`expenseManual` + SET companyFK= NULL + WHERE companyFk= 0; + +ALTER TABLE `vn`.`expenseManual` ADD CONSTRAINT expenseManual_company_FK FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company(id) ON DELETE CASCADE ON UPDATE CASCADE; + +ALTER TABLE `vn`.`expenseManual` ADD COLUMN id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY FIRST; + +ALTER TABLE `vn`.`expenseManual` ADD CONSTRAINT expenseManual_unique UNIQUE KEY IF NOT EXISTS (expenseFk,`year`,`month`,companyFk); \ No newline at end of file diff --git a/db/versions/10896-salmonOrchid/04-integra2.sql b/db/versions/10896-salmonOrchid/04-integra2.sql new file mode 100644 index 000000000..663b28d78 --- /dev/null +++ b/db/versions/10896-salmonOrchid/04-integra2.sql @@ -0,0 +1,10 @@ +ALTER TABLE IF EXISTS `vn2008`.`integra2` RENAME `vn`.`integra2`; + +ALTER TABLE IF EXISTS `vn`.`integra2` +CHANGE COLUMN IF EXISTS `postal_code` `postCode` varchar(10) NOT NULL, +CHANGE COLUMN IF EXISTS `frequency` `frequency` decimal(10,2) DEFAULT NULL, +CHANGE COLUMN IF EXISTS `warehouse_id` `warehouseFk` smallint(6) unsigned NOT NULL; + +ALTER TABLE IF EXISTS vn.integra2 ADD CONSTRAINT integra2_warehouse_FK +FOREIGN KEY (warehouseFk) REFERENCES vn.warehouse(id) ON DELETE CASCADE ON UPDATE CASCADE; + diff --git a/db/versions/10896-salmonOrchid/05-integra2_province.sql b/db/versions/10896-salmonOrchid/05-integra2_province.sql new file mode 100644 index 000000000..31f8f4156 --- /dev/null +++ b/db/versions/10896-salmonOrchid/05-integra2_province.sql @@ -0,0 +1,4 @@ +ALTER TABLE IF EXISTS `vn2008`.`integra2_province` RENAME `vn`.`integra2Province`; +ALTER TABLE IF EXISTS `vn`.`integra2Province` +CHANGE COLUMN IF EXISTS `franquicia` `franchise` varchar(65) NOT NULL, +CHANGE COLUMN IF EXISTS `province_id` `provinceFk` smallint(6) unsigned NOT NULL; diff --git a/db/versions/10896-salmonOrchid/06-intervalos__delete.sql b/db/versions/10896-salmonOrchid/06-intervalos__delete.sql new file mode 100644 index 000000000..18d4f57ca --- /dev/null +++ b/db/versions/10896-salmonOrchid/06-intervalos__delete.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS vn2008.intervalos__; \ No newline at end of file diff --git a/db/versions/10896-salmonOrchid/10-mail_templates__delete.sql b/db/versions/10896-salmonOrchid/10-mail_templates__delete.sql new file mode 100644 index 000000000..e30aae925 --- /dev/null +++ b/db/versions/10896-salmonOrchid/10-mail_templates__delete.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS vn2008.mail_templates__; diff --git a/db/versions/10896-salmonOrchid/12-ticket_location__delete.sql b/db/versions/10896-salmonOrchid/12-ticket_location__delete.sql new file mode 100644 index 000000000..a7dbbfb95 --- /dev/null +++ b/db/versions/10896-salmonOrchid/12-ticket_location__delete.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS vn2008.ticket_location__; \ No newline at end of file diff --git a/db/versions/10896-salmonOrchid/13-turn__delete.sql b/db/versions/10896-salmonOrchid/13-turn__delete.sql new file mode 100644 index 000000000..7aa69e57d --- /dev/null +++ b/db/versions/10896-salmonOrchid/13-turn__delete.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS vn2008.turn__; \ No newline at end of file diff --git a/db/versions/10896-salmonOrchid/14-movement_label.sql b/db/versions/10896-salmonOrchid/14-movement_label.sql new file mode 100644 index 000000000..194df6e1e --- /dev/null +++ b/db/versions/10896-salmonOrchid/14-movement_label.sql @@ -0,0 +1,12 @@ +DROP TRIGGER IF EXISTS `vn2008`.`movement_label_afterUpdate`; + +ALTER TABLE vn2008.movement_label DROP FOREIGN KEY movement_label_ibfk_1; + +DROP VIEW IF EXISTS `vn`.`saleLabel`; + +ALTER TABLE IF EXISTS `vn2008`.`movement_label` RENAME `vn`.`saleLabel`; + +ALTER TABLE IF EXISTS `vn`.`saleLabel` +CHANGE COLUMN IF EXISTS `Id_movimiento` `saleFk` int(11) NOT NULL; + +ALTER TABLE `vn`.`saleLabel` ADD CONSTRAINT saleLabel_sale_FK FOREIGN KEY (saleFk) REFERENCES vn.sale(id) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/db/versions/10896-salmonOrchid/15-pago_sdc.sql b/db/versions/10896-salmonOrchid/15-pago_sdc.sql new file mode 100644 index 000000000..1b63b9c54 --- /dev/null +++ b/db/versions/10896-salmonOrchid/15-pago_sdc.sql @@ -0,0 +1,11 @@ +DROP VIEW IF EXISTS `vn`.`exchangeInsurance`; + +ALTER TABLE IF EXISTS `vn2008`.`pago_sdc` RENAME `vn`.`exchangeInsurance`; + +ALTER TABLE IF EXISTS `vn`.`exchangeInsurance` +CHANGE COLUMN IF EXISTS `pago_sdc_id` `id` int(11) NOT NULL AUTO_INCREMENT, +CHANGE COLUMN IF EXISTS `importe` `amount` decimal(10,2) NOT NULL, +CHANGE COLUMN IF EXISTS `fecha` `dated` date NOT NULL, +CHANGE COLUMN IF EXISTS `vencimiento` `dueDated` date NOT NULL, +CHANGE COLUMN IF EXISTS `entity_id` `entityFk` int(10) unsigned NOT NULL, +CHANGE COLUMN IF EXISTS `empresa_id` `companyFk`int(10) unsigned NOT NULL DEFAULT 442; diff --git a/db/versions/10896-salmonOrchid/25-warehouse_pickup.sql b/db/versions/10896-salmonOrchid/25-warehouse_pickup.sql new file mode 100644 index 000000000..d6f2ae18d --- /dev/null +++ b/db/versions/10896-salmonOrchid/25-warehouse_pickup.sql @@ -0,0 +1,7 @@ +ALTER TABLE IF EXISTS `vn2008`.`warehouse_pickup` RENAME `vn`.`warehousePickup`; + +ALTER TABLE IF EXISTS `vn`.`warehousePickup` +CHANGE COLUMN IF EXISTS `warehouse_id` `warehouseFk` smallint(5) unsigned NOT NULL, +CHANGE COLUMN IF EXISTS `agency_id` `agencyModeFk` int(11) DEFAULT NULL; + +ALTER TABLE `vn`.`warehousePickup` COMMENT='Agencia de recogida para cada almacén'; diff --git a/db/versions/10896-salmonOrchid/29-kk.sql b/db/versions/10896-salmonOrchid/29-kk.sql new file mode 100644 index 000000000..201a1c806 --- /dev/null +++ b/db/versions/10896-salmonOrchid/29-kk.sql @@ -0,0 +1,155 @@ +ALTER TABLE IF EXISTS vn2008.template_bionic_component RENAME vn2008.template_bionic_component__; +ALTER TABLE IF EXISTS vn2008.template_bionic_component__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.template_bionic_lot RENAME vn2008.template_bionic_lot__; +ALTER TABLE IF EXISTS vn2008.template_bionic_lot__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.template_bionic_price RENAME vn2008.template_bionic_price__; +ALTER TABLE IF EXISTS vn2008.template_bionic_price__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.tmpNEWTARIFAS RENAME vn2008.tmpNEWTARIFAS__; +ALTER TABLE IF EXISTS vn2008.tmpNEWTARIFAS__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.unaryScanFilter RENAME vn2008.unaryScanFilter__; +ALTER TABLE IF EXISTS vn2008.unaryScanFilter__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.unary_source RENAME vn2008.unary_source__; +ALTER TABLE IF EXISTS vn2008.unary_source__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.viaxpress RENAME vn2008.viaxpress__; +ALTER TABLE IF EXISTS vn2008.viaxpress__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.warehouse_filtro RENAME vn2008.warehouse_filtro__; +ALTER TABLE IF EXISTS vn2008.warehouse_filtro__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.warehouse_group RENAME vn2008.warehouse_group__; +ALTER TABLE IF EXISTS vn2008.warehouse_group__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.warehouse_joined RENAME vn2008.warehouse_joined__; +ALTER TABLE IF EXISTS vn2008.warehouse_joined__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.warehouse_lc RENAME vn2008.warehouse_lc__; +ALTER TABLE IF EXISTS vn2008.warehouse_lc__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.wh_selection RENAME vn2008.wh_selection__; +ALTER TABLE IF EXISTS vn2008.wh_selection__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.trolley RENAME vn2008.trolley__; +ALTER TABLE IF EXISTS vn2008.trolley__ COMMENT='refs #6372 @deprecated 2023-12-13;'; + +ALTER TABLE IF EXISTS vn2008.zones RENAME vn2008.zones__; +ALTER TABLE IF EXISTS vn2008.zones__ COMMENT='refs #6372 @deprecated 2023-12-13;'; + +ALTER TABLE IF EXISTS vn2008.tblIVA RENAME vn2008.tblIVA__; +ALTER TABLE IF EXISTS vn2008.tblIVA__ COMMENT='refs #6372 @deprecated 2023-12-13;'; + +ALTER TABLE IF EXISTS vn2008.filtros RENAME vn2008.filtros__; +ALTER TABLE IF EXISTS vn2008.filtros__ COMMENT='refs #6372 @deprecated 2023-11-21;'; + +ALTER TABLE IF EXISTS vn2008.form_query RENAME vn2008.form_query__; +ALTER TABLE IF EXISTS vn2008.form_query__ COMMENT='refs #6372 @deprecated 2023-11-21;'; + +ALTER TABLE IF EXISTS vn2008.guillen RENAME vn2008.guillen__; +ALTER TABLE IF EXISTS vn2008.guillen__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.guillen_carry RENAME vn2008.guillen_carry__; +ALTER TABLE IF EXISTS vn2008.guillen_carry__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.integra2_escala RENAME vn2008.integra2_escala__; +ALTER TABLE IF EXISTS vn2008.integra2_escala__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.invoice_observation RENAME vn2008.invoice_observation__; +ALTER TABLE IF EXISTS vn2008.invoice_observation__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.nichos RENAME vn2008.nichos__; +ALTER TABLE IF EXISTS vn2008.nichos__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.payroll_bonificaciones RENAME vn2008.payroll_bonificaciones__; +ALTER TABLE IF EXISTS vn2008.payroll_bonificaciones__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.payroll_datos RENAME vn2008.payroll_datos__; +ALTER TABLE IF EXISTS vn2008.payroll_datos__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.payroll_embargos RENAME vn2008.payroll_embargos__; +ALTER TABLE IF EXISTS vn2008.payroll_embargos__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.payroll_tipobasess RENAME vn2008.payroll_tipobasess__; +ALTER TABLE IF EXISTS vn2008.payroll_tipobasess__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.preparation_exception RENAME vn2008.preparation_exception__; +ALTER TABLE IF EXISTS vn2008.preparation_exception__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.payrroll_apEmpresarial RENAME vn2008.payrroll_apEmpresarial__; +ALTER TABLE IF EXISTS vn2008.payrroll_apEmpresarial__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.rec_translator RENAME vn2008.rec_translator__; +ALTER TABLE IF EXISTS vn2008.rec_translator__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.recibida_agricola RENAME vn2008.recibida_agricola__; +ALTER TABLE IF EXISTS vn2008.recibida_agricola__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.rounding RENAME vn2008.rounding__; +ALTER TABLE IF EXISTS vn2008.rounding__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.scanTree RENAME vn2008.scanTree__; +ALTER TABLE IF EXISTS vn2008.scanTree__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.sort_merge_results_ernesto RENAME vn2008.sort_merge_results_ernesto__; +ALTER TABLE IF EXISTS vn2008.sort_merge_results_ernesto__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.route RENAME vn2008.route__; +ALTER TABLE IF EXISTS vn2008.route__ COMMENT='refs #6372 @deprecated 2023-11-28;'; + +ALTER TABLE IF EXISTS vn2008.travel_reserve RENAME vn2008.travel_reserve__; +ALTER TABLE IF EXISTS vn2008.travel_reserve__ COMMENT='refs #6372 @deprecated 2023-12-13;'; + +ALTER TABLE IF EXISTS vn2008.wks RENAME vn2008.wks__; +ALTER TABLE IF EXISTS vn2008.wks__ COMMENT='refs #6372 @deprecated 2023-12-13;'; + +ALTER TABLE IF EXISTS vn2008.unary RENAME vn2008.unary__; +ALTER TABLE IF EXISTS vn2008.unary__ COMMENT='refs #6372 @deprecated 2023-12-13;'; + +ALTER TABLE IF EXISTS vn2008.unary_scan RENAME vn2008.unary_scan__; +ALTER TABLE IF EXISTS vn2008.unary_scan__ COMMENT='refs #6372 @deprecated 2023-12-13;'; + +ALTER TABLE IF EXISTS vn2008.unary_scan_line RENAME vn2008.unary_scan_line__; +ALTER TABLE IF EXISTS vn2008.unary_scan_line__ COMMENT='refs #6372 @deprecated 2023-12-13;'; + +ALTER TABLE IF EXISTS vn2008.unary_scan_line_buy RENAME vn2008.unary_scan_line_buy__; +ALTER TABLE IF EXISTS vn2008.unary_scan_line_buy__ COMMENT='refs #6372 @deprecated 2023-12-13;'; + +ALTER TABLE IF EXISTS vn2008.unary_scan_line_expedition RENAME vn2008.unary_scan_line_expedition__; +ALTER TABLE IF EXISTS vn2008.unary_scan_line_expedition__ COMMENT='refs #6372 @deprecated 2023-12-13;'; + +ALTER TABLE IF EXISTS vn2008.widget RENAME vn2008.widget__; +ALTER TABLE IF EXISTS vn2008.widget__ COMMENT='refs #6372 @deprecated 2023-12-13;'; + +ALTER TABLE IF EXISTS vn2008.scan RENAME vn2008.scan__; +ALTER TABLE IF EXISTS vn2008.scan__ COMMENT='refs #6372 @deprecated 2023-12-13;'; + +ALTER TABLE IF EXISTS vn2008.scan_line RENAME vn2008.scan_line__; +ALTER TABLE IF EXISTS vn2008.scan_line__ COMMENT='refs #6372 @deprecated 2023-12-13;'; + +ALTER TABLE IF EXISTS vn2008.tipsa RENAME vn2008.tipsa__; +ALTER TABLE IF EXISTS vn2008.tipsa__ COMMENT='refs #6372 @deprecated 2023-12-13;'; + +ALTER TABLE IF EXISTS vn2008.payroll_basess RENAME vn2008.payroll_basess__; +ALTER TABLE IF EXISTS vn2008.payroll_basess__ COMMENT='refs #6372 @deprecated 2023-12-13;'; + +ALTER TABLE IF EXISTS vn2008.pago_sdc RENAME vn2008.pago_sdc__; +ALTER TABLE IF EXISTS vn2008.pago_sdc__ COMMENT='refs #6372 @deprecated 2023-12-13;'; + +ALTER TABLE IF EXISTS vn2008.transport RENAME vn2008.transport__; +ALTER TABLE IF EXISTS vn2008.transport__ COMMENT='refs #6372 @deprecated 2023-12-13;'; + +ALTER TABLE IF EXISTS vn2008.travel_pattern RENAME vn2008.travel_pattern__; +ALTER TABLE IF EXISTS vn2008.travel_pattern__ COMMENT='refs #6372 @deprecated 2023-12-13;'; + +ALTER TABLE IF EXISTS vn2008.jerarquia RENAME vn2008.jerarquia__; +ALTER TABLE IF EXISTS vn2008.jerarquia__ COMMENT='refs #6372 @deprecated 2023-12-13;'; + +ALTER TABLE IF EXISTS vn2008.language RENAME vn2008.language__; +ALTER TABLE IF EXISTS vn2008.language__ COMMENT='refs #6372 @deprecated 2023-12-13;'; + +ALTER TABLE IF EXISTS vn2008.link RENAME vn2008.link__; +ALTER TABLE IF EXISTS vn2008.link__ COMMENT='refs #6372 @deprecated 2023-12-13;'; diff --git a/db/versions/10896-salmonOrchid/30-permissions.sql b/db/versions/10896-salmonOrchid/30-permissions.sql new file mode 100644 index 000000000..fd7c6c58e --- /dev/null +++ b/db/versions/10896-salmonOrchid/30-permissions.sql @@ -0,0 +1,32 @@ +-- flight +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER +VIEW `vn2008`.`flight` AS + SELECT 1; +GRANT SELECT, INSERT, UPDATE ON TABLE vn2008.flight TO `logistic`; +GRANT SELECT, INSERT, UPDATE ON TABLE vn.flight TO `logistic`; +-- integra2_province +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER +VIEW `vn2008`.`integra2_province` AS + SELECT 1; +GRANT SELECT ON TABLE vn2008.integra2_province TO `employee`; +GRANT SELECT ON TABLE vn.integra2Province TO `employee`; +-- link + +GRANT SELECT ON TABLE vn.company TO `administrative`; +GRANT SELECT ON TABLE vn.company TO `hr`; + +-- warehouse_pickup +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER +VIEW `vn2008`.`warehouse_pickup` AS + SELECT 1; +GRANT SELECT ON TABLE vn2008.warehouse_pickup TO `logistic`; +GRANT SELECT ON TABLE vn.warehousePickup TO `logistic`; +GRANT SELECT ON TABLE vn2008.warehouse_pickup TO `claimManager`; +GRANT SELECT ON TABLE vn.warehousePickup TO `claimManager`; +GRANT SELECT ON TABLE vn2008.warehouse_pickup TO `employee`; +GRANT SELECT ON TABLE vn.warehousePickup TO `employee`; +GRANT SELECT ON TABLE vn2008.warehouse_pickup TO `deliveryAssistant`; +GRANT SELECT ON TABLE vn.warehousePickup TO `deliveryAssistant`; diff --git a/db/versions/10898-workerActivity/00-table.sql b/db/versions/10898-workerActivity/00-table.sql new file mode 100644 index 000000000..ec517b929 --- /dev/null +++ b/db/versions/10898-workerActivity/00-table.sql @@ -0,0 +1,13 @@ +-- Place your SQL code here +CREATE TABLE vn.workerActivity ( +id INT PRIMARY KEY AUTO_INCREMENT, +created TIMESTAMP DEFAULT CURRENT_TIMESTAMP, +model ENUM('COM', 'ENT', 'TPV', 'ENC', 'LAB', 'ETI') NOT NULL, +workerFk INT(10) UNSIGNED NOT NULL, +event ENUM('open', 'close', 'insert', 'delete', 'update', 'refresh') NOT NULL, +description VARCHAR(255) DEFAULT NULL, +CONSTRAINT fk_workerActivity_worker FOREIGN KEY (workerFk) + REFERENCES vn.worker (id) + ON DELETE CASCADE + ON UPDATE CASCADE +); \ No newline at end of file diff --git a/db/versions/10903-pinkIvy/00-professionalCategoryAddCode.sql b/db/versions/10903-pinkIvy/00-professionalCategoryAddCode.sql new file mode 100644 index 000000000..7caa42f32 --- /dev/null +++ b/db/versions/10903-pinkIvy/00-professionalCategoryAddCode.sql @@ -0,0 +1,6 @@ +ALTER TABLE vn.professionalCategory DROP COLUMN IF EXISTS code; +ALTER TABLE IF EXISTS vn.professionalCategory ADD COLUMN code VARCHAR(25) DEFAULT NULL; + +UPDATE vn.professionalCategory + SET code = 'driverCE' + WHERE name = 'Conductor C + E'; \ No newline at end of file diff --git a/db/versions/10906-limeIvy/00-firstScript.sql b/db/versions/10906-limeIvy/00-firstScript.sql new file mode 100644 index 000000000..6ce187d20 --- /dev/null +++ b/db/versions/10906-limeIvy/00-firstScript.sql @@ -0,0 +1,6 @@ +ALTER TABLE vn.professionalCategory DROP COLUMN IF EXISTS code; +ALTER TABLE IF EXISTS vn.professionalCategory ADD COLUMN code VARCHAR(25) UNIQUE DEFAULT NULL; + +UPDATE vn.professionalCategory + SET code = 'driverCE' + WHERE name = 'Conductor C + E'; \ No newline at end of file diff --git a/db/versions/10908-blueAsparagus/00-createSupplierDms.sql b/db/versions/10908-blueAsparagus/00-createSupplierDms.sql new file mode 100644 index 000000000..fbdc7ed58 --- /dev/null +++ b/db/versions/10908-blueAsparagus/00-createSupplierDms.sql @@ -0,0 +1,9 @@ +ALTER TABLE `vn`.`supplierDms` + MODIFY COLUMN supplierFk int(10) unsigned NOT NULL, + ADD editorFk INT UNSIGNED NULL, + ADD CONSTRAINT user_Fk FOREIGN KEY (editorFk) REFERENCES account.`user`(id), + ADD CONSTRAINT dms_FK FOREIGN KEY (dmsFk) REFERENCES vn.dms(id) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT supplier_Fk FOREIGN KEY (supplierFk) REFERENCES vn.supplier(id) ON UPDATE CASCADE; + +ALTER TABLE `supplierLog` + MODIFY COLUMN `changedModel` ENUM('Supplier','SupplierAddress','SupplierAccount','SupplierContact','SupplierDms') NOT NULL DEFAULT 'Supplier'; \ No newline at end of file diff --git a/db/versions/10909-crimsonLaurel/00-firstScript.sql b/db/versions/10909-crimsonLaurel/00-firstScript.sql new file mode 100644 index 000000000..58e679dff --- /dev/null +++ b/db/versions/10909-crimsonLaurel/00-firstScript.sql @@ -0,0 +1,5 @@ +DELETE FROM vn.entryObservation + WHERE observationTypeFk IS NULL; + +ALTER TABLE vn.entryObservation + MODIFY COLUMN observationTypeFk tinyint(3) unsigned NOT NULL; diff --git a/loopback/locale/es.json b/loopback/locale/es.json index aea0c311c..11f0fe21b 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -336,6 +336,7 @@ "Incorrect pin": "Pin incorrecto", "You already have the mailAlias": "Ya tienes este alias de correo", "The alias cant be modified": "Este alias de correo no puede ser modificado", + "this warehouse has not dms": "El Almacén no acepta documentos", "This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado", "Name should be uppercase": "El nombre debe ir en mayúscula", "Bank entity must be specified": "La entidad bancaria es obligatoria", diff --git a/loopback/server/datasources.json b/loopback/server/datasources.json index aadee048c..608479b4b 100644 --- a/loopback/server/datasources.json +++ b/loopback/server/datasources.json @@ -103,6 +103,20 @@ "video/mp4" ] }, + "entryStorage": { + "name": "entryStorage", + "connector": "loopback-component-storage", + "provider": "filesystem", + "root": "./storage/dms", + "maxFileSize": "31457280", + "allowedContentTypes": [ + "image/png", + "image/jpeg", + "image/jpg", + "image/webp", + "video/mp4" + ] + }, "accessStorage": { "name": "accessStorage", "connector": "loopback-component-storage", diff --git a/modules/client/back/methods/client/setRating.js b/modules/client/back/methods/client/setRating.js index 21ac0c914..e3f866683 100644 --- a/modules/client/back/methods/client/setRating.js +++ b/modules/client/back/methods/client/setRating.js @@ -28,7 +28,6 @@ module.exports = Self => { Self.setRating = async function(ctx, id, rating, recommendedCredit, options) { let tx; const myOptions = {}; - if (typeof options == 'object') Object.assign(myOptions, options); @@ -42,6 +41,7 @@ module.exports = Self => { const clientUpdated = await client.updateAttributes({ rating: rating, recommendedCredit: recommendedCredit + }, myOptions); if (tx) await tx.commit(); diff --git a/modules/client/back/methods/client/specs/setRating.spec.js b/modules/client/back/methods/client/specs/setRating.spec.js index a7d0fb03a..353095e31 100644 --- a/modules/client/back/methods/client/specs/setRating.spec.js +++ b/modules/client/back/methods/client/specs/setRating.spec.js @@ -40,4 +40,26 @@ describe('Client setRating()', () => { throw e; } }); + + it('should change rating and recommendedCredit to 0', async() => { + const tx = await models.Ticket.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const clientId = 1101; + const newRating = 0; + const newRecommendedCredit = 0; + + const updatedClient = await models.Client.setRating(ctx, clientId, newRating, newRecommendedCredit, options); + + expect(updatedClient.rating).toEqual(newRating); + expect(updatedClient.recommendedCredit).toEqual(newRecommendedCredit); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); }); diff --git a/modules/client/back/models/client-type.json b/modules/client/back/models/client-type.json index eeae845eb..ecf0c065f 100644 --- a/modules/client/back/models/client-type.json +++ b/modules/client/back/models/client-type.json @@ -7,12 +7,9 @@ } }, "properties": { - "id": { - "type": "number", - "id": true - }, "code": { - "type": "string" + "type": "string", + "id": true }, "type": { "type": "string" diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index a9e14effa..0a8ebcae5 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -319,7 +319,8 @@ module.exports = Self => { await Self.changeCredit(ctx, finalState, changes); // Credit management changes - if (changes?.rating || changes?.recommendedCredit) + + if (changes?.rating >= 0 || changes?.recommendedCredit >= 0) await Self.changeCreditManagement(ctx, finalState, changes); const oldInstance = {}; diff --git a/modules/client/back/models/client.json b/modules/client/back/models/client.json index bfde05162..550ac380e 100644 --- a/modules/client/back/models/client.json +++ b/modules/client/back/models/client.json @@ -197,7 +197,7 @@ "type": { "type": "belongsTo", "model": "ClientType", - "foreignKey": "clientTypeFk" + "foreignKey": "typeFk" }, "businessType": { "type": "belongsTo", diff --git a/modules/entry/back/methods/entry-dms/downloadFile.js b/modules/entry/back/methods/entry-dms/downloadFile.js new file mode 100644 index 000000000..a4f10f9dc --- /dev/null +++ b/modules/entry/back/methods/entry-dms/downloadFile.js @@ -0,0 +1,59 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('downloadFile', { + description: 'Get the entry file', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'Number', + description: 'The document id', + http: {source: 'path'} + } + ], + returns: [ + { + arg: 'body', + type: 'file', + root: true + }, + { + arg: 'Content-Type', + type: 'String', + http: {target: 'header'} + }, + { + arg: 'Content-Disposition', + type: 'String', + http: {target: 'header'} + } + ], + http: { + path: `/:id/downloadFile`, + verb: 'GET' + } + }); + + Self.downloadFile = async function(ctx, id) { + const models = Self.app.models; + const EntryContainer = models.EntryContainer; + const dms = await models.Dms.findById(id); + const pathHash = EntryContainer.getHash(dms.id); + try { + await EntryContainer.getFile(pathHash, dms.file); + } catch (e) { + if (e.code != 'ENOENT') + throw e; + + const error = new UserError(`File doesn't exists`); + error.statusCode = 404; + + throw error; + } + + const stream = EntryContainer.downloadStream(pathHash, dms.file); + + return [stream, dms.contentType, `filename="${dms.file}"`]; + }; +}; diff --git a/modules/entry/back/methods/entry-dms/removeFile.js b/modules/entry/back/methods/entry-dms/removeFile.js new file mode 100644 index 000000000..89a87755c --- /dev/null +++ b/modules/entry/back/methods/entry-dms/removeFile.js @@ -0,0 +1,53 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('removeFile', { + description: 'Removes a entry document', + accessType: 'WRITE', + accepts: { + arg: 'id', + type: 'number', + description: 'The document id', + http: {source: 'path'} + }, + returns: { + type: 'object', + root: true + }, + http: { + path: `/:id/removeFile`, + verb: 'POST' + } + }); + + Self.removeFile = async(ctx, id, options) => { + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const targetEntryDms = await Self.findById(id, null, myOptions); + const targetDms = await Self.app.models.Dms.removeFile(ctx, targetEntryDms.dmsFk, myOptions); + + if (!targetDms) + throw new UserError('Try again'); + + const entryDmsDestroyed = await targetEntryDms.destroy(myOptions); + + if (tx) await tx.commit(); + + return entryDmsDestroyed; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; + diff --git a/modules/entry/back/methods/entry-dms/uploadFile.js b/modules/entry/back/methods/entry-dms/uploadFile.js new file mode 100644 index 000000000..54b56fed4 --- /dev/null +++ b/modules/entry/back/methods/entry-dms/uploadFile.js @@ -0,0 +1,86 @@ + +module.exports = Self => { + Self.remoteMethodCtx('uploadFile', { + description: 'Upload and attach a file', + accessType: 'WRITE', + accepts: [{ + arg: 'id', + type: 'number', + description: 'The entry id', + http: {source: 'path'} + }, + { + arg: 'warehouseId', + type: 'number', + description: 'The warehouse id', + required: true + }, + { + arg: 'companyId', + type: 'number', + description: 'The company id', + required: true + }, + { + arg: 'dmsTypeId', + type: 'number', + description: 'The dms type id', + required: true + }, + { + arg: 'reference', + type: 'string', + required: true + }, + { + arg: 'description', + type: 'string', + required: true + }, + { + arg: 'hasFile', + type: 'boolean', + description: 'True if has an attached file', + required: true + }], + returns: { + type: 'object', + root: true + }, + http: { + path: `/:id/uploadFile`, + verb: 'POST' + } + }); + + Self.uploadFile = async(ctx, id, options) => { + const {Dms, EntryDms} = Self.app.models; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const uploadedFiles = await Dms.uploadFile(ctx, myOptions); + + const promises = uploadedFiles.map(dms => EntryDms.create({ + entryFk: id, + dmsFk: dms.id + }, myOptions)); + await Promise.all(promises); + + if (tx) await tx.commit(); + + return uploadedFiles; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/entry/back/model-config.json b/modules/entry/back/model-config.json index ca4472c8c..7b6e23685 100644 --- a/modules/entry/back/model-config.json +++ b/modules/entry/back/model-config.json @@ -2,6 +2,12 @@ "Entry": { "dataSource": "vn" }, + "EntryDms": { + "dataSource": "vn" + }, + "EntryContainer": { + "dataSource": "entryStorage" + }, "Buy": { "dataSource": "vn" }, diff --git a/modules/entry/back/models/entry-container.json b/modules/entry/back/models/entry-container.json new file mode 100644 index 000000000..a60c272fa --- /dev/null +++ b/modules/entry/back/models/entry-container.json @@ -0,0 +1,10 @@ +{ + "name": "EntryContainer", + "base": "Container", + "acls": [{ + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + }] +} diff --git a/modules/entry/back/models/entry-dms.js b/modules/entry/back/models/entry-dms.js new file mode 100644 index 000000000..219f4fcf5 --- /dev/null +++ b/modules/entry/back/models/entry-dms.js @@ -0,0 +1,13 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + require('../methods/entry-dms/removeFile')(Self); + require('../methods/entry-dms/downloadFile')(Self); + require('../methods/entry-dms/uploadFile')(Self); + + Self.rewriteDbError(function(err) { + if (err.code === 'ER_DUP_ENTRY') + return new UserError('This document already exists on this entry'); + return err; + }); +}; diff --git a/modules/entry/back/models/entry-dms.json b/modules/entry/back/models/entry-dms.json new file mode 100644 index 000000000..eb8300e83 --- /dev/null +++ b/modules/entry/back/models/entry-dms.json @@ -0,0 +1,36 @@ +{ + "name": "EntryDms", + "base": "VnModel", + "mixins": { + "Loggable": true + }, + "options": { + "mysql": { + "table": "entryDms" + } + }, + "allowedContentTypes": [ + "image/png", + "image/jpeg", + "image/jpg" + ], + "properties": { + "dmsFk": { + "type": "number", + "id": true, + "required": true + } + }, + "relations": { + "entry": { + "type": "belongsTo", + "model": "Entry", + "foreignKey": "entryFk" + }, + "dms": { + "type": "belongsTo", + "model": "Dms", + "foreignKey": "dmsFk" + } + } +} diff --git a/modules/order/back/methods/order/isEditable.js b/modules/order/back/methods/order/isEditable.js index 4ef76c11f..3fd2f993c 100644 --- a/modules/order/back/methods/order/isEditable.js +++ b/modules/order/back/methods/order/isEditable.js @@ -29,17 +29,11 @@ module.exports = Self => { where: {id: orderId}, fields: ['isConfirmed', 'clientFk'], include: [ - {relation: 'client', - scope: { - include: { - relation: 'type' - } - } - } + {relation: 'client'} ] }, myOptions); - if (exists && exists.client().type().code !== 'normal') + if (exists && exists.client().typeFk !== 'normal') return true; if (!exists || exists.isConfirmed === 1) diff --git a/modules/order/back/methods/order/new.js b/modules/order/back/methods/order/new.js index d65b18e12..2aad27c9a 100644 --- a/modules/order/back/methods/order/new.js +++ b/modules/order/back/methods/order/new.js @@ -49,17 +49,12 @@ module.exports = Self => { where: {id: addressId}, fields: ['clientFk'], include: [ - {relation: 'client', - scope: { - include: { - relation: 'type' - } - } + {relation: 'client' } ] }, myOptions); - if (address.client().type().code === 'normal') { + if (address.client().typeFk === 'normal') { if (!address.client().isActive) throw new UserError(`You can't create an order for an inactive client`); } diff --git a/modules/route/back/methods/route/cmrEmail.js b/modules/route/back/methods/route/cmrEmail.js index 11c4d3dc8..0c4cc5061 100644 --- a/modules/route/back/methods/route/cmrEmail.js +++ b/modules/route/back/methods/route/cmrEmail.js @@ -48,23 +48,18 @@ module.exports = Self => { if (!recipient) throw new UserError('There is no assigned email for this client'); - const dms = await models.TicketDms.findOne({ - where: {ticketFk: ticketId}, - include: [{ - relation: 'dms', - fields: ['id'], - scope: { - relation: 'dmsType', - scope: { - where: {code: 'cmr'} - } - } - }] - }, myOptions); + const dms = await Self.rawSql(` + SELECT d.id + FROM ticketDms td + JOIN dms d ON d.id = td.dmsFk + JOIN dmsType dt ON dt.id = d.dmsTypeFk + WHERE td.ticketFk = ? + AND dt.code = 'cmr' + `, [ticketId]); - if (!dms) throw new UserError('Cmr file does not exist'); + if (!dms.length) throw new UserError('Cmr file does not exist'); - const response = await models.Dms.downloadFile(ctx, dms.id); + const response = await models.Dms.downloadFile(ctx, dms[0].id); const email = new Email('cmr', { ticketId, diff --git a/modules/ticket/back/methods/sale/specs/usesMana.spec.js b/modules/ticket/back/methods/sale/specs/usesMana.spec.js index 777bdc8f0..74465ab27 100644 --- a/modules/ticket/back/methods/sale/specs/usesMana.spec.js +++ b/modules/ticket/back/methods/sale/specs/usesMana.spec.js @@ -1,11 +1,7 @@ const models = require('vn-loopback/server/server').models; describe('sale usesMana()', () => { - const ctx = { - req: { - accessToken: {userId: 18} - } - }; + const ctx = {req: { accessToken: {userId: 18}}}; it('should return that the worker uses mana', async() => { const tx = await models.Sale.beginTransaction({}); @@ -45,4 +41,27 @@ describe('sale usesMana()', () => { throw e; } }); + + it('should return that the worker does not use mana because it is excluded', async() => { + const tx = await models.Sale.beginTransaction({}); + const buyerId = 35; + const franceDepartmentId = 133; + const buyerCtx = {req: {accessToken: {userId: buyerId}}}; + + try { + const options = {transaction: tx} + + await models.WorkerManaExcluded.create({workerFk: buyerId}, options); + await models.Business.updateAll({workerFk: buyerId}, {departmentFk: franceDepartmentId}, options); + + const usesMana = await models.Sale.usesMana(buyerCtx, options); + + expect(usesMana).toBe(false); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); }); diff --git a/modules/ticket/back/methods/sale/usesMana.js b/modules/ticket/back/methods/sale/usesMana.js index 75d8cdda7..31beb3a4c 100644 --- a/modules/ticket/back/methods/sale/usesMana.js +++ b/modules/ticket/back/methods/sale/usesMana.js @@ -21,6 +21,9 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); + const isManaExcluded = await models.WorkerManaExcluded.findById(userId, null, myOptions); + if (isManaExcluded) return false; + const salesDepartment = await models.Department.findOne({where: {code: 'VT'}, fields: 'id'}, myOptions); const departments = await models.Department.getLeaves(ctx, salesDepartment.id, null, myOptions); const workerDepartment = await models.WorkerDepartment.findById(userId, null, myOptions); diff --git a/modules/ticket/back/methods/ticket/isEditableOrThrow.js b/modules/ticket/back/methods/ticket/isEditableOrThrow.js index 41438be3a..16cff84f1 100644 --- a/modules/ticket/back/methods/ticket/isEditableOrThrow.js +++ b/modules/ticket/back/methods/ticket/isEditableOrThrow.js @@ -17,21 +17,16 @@ module.exports = Self => { const alertLevel = state ? state.alertLevel : null; const ticket = await models.Ticket.findById(id, { fields: ['clientFk'], - include: [{ - relation: 'client', - scope: { - include: { - relation: 'type' - } - } - }] + include: { + relation: 'client' + } }, myOptions); const isLocked = await models.Ticket.isLocked(id, myOptions); const isWeekly = await models.TicketWeekly.findOne({where: {ticketFk: id}}, myOptions); const alertLevelGreaterThanZero = (alertLevel && alertLevel > 0); - const isNormalClient = ticket && ticket.client().type().code == 'normal'; + const isNormalClient = ticket && ticket.client().typeFk == 'normal'; const isEditable = !(alertLevelGreaterThanZero && isNormalClient); if (!ticket) diff --git a/modules/ticket/back/methods/ticket/new.js b/modules/ticket/back/methods/ticket/new.js index 288d38d77..8c27101ef 100644 --- a/modules/ticket/back/methods/ticket/new.js +++ b/modules/ticket/back/methods/ticket/new.js @@ -77,12 +77,7 @@ module.exports = Self => { where: {id: args.addressId}, fields: ['id', 'clientFk'], include: { - relation: 'client', - scope: { - include: { - relation: 'type' - } - } + relation: 'client' } }, myOptions); @@ -93,7 +88,7 @@ module.exports = Self => { if (args.agencyModeId) agencyMode = await models.AgencyMode.findById(args.agencyModeId, null, myOptions); - if (address.client().type().code === 'normal' && (!agencyMode || agencyMode.code != 'refund')) { + if (address.client().typeFk === 'normal' && (!agencyMode || agencyMode.code != 'refund')) { const canCreateTicket = await models.Client.canCreateTicket(args.clientId, myOptions); if (!canCreateTicket) throw new UserError(`You can't create a ticket for an inactive client`); diff --git a/modules/ticket/back/methods/ticket/saveCmr.js b/modules/ticket/back/methods/ticket/saveCmr.js index 17760bacc..691af796c 100644 --- a/modules/ticket/back/methods/ticket/saveCmr.js +++ b/modules/ticket/back/methods/ticket/saveCmr.js @@ -42,18 +42,15 @@ module.exports = Self => { const ticket = await models.Ticket.findById(ticketId, myOptions); if (ticket.cmrFk) { - const hasDmsCmr = await models.TicketDms.findOne({ - where: {ticketFk: ticketId}, - include: { - relation: 'dms', - fields: ['dmsFk'], - scope: { - where: {dmsTypeFk: dmsTypeCmr.id} - } - } - }, myOptions); + const hasDmsCmr = await Self.rawSql(` + SELECT d.id + FROM ticketDms td + JOIN dms d ON d.id = td.dmsFk + WHERE td.ticketFk = ? + AND d.dmsTypeFk = ? + `, [ticketId, dmsTypeCmr.id]); - if (hasDmsCmr?.dms()) + if (hasDmsCmr.length) throw new UserError('This ticket already has a cmr saved'); ctx.args.id = ticket.cmrFk; diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 9c6e8181a..aa970237f 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -34,6 +34,8 @@ module.exports = Self => { const myOptions = {userId: ctx.req.accessToken.userId}; let tx; let ticket; + let dms; + let isSignUploaded; let externalTickets = []; if (typeof options == 'object') @@ -47,7 +49,7 @@ module.exports = Self => { const dmsTypeTicket = await models.DmsType.findOne({ where: {code: 'ticket'}, fields: ['id'] - }, myOptions); + }); async function setLocation(ticketId) { await models.Delivery.create({ @@ -59,19 +61,15 @@ module.exports = Self => { } async function hasSignDms(ticketId) { - const ticketDms = await models.TicketDms.findOne({ - where: {ticketFk: ticketId}, - include: [ - { - relation: 'dms', - fields: ['id'], - scope: { - where: {dmsTypeFk: dmsTypeTicket.id} - } - } - ] - }, myOptions); - if (ticketDms?.dms()?.id) return true; + const hasTicketDms = await Self.rawSql(` + SELECT d.id + FROM ticketDms td + JOIN dms d ON d.id = td.dmsFk + WHERE td.ticketFk = ? + AND d.dmsTypeFk = ? + `, [ticketId, dmsTypeTicket.id], myOptions); + + if (hasTicketDms.length) return true; } async function createGestDoc() { @@ -82,11 +80,12 @@ module.exports = Self => { dmsTypeId: dmsTypeTicket.id, reference: ticket.id, description: `Firma del cliente - Ruta ${ticket.route().id}`, - contentType: 'image/png', hasFile: true }; - const dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); - await models.TicketDms.create({ticketFk: ticket.id, dmsFk: dms[0].id}, myOptions); + dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); + // Si se ha subido ya la firma, no se vuelve a subir, ya que si no + // da un error de deadlock en la db + isSignUploaded = true; } try { @@ -135,8 +134,10 @@ module.exports = Self => { throw new UserError('Ticket is already signed'); if (location) await setLocation(ticketId); - if (!await hasSignDms(ticketId)) + if (!await hasSignDms(ticketId) && !isSignUploaded) await createGestDoc(ticketId); + if (isSignUploaded) + await models.TicketDms.create({ticketFk: ticket.id, dmsFk: dms[0].id}, myOptions); await ticket.updateAttribute('isSigned', true, myOptions); const deliveryState = await models.State.findOne({ @@ -148,7 +149,7 @@ module.exports = Self => { stateFk: deliveryState.id }, myOptions); - if (ticket?.address()?.province()?.country()?.code != 'ES') { + if (ticket?.address()?.province()?.country()?.code != 'ES' && ticket.cmrFk) { await models.Ticket.saveCmr(ctx, [ticketId], myOptions); externalTickets.push(ticketId); } diff --git a/modules/ticket/back/models/sale.js b/modules/ticket/back/models/sale.js index 30fb74b75..22ad40184 100644 --- a/modules/ticket/back/models/sale.js +++ b/modules/ticket/back/models/sale.js @@ -41,7 +41,7 @@ module.exports = Self => { include: { relation: 'client', scope: { - fields: ['id', 'clientTypeFk'], + fields: ['id', 'typeFk'], include: { relation: 'type', scope: { @@ -52,7 +52,7 @@ module.exports = Self => { } }, ctx.options); - if (ticket?.client()?.type()?.code === 'loses') return; + if (ticket?.client()?.typeFk === 'loses') return; const isRefund = await models.TicketRefund.findOne({ fields: ['id'], diff --git a/modules/worker/back/methods/worker-time-control/sendMail.js b/modules/worker/back/methods/worker-time-control/sendMail.js index 6f67bbea3..e43f4a8ab 100644 --- a/modules/worker/back/methods/worker-time-control/sendMail.js +++ b/modules/worker/back/methods/worker-time-control/sendMail.js @@ -137,7 +137,8 @@ module.exports = Self => { tb.type, tb.businessFk, tb.permissionRate, - d.isTeleworking + d.isTeleworking, + d.hasToRefill FROM tmp.timeBusinessCalculate tb JOIN account.user u ON u.id = tb.userFk JOIN department d ON d.id = tb.departmentFk @@ -174,7 +175,7 @@ module.exports = Self => { myOptions.transaction = tx; try { workerFk = day.workerFk; - if (day.timeWorkDecimal > 0 && day.timeWorkedDecimal == null + if (day.hasToRefill && day.timeWorkDecimal > 0 && day.timeWorkedDecimal == null && (day.permissionRate == null ? true : day.permissionRate)) { if (day.timeTable == null) { const timed = new Date(day.dated); diff --git a/modules/worker/back/methods/worker-time-control/specs/clockIn.spec.js b/modules/worker/back/methods/worker-time-control/specs/clockIn.spec.js index ff4cac7b7..0ee439941 100644 --- a/modules/worker/back/methods/worker-time-control/specs/clockIn.spec.js +++ b/modules/worker/back/methods/worker-time-control/specs/clockIn.spec.js @@ -46,6 +46,31 @@ describe('workerTimeControl clockIn()', () => { } }); + it('should throw an error trying to change a middle hour to out not resting 12h', async() => { + activeCtx.accessToken.userId = HHRRId; + const workerId = teamBossId; + + const tx = await models.WorkerTimeControl.beginTransaction({}); + try { + const options = {transaction: tx}; + + const entryTime = "2000-12-25T11:00:00.000Z"; + ctx.args = {timed: entryTime, direction: 'in'}; + await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + const middleTime ="2000-12-26T11:00:00.000Z"; + ctx.args = {timed: middleTime, direction: 'middle'}; + const middleEntryTime = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + const direction = 'out'; + await models.WorkerTimeControl.updateTimeEntry(ctx, middleEntryTime.id, direction, options); + await tx.rollback(); + } catch (e) { + expect(e.message).toBe('Superado el tiempo máximo entre entrada y salida'); + await tx.rollback(); + } + }); + describe('as Role errors', () => { it('should add if the current user is team boss and the target user is himself', async() => { activeCtx.accessToken.userId = teamBossId; @@ -110,16 +135,22 @@ describe('workerTimeControl clockIn()', () => { todayAtOne.setHours(1, 0, 0, 0); ctx.args = {timed: todayAtOne, direction: 'in'}; - const createdTimeEntry = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + const entryTime = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + expect(entryTime.id).toBeDefined(); + const todayAtTwo = Date.vnNew(); - expect(createdTimeEntry.id).toBeDefined(); - - ctx.args = {direction: 'out'}; - const updatedTimeEntry = await models.WorkerTimeControl.updateTimeEntry( - ctx, createdTimeEntry.id, options + todayAtTwo.setHours(2, 0, 0, 0); + ctx.args = {timed: todayAtTwo, direction: 'middle'}; + const middleTime = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options); + + const direction = 'out'; + const {id:outTimeEntryId} = await models.WorkerTimeControl.updateTimeEntry( + ctx, middleTime.id, direction, options ); - expect(updatedTimeEntry.direction).toEqual('out'); + const {direction: updatedDirection} = await models.WorkerTimeControl.findById(outTimeEntryId,{fields:['direction']},options); + expect(updatedDirection).toEqual('out'); + await tx.rollback(); } catch (e) { await tx.rollback(); diff --git a/modules/worker/back/methods/worker-time-control/updateTimeEntry.js b/modules/worker/back/methods/worker-time-control/updateTimeEntry.js index e9d35f880..7e4455447 100644 --- a/modules/worker/back/methods/worker-time-control/updateTimeEntry.js +++ b/modules/worker/back/methods/worker-time-control/updateTimeEntry.js @@ -26,32 +26,39 @@ module.exports = Self => { } }); - Self.updateTimeEntry = async(ctx, id, options) => { + Self.updateTimeEntry = async(ctx, timeEntryId, direction, options) => { const currentUserId = ctx.req.accessToken.userId; const models = Self.app.models; - const args = ctx.args; - const myOptions = {}; + let tx; if (typeof options == 'object') Object.assign(myOptions, options); - const targetTimeEntry = await Self.findById(id, null, myOptions); - const isSubordinate = await models.Worker.isSubordinate(ctx, targetTimeEntry.userFk, myOptions); - const isTeamBoss = await models.ACL.checkAccessAcl(ctx, 'Worker', 'isTeamBoss', 'WRITE'); - const isHimself = currentUserId == targetTimeEntry.userFk; + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } - const notAllowed = isSubordinate === false || (isSubordinate && isHimself && !isTeamBoss); + try { + const {id, userFk, timed} = await Self.findById(timeEntryId, null, myOptions); + const isSubordinate = await models.Worker.isSubordinate(ctx, userFk, myOptions); + const isTeamBoss = await models.ACL.checkAccessAcl(ctx, 'Worker', 'isTeamBoss', 'WRITE'); + const isHimself = currentUserId == userFk; - if (notAllowed) - throw new UserError(`You don't have enough privileges`); + const notAllowed = isSubordinate === false || (isSubordinate && isHimself && !isTeamBoss); + if (notAllowed) throw new UserError(`You don't have enough privileges`); - const timeEntryUpdated = await targetTimeEntry.updateAttributes({ - direction: args.direction - }, myOptions); + await models.WorkerTimeControl.deleteById(id, myOptions); + const timeEntryUpdatedId = await Self.clockIn(userFk, timed, direction, null, myOptions); - await models.WorkerTimeControl.resendWeeklyHourEmail(ctx, targetTimeEntry.userFk, targetTimeEntry.timed, myOptions); + await models.WorkerTimeControl.resendWeeklyHourEmail(ctx, userFk, timed, myOptions); - return timeEntryUpdated; + if (tx) await tx.commit(); + return timeEntryUpdatedId; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } }; }; diff --git a/modules/worker/back/methods/worker/specs/new.spec.js b/modules/worker/back/methods/worker/specs/new.spec.js index 1f74e9b95..d3e9cb9d0 100644 --- a/modules/worker/back/methods/worker/specs/new.spec.js +++ b/modules/worker/back/methods/worker/specs/new.spec.js @@ -139,9 +139,12 @@ describe('Worker new', () => { }); it('should create a new worker', async() => { - const newWorker = await models.Worker.new({args: defaultWorker, req}); - - await removeWorker(newWorker.id); + let newWorker; + try { + newWorker = await models.Worker.new({args: defaultWorker, req}); + } finally { + await removeWorker(newWorker.id); + } expect(newWorker.id).toBeDefined(); }); @@ -173,9 +176,12 @@ describe('Worker new', () => { }), req }; - const newWorker = await models.Worker.new(newWorkerData); - - await models.Worker.destroyById(newWorker.id); + let newWorker; + try { + newWorker = await models.Worker.new(newWorkerData); + } finally { + await models.Worker.destroyById(newWorker.id); + } expect(newWorker.id).toEqual(bruceWayneId); }); diff --git a/modules/worker/back/model-config.json b/modules/worker/back/model-config.json index 8352eb070..e12ceada5 100644 --- a/modules/worker/back/model-config.json +++ b/modules/worker/back/model-config.json @@ -86,6 +86,9 @@ "WorkerMana": { "dataSource": "vn" }, + "WorkerManaExcluded": { + "dataSource": "vn" + }, "WorkerMistake": { "dataSource": "vn" }, diff --git a/modules/worker/back/models/worker-mana-excluded.json b/modules/worker/back/models/worker-mana-excluded.json new file mode 100644 index 000000000..6610b701b --- /dev/null +++ b/modules/worker/back/models/worker-mana-excluded.json @@ -0,0 +1,22 @@ +{ + "name": "WorkerManaExcluded", + "base": "VnModel", + "options": { + "mysql": { + "table": "workerManaExcluded" + } + }, + "properties": { + "workerFk": { + "id": true, + "type": "number" + } + }, + "relations": { + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "workerFk" + } + } +} diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js index f6a6ed535..094e200a4 100644 --- a/modules/worker/front/time-control/index.js +++ b/modules/worker/front/time-control/index.js @@ -415,11 +415,13 @@ class Controller extends Section { throw new Error(`The entry type can't be empty`); const query = `WorkerTimeControls/${entry.id}/updateTimeEntry`; - this.$http.post(query, {direction: entry.direction}) - .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))) - .then(() => this.$.editEntry.hide()) - .then(() => this.fetchHours()) - .then(() => this.getMailStates(this.date)); + if (entry.direction !== entry.$orgRow.direction) { + this.$http.post(query, {direction: entry.direction}) + .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))) + .then(() => this.$.editEntry.hide()) + .then(() => this.fetchHours()) + .then(() => this.getMailStates(this.date)); + } } catch (e) { this.vnApp.showError(this.$t(e.message)); } diff --git a/modules/worker/front/time-control/index.spec.js b/modules/worker/front/time-control/index.spec.js index 10e8aba0d..8610da46e 100644 --- a/modules/worker/front/time-control/index.spec.js +++ b/modules/worker/front/time-control/index.spec.js @@ -130,7 +130,7 @@ describe('Component vnWorkerTimeControl', () => { controller.$.model = {applyFilter: jest.fn().mockReturnValue(Promise.resolve())}; controller.date = today; controller.fetchHours = jest.fn(); - controller.selectedRow = {id: 1, timed: Date.vnNew(), direction: 'in'}; + controller.selectedRow = {id: 1, timed: Date.vnNew(), direction: 'in', $orgRow: {direction: null}}; controller.$.editEntry = { hide: () => {} }; diff --git a/package.json b/package.json index 47b3a1564..302738524 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@babel/plugin-syntax-dynamic-import": "^7.7.4", "@babel/preset-env": "^7.11.0", "@babel/register": "^7.7.7", - "@verdnatura/myt": "^1.6.7", + "@verdnatura/myt": "^1.6.8", "angular-mocks": "^1.7.9", "babel-jest": "^26.0.1", "babel-loader": "^8.2.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 025be234e..36bff2fe1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -131,8 +131,8 @@ devDependencies: specifier: ^7.7.7 version: 7.23.7(@babel/core@7.23.9) '@verdnatura/myt': - specifier: ^1.6.7 - version: 1.6.7 + specifier: ^1.6.8 + version: 1.6.8 angular-mocks: specifier: ^1.7.9 version: 1.8.3 @@ -2633,8 +2633,8 @@ packages: dev: false optional: true - /@verdnatura/myt@1.6.7: - resolution: {integrity: sha512-t/Q1T3QzHpZFdxwIyQL/CV5g+HJvWE6Q65VeA9k0svZdX/vezgnQ21nkI+wuvIurIl6BXqq2Arx7EWYkAhGNNA==} + /@verdnatura/myt@1.6.8: + resolution: {integrity: sha512-jpadr6yAR9TQXPv+has5yOYAolR/YEzsxbLgMR7BoDrpLyVFLHJEy4Dfe+Hy11r3AmxCB/8lWM+La1YGvXMWOA==} hasBin: true dependencies: '@sqltools/formatter': 1.2.5 diff --git a/print/templates/reports/invoice/sql/sales.sql b/print/templates/reports/invoice/sql/sales.sql index 3833a3700..8e5ad1102 100644 --- a/print/templates/reports/invoice/sql/sales.sql +++ b/print/templates/reports/invoice/sql/sales.sql @@ -7,7 +7,8 @@ SELECT s.discount, s.itemFk, s.concept, - tc.code vatType + tc.code vatType, + it.isPackaging FROM vn.invoiceOut io JOIN vn.ticket t ON t.refFk = io.ref JOIN vn.supplier su ON su.id = io.companyFk @@ -34,9 +35,10 @@ SELECT ts.quantity, ts.price, 0 discount, - '', - ts.description concept, - tc.code vatType + NULL, + ts.description, + tc.code, + NULL FROM vn.invoiceOut io JOIN vn.ticket t ON t.refFk = io.ref JOIN vn.ticketService ts ON ts.ticketFk = t.id @@ -46,3 +48,4 @@ SELECT JOIN vn.supplierAccount sa ON sa.id = co.supplierAccountFk JOIN vn.taxClass tc ON tc.id = ts.taxClassFk WHERE t.refFk = ? +ORDER BY (isPackaging), concept, itemFk